summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2012-10-28 10:36:27 -0700
committerLukas Reschke <lukas@statuscode.ch>2012-10-28 10:36:27 -0700
commitf3971e659b51dfe9e351274f63ce525a23806dab (patch)
tree7ea00fa5d200541d8cfb9e41d97b3f00cce4e5c9
parent2248fe9f3e23cbe342a5609119b5424448eb19b8 (diff)
parent5d640f9ae3ee2aa74ebd29bc93c90f82c032a97a (diff)
downloadnextcloud-server-f3971e659b51dfe9e351274f63ce525a23806dab.tar.gz
nextcloud-server-f3971e659b51dfe9e351274f63ce525a23806dab.zip
Merge pull request #129 from fmms/checkstyle01
Checkstyle
-rw-r--r--lib/filesystem.php54
-rw-r--r--lib/image.php64
-rw-r--r--lib/installer.php30
-rwxr-xr-xlib/util.php52
4 files changed, 100 insertions, 100 deletions
diff --git a/lib/filesystem.php b/lib/filesystem.php
index bc30dac7fa1..3b6772c9849 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -148,21 +148,21 @@ class OC_Filesystem{
* @return string
*/
static public function getMountPoint($path) {
- OC_Hook::emit(self::CLASSNAME,'get_mountpoint', array('path'=>$path));
+ OC_Hook::emit(self::CLASSNAME, 'get_mountpoint', array('path'=>$path));
if(!$path) {
$path='/';
}
if($path[0]!=='/') {
$path='/'.$path;
}
- $path=str_replace('//', '/',$path);
+ $path=str_replace('//', '/', $path);
$foundMountPoint='';
$mountPoints=array_keys(OC_Filesystem::$mounts);
foreach($mountPoints as $mountpoint) {
if($mountpoint==$path) {
return $mountpoint;
}
- if(strpos($path,$mountpoint)===0 and strlen($mountpoint)>strlen($foundMountPoint)) {
+ if(strpos($path, $mountpoint)===0 and strlen($mountpoint)>strlen($foundMountPoint)) {
$foundMountPoint=$mountpoint;
}
}
@@ -202,7 +202,7 @@ class OC_Filesystem{
if($mountpoint) {
if(!isset(OC_Filesystem::$storages[$mountpoint])) {
$mount=OC_Filesystem::$mounts[$mountpoint];
- OC_Filesystem::$storages[$mountpoint]=OC_Filesystem::createStorage($mount['class'],$mount['arguments']);
+ OC_Filesystem::$storages[$mountpoint]=OC_Filesystem::createStorage($mount['class'], $mount['arguments']);
}
return OC_Filesystem::$storages[$mountpoint];
}
@@ -213,19 +213,19 @@ class OC_Filesystem{
$mountConfig=include OC::$SERVERROOT.'/config/mount.php';
if(isset($mountConfig['global'])) {
foreach($mountConfig['global'] as $mountPoint=>$options) {
- self::mount($options['class'],$options['options'],$mountPoint);
+ self::mount($options['class'], $options['options'], $mountPoint);
}
}
if(isset($mountConfig['group'])) {
foreach($mountConfig['group'] as $group=>$mounts) {
- if(OC_Group::inGroup($user,$group)) {
+ if(OC_Group::inGroup($user, $group)) {
foreach($mounts as $mountPoint=>$options) {
$mountPoint=self::setUserVars($mountPoint, $user);
foreach($options as &$option) {
$option=self::setUserVars($option, $user);
}
- self::mount($options['class'],$options['options'],$mountPoint);
+ self::mount($options['class'], $options['options'], $mountPoint);
}
}
}
@@ -239,7 +239,7 @@ class OC_Filesystem{
foreach($options as &$option) {
$option=self::setUserVars($option, $user);
}
- self::mount($options['class'],$options['options'],$mountPoint);
+ self::mount($options['class'], $options['options'], $mountPoint);
}
}
}
@@ -249,7 +249,7 @@ class OC_Filesystem{
$previousMTime=OC_Appconfig::getValue('files','mountconfigmtime',0);
if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
OC_FileCache::triggerUpdate();
- OC_Appconfig::setValue('files','mountconfigmtime',$mtime);
+ OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime);
}
}
}
@@ -276,9 +276,9 @@ class OC_Filesystem{
*/
private static function setUserVars($input, $user) {
if (isset($user)) {
- return str_replace('$user', $user,$input);
+ return str_replace('$user', $user, $input);
} else {
- return str_replace('$user',OC_User::getUser(),$input);
+ return str_replace('$user', OC_User::getUser(), $input);
}
}
@@ -353,7 +353,7 @@ class OC_Filesystem{
if($mountpoint[0]!='/') {
$mountpoint='/'.$mountpoint;
}
- if(substr($mountpoint,-1)!=='/') {
+ if(substr($mountpoint, -1)!=='/') {
$mountpoint=$mountpoint.'/';
}
self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
@@ -399,7 +399,7 @@ class OC_Filesystem{
if(!$path || $path[0]!=='/') {
$path='/'.$path;
}
- if(strstr($path,'/../') || strrchr($path, '/') === '/..' ) {
+ if(strstr($path, '/../') || strrchr($path, '/') === '/..' ) {
return false;
}
return true;
@@ -501,32 +501,32 @@ class OC_Filesystem{
return self::$defaultInstance->file_get_contents($path);
}
static public function file_put_contents($path,$data) {
- return self::$defaultInstance->file_put_contents($path,$data);
+ return self::$defaultInstance->file_put_contents($path, $data);
}
static public function unlink($path) {
return self::$defaultInstance->unlink($path);
}
static public function rename($path1,$path2) {
- return self::$defaultInstance->rename($path1,$path2);
+ return self::$defaultInstance->rename($path1, $path2);
}
static public function copy($path1,$path2) {
- return self::$defaultInstance->copy($path1,$path2);
+ return self::$defaultInstance->copy($path1, $path2);
}
static public function fopen($path,$mode) {
- return self::$defaultInstance->fopen($path,$mode);
+ return self::$defaultInstance->fopen($path, $mode);
}
static public function toTmpFile($path) {
return self::$defaultInstance->toTmpFile($path);
}
static public function fromTmpFile($tmpFile,$path) {
- return self::$defaultInstance->fromTmpFile($tmpFile,$path);
+ return self::$defaultInstance->fromTmpFile($tmpFile, $path);
}
static public function getMimeType($path) {
return self::$defaultInstance->getMimeType($path);
}
static public function hash($type,$path, $raw = false) {
- return self::$defaultInstance->hash($type,$path, $raw);
+ return self::$defaultInstance->hash($type, $path, $raw);
}
static public function free_space($path='/') {
@@ -543,7 +543,7 @@ class OC_Filesystem{
* @return bool
*/
static public function hasUpdated($path,$time) {
- return self::$defaultInstance->hasUpdated($path,$time);
+ return self::$defaultInstance->hasUpdated($path, $time);
}
static public function removeETagHook($params, $root = false) {
@@ -574,18 +574,18 @@ class OC_Filesystem{
return '/';
}
//no windows style slashes
- $path=str_replace('\\','/',$path);
+ $path=str_replace('\\', '/', $path);
//add leading slash
if($path[0]!=='/') {
$path='/'.$path;
}
//remove trainling slash
- if($stripTrailingSlash and strlen($path)>1 and substr($path,-1,1)==='/') {
- $path=substr($path,0,-1);
+ if($stripTrailingSlash and strlen($path)>1 and substr($path, -1, 1)==='/') {
+ $path=substr($path, 0, -1);
}
//remove duplicate slashes
while(strpos($path,'//')!==false) {
- $path=str_replace('//','/',$path);
+ $path=str_replace('//', '/', $path);
}
//normalize unicode if possible
if(class_exists('Normalizer')) {
@@ -594,9 +594,9 @@ class OC_Filesystem{
return $path;
}
}
-OC_Hook::connect('OC_Filesystem','post_write', 'OC_Filesystem','removeETagHook');
-OC_Hook::connect('OC_Filesystem','post_delete','OC_Filesystem','removeETagHook');
-OC_Hook::connect('OC_Filesystem','post_rename','OC_Filesystem','removeETagHook');
+OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_Filesystem', 'removeETagHook');
+OC_Hook::connect('OC_Filesystem', 'post_delete', 'OC_Filesystem', 'removeETagHook');
+OC_Hook::connect('OC_Filesystem', 'post_rename', 'OC_Filesystem', 'removeETagHook');
OC_Util::setupFS();
require_once 'filecache.php';
diff --git a/lib/image.php b/lib/image.php
index 016d20599b2..13460a13eb5 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -66,7 +66,7 @@ class OC_Image {
public function __construct($imageref = null) {
//OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
if(!extension_loaded('gd') || !function_exists('gd_info')) {
- OC_Log::write('core',__METHOD__.'(): GD module not installed', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): GD module not installed', OC_Log::ERROR);
return false;
}
if(!is_null($imageref)) {
@@ -112,7 +112,7 @@ class OC_Image {
*/
public function widthTopLeft() {
$o = $this->getOrientation();
- OC_Log::write('core','OC_Image->widthTopLeft() Orientation: '.$o, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->widthTopLeft() Orientation: '.$o, OC_Log::DEBUG);
switch($o) {
case -1:
case 1:
@@ -137,7 +137,7 @@ class OC_Image {
*/
public function heightTopLeft() {
$o = $this->getOrientation();
- OC_Log::write('core','OC_Image->heightTopLeft() Orientation: '.$o, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->heightTopLeft() Orientation: '.$o, OC_Log::DEBUG);
switch($o) {
case -1:
case 1:
@@ -172,7 +172,7 @@ class OC_Image {
public function save($filepath=null) {
if($filepath === null && $this->filepath === null) {
- OC_Log::write('core',__METHOD__.'(): called with no path.', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): called with no path.', OC_Log::ERROR);
return false;
} elseif($filepath === null && $this->filepath !== null) {
$filepath = $this->filepath;
@@ -188,10 +188,10 @@ class OC_Image {
if (!file_exists(dirname($filepath)))
mkdir(dirname($filepath), 0777, true);
if(!is_writable(dirname($filepath))) {
- OC_Log::write('core',__METHOD__.'(): Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
return false;
} elseif(is_writable(dirname($filepath)) && file_exists($filepath) && !is_writable($filepath)) {
- OC_Log::write('core',__METHOD__.'(): File \''.$filepath.'\' is not writable.', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): File \''.$filepath.'\' is not writable.', OC_Log::ERROR);
return false;
}
}
@@ -291,7 +291,7 @@ class OC_Image {
*/
public function fixOrientation() {
$o = $this->getOrientation();
- OC_Log::write('core','OC_Image->fixOrientation() Orientation: '.$o, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->fixOrientation() Orientation: '.$o, OC_Log::DEBUG);
$rotate = 0;
$flip = false;
switch($o) {
@@ -341,15 +341,15 @@ class OC_Image {
$this->resource = $res;
return true;
} else {
- OC_Log::write('core','OC_Image->fixOrientation() Error during alphasaving.', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->fixOrientation() Error during alphasaving.', OC_Log::DEBUG);
return false;
}
} else {
- OC_Log::write('core','OC_Image->fixOrientation() Error during alphablending.', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->fixOrientation() Error during alphablending.', OC_Log::DEBUG);
return false;
}
} else {
- OC_Log::write('core','OC_Image->fixOrientation() Error during oriention fixing.', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->fixOrientation() Error during oriention fixing.', OC_Log::DEBUG);
return false;
}
}
@@ -365,7 +365,7 @@ class OC_Image {
if(get_resource_type($imageref) == 'gd') {
$this->resource = $imageref;
return $this->resource;
- } elseif(in_array(get_resource_type($imageref), array('file','stream'))) {
+ } elseif(in_array(get_resource_type($imageref), array('file', 'stream'))) {
return $this->loadFromFileHandle($imageref);
}
} elseif($this->loadFromFile($imageref) !== false) {
@@ -375,7 +375,7 @@ class OC_Image {
} elseif($this->loadFromData($imageref) !== false) {
return $this->resource;
} else {
- OC_Log::write('core',__METHOD__.'(): couldn\'t load anything. Giving up!', OC_Log::DEBUG);
+ OC_Log::write('core', __METHOD__.'(): couldn\'t load anything. Giving up!', OC_Log::DEBUG);
return false;
}
}
@@ -387,7 +387,7 @@ class OC_Image {
* @returns An image resource or false on error
*/
public function loadFromFileHandle($handle) {
- OC_Log::write('core',__METHOD__.'(): Trying', OC_Log::DEBUG);
+ OC_Log::write('core', __METHOD__.'(): Trying', OC_Log::DEBUG);
$contents = stream_get_contents($handle);
if($this->loadFromData($contents)) {
return $this->resource;
@@ -402,7 +402,7 @@ class OC_Image {
public function loadFromFile($imagepath=false) {
if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) {
// Debug output disabled because this method is tried before loadFromBase64?
- OC_Log::write('core','OC_Image->loadFromFile, couldn\'t load: '.ellipsis($imagepath, 50), OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.ellipsis($imagepath, 50), OC_Log::DEBUG);
return false;
}
$itype = exif_imagetype($imagepath);
@@ -411,28 +411,28 @@ class OC_Image {
if (imagetypes() & IMG_GIF) {
$this->resource = imagecreatefromgif($imagepath);
} else {
- OC_Log::write('core','OC_Image->loadFromFile, GIF images not supported: '.$imagepath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, GIF images not supported: '.$imagepath, OC_Log::DEBUG);
}
break;
case IMAGETYPE_JPEG:
if (imagetypes() & IMG_JPG) {
$this->resource = imagecreatefromjpeg($imagepath);
} else {
- OC_Log::write('core','OC_Image->loadFromFile, JPG images not supported: '.$imagepath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, JPG images not supported: '.$imagepath, OC_Log::DEBUG);
}
break;
case IMAGETYPE_PNG:
if (imagetypes() & IMG_PNG) {
$this->resource = imagecreatefrompng($imagepath);
} else {
- OC_Log::write('core','OC_Image->loadFromFile, PNG images not supported: '.$imagepath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, PNG images not supported: '.$imagepath, OC_Log::DEBUG);
}
break;
case IMAGETYPE_XBM:
if (imagetypes() & IMG_XPM) {
$this->resource = imagecreatefromxbm($imagepath);
} else {
- OC_Log::write('core','OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagepath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagepath, OC_Log::DEBUG);
}
break;
case IMAGETYPE_WBMP:
@@ -440,7 +440,7 @@ class OC_Image {
if (imagetypes() & IMG_WBMP) {
$this->resource = imagecreatefromwbmp($imagepath);
} else {
- OC_Log::write('core','OC_Image->loadFromFile, (W)BMP images not supported: '.$imagepath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, (W)BMP images not supported: '.$imagepath, OC_Log::DEBUG);
}
break;
/*
@@ -472,7 +472,7 @@ class OC_Image {
// this is mostly file created from encrypted file
$this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents(\OC_Filesystem::getLocalPath($imagepath)));
$itype = IMAGETYPE_PNG;
- OC_Log::write('core','OC_Image->loadFromFile, Default', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, Default', OC_Log::DEBUG);
break;
}
if($this->valid()) {
@@ -493,7 +493,7 @@ class OC_Image {
}
$this->resource = @imagecreatefromstring($str);
if(!$this->resource) {
- OC_Log::write('core','OC_Image->loadFromData, couldn\'t load', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromData, couldn\'t load', OC_Log::DEBUG);
return false;
}
return $this->resource;
@@ -512,7 +512,7 @@ class OC_Image {
if($data) { // try to load from string data
$this->resource = @imagecreatefromstring($data);
if(!$this->resource) {
- OC_Log::write('core','OC_Image->loadFromBase64, couldn\'t load', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromBase64, couldn\'t load', OC_Log::DEBUG);
return false;
}
return $this->resource;
@@ -528,7 +528,7 @@ class OC_Image {
*/
public function resize($maxsize) {
if(!$this->valid()) {
- OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
$width_orig=imageSX($this->resource);
@@ -557,14 +557,14 @@ class OC_Image {
$process = imagecreatetruecolor($width, $height);
if ($process == false) {
- OC_Log::write('core',__METHOD__.'(): Error creating true color image',OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): Error creating true color image',OC_Log::ERROR);
imagedestroy($process);
return false;
}
imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
if ($process == false) {
- OC_Log::write('core',__METHOD__.'(): Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
imagedestroy($process);
return false;
}
@@ -580,7 +580,7 @@ class OC_Image {
*/
public function centerCrop($size=0) {
if(!$this->valid()) {
- OC_Log::write('core','OC_Image->centerCrop, No image loaded', OC_Log::ERROR);
+ OC_Log::write('core', 'OC_Image->centerCrop, No image loaded', OC_Log::ERROR);
return false;
}
$width_orig=imageSX($this->resource);
@@ -607,13 +607,13 @@ class OC_Image {
}
$process = imagecreatetruecolor($targetWidth, $targetHeight);
if ($process == false) {
- OC_Log::write('core','OC_Image->centerCrop. Error creating true color image',OC_Log::ERROR);
+ OC_Log::write('core', 'OC_Image->centerCrop. Error creating true color image',OC_Log::ERROR);
imagedestroy($process);
return false;
}
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
if ($process == false) {
- OC_Log::write('core','OC_Image->centerCrop. Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
+ OC_Log::write('core', 'OC_Image->centerCrop. Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
imagedestroy($process);
return false;
}
@@ -632,18 +632,18 @@ class OC_Image {
*/
public function crop($x, $y, $w, $h) {
if(!$this->valid()) {
- OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
$process = imagecreatetruecolor($w, $h);
if ($process == false) {
- OC_Log::write('core',__METHOD__.'(): Error creating true color image',OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): Error creating true color image',OC_Log::ERROR);
imagedestroy($process);
return false;
}
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h);
if ($process == false) {
- OC_Log::write('core',__METHOD__.'(): Error resampling process image '.$w.'x'.$h,OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$w.'x'.$h,OC_Log::ERROR);
imagedestroy($process);
return false;
}
@@ -660,7 +660,7 @@ class OC_Image {
*/
public function fitIn($maxWidth, $maxHeight) {
if(!$this->valid()) {
- OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
+ OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
$width_orig=imageSX($this->resource);
diff --git a/lib/installer.php b/lib/installer.php
index 83d082b804a..8c504fb6129 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 69f29f12228..789c75f4154 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<br/>','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<br/>', '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<br/>','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<br/>', '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<time()) {
// 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.
*/
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
return $value;
}