diff --git a/lib/installer.php b/lib/installer.php index 83d082b804..8c504fb612 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -97,7 +97,7 @@ class OC_Installer{ if($archive=OC_Archive::open($path)) { $archive->extract($extractDir); } else { - OC_Log::write('core','Failed to open archive when installing app',OC_Log::ERROR); + OC_Log::write('core', 'Failed to open archive when installing app', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); @@ -118,7 +118,7 @@ class OC_Installer{ } } if(!is_file($extractDir.'/appinfo/info.xml')) { - OC_Log::write('core','App does not provide an info.xml file',OC_Log::ERROR); + OC_Log::write('core', 'App does not provide an info.xml file', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); @@ -127,8 +127,8 @@ class OC_Installer{ } $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); // check the code for not allowed calls - if(!OC_Installer::checkCode($info['id'],$extractDir)) { - OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR); + if(!OC_Installer::checkCode($info['id'], $extractDir)) { + OC_Log::write('core', 'App can\'t be installed because of not allowed code in the App', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); return false; } @@ -136,14 +136,14 @@ class OC_Installer{ // check if the app is compatible with this version of ownCloud $version=OC_Util::getVersion(); if(!isset($info['require']) or ($version[0]>$info['require'])) { - OC_Log::write('core','App can\'t be installed because it is not compatible with this version of ownCloud',OC_Log::ERROR); + OC_Log::write('core', 'App can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); return false; } //check if an app with the same id is already installed if(self::isInstalled( $info['id'] )) { - OC_Log::write('core','App already installed',OC_Log::WARN); + OC_Log::write('core', 'App already installed', OC_Log::WARN); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); @@ -154,7 +154,7 @@ class OC_Installer{ $basedir=OC_App::getInstallPath().'/'.$info['id']; //check if the destination directory already exists if(is_dir($basedir)) { - OC_Log::write('core','App directory already exists',OC_Log::WARN); + OC_Log::write('core', 'App directory already exists', OC_Log::WARN); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); @@ -168,14 +168,14 @@ class OC_Installer{ //copy the app to the correct place if(@!mkdir($basedir)) { - OC_Log::write('core','Can\'t create app folder. Please fix permissions. ('.$basedir.')',OC_Log::ERROR); + OC_Log::write('core', 'Can\'t create app folder. Please fix permissions. ('.$basedir.')', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } return false; } - OC_Helper::copyr($extractDir,$basedir); + OC_Helper::copyr($extractDir, $basedir); //remove temporary files OC_Helper::rmdirr($extractDir); @@ -191,8 +191,8 @@ class OC_Installer{ } //set the installed version - OC_Appconfig::setValue($info['id'],'installed_version',OC_App::getAppVersion($info['id'])); - OC_Appconfig::setValue($info['id'],'enabled','no'); + OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id'])); + OC_Appconfig::setValue($info['id'], 'enabled', 'no'); //set remote/public handelers foreach($info['remote'] as $name=>$path) { @@ -296,7 +296,7 @@ class OC_Installer{ $enabled = isset($info['default_enable']); if( $enabled ) { OC_Installer::installShippedApp($filename); - OC_Appconfig::setValue($filename,'enabled','yes'); + OC_Appconfig::setValue($filename, 'enabled', 'yes'); } } } @@ -323,7 +323,7 @@ class OC_Installer{ include OC_App::getAppPath($app)."/appinfo/install.php"; } $info=OC_App::getAppInfo($app); - OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app)); + OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app)); //set remote/public handelers foreach($info['remote'] as $name=>$path) { @@ -360,7 +360,7 @@ class OC_Installer{ // check if grep is installed $grep = exec('which grep'); if($grep=='') { - OC_Log::write('core','grep not installed. So checking the code of the app "'.$appname.'" was not possible',OC_Log::ERROR); + OC_Log::write('core', 'grep not installed. So checking the code of the app "'.$appname.'" was not possible', OC_Log::ERROR); return true; } @@ -370,7 +370,7 @@ class OC_Installer{ $result = exec($cmd); // bad pattern found if($result<>'') { - OC_Log::write('core','App "'.$appname.'" is using a not allowed call "'.$bl.'". Installation refused.',OC_Log::ERROR); + OC_Log::write('core', 'App "'.$appname.'" is using a not allowed call "'.$bl.'". Installation refused.', OC_Log::ERROR); return false; } } diff --git a/lib/util.php b/lib/util.php index 69f29f1222..789c75f415 100755 --- a/lib/util.php +++ b/lib/util.php @@ -39,7 +39,7 @@ class OC_Util { $CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ); //first set up the local "root" storage if(!self::$rootMounted) { - OC_Filesystem::mount('OC_Filestorage_Local', array('datadir'=>$CONFIG_DATADIRECTORY),'/'); + OC_Filesystem::mount('OC_Filestorage_Local', array('datadir'=>$CONFIG_DATADIRECTORY), '/'); self::$rootMounted=true; } @@ -81,10 +81,10 @@ class OC_Util { } $mtime=filemtime($user_root.'/mount.php'); - $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0); + $previousMTime=OC_Preferences::getValue($user, 'files', 'mountconfigmtime', 0); if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated OC_FileCache::triggerUpdate($user); - OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime); + OC_Preferences::setValue($user, 'files', 'mountconfigmtime', $mtime); } } } @@ -169,7 +169,7 @@ class OC_Util { public static function formatDate( $timestamp,$dateOnly=false) { if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it $systemTimeZone = intval(date('O')); - $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); + $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100); $clientTimeZone=$_SESSION['timezone']*60; $offset=$clientTimeZone-$systemTimeZone; $timestamp=$timestamp+$offset*60; @@ -196,11 +196,11 @@ class OC_Util { if($pagestop>$pagecount) $pagestop=$pagecount; $tmpl = new OC_Template( '', 'part.pagenavi', '' ); - $tmpl->assign('page',$page); - $tmpl->assign('pagecount',$pagecount); - $tmpl->assign('pagestart',$pagestart); - $tmpl->assign('pagestop',$pagestop); - $tmpl->assign('url',$url); + $tmpl->assign('page', $page); + $tmpl->assign('pagecount', $pagecount); + $tmpl->assign('pagestart', $pagestart); + $tmpl->assign('pagestop', $pagestop); + $tmpl->assign('url', $url); return $tmpl; } } @@ -241,24 +241,24 @@ class OC_Util { //check for correct file permissions if(!stristr(PHP_OS, 'WIN')) { $permissionsModHint="Please change the permissions to 0770 so that the directory cannot be listed by other users."; - $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3); - if(substr($prems,-1)!='0') { - OC_Helper::chmodr($CONFIG_DATADIRECTORY,0770); + $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3); + if(substr($prems, -1)!='0') { + OC_Helper::chmodr($CONFIG_DATADIRECTORY, 0770); clearstatcache(); - $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3); - if(substr($prems,2,1)!='0') { - $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users
','hint'=>$permissionsModHint); + $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3); + if(substr($prems, 2, 1)!='0') { + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users
', 'hint'=>$permissionsModHint); } } if( OC_Config::getValue( "enablebackup", false )) { $CONFIG_BACKUPDIRECTORY = OC_Config::getValue( "backupdirectory", OC::$SERVERROOT."/backup" ); - $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3); - if(substr($prems,-1)!='0') { - OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY,0770); + $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3); + if(substr($prems, -1)!='0') { + OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY, 0770); clearstatcache(); - $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3); - if(substr($prems,2,1)!='0') { - $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users
','hint'=>$permissionsModHint); + $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3); + if(substr($prems, 2, 1)!='0') { + $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users
', 'hint'=>$permissionsModHint); } } } @@ -391,7 +391,7 @@ class OC_Util { // Check if we are a user self::checkLoggedIn(); self::verifyUser(); - if(OC_Group::inGroup(OC_User::getUser(),'admin')) { + if(OC_Group::inGroup(OC_User::getUser(), 'admin')) { return true; } if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) { @@ -467,7 +467,7 @@ class OC_Util { $id=OC_Config::getValue('instanceid', null); if(is_null($id)) { $id=uniqid(); - OC_Config::setValue('instanceid',$id); + OC_Config::setValue('instanceid', $id); } return $id; } @@ -504,10 +504,10 @@ class OC_Util { // cleanup old tokens garbage collector // only run every 20th time so we don't waste cpu cycles - if(rand(0,20)==0) { + if(rand(0, 20)==0) { foreach($_SESSION as $key=>$value) { // search all tokens in the session - if(substr($key,0,12)=='requesttoken') { + if(substr($key, 0, 12)=='requesttoken') { // check if static lifespan has expired if($value+self::$callLifespan