Benutzer-Werkzeuge

Webseiten-Werkzeuge


cloud4education

Dies ist eine alte Version des Dokuments!


cloud4education

Version 4.5.1

Version 4.0.1

lib/util.php
        /**
        * Check if the user is logged in, redirects to home if not
        */
        public static function checkLoggedIn(){
                // Check if we are a user
                if( !OC_User::isLoggedIn()){
                        header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
                        exit();
                }
        }
 
/*** server4education ***/
 
        /**
        * Check if home folder is mounted, mount if not
        */
        public static function checkHomeMounted(){
                // Check if home folder is mounted
                if (!OC_Filesystem::is_dir('/Home')) {
                        OC_Filesystem::mkdir('/Home'); }
                        exec("sudo /usr/local/bin/mounthome ".OC_User::getUser()." ".$_SESSION['user_password']);
#exec("sudo mount | grep \"on /srv/www/htdocs/owncloud/data/".OC_User::getUser()."/files/Home type\"; if [ $? -eq 1 ] ; then sudo mount //localhost/".OC_User::getUser()." /srv/www/htdocs/".OC::$WEBROOT."/data/".OC_User::getUser()."/files/Home -o user=".OC_User::getUser().",pass=".$_SESSION['user_password'].",uid=wwwrun,gid=www; fi");

                foreach(self::getS4eShares() as $share) {
                        if (!OC_Filesystem::is_dir('/'.$share)) {
                                OC_Filesystem::mkdir('/'.$share);
                        }
                        exec("sudo /usr/local/bin/mountshare ".OC_User::getUser()." ".$_SESSION['user_password']." ".$share);
#                        exec("mount | grep \"on /srv/www/htdocs/".OC::$WEBROOT."/data/".OC_User::getUser()."/files/".$share." type\" > /dev/null; if [ $? -eq 1 ] ; then sudo mount //localhost/".$share." /srv/www/htdocs/".OC::$WEBROOT."/data/".OC_User::getUser()."/files/".$share." -o user=".OC_User::getUser().",pass=".$_SESSION['user_password'].",uid=wwwrun,gid=www; fi");
                }
                exec("logger \"".OC_User::getUser()." - cloud4education ".`date +%s`."\"");
        }
 
/*** server4education ***/
/usr/local/bin/mounthome
#!/bin/bash
 
mount | grep "on /srv/www/htdocs/owncloud/data/$1/files/Home type" > /dev/null
if [ $? -eq 1 ] ; then
        sudo mount "//localhost/$1" /srv/www/htdocs/owncloud/data/$1/files/Home -o user="$1",pass="$2",uid=wwwrun,gid=www
fi
/usr/local/bin/mountshare
#!/bin/bash
 
mount | grep "on /srv/www/htdocs/owncloud/data/$1/files/$3 type" > /dev/null
if [ $? -eq 1 ] ; then
        sudo mount "//localhost/$3" "/srv/www/htdocs/owncloud/data/$1/files/$3" -o user="$1",pass="$2",uid=wwwrun,gid=www
fi
cloud4education.1352030333.txt.gz · Zuletzt geändert: 2012/11/04 12:58 von admin