NoSpaceAfterComma

first in new branch
This commit is contained in:
Felix Moeller 2012-10-28 18:12:31 +01:00
parent 2248fe9f3e
commit b7a02f0c93
2 changed files with 41 additions and 41 deletions

View File

@ -97,7 +97,7 @@ class OC_Installer{
if($archive=OC_Archive::open($path)) { if($archive=OC_Archive::open($path)) {
$archive->extract($extractDir); $archive->extract($extractDir);
} else { } 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); OC_Helper::rmdirr($extractDir);
if($data['source']=='http') { if($data['source']=='http') {
unlink($path); unlink($path);
@ -118,7 +118,7 @@ class OC_Installer{
} }
} }
if(!is_file($extractDir.'/appinfo/info.xml')) { 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); OC_Helper::rmdirr($extractDir);
if($data['source']=='http') { if($data['source']=='http') {
unlink($path); unlink($path);
@ -127,8 +127,8 @@ class OC_Installer{
} }
$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true);
// check the code for not allowed calls // check the code for not allowed calls
if(!OC_Installer::checkCode($info['id'],$extractDir)) { 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_Log::write('core', 'App can\'t be installed because of not allowed code in the App', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir); OC_Helper::rmdirr($extractDir);
return false; return false;
} }
@ -136,14 +136,14 @@ class OC_Installer{
// check if the app is compatible with this version of ownCloud // check if the app is compatible with this version of ownCloud
$version=OC_Util::getVersion(); $version=OC_Util::getVersion();
if(!isset($info['require']) or ($version[0]>$info['require'])) { 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); OC_Helper::rmdirr($extractDir);
return false; return false;
} }
//check if an app with the same id is already installed //check if an app with the same id is already installed
if(self::isInstalled( $info['id'] )) { 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); OC_Helper::rmdirr($extractDir);
if($data['source']=='http') { if($data['source']=='http') {
unlink($path); unlink($path);
@ -154,7 +154,7 @@ class OC_Installer{
$basedir=OC_App::getInstallPath().'/'.$info['id']; $basedir=OC_App::getInstallPath().'/'.$info['id'];
//check if the destination directory already exists //check if the destination directory already exists
if(is_dir($basedir)) { 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); OC_Helper::rmdirr($extractDir);
if($data['source']=='http') { if($data['source']=='http') {
unlink($path); unlink($path);
@ -168,14 +168,14 @@ class OC_Installer{
//copy the app to the correct place //copy the app to the correct place
if(@!mkdir($basedir)) { 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); OC_Helper::rmdirr($extractDir);
if($data['source']=='http') { if($data['source']=='http') {
unlink($path); unlink($path);
} }
return false; return false;
} }
OC_Helper::copyr($extractDir,$basedir); OC_Helper::copyr($extractDir, $basedir);
//remove temporary files //remove temporary files
OC_Helper::rmdirr($extractDir); OC_Helper::rmdirr($extractDir);
@ -191,8 +191,8 @@ class OC_Installer{
} }
//set the installed version //set the installed version
OC_Appconfig::setValue($info['id'],'installed_version',OC_App::getAppVersion($info['id'])); OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
OC_Appconfig::setValue($info['id'],'enabled','no'); OC_Appconfig::setValue($info['id'], 'enabled', 'no');
//set remote/public handelers //set remote/public handelers
foreach($info['remote'] as $name=>$path) { foreach($info['remote'] as $name=>$path) {
@ -296,7 +296,7 @@ class OC_Installer{
$enabled = isset($info['default_enable']); $enabled = isset($info['default_enable']);
if( $enabled ) { if( $enabled ) {
OC_Installer::installShippedApp($filename); 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"; include OC_App::getAppPath($app)."/appinfo/install.php";
} }
$info=OC_App::getAppInfo($app); $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 //set remote/public handelers
foreach($info['remote'] as $name=>$path) { foreach($info['remote'] as $name=>$path) {
@ -360,7 +360,7 @@ class OC_Installer{
// check if grep is installed // check if grep is installed
$grep = exec('which grep'); $grep = exec('which grep');
if($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; return true;
} }
@ -370,7 +370,7 @@ class OC_Installer{
$result = exec($cmd); $result = exec($cmd);
// bad pattern found // bad pattern found
if($result<>'') { 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; return false;
} }
} }

View File

@ -39,7 +39,7 @@ class OC_Util {
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ); $CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//first set up the local "root" storage //first set up the local "root" storage
if(!self::$rootMounted) { 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; self::$rootMounted=true;
} }
@ -81,10 +81,10 @@ class OC_Util {
} }
$mtime=filemtime($user_root.'/mount.php'); $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 if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
OC_FileCache::triggerUpdate($user); 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) { public static function formatDate( $timestamp,$dateOnly=false) {
if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it
$systemTimeZone = intval(date('O')); $systemTimeZone = intval(date('O'));
$systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100);
$clientTimeZone=$_SESSION['timezone']*60; $clientTimeZone=$_SESSION['timezone']*60;
$offset=$clientTimeZone-$systemTimeZone; $offset=$clientTimeZone-$systemTimeZone;
$timestamp=$timestamp+$offset*60; $timestamp=$timestamp+$offset*60;
@ -196,11 +196,11 @@ class OC_Util {
if($pagestop>$pagecount) $pagestop=$pagecount; if($pagestop>$pagecount) $pagestop=$pagecount;
$tmpl = new OC_Template( '', 'part.pagenavi', '' ); $tmpl = new OC_Template( '', 'part.pagenavi', '' );
$tmpl->assign('page',$page); $tmpl->assign('page', $page);
$tmpl->assign('pagecount',$pagecount); $tmpl->assign('pagecount', $pagecount);
$tmpl->assign('pagestart',$pagestart); $tmpl->assign('pagestart', $pagestart);
$tmpl->assign('pagestop',$pagestop); $tmpl->assign('pagestop', $pagestop);
$tmpl->assign('url',$url); $tmpl->assign('url', $url);
return $tmpl; return $tmpl;
} }
} }
@ -241,24 +241,24 @@ class OC_Util {
//check for correct file permissions //check for correct file permissions
if(!stristr(PHP_OS, 'WIN')) { if(!stristr(PHP_OS, 'WIN')) {
$permissionsModHint="Please change the permissions to 0770 so that the directory cannot be listed by other users."; $permissionsModHint="Please change the permissions to 0770 so that the directory cannot be listed by other users.";
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3); $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3);
if(substr($prems,-1)!='0') { if(substr($prems, -1)!='0') {
OC_Helper::chmodr($CONFIG_DATADIRECTORY,0770); OC_Helper::chmodr($CONFIG_DATADIRECTORY, 0770);
clearstatcache(); clearstatcache();
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3); $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3);
if(substr($prems,2,1)!='0') { if(substr($prems, 2, 1)!='0') {
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users<br/>','hint'=>$permissionsModHint); $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users<br/>', 'hint'=>$permissionsModHint);
} }
} }
if( OC_Config::getValue( "enablebackup", false )) { if( OC_Config::getValue( "enablebackup", false )) {
$CONFIG_BACKUPDIRECTORY = OC_Config::getValue( "backupdirectory", OC::$SERVERROOT."/backup" ); $CONFIG_BACKUPDIRECTORY = OC_Config::getValue( "backupdirectory", OC::$SERVERROOT."/backup" );
$prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3); $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3);
if(substr($prems,-1)!='0') { if(substr($prems, -1)!='0') {
OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY,0770); OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY, 0770);
clearstatcache(); clearstatcache();
$prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3); $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3);
if(substr($prems,2,1)!='0') { if(substr($prems, 2, 1)!='0') {
$errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users<br/>','hint'=>$permissionsModHint); $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users<br/>', 'hint'=>$permissionsModHint);
} }
} }
} }
@ -391,7 +391,7 @@ class OC_Util {
// Check if we are a user // Check if we are a user
self::checkLoggedIn(); self::checkLoggedIn();
self::verifyUser(); self::verifyUser();
if(OC_Group::inGroup(OC_User::getUser(),'admin')) { if(OC_Group::inGroup(OC_User::getUser(), 'admin')) {
return true; return true;
} }
if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) { if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
@ -467,7 +467,7 @@ class OC_Util {
$id=OC_Config::getValue('instanceid', null); $id=OC_Config::getValue('instanceid', null);
if(is_null($id)) { if(is_null($id)) {
$id=uniqid(); $id=uniqid();
OC_Config::setValue('instanceid',$id); OC_Config::setValue('instanceid', $id);
} }
return $id; return $id;
} }
@ -504,10 +504,10 @@ class OC_Util {
// cleanup old tokens garbage collector // cleanup old tokens garbage collector
// only run every 20th time so we don't waste cpu cycles // 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) { foreach($_SESSION as $key=>$value) {
// search all tokens in the session // search all tokens in the session
if(substr($key,0,12)=='requesttoken') { if(substr($key, 0, 12)=='requesttoken') {
// check if static lifespan has expired // check if static lifespan has expired
if($value+self::$callLifespan<time()) { if($value+self::$callLifespan<time()) {
// remove outdated tokens // remove outdated tokens
@ -571,7 +571,7 @@ class OC_Util {
* @return array with sanitized strings or a single sanitized string, depends on the input parameter. * @return array with sanitized strings or a single sanitized string, depends on the input parameter.
*/ */
public static function sanitizeHTML( &$value ) { public static function sanitizeHTML( &$value ) {
if (is_array($value) || is_object($value)) array_walk_recursive($value,'OC_Util::sanitizeHTML'); if (is_array($value) || is_object($value)) array_walk_recursive($value, 'OC_Util::sanitizeHTML');
else $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4 else $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
return $value; return $value;
} }