aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/MDB2/Driver/Function/sqlite3.php2
-rw-r--r--lib/MDB2/Driver/sqlite3.php18
-rwxr-xr-xlib/app.php12
-rw-r--r--lib/appconfig.php4
-rw-r--r--lib/archive.php10
-rw-r--r--lib/archive/tar.php16
-rw-r--r--lib/archive/zip.php10
-rw-r--r--lib/backgroundjob.php2
-rw-r--r--lib/base.php10
-rw-r--r--lib/connector/sabre/file.php4
-rw-r--r--lib/connector/sabre/locks.php10
-rw-r--r--lib/connector/sabre/node.php8
-rw-r--r--lib/connector/sabre/principal.php4
-rw-r--r--lib/db.php10
-rw-r--r--lib/eventsource.php2
-rw-r--r--lib/filecache.php42
-rw-r--r--lib/filecache/cached.php4
-rw-r--r--lib/filecache/update.php22
-rw-r--r--lib/fileproxy.php8
-rw-r--r--lib/fileproxy/fileoperations.php2
-rw-r--r--lib/fileproxy/quota.php18
-rw-r--r--lib/files.php18
-rw-r--r--lib/filestorage.php12
-rw-r--r--lib/filestorage/common.php18
-rw-r--r--lib/filestorage/commontest.php6
-rw-r--r--lib/filestorage/local.php34
-rw-r--r--lib/filesystem.php52
-rw-r--r--lib/filesystemview.php18
-rw-r--r--lib/group.php4
-rw-r--r--lib/group/dummy.php10
-rw-r--r--lib/group/example.php2
-rw-r--r--lib/helper.php12
-rw-r--r--lib/image.php2
-rw-r--r--lib/installer.php18
-rw-r--r--lib/json.php4
-rw-r--r--lib/l10n.php6
-rw-r--r--lib/l10n/pt_BR.php1
-rw-r--r--lib/log.php6
-rw-r--r--lib/log/owncloud.php4
-rw-r--r--lib/mail.php8
-rw-r--r--lib/migrate.php6
-rw-r--r--lib/migration/content.php6
-rw-r--r--lib/minimizer.php6
-rw-r--r--lib/ocsclient.php16
-rw-r--r--lib/preferences.php2
-rw-r--r--lib/public/db.php2
-rw-r--r--lib/public/util.php4
-rw-r--r--lib/request.php4
-rw-r--r--lib/route.php2
-rw-r--r--lib/router.php2
-rw-r--r--lib/search.php4
-rw-r--r--lib/search/result.php2
-rw-r--r--lib/setup.php12
-rw-r--r--lib/streamwrappers.php22
-rw-r--r--lib/template.php24
-rw-r--r--lib/templatelayout.php6
-rw-r--r--lib/updater.php4
-rw-r--r--lib/user.php6
-rw-r--r--lib/user/database.php6
-rw-r--r--lib/user/http.php6
-rwxr-xr-xlib/util.php69
-rw-r--r--lib/vcategories.php30
-rw-r--r--lib/vobject.php2
63 files changed, 341 insertions, 355 deletions
diff --git a/lib/MDB2/Driver/Function/sqlite3.php b/lib/MDB2/Driver/Function/sqlite3.php
index 0bddde5bf3f..4147a48199f 100644
--- a/lib/MDB2/Driver/Function/sqlite3.php
+++ b/lib/MDB2/Driver/Function/sqlite3.php
@@ -92,7 +92,7 @@ class MDB2_Driver_Function_sqlite3 extends MDB2_Driver_Function_Common
function substring($value, $position = 1, $length = null)
{
if (!is_null($length)) {
- return "substr($value,$position,$length)";
+ return "substr($value, $position, $length)";
}
return "substr($value, $position, length($value))";
}
diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php
index 9757e4faf94..bccb8cbbf01 100644
--- a/lib/MDB2/Driver/sqlite3.php
+++ b/lib/MDB2/Driver/sqlite3.php
@@ -153,7 +153,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
if($this->connection) {
return $this->connection->escapeString($text);
}else{
- return str_replace("'","''",$text);//TODO; more
+ return str_replace("'", "''", $text);//TODO; more
}
}
@@ -276,7 +276,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
* @access public
* @since 2.1.1
*/
- function setTransactionIsolation($isolation,$options=array())
+ function setTransactionIsolation($isolation, $options=array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
switch ($isolation) {
@@ -351,7 +351,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
}
if ($database_file !== ':memory:') {
- if(!strpos($database_file,'.db')) {
+ if(!strpos($database_file, '.db')) {
$database_file="$datadir/$database_file.db";
}
if (!file_exists($database_file)) {
@@ -387,7 +387,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
$php_errormsg = '';
$this->connection = new SQLite3($database_file);
- if(is_callable(array($this->connection,'busyTimeout'))) {//busy timout is only available in php>=5.3
+ if(is_callable(array($this->connection, 'busyTimeout'))) {//busy timout is only available in php>=5.3
$this->connection->busyTimeout(100);
}
$this->_lasterror = $this->connection->lastErrorMsg();
@@ -1142,9 +1142,9 @@ class MDB2_Statement_sqlite3 extends MDB2_Statement_Common
function bindValue($parameter, $value, $type = null) {
if($type) {
$type=$this->getParamType($type);
- $this->statement->bindValue($parameter,$value,$type);
+ $this->statement->bindValue($parameter, $value, $type);
}else{
- $this->statement->bindValue($parameter,$value);
+ $this->statement->bindValue($parameter, $value);
}
return MDB2_OK;
}
@@ -1165,9 +1165,9 @@ class MDB2_Statement_sqlite3 extends MDB2_Statement_Common
function bindParam($parameter, &$value, $type = null) {
if($type) {
$type=$this->getParamType($type);
- $this->statement->bindParam($parameter,$value,$type);
+ $this->statement->bindParam($parameter, $value, $type);
}else{
- $this->statement->bindParam($parameter,$value);
+ $this->statement->bindParam($parameter, $value);
}
return MDB2_OK;
}
@@ -1318,7 +1318,7 @@ class MDB2_Statement_sqlite3 extends MDB2_Statement_Common
}else{
$types=null;
}
- $err = $this->bindValueArray($values,$types);
+ $err = $this->bindValueArray($values, $types);
if (PEAR::isError($err)) {
return $this->db->raiseError(MDB2_ERROR, null, null,
'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__);
diff --git a/lib/app.php b/lib/app.php
index 231037cbd3b..79c1d83314f 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -92,7 +92,7 @@ class OC_App{
* @param string/array $types
* @return bool
*/
- public static function isType($app,$types) {
+ public static function isType($app, $types) {
if(is_string($types)) {
$types=array($types);
}
@@ -185,7 +185,7 @@ class OC_App{
}else{
$download=OC_OCSClient::getApplicationDownload($app, 1);
if(isset($download['downloadlink']) and $download['downloadlink']!='') {
- $app=OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink']));
+ $app=OC_Installer::installApp(array('source'=>'http', 'href'=>$download['downloadlink']));
}
}
}
@@ -404,7 +404,7 @@ class OC_App{
* @return array
* @note all data is read from info.xml, not just pre-defined fields
*/
- public static function getAppInfo($appid,$path=false) {
+ public static function getAppInfo($appid, $path=false) {
if($path) {
$file=$appid;
}else{
@@ -523,21 +523,21 @@ class OC_App{
/**
* register a settings form to be shown
*/
- public static function registerSettings($app,$page) {
+ public static function registerSettings($app, $page) {
self::$settingsForms[]= $app.'/'.$page.'.php';
}
/**
* register an admin form to be shown
*/
- public static function registerAdmin($app,$page) {
+ public static function registerAdmin($app, $page) {
self::$adminForms[]= $app.'/'.$page.'.php';
}
/**
* register a personal form to be shown
*/
- public static function registerPersonal($app,$page) {
+ public static function registerPersonal($app, $page) {
self::$personalForms[]= $app.'/'.$page.'.php';
}
diff --git a/lib/appconfig.php b/lib/appconfig.php
index ed0e8f1d0bd..1f2d576af87 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -107,7 +107,7 @@ class OC_Appconfig{
* @param string $key
* @return bool
*/
- public static function hasKey($app,$key) {
+ public static function hasKey($app, $key) {
$exists = self::getKeys( $app );
return in_array( $key, $exists );
}
@@ -170,7 +170,7 @@ class OC_Appconfig{
* @param key
* @return array
*/
- public static function getValues($app,$key) {
+ public static function getValues($app, $key) {
if($app!==false and $key!==false) {
return false;
}
diff --git a/lib/archive.php b/lib/archive.php
index a9c245eaf43..61239c82076 100644
--- a/lib/archive.php
+++ b/lib/archive.php
@@ -42,14 +42,14 @@ abstract class OC_Archive{
* @param string source either a local file or string data
* @return bool
*/
- abstract function addFile($path,$source='');
+ abstract function addFile($path, $source='');
/**
* rename a file or folder in the archive
* @param string source
* @param string dest
* @return bool
*/
- abstract function rename($source,$dest);
+ abstract function rename($source, $dest);
/**
* get the uncompressed size of a file in the archive
* @param string path
@@ -85,7 +85,7 @@ abstract class OC_Archive{
* @param string dest
* @return bool
*/
- abstract function extractFile($path,$dest);
+ abstract function extractFile($path, $dest);
/**
* extract the archive
* @param string path
@@ -111,14 +111,14 @@ abstract class OC_Archive{
* @param string mode
* @return resource
*/
- abstract function getStream($path,$mode);
+ abstract function getStream($path, $mode);
/**
* add a folder and all it's content
* @param string $path
* @param string source
* @return bool
*/
- function addRecursive($path,$source) {
+ function addRecursive($path, $source) {
if($dh=opendir($source)) {
$this->addFolder($path);
while($file=readdir($dh)) {
diff --git a/lib/archive/tar.php b/lib/archive/tar.php
index 86d39b88968..6c264686991 100644
--- a/lib/archive/tar.php
+++ b/lib/archive/tar.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once '3rdparty/Archive/Tar.php';
+require_once 'Archive/Tar.php';
class OC_Archive_TAR extends OC_Archive{
const PLAIN=0;
@@ -23,7 +23,7 @@ class OC_Archive_TAR extends OC_Archive{
private $path;
function __construct($source) {
- $types=array(null,'gz','bz');
+ $types=array(null, 'gz', 'bz');
$this->path=$source;
$this->tar=new Archive_Tar($source, $types[self::getTarType($source)]);
}
@@ -84,7 +84,7 @@ class OC_Archive_TAR extends OC_Archive{
* @param string source either a local file or string data
* @return bool
*/
- function addFile($path,$source='') {
+ function addFile($path, $source='') {
if($this->fileExists($path)) {
$this->remove($path);
}
@@ -107,7 +107,7 @@ class OC_Archive_TAR extends OC_Archive{
* @param string dest
* @return bool
*/
- function rename($source,$dest) {
+ function rename($source, $dest) {
//no proper way to delete, rename entire archive, rename file and remake archive
$tmp=OCP\Files::tmpFolder();
$this->tar->extract($tmp);
@@ -214,7 +214,7 @@ class OC_Archive_TAR extends OC_Archive{
* @param string dest
* @return bool
*/
- function extractFile($path,$dest) {
+ function extractFile($path, $dest) {
$tmp=OCP\Files::tmpFolder();
if(!$this->fileExists($path)) {
return false;
@@ -294,7 +294,7 @@ class OC_Archive_TAR extends OC_Archive{
* @param string mode
* @return resource
*/
- function getStream($path,$mode) {
+ function getStream($path, $mode) {
if(strrpos($path, '.')!==false) {
$ext=substr($path, strrpos($path, '.'));
}else{
@@ -309,7 +309,7 @@ class OC_Archive_TAR extends OC_Archive{
if($mode=='r' or $mode=='rb') {
return fopen($tmpFile, $mode);
}else{
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
self::$tempFiles[$tmpFile]=$path;
return fopen('close://'.$tmpFile, $mode);
}
@@ -334,7 +334,7 @@ class OC_Archive_TAR extends OC_Archive{
$this->tar->_close();
$this->tar=null;
}
- $types=array(null,'gz','bz');
+ $types=array(null, 'gz', 'bz');
$this->tar=new Archive_Tar($this->path, $types[self::getTarType($this->path)]);
}
}
diff --git a/lib/archive/zip.php b/lib/archive/zip.php
index d016c692e35..1c967baa08f 100644
--- a/lib/archive/zip.php
+++ b/lib/archive/zip.php
@@ -35,7 +35,7 @@ class OC_Archive_ZIP extends OC_Archive{
* @param string source either a local file or string data
* @return bool
*/
- function addFile($path,$source='') {
+ function addFile($path, $source='') {
if($source and $source[0]=='/' and file_exists($source)) {
$result=$this->zip->addFile($source, $path);
}else{
@@ -53,7 +53,7 @@ class OC_Archive_ZIP extends OC_Archive{
* @param string dest
* @return bool
*/
- function rename($source,$dest) {
+ function rename($source, $dest) {
$source=$this->stripPath($source);
$dest=$this->stripPath($dest);
$this->zip->renameName($source, $dest);
@@ -119,7 +119,7 @@ class OC_Archive_ZIP extends OC_Archive{
* @param string dest
* @return bool
*/
- function extractFile($path,$dest) {
+ function extractFile($path, $dest) {
$fp = $this->zip->getStream($path);
file_put_contents($dest, $fp);
}
@@ -158,7 +158,7 @@ class OC_Archive_ZIP extends OC_Archive{
* @param string mode
* @return resource
*/
- function getStream($path,$mode) {
+ function getStream($path, $mode) {
if($mode=='r' or $mode=='rb') {
return $this->zip->getStream($path);
} else {
@@ -171,7 +171,7 @@ class OC_Archive_ZIP extends OC_Archive{
$ext='';
}
$tmpFile=OCP\Files::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
if($this->fileExists($path)) {
$this->extractFile($path, $tmpFile);
}
diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php
index 6415f5b84aa..f486519bf09 100644
--- a/lib/backgroundjob.php
+++ b/lib/backgroundjob.php
@@ -44,7 +44,7 @@ class OC_BackgroundJob{
* are "none", "ajax", "webcron", "cron"
*/
public static function setExecutionType( $type ) {
- if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))){
+ if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))) {
return false;
}
return OC_Appconfig::setValue( 'core', 'backgroundjobs_mode', $type );
diff --git a/lib/base.php b/lib/base.php
index 5c3d3fb80ce..f494716bd87 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -239,7 +239,7 @@ class OC{
}
if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) {
$tmpl = new OC_Template( '', 'error', 'guest' );
- $tmpl->assign('errors', array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
+ $tmpl->assign('errors', array(1=>array('error'=>"Can't write into config directory 'config'", 'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
$tmpl->printPage();
exit;
}
@@ -264,8 +264,6 @@ class OC{
OC_Util::addScript( "jquery-tipsy" );
OC_Util::addScript( "oc-dialogs" );
OC_Util::addScript( "js" );
- // request protection token MUST be defined after the jquery library but before any $('document').ready()
- OC_Util::addScript( "requesttoken" );
OC_Util::addScript( "eventsource" );
OC_Util::addScript( "config" );
//OC_Util::addScript( "multiselect" );
@@ -322,7 +320,7 @@ class OC{
public static function init() {
// register autoloader
- spl_autoload_register(array('OC','autoload'));
+ spl_autoload_register(array('OC', 'autoload'));
setlocale(LC_ALL, 'en_US.UTF-8');
// set some stuff
@@ -440,7 +438,7 @@ class OC{
OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted');
//make sure temporary files are cleaned up
- register_shutdown_function(array('OC_Helper','cleanTmp'));
+ register_shutdown_function(array('OC_Helper', 'cleanTmp'));
//parse the given parameters
self::$REQUESTEDAPP = (isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app'])?str_replace(array('\0', '/', '\\', '..'), '', strip_tags($_GET['app'])):OC_Config::getValue('defaultapp', 'files'));
@@ -669,7 +667,7 @@ class OC{
}
OC_App::loadApps(array('authentication'));
if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
- //OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG);
+ //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG);
OC_User::unsetMagicInCookie();
$_REQUEST['redirect_url'] = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'');
OC_Util::redirectToDefaultPage();
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index 5bd38240d44..8d963a1cf8d 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -45,7 +45,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*/
public function put($data) {
- OC_Filesystem::file_put_contents($this->path,$data);
+ OC_Filesystem::file_put_contents($this->path, $data);
return OC_Connector_Sabre_Node::getETagPropertyForPath($this->path);
}
@@ -57,7 +57,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*/
public function get() {
- return OC_Filesystem::fopen($this->path,'rb');
+ return OC_Filesystem::fopen($this->path, 'rb');
}
diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php
index 8ebe324602c..a72d003bc72 100644
--- a/lib/connector/sabre/locks.php
+++ b/lib/connector/sabre/locks.php
@@ -45,10 +45,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
// but otherwise reading locks from SQLite Databases will return
// nothing
$query = 'SELECT * FROM `*PREFIX*locks` WHERE `userid` = ? AND (`created` + `timeout`) > '.time().' AND (( `uri` = ?)';
- $params = array(OC_User::getUser(),$uri);
+ $params = array(OC_User::getUser(), $uri);
// We need to check locks for every part in the uri.
- $uriParts = explode('/',$uri);
+ $uriParts = explode('/', $uri);
// We already covered the last part of the uri
array_pop($uriParts);
@@ -102,7 +102,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
* @param Sabre_DAV_Locks_LockInfo $lockInfo
* @return bool
*/
- public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
+ public function lock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
// We're making the lock timeout 5 minutes
$lockInfo->timeout = 300;
@@ -134,10 +134,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
* @param Sabre_DAV_Locks_LockInfo $lockInfo
* @return bool
*/
- public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
+ public function unlock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*locks` WHERE `userid` = ? AND `uri` = ? AND `token` = ?' );
- $result = $query->execute( array(OC_User::getUser(),$uri,$lockInfo->token));
+ $result = $query->execute( array(OC_User::getUser(), $uri, $lockInfo->token));
return $result->numRows() === 1;
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index 72de9723774..5fc106b85ed 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -80,12 +80,12 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
$newPath = $parentPath . '/' . $newName;
$oldPath = $this->path;
- OC_Filesystem::rename($this->path,$newPath);
+ OC_Filesystem::rename($this->path, $newPath);
$this->path = $newPath;
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ? WHERE `userid` = ? AND `propertypath` = ?' );
- $query->execute( array( $newPath,OC_User::getUser(), $oldPath ));
+ $query->execute( array( $newPath, OC_User::getUser(), $oldPath ));
}
@@ -156,10 +156,10 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
} else {
if(!array_key_exists( $propertyName, $existing )) {
$query = OC_DB::prepare( 'INSERT INTO `*PREFIX*properties` (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)' );
- $query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue ));
+ $query->execute( array( OC_User::getUser(), $this->path, $propertyName, $propertyValue ));
} else {
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ? WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' );
- $query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName ));
+ $query->execute( array( $propertyValue, OC_User::getUser(), $this->path, $propertyName ));
}
}
}
diff --git a/lib/connector/sabre/principal.php b/lib/connector/sabre/principal.php
index 763503721f8..04be410ac85 100644
--- a/lib/connector/sabre/principal.php
+++ b/lib/connector/sabre/principal.php
@@ -46,7 +46,7 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
* @return array
*/
public function getPrincipalByPath($path) {
- list($prefix,$name) = explode('/', $path);
+ list($prefix, $name) = explode('/', $path);
if ($prefix == 'principals' && OC_User::userExists($name)) {
return array(
@@ -83,7 +83,7 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
* @return array
*/
public function getGroupMembership($principal) {
- list($prefix,$name) = Sabre_DAV_URLUtil::splitPath($principal);
+ list($prefix, $name) = Sabre_DAV_URLUtil::splitPath($principal);
$group_membership = array();
if ($prefix == 'principals') {
diff --git a/lib/db.php b/lib/db.php
index a43f2ad20b2..fba2687967f 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -115,7 +115,7 @@ class OC_DB {
$pass = OC_Config::getValue( "dbpassword", "" );
$type = OC_Config::getValue( "dbtype", "sqlite" );
if(strpos($host, ':')) {
- list($host, $port)=explode(':', $host,2);
+ list($host, $port)=explode(':', $host, 2);
}else{
$port=false;
}
@@ -324,7 +324,7 @@ class OC_DB {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
- OC_Log::write('core', $entry,OC_Log::FATAL);
+ OC_Log::write('core', $entry, OC_Log::FATAL);
error_log('DB error: '.$entry);
die( $entry );
}
@@ -334,7 +334,7 @@ class OC_DB {
}catch(PDOException $e) {
$entry = 'DB Error: "'.$e->getMessage().'"<br />';
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
- OC_Log::write('core', $entry,OC_Log::FATAL);
+ OC_Log::write('core', $entry, OC_Log::FATAL);
error_log('DB error: '.$entry);
die( $entry );
}
@@ -767,8 +767,8 @@ class PDOStatementWrapper{
/**
* pass all other function directly to the PDOStatement
*/
- public function __call($name,$arguments) {
- return call_user_func_array(array($this->statement,$name), $arguments);
+ public function __call($name, $arguments) {
+ return call_user_func_array(array($this->statement, $name), $arguments);
}
/**
diff --git a/lib/eventsource.php b/lib/eventsource.php
index 3bada131bdd..578441ee707 100644
--- a/lib/eventsource.php
+++ b/lib/eventsource.php
@@ -56,7 +56,7 @@ class OC_EventSource{
*
* if only one paramater is given, a typeless message will be send with that paramater as data
*/
- public function send($type,$data=null) {
+ public function send($type, $data=null) {
if(is_null($data)) {
$data=$type;
$type=null;
diff --git a/lib/filecache.php b/lib/filecache.php
index fee3b398251..6263e03fc64 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -42,7 +42,7 @@ class OC_FileCache{
* - encrypted
* - versioned
*/
- public static function get($path,$root=false) {
+ public static function get($path, $root=false) {
if(OC_FileCache_Update::hasUpdated($path, $root)) {
if($root===false) {//filesystem hooks are only valid for the default root
OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$path));
@@ -61,7 +61,7 @@ class OC_FileCache{
*
* $data is an assiciative array in the same format as returned by get
*/
- public static function put($path,$data,$root=false) {
+ public static function put($path, $data, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -117,10 +117,10 @@ class OC_FileCache{
* @param int $id
* @param array $data
*/
- private static function update($id,$data) {
+ private static function update($id, $data) {
$arguments=array();
$queryParts=array();
- foreach(array('size','mtime','ctime','mimetype','encrypted','versioned','writable') as $attribute) {
+ foreach(array('size','mtime','ctime','mimetype','encrypted','versioned', 'writable') as $attribute) {
if(isset($data[$attribute])) {
//Convert to int it args are false
if($data[$attribute] === false) {
@@ -151,7 +151,7 @@ class OC_FileCache{
* @param string newPath
* @param string root (optional)
*/
- public static function move($oldPath,$newPath,$root=false) {
+ public static function move($oldPath, $newPath, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -190,7 +190,7 @@ class OC_FileCache{
* @param string path
* @param string root (optional)
*/
- public static function delete($path,$root=false) {
+ public static function delete($path, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -211,7 +211,7 @@ class OC_FileCache{
* @param string root (optional)
* @return array of filepaths
*/
- public static function search($search,$returnData=false,$root=false) {
+ public static function search($search, $returnData=false, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -227,7 +227,7 @@ class OC_FileCache{
$where = '`name` LIKE ? AND `user`=?';
}
$query=OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*fscache` WHERE '.$where);
- $result=$query->execute(array("%$search%",OC_User::getUser()));
+ $result=$query->execute(array("%$search%", OC_User::getUser()));
$names=array();
while($row=$result->fetchRow()) {
if(!$returnData) {
@@ -255,7 +255,7 @@ class OC_FileCache{
* - encrypted
* - versioned
*/
- public static function getFolderContent($path,$root=false,$mimetype_filter='') {
+ public static function getFolderContent($path, $root=false, $mimetype_filter='') {
if(OC_FileCache_Update::hasUpdated($path, $root, true)) {
OC_FileCache_Update::updateFolder($path, $root);
}
@@ -268,7 +268,7 @@ class OC_FileCache{
* @param string root (optional)
* @return bool
*/
- public static function inCache($path,$root=false) {
+ public static function inCache($path, $root=false) {
return self::getId($path, $root)!=-1;
}
@@ -278,7 +278,7 @@ class OC_FileCache{
* @param string root (optional)
* @return int
*/
- public static function getId($path,$root=false) {
+ public static function getId($path, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -314,7 +314,7 @@ class OC_FileCache{
* @param string user (optional)
* @return string
*/
- public static function getPath($id,$user='') {
+ public static function getPath($id, $user='') {
if(!$user) {
$user=OC_User::getUser();
}
@@ -348,12 +348,12 @@ class OC_FileCache{
* @param int $sizeDiff
* @param string root (optinal)
*/
- public static function increaseSize($path,$sizeDiff, $root=false) {
+ public static function increaseSize($path, $sizeDiff, $root=false) {
if($sizeDiff==0) return;
$id=self::getId($path, $root);
while($id!=-1) {//walk up the filetree increasing the size of all parent folders
$query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `size`=`size`+? WHERE `id`=?');
- $query->execute(array($sizeDiff,$id));
+ $query->execute(array($sizeDiff, $id));
$id=self::getParentId($path);
$path=dirname($path);
}
@@ -366,7 +366,7 @@ class OC_FileCache{
* @param int count (optional)
* @param string root (optional)
*/
- public static function scan($path,$eventSource=false,&$count=0,$root=false) {
+ public static function scan($path, $eventSource=false,&$count=0, $root=false) {
if($eventSource) {
$eventSource->send('scanning', array('file'=>$path, 'count'=>$count));
}
@@ -401,8 +401,8 @@ class OC_FileCache{
}
}
- OC_FileCache_Update::cleanFolder($path,$root);
- self::increaseSize($path,$totalSize,$root);
+ OC_FileCache_Update::cleanFolder($path, $root);
+ self::increaseSize($path, $totalSize, $root);
}
/**
@@ -411,7 +411,7 @@ class OC_FileCache{
* @param string root (optional)
* @return int size of the scanned file
*/
- public static function scanFile($path,$root=false) {
+ public static function scanFile($path, $root=false) {
// NOTE: Ugly hack to prevent shared files from going into the cache (the source already exists somewhere in the cache)
if (substr($path, 0, 7) == '/Shared') {
return;
@@ -448,12 +448,12 @@ class OC_FileCache{
* @return array of file paths
*
* $part1 and $part2 together form the complete mimetype.
- * e.g. searchByMime('text','plain')
+ * e.g. searchByMime('text', 'plain')
*
* seccond mimetype part can be ommited
* e.g. searchByMime('audio')
*/
- public static function searchByMime($part1,$part2=null,$root=false) {
+ public static function searchByMime($part1, $part2=null, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -500,7 +500,7 @@ class OC_FileCache{
* trigger an update for the cache by setting the mtimes to 0
* @param string $user (optional)
*/
- public static function triggerUpdate($user=''){
+ public static function triggerUpdate($user='') {
if($user) {
$query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 WHERE `user`=? AND `mimetype`="httpd/unix-directory"');
$query->execute(array($user));
diff --git a/lib/filecache/cached.php b/lib/filecache/cached.php
index 9b1eb4f7803..7458322fb14 100644
--- a/lib/filecache/cached.php
+++ b/lib/filecache/cached.php
@@ -13,7 +13,7 @@
class OC_FileCache_Cached{
public static $savedData=array();
- public static function get($path,$root=false) {
+ public static function get($path, $root=false) {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
@@ -61,7 +61,7 @@ class OC_FileCache_Cached{
* - encrypted
* - versioned
*/
- public static function getFolderContent($path,$root=false,$mimetype_filter='') {
+ public static function getFolderContent($path, $root=false, $mimetype_filter='') {
if($root===false) {
$root=OC_Filesystem::getRoot();
}
diff --git a/lib/filecache/update.php b/lib/filecache/update.php
index f9d64d0ae99..bc403113e7c 100644
--- a/lib/filecache/update.php
+++ b/lib/filecache/update.php
@@ -18,7 +18,7 @@ class OC_FileCache_Update{
* @param boolean folder
* @return bool
*/
- public static function hasUpdated($path,$root=false,$folder=false) {
+ public static function hasUpdated($path, $root=false, $folder=false) {
if($root===false) {
$view=OC_Filesystem::getView();
}else{
@@ -46,14 +46,14 @@ class OC_FileCache_Update{
/**
* delete non existing files from the cache
*/
- public static function cleanFolder($path,$root=false) {
+ public static function cleanFolder($path, $root=false) {
if($root===false) {
$view=OC_Filesystem::getView();
}else{
$view=new OC_FilesystemView($root);
}
- $cachedContent=OC_FileCache_Cached::getFolderContent($path,$root);
+ $cachedContent=OC_FileCache_Cached::getFolderContent($path, $root);
foreach($cachedContent as $fileData) {
$path=$fileData['path'];
$file=$view->getRelativePath($path);
@@ -72,7 +72,7 @@ class OC_FileCache_Update{
* @param string path
* @param string root (optional)
*/
- public static function updateFolder($path,$root=false) {
+ public static function updateFolder($path, $root=false) {
if($root===false) {
$view=OC_Filesystem::getView();
}else{
@@ -85,7 +85,7 @@ class OC_FileCache_Update{
$file=$path.'/'.$filename;
$isDir=$view->is_dir($file);
if(self::hasUpdated($file, $root, $isDir)) {
- if($isDir){
+ if($isDir) {
self::updateFolder($file, $root);
}elseif($root===false) {//filesystem hooks are only valid for the default root
OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$file));
@@ -143,7 +143,7 @@ class OC_FileCache_Update{
* @param string path
* @param string root (optional)
*/
- public static function update($path,$root=false) {
+ public static function update($path, $root=false) {
if($root===false) {
$view=OC_Filesystem::getView();
}else{
@@ -153,7 +153,7 @@ class OC_FileCache_Update{
$mimetype=$view->getMimeType($path);
$size=0;
- $cached=OC_FileCache_Cached::get($path,$root);
+ $cached=OC_FileCache_Cached::get($path, $root);
$cachedSize=isset($cached['size'])?$cached['size']:0;
if($view->is_dir($path.'/')) {
@@ -165,7 +165,7 @@ class OC_FileCache_Update{
$mtime=$view->filemtime($path.'/');
$ctime=$view->filectime($path.'/');
$writable=$view->is_writable($path.'/');
- OC_FileCache::put($path, array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
+ OC_FileCache::put($path, array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype, 'writable'=>$writable));
}else{
$count=0;
OC_FileCache::scan($path, null, $count, $root);
@@ -174,7 +174,7 @@ class OC_FileCache_Update{
}else{
$size=OC_FileCache::scanFile($path, $root);
}
- if($path !== '' and $path !== '/'){
+ if($path !== '' and $path !== '/') {
OC_FileCache::increaseSize(dirname($path), $size-$cachedSize, $root);
}
}
@@ -184,7 +184,7 @@ class OC_FileCache_Update{
* @param string path
* @param string root (optional)
*/
- public static function delete($path,$root=false) {
+ public static function delete($path, $root=false) {
$cached=OC_FileCache_Cached::get($path, $root);
if(!isset($cached['size'])) {
return;
@@ -200,7 +200,7 @@ class OC_FileCache_Update{
* @param string newPath
* @param string root (optional)
*/
- public static function rename($oldPath,$newPath,$root=false) {
+ public static function rename($oldPath, $newPath, $root=false) {
if(!OC_FileCache::inCache($oldPath, $root)) {
return;
}
diff --git a/lib/fileproxy.php b/lib/fileproxy.php
index 3e7f1aa1c41..2f81bde64a1 100644
--- a/lib/fileproxy.php
+++ b/lib/fileproxy.php
@@ -51,7 +51,7 @@ class OC_FileProxy{
*
* this implements a dummy proxy for all operations
*/
- public function __call($function,$arguments) {
+ public function __call($function, $arguments) {
if(substr($function, 0, 3)=='pre') {
return true;
}else{
@@ -85,7 +85,7 @@ class OC_FileProxy{
$proxies=self::getProxies($operation);
foreach($proxies as $proxy) {
if(!is_null($filepath2)) {
- if($proxy->$operation($filepath,$filepath2)===false) {
+ if($proxy->$operation($filepath, $filepath2)===false) {
return false;
}
}else{
@@ -97,14 +97,14 @@ class OC_FileProxy{
return true;
}
- public static function runPostProxies($operation,$path,$result) {
+ public static function runPostProxies($operation, $path, $result) {
if(!self::$enabled) {
return $result;
}
$operation='post'.$operation;
$proxies=self::getProxies($operation);
foreach($proxies as $proxy) {
- $result=$proxy->$operation($path,$result);
+ $result=$proxy->$operation($path, $result);
}
return $result;
}
diff --git a/lib/fileproxy/fileoperations.php b/lib/fileproxy/fileoperations.php
index 23fb63fcfb1..516629adaec 100644
--- a/lib/fileproxy/fileoperations.php
+++ b/lib/fileproxy/fileoperations.php
@@ -28,7 +28,7 @@ class OC_FileProxy_FileOperations extends OC_FileProxy{
static $rootView;
public function premkdir($path) {
- if(!self::$rootView){
+ if(!self::$rootView) {
self::$rootView = new OC_FilesystemView('');
}
return !self::$rootView->file_exists($path);
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
index 012be582a51..81376fb6fca 100644
--- a/lib/fileproxy/quota.php
+++ b/lib/fileproxy/quota.php
@@ -38,9 +38,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
if(in_array($user, $this->userQuota)) {
return $this->userQuota[$user];
}
- $userQuota=OC_Preferences::getValue($user,'files','quota','default');
+ $userQuota=OC_Preferences::getValue($user,'files','quota', 'default');
if($userQuota=='default') {
- $userQuota=OC_AppConfig::getValue('files','default_quota','none');
+ $userQuota=OC_AppConfig::getValue('files','default_quota', 'none');
}
if($userQuota=='none') {
$this->userQuota[$user]=0;
@@ -77,33 +77,33 @@ class OC_FileProxy_Quota extends OC_FileProxy{
return $totalSpace-$usedSpace;
}
- public function postFree_space($path,$space) {
+ public function postFree_space($path, $space) {
$free=$this->getFreeSpace($path);
if($free==0) {
return $space;
}
- return min($free,$space);
+ return min($free, $space);
}
- public function preFile_put_contents($path,$data) {
+ public function preFile_put_contents($path, $data) {
if (is_resource($data)) {
$data = '';//TODO: find a way to get the length of the stream without emptying it
}
return (strlen($data)<$this->getFreeSpace($path) or $this->getFreeSpace($path)==0);
}
- public function preCopy($path1,$path2) {
- if(!self::$rootView){
+ public function preCopy($path1, $path2) {
+ if(!self::$rootView) {
self::$rootView = new OC_FilesystemView('');
}
return (self::$rootView->filesize($path1)<$this->getFreeSpace($path2) or $this->getFreeSpace($path2)==0);
}
- public function preFromTmpFile($tmpfile,$path) {
+ public function preFromTmpFile($tmpfile, $path) {
return (filesize($tmpfile)<$this->getFreeSpace($path) or $this->getFreeSpace($path)==0);
}
- public function preFromUploadedFile($tmpfile,$path) {
+ public function preFromUploadedFile($tmpfile, $path) {
return (filesize($tmpfile)<$this->getFreeSpace($path) or $this->getFreeSpace($path)==0);
}
}
diff --git a/lib/files.php b/lib/files.php
index b4d4de1c995..5a14083c285 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -135,7 +135,7 @@ class OC_Files {
* @param file $file ; seperated list of files to download
* @param boolean $only_header ; boolean to only send header of the request
*/
- public static function get($dir,$files, $only_header = false) {
+ public static function get($dir, $files, $only_header = false) {
if(strpos($files, ';')) {
$files=explode(';', $files);
}
@@ -224,7 +224,7 @@ class OC_Files {
}
}
- public static function zipAddDir($dir,$zip,$internalDir='') {
+ public static function zipAddDir($dir, $zip, $internalDir='') {
$dirname=basename($dir);
$zip->addEmptyDir($internalDir.$dirname);
$internalDir.=$dirname.='/';
@@ -249,7 +249,7 @@ class OC_Files {
* @param dir $targetDir
* @param file $target
*/
- public static function move($sourceDir,$source,$targetDir,$target) {
+ public static function move($sourceDir, $source, $targetDir, $target) {
if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')) {
$targetFile=self::normalizePath($targetDir.'/'.$target);
$sourceFile=self::normalizePath($sourceDir.'/'.$source);
@@ -267,7 +267,7 @@ class OC_Files {
* @param dir $targetDir
* @param file $target
*/
- public static function copy($sourceDir,$source,$targetDir,$target) {
+ public static function copy($sourceDir, $source, $targetDir, $target) {
if(OC_User::isLoggedIn()) {
$targetFile=$targetDir.'/'.$target;
$sourceFile=$sourceDir.'/'.$source;
@@ -282,7 +282,7 @@ class OC_Files {
* @param file $name
* @param type $type
*/
- public static function newFile($dir,$name,$type) {
+ public static function newFile($dir, $name, $type) {
if(OC_User::isLoggedIn()) {
$file=$dir.'/'.$name;
if($type=='dir') {
@@ -305,7 +305,7 @@ class OC_Files {
* @param dir $dir
* @param file $name
*/
- public static function delete($dir,$file) {
+ public static function delete($dir, $file) {
if(OC_User::isLoggedIn() && ($dir!= '' || $file != 'Shared')) {
$file=$dir.'/'.$file;
return OC_Filesystem::unlink($file);
@@ -389,9 +389,9 @@ class OC_Files {
* @param string file
* @return string guessed mime type
*/
- static function pull($source,$token,$dir,$file) {
+ static function pull($source, $token, $dir, $file) {
$tmpfile=tempnam(get_temp_dir(), 'remoteCloudFile');
- $fp=fopen($tmpfile,'w+');
+ $fp=fopen($tmpfile, 'w+');
$url=$source.="/files/pull.php?token=$token";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@@ -480,7 +480,7 @@ class OC_Files {
}
}
-function fileCmp($a,$b) {
+function fileCmp($a, $b) {
if($a['type']=='dir' and $b['type']!='dir') {
return -1;
}elseif($a['type']!='dir' and $b['type']=='dir') {
diff --git a/lib/filestorage.php b/lib/filestorage.php
index 146cecf4efa..dd65f4421b7 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -42,13 +42,13 @@ abstract class OC_Filestorage{
abstract public function filectime($path);
abstract public function filemtime($path);
abstract public function file_get_contents($path);
- abstract public function file_put_contents($path,$data);
+ abstract public function file_put_contents($path, $data);
abstract public function unlink($path);
- abstract public function rename($path1,$path2);
- abstract public function copy($path1,$path2);
- abstract public function fopen($path,$mode);
+ abstract public function rename($path1, $path2);
+ abstract public function copy($path1, $path2);
+ abstract public function fopen($path, $mode);
abstract public function getMimeType($path);
- abstract public function hash($type,$path,$raw = false);
+ abstract public function hash($type, $path, $raw = false);
abstract public function free_space($path);
abstract public function search($query);
abstract public function touch($path, $mtime=null);
@@ -62,6 +62,6 @@ abstract class OC_Filestorage{
* hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
* returning true for other changes in the folder is optional
*/
- abstract public function hasUpdated($path,$time);
+ abstract public function hasUpdated($path, $time);
abstract public function getOwner($path);
}
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index cf09ea71e8c..b97eb79d8d4 100644
--- a/lib/filestorage/common.php
+++ b/lib/filestorage/common.php
@@ -89,25 +89,25 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
}
return fread($handle, $size);
}
- public function file_put_contents($path,$data) {
+ public function file_put_contents($path, $data) {
$handle = $this->fopen($path, "w");
return fwrite($handle, $data);
}
// abstract public function unlink($path);
- public function rename($path1,$path2) {
+ public function rename($path1, $path2) {
if($this->copy($path1, $path2)) {
return $this->unlink($path1);
}else{
return false;
}
}
- public function copy($path1,$path2) {
+ public function copy($path1, $path2) {
$source=$this->fopen($path1, 'r');
$target=$this->fopen($path2, 'w');
$count=OC_Helper::streamCopy($source, $target);
return $count>0;
}
-// abstract public function fopen($path,$mode);
+// abstract public function fopen($path, $mode);
/**
* @brief Deletes all files and folders recursively within a directory
@@ -204,7 +204,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
unlink($tmpFile);
return $mime;
}
- public function hash($type,$path,$raw = false) {
+ public function hash($type, $path, $raw = false) {
$tmpFile=$this->getLocalFile();
$hash=hash($type, $tmpFile, $raw);
unlink($tmpFile);
@@ -237,7 +237,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
$this->addLocalFolder($path, $baseDir);
return $baseDir;
}
- private function addLocalFolder($path,$target) {
+ private function addLocalFolder($path, $target) {
if($dh=$this->opendir($path)) {
while($file=readdir($dh)) {
if($file!=='.' and $file!=='..') {
@@ -254,7 +254,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
}
// abstract public function touch($path, $mtime=null);
- protected function searchInDir($query,$dir='') {
+ protected function searchInDir($query, $dir='') {
$files=array();
$dh=$this->opendir($dir);
if($dh) {
@@ -264,7 +264,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
$files[]=$dir.'/'.$item;
}
if($this->is_dir($dir.'/'.$item)) {
- $files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item));
+ $files=array_merge($files, $this->searchInDir($query, $dir.'/'.$item));
}
}
}
@@ -276,7 +276,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
* @param int $time
* @return bool
*/
- public function hasUpdated($path,$time) {
+ public function hasUpdated($path, $time) {
return $this->filemtime($path)>$time;
}
diff --git a/lib/filestorage/commontest.php b/lib/filestorage/commontest.php
index b88bb232c36..3b038b3fda9 100644
--- a/lib/filestorage/commontest.php
+++ b/lib/filestorage/commontest.php
@@ -63,13 +63,13 @@ class OC_Filestorage_CommonTest extends OC_Filestorage_Common{
public function unlink($path) {
return $this->storage->unlink($path);
}
- public function fopen($path,$mode) {
- return $this->storage->fopen($path,$mode);
+ public function fopen($path, $mode) {
+ return $this->storage->fopen($path, $mode);
}
public function free_space($path) {
return $this->storage->free_space($path);
}
public function touch($path, $mtime=null) {
- return $this->storage->touch($path,$mtime);
+ return $this->storage->touch($path, $mtime);
}
} \ No newline at end of file
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 731ac4a3c72..2dde0093d4b 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -21,7 +21,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
}
public function is_dir($path) {
if(substr($path,-1)=='/') {
- $path=substr($path,0,-1);
+ $path=substr($path, 0, -1);
}
return is_dir($this->datadir.$path);
}
@@ -78,38 +78,38 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
public function file_get_contents($path) {
return file_get_contents($this->datadir.$path);
}
- public function file_put_contents($path,$data) {
- return file_put_contents($this->datadir.$path,$data);
+ public function file_put_contents($path, $data) {
+ return file_put_contents($this->datadir.$path, $data);
}
public function unlink($path) {
return $this->delTree($path);
}
- public function rename($path1,$path2) {
+ public function rename($path1, $path2) {
if (!$this->isUpdatable($path1)) {
- OC_Log::write('core','unable to rename, file is not writable : '.$path1,OC_Log::ERROR);
+ OC_Log::write('core','unable to rename, file is not writable : '.$path1, OC_Log::ERROR);
return false;
}
if(! $this->file_exists($path1)) {
- OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR);
+ OC_Log::write('core','unable to rename, file does not exists : '.$path1, OC_Log::ERROR);
return false;
}
- if($return=rename($this->datadir.$path1,$this->datadir.$path2)) {
+ if($return=rename($this->datadir.$path1, $this->datadir.$path2)) {
}
return $return;
}
- public function copy($path1,$path2) {
+ public function copy($path1, $path2) {
if($this->is_dir($path2)) {
if(!$this->file_exists($path2)) {
$this->mkdir($path2);
}
- $source=substr($path1, strrpos($path1,'/')+1);
+ $source=substr($path1, strrpos($path1, '/')+1);
$path2.=$source;
}
- return copy($this->datadir.$path1,$this->datadir.$path2);
+ return copy($this->datadir.$path1, $this->datadir.$path2);
}
- public function fopen($path,$mode) {
- if($return=fopen($this->datadir.$path,$mode)) {
+ public function fopen($path, $mode) {
+ if($return=fopen($this->datadir.$path, $mode)) {
switch($mode) {
case 'r':
break;
@@ -156,8 +156,8 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
return $return;
}
- public function hash($path,$type,$raw=false) {
- return hash_file($type,$this->datadir.$path,$raw);
+ public function hash($path, $type, $raw=false) {
+ return hash_file($type, $this->datadir.$path, $raw);
}
public function free_space($path) {
@@ -174,7 +174,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
return $this->datadir.$path;
}
- protected function searchInDir($query,$dir='') {
+ protected function searchInDir($query, $dir='') {
$files=array();
foreach (scandir($this->datadir.$dir) as $item) {
if ($item == '.' || $item == '..') continue;
@@ -182,7 +182,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
$files[]=$dir.'/'.$item;
}
if(is_dir($this->datadir.$dir.'/'.$item)) {
- $files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item));
+ $files=array_merge($files, $this->searchInDir($query, $dir.'/'.$item));
}
}
return $files;
@@ -193,7 +193,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
* @param int $time
* @return bool
*/
- public function hasUpdated($path,$time) {
+ public function hasUpdated($path, $time) {
return $this->filemtime($path)>$time;
}
}
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 3b6772c9849..aeafb149395 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -35,10 +35,10 @@
* post_create(path)
* delete(path, &run)
* post_delete(path)
- * rename(oldpath,newpath, &run)
- * post_rename(oldpath,newpath)
- * copy(oldpath,newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emited in that order)
- * post_rename(oldpath,newpath)
+ * rename(oldpath, newpath, &run)
+ * post_rename(oldpath, newpath)
+ * copy(oldpath, newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emited in that order)
+ * post_rename(oldpath, newpath)
*
* the &run parameter can be set to false to prevent the operation from occuring
*/
@@ -246,7 +246,7 @@ class OC_Filesystem{
}
$mtime=filemtime(OC::$SERVERROOT.'/config/mount.php');
- $previousMTime=OC_Appconfig::getValue('files','mountconfigmtime',0);
+ $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);
@@ -303,7 +303,7 @@ class OC_Filesystem{
* @param array arguments
* @return OC_Filestorage
*/
- static private function createStorage($class,$arguments) {
+ static private function createStorage($class, $arguments) {
if(class_exists($class)) {
try {
return new $class($arguments);
@@ -312,7 +312,7 @@ class OC_Filesystem{
return false;
}
}else{
- OC_Log::write('core','storage backend '.$class.' not found',OC_Log::ERROR);
+ OC_Log::write('core','storage backend '.$class.' not found', OC_Log::ERROR);
return false;
}
}
@@ -349,14 +349,14 @@ class OC_Filesystem{
* @param OC_Filestorage storage
* @param string mountpoint
*/
- static public function mount($class,$arguments,$mountpoint) {
+ static public function mount($class, $arguments, $mountpoint) {
if($mountpoint[0]!='/') {
$mountpoint='/'.$mountpoint;
}
if(substr($mountpoint, -1)!=='/') {
$mountpoint=$mountpoint.'/';
}
- self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
+ self::$mounts[$mountpoint]=array('class'=>$class, 'arguments'=>$arguments);
}
/**
@@ -396,12 +396,16 @@ class OC_Filesystem{
* @return bool
*/
static public function isValidPath($path) {
+ $path = self::normalizePath($path);
if(!$path || $path[0]!=='/') {
$path='/'.$path;
}
if(strstr($path, '/../') || strrchr($path, '/') === '/..' ) {
return false;
}
+ if(self::isFileBlacklisted($path)) {
+ return false;
+ }
return true;
}
@@ -411,20 +415,22 @@ class OC_Filesystem{
* @param array $data from hook
*/
static public function isBlacklisted($data) {
- $blacklist = array('.htaccess');
if (isset($data['path'])) {
$path = $data['path'];
} else if (isset($data['newpath'])) {
$path = $data['newpath'];
}
if (isset($path)) {
- $filename = strtolower(basename($path));
- if (in_array($filename, $blacklist)) {
- $data['run'] = false;
- }
+ $data['run'] = !self::isFileBlacklisted($path);
}
}
+ static public function isFileBlacklisted($path) {
+ $blacklist = array('.htaccess');
+ $filename = strtolower(basename($path));
+ return in_array($filename, $blacklist);
+ }
+
/**
* following functions are equivilent to their php buildin equivilents for arguments/return values.
*/
@@ -500,32 +506,32 @@ class OC_Filesystem{
static public function file_get_contents($path) {
return self::$defaultInstance->file_get_contents($path);
}
- static public function file_put_contents($path,$data) {
+ static public function 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) {
+ static public function rename($path1, $path2) {
return self::$defaultInstance->rename($path1, $path2);
}
- static public function copy($path1,$path2) {
+ static public function copy($path1, $path2) {
return self::$defaultInstance->copy($path1, $path2);
}
- static public function fopen($path,$mode) {
+ static public function 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) {
+ static public function 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) {
+ static public function hash($type, $path, $raw = false) {
return self::$defaultInstance->hash($type, $path, $raw);
}
@@ -542,7 +548,7 @@ class OC_Filesystem{
* @param int $time
* @return bool
*/
- static public function hasUpdated($path,$time) {
+ static public function hasUpdated($path, $time) {
return self::$defaultInstance->hasUpdated($path, $time);
}
@@ -569,7 +575,7 @@ class OC_Filesystem{
* @param bool $stripTrailingSlash
* @return string
*/
- public static function normalizePath($path,$stripTrailingSlash=true) {
+ public static function normalizePath($path, $stripTrailingSlash=true) {
if($path=='') {
return '/';
}
@@ -584,7 +590,7 @@ class OC_Filesystem{
$path=substr($path, 0, -1);
}
//remove duplicate slashes
- while(strpos($path,'//')!==false) {
+ while(strpos($path, '//')!==false) {
$path=str_replace('//', '/', $path);
}
//normalize unicode if possible
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index dbb6681656f..936e1feb412 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -251,7 +251,7 @@ class OC_FilesystemView {
return $this->basicOperation('filemtime', $path);
}
public function touch($path, $mtime=null) {
- if(!is_null($mtime) and !is_numeric($mtime)){
+ if(!is_null($mtime) and !is_numeric($mtime)) {
$mtime = strtotime($mtime);
}
return $this->basicOperation('touch', $path, array('write'), $mtime);
@@ -266,7 +266,7 @@ class OC_FilesystemView {
$path = $this->getRelativePath($absolutePath);
$exists = $this->file_exists($path);
$run = true;
- if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ) {
if(!$exists) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
@@ -294,7 +294,7 @@ class OC_FilesystemView {
$count=OC_Helper::streamCopy($data, $target);
fclose($target);
fclose($data);
- if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ) {
if(!$exists) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
@@ -337,7 +337,7 @@ class OC_FilesystemView {
return false;
}
$run=true;
- if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename,
array(
@@ -362,7 +362,7 @@ class OC_FilesystemView {
$storage1->unlink($this->getInternalPath($path1.$postFix1));
$result = $count>0;
}
- if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_post_rename,
@@ -389,7 +389,7 @@ class OC_FilesystemView {
return false;
}
$run=true;
- if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_copy,
@@ -433,7 +433,7 @@ class OC_FilesystemView {
$target = $this->fopen($path2.$postFix2, 'w');
$result = OC_Helper::streamCopy($source, $target);
}
- if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_post_copy,
@@ -489,7 +489,7 @@ class OC_FilesystemView {
$hooks[]='write';
break;
default:
- OC_Log::write('core', 'invalid mode ('.$mode.') for '.$path,OC_Log::ERROR);
+ OC_Log::write('core', 'invalid mode ('.$mode.') for '.$path, OC_Log::ERROR);
}
return $this->basicOperation('fopen', $path, $hooks, $mode);
@@ -597,7 +597,7 @@ class OC_FilesystemView {
return null;
}
- private function runHooks($hooks,$path,$post=false) {
+ private function runHooks($hooks, $path, $post=false) {
$prefix=($post)?'post_':'';
$run=true;
if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()) {
diff --git a/lib/group.php b/lib/group.php
index a89c6c55e36..ed9482418bd 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -139,7 +139,7 @@ class OC_Group {
*/
public static function inGroup( $uid, $gid ) {
foreach(self::$_usedBackends as $backend) {
- if($backend->inGroup($uid,$gid)) {
+ if($backend->inGroup($uid, $gid)) {
return true;
}
}
@@ -223,7 +223,7 @@ class OC_Group {
public static function getUserGroups( $uid ) {
$groups=array();
foreach(self::$_usedBackends as $backend) {
- $groups=array_merge($backend->getUserGroups($uid),$groups);
+ $groups=array_merge($backend->getUserGroups($uid), $groups);
}
asort($groups);
return $groups;
diff --git a/lib/group/dummy.php b/lib/group/dummy.php
index 8116dcbd675..9516fd52ff8 100644
--- a/lib/group/dummy.php
+++ b/lib/group/dummy.php
@@ -69,7 +69,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public function inGroup($uid, $gid) {
if(isset($this->groups[$gid])) {
- return (array_search($uid,$this->groups[$gid])!==false);
+ return (array_search($uid, $this->groups[$gid])!==false);
}else{
return false;
}
@@ -85,7 +85,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public function addToGroup($uid, $gid) {
if(isset($this->groups[$gid])) {
- if(array_search($uid,$this->groups[$gid])===false) {
+ if(array_search($uid, $this->groups[$gid])===false) {
$this->groups[$gid][]=$uid;
return true;
}else{
@@ -104,9 +104,9 @@ class OC_Group_Dummy extends OC_Group_Backend {
*
* removes the user from a group.
*/
- public function removeFromGroup($uid,$gid) {
+ public function removeFromGroup($uid, $gid) {
if(isset($this->groups[$gid])) {
- if(($index=array_search($uid,$this->groups[$gid]))!==false) {
+ if(($index=array_search($uid, $this->groups[$gid]))!==false) {
unset($this->groups[$gid][$index]);
}else{
return false;
@@ -128,7 +128,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
$groups=array();
$allGroups=array_keys($this->groups);
foreach($allGroups as $group) {
- if($this->inGroup($uid,$group)) {
+ if($this->inGroup($uid, $group)) {
$groups[]=$group;
}
}
diff --git a/lib/group/example.php b/lib/group/example.php
index 76d12629763..3519b9ed92f 100644
--- a/lib/group/example.php
+++ b/lib/group/example.php
@@ -73,7 +73,7 @@ abstract class OC_Group_Example {
*
* removes the user from a group.
*/
- abstract public static function removeFromGroup($uid,$gid);
+ abstract public static function removeFromGroup($uid, $gid);
/**
* @brief Get all groups a user belongs to
diff --git a/lib/helper.php b/lib/helper.php
index 9843f5b1dc2..ed459dab624 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -377,7 +377,7 @@ class OC_Helper {
if($mimeType=='application/octet-stream' and function_exists('finfo_open') and function_exists('finfo_file') and $finfo=finfo_open(FILEINFO_MIME)) {
$info = @strtolower(finfo_file($finfo, $path));
if($info) {
- $mimeType=substr($info,0, strpos($info, ';'));
+ $mimeType=substr($info, 0, strpos($info, ';'));
}
finfo_close($finfo);
}
@@ -475,16 +475,16 @@ class OC_Helper {
$dirs = explode(PATH_SEPARATOR, $path);
// WARNING : We have to check if open_basedir is enabled :
$obd = ini_get('open_basedir');
- if($obd != "none"){
+ if($obd != "none") {
$obd_values = explode(PATH_SEPARATOR, $obd);
- if(count($obd_values) > 0 and $obd_values[0]){
+ if(count($obd_values) > 0 and $obd_values[0]) {
// open_basedir is in effect !
// We need to check if the program is in one of these dirs :
$dirs = $obd_values;
}
}
- foreach($dirs as $dir){
- foreach($exts as $ext){
+ foreach($dirs as $dir) {
+ foreach($exts as $ext) {
if($check_fn("$dir/$name".$ext))
return true;
}
@@ -498,7 +498,7 @@ class OC_Helper {
* @param resource $target
* @return int the number of bytes copied
*/
- public static function streamCopy($source,$target) {
+ public static function streamCopy($source, $target) {
if(!$source or !$target) {
return false;
}
diff --git a/lib/image.php b/lib/image.php
index 38acf00d9fe..41cd9081690 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -271,7 +271,7 @@ class OC_Image {
return -1;
}
if(is_null($this->filepath) || !is_readable($this->filepath)) {
- OC_Log::write('core','OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
return -1;
}
$exif = @exif_read_data($this->filepath, 'IFD0');
diff --git a/lib/installer.php b/lib/installer.php
index 8c504fb6129..266c07d5c2b 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -57,7 +57,7 @@ class OC_Installer{
*/
public static function installApp( $data = array()) {
if(!isset($data['source'])) {
- OC_Log::write('core','No source specified when installing app',OC_Log::ERROR);
+ OC_Log::write('core','No source specified when installing app', OC_Log::ERROR);
return false;
}
@@ -65,13 +65,13 @@ class OC_Installer{
if($data['source']=='http') {
$path=OC_Helper::tmpFile();
if(!isset($data['href'])) {
- OC_Log::write('core','No href specified when installing app from http',OC_Log::ERROR);
+ OC_Log::write('core','No href specified when installing app from http', OC_Log::ERROR);
return false;
}
- copy($data['href'],$path);
+ copy($data['href'], $path);
}else{
if(!isset($data['path'])) {
- OC_Log::write('core','No path specified when installing app from local file',OC_Log::ERROR);
+ OC_Log::write('core','No path specified when installing app from local file', OC_Log::ERROR);
return false;
}
$path=$data['path'];
@@ -80,13 +80,13 @@ class OC_Installer{
//detect the archive type
$mime=OC_Helper::getMimeType($path);
if($mime=='application/zip') {
- rename($path,$path.'.zip');
+ rename($path, $path.'.zip');
$path.='.zip';
}elseif($mime=='application/x-gzip') {
- rename($path,$path.'.tgz');
+ rename($path, $path.'.tgz');
$path.='.tgz';
}else{
- OC_Log::write('core','Archives of type '.$mime.' are not supported',OC_Log::ERROR);
+ OC_Log::write('core','Archives of type '.$mime.' are not supported', OC_Log::ERROR);
return false;
}
@@ -248,7 +248,7 @@ class OC_Installer{
* -# including appinfo/upgrade.php
* -# setting the installed version
*
- * upgrade.php can determine the current installed version of the app using "OC_Appconfig::getValue($appid,'installed_version')"
+ * upgrade.php can determine the current installed version of the app using "OC_Appconfig::getValue($appid, 'installed_version')"
*/
public static function upgradeApp( $data = array()) {
// TODO: write function
@@ -344,7 +344,7 @@ class OC_Installer{
* @param string $folder the folder of the app to check
* @returns true for app is o.k. and false for app is not o.k.
*/
- public static function checkCode($appname,$folder) {
+ public static function checkCode($appname, $folder) {
$blacklist=array(
'exec(',
diff --git a/lib/json.php b/lib/json.php
index cc6cee6caff..204430411c0 100644
--- a/lib/json.php
+++ b/lib/json.php
@@ -72,7 +72,7 @@ class OC_JSON{
public static function checkSubAdminUser() {
self::checkLoggedIn();
self::verifyUser();
- if(!OC_Group::inGroup(OC_User::getUser(),'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
+ if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
$l = OC_L10N::get('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
@@ -120,7 +120,7 @@ class OC_JSON{
/**
* Encode and print $data in json format
*/
- public static function encodedPrint($data,$setContentType=true) {
+ public static function encodedPrint($data, $setContentType=true) {
// Disable mimesniffing, don't move this to setContentTypeHeader!
header( 'X-Content-Type-Options: nosniff' );
if($setContentType) {
diff --git a/lib/l10n.php b/lib/l10n.php
index f1a2523c307..f172710e5d7 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -68,14 +68,14 @@ class OC_L10N{
* get an L10N instance
* @return OC_L10N
*/
- public static function get($app,$lang=null) {
+ public static function get($app, $lang=null) {
if(is_null($lang)) {
if(!isset(self::$instances[$app])) {
self::$instances[$app]=new OC_L10N($app);
}
return self::$instances[$app];
}else{
- return new OC_L10N($app,$lang);
+ return new OC_L10N($app, $lang);
}
}
@@ -167,7 +167,7 @@ class OC_L10N{
*
*/
public function tA($textArray) {
- OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.',OC_Log::WARN);
+ OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.', OC_Log::WARN);
$result = array();
foreach($textArray as $key => $text) {
$result[$key] = (string)$this->t($text);
diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php
index 5eb2348100a..161a5bc0a68 100644
--- a/lib/l10n/pt_BR.php
+++ b/lib/l10n/pt_BR.php
@@ -14,6 +14,7 @@
"Token expired. Please reload page." => "Token expirou. Por favor recarregue a página.",
"Files" => "Arquivos",
"Text" => "Texto",
+"Images" => "Imagens",
"seconds ago" => "segundos atrás",
"1 minute ago" => "1 minuto atrás",
"%d minutes ago" => "%d minutos atrás",
diff --git a/lib/log.php b/lib/log.php
index 3fc1e3976a1..b5e8e1b06a1 100644
--- a/lib/log.php
+++ b/lib/log.php
@@ -41,7 +41,7 @@ class OC_Log {
}
//Fatal errors handler
- public static function onShutdown(){
+ public static function onShutdown() {
$error = error_get_last();
if($error) {
//ob_end_clean();
@@ -52,12 +52,12 @@ class OC_Log {
}
// Uncaught exception handler
- public static function onException($exception){
+ public static function onException($exception) {
self::write('PHP', $exception->getMessage() . ' at ' . $exception->getFile() . '#' . $exception->getLine(), self::FATAL);
}
//Recoverable errors handler
- public static function onError($number, $message, $file, $line){
+ public static function onError($number, $message, $file, $line) {
if (error_reporting() === 0) {
return;
}
diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php
index d4644163ad5..ec43208d833 100644
--- a/lib/log/owncloud.php
+++ b/lib/log/owncloud.php
@@ -44,9 +44,9 @@ class OC_Log_Owncloud {
* @param int level
*/
public static function write($app, $message, $level) {
- $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ),OC_Log::ERROR);
+ $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
if($level>=$minLevel) {
- $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level,'time'=>time());
+ $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=>time());
$fh=fopen(self::$logFile, 'a');
fwrite($fh, json_encode($entry)."\n");
fclose($fh);
diff --git a/lib/mail.php b/lib/mail.php
index 8d30fff9f28..c78fcce88d4 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -27,7 +27,7 @@ class OC_Mail {
* @param string $fromname
* @param bool $html
*/
- public static function send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='') {
+ public static function send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='', $bcc='') {
$SMTPMODE = OC_Config::getValue( 'mail_smtpmode', 'sendmail' );
$SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' );
@@ -56,13 +56,13 @@ class OC_Mail {
$mailo->From =$fromaddress;
$mailo->FromName = $fromname;;
$mailo->Sender =$fromaddress;
- $a=explode(' ',$toaddress);
+ $a=explode(' ', $toaddress);
try {
foreach($a as $ad) {
- $mailo->AddAddress($ad,$toname);
+ $mailo->AddAddress($ad, $toname);
}
- if($ccaddress<>'') $mailo->AddCC($ccaddress,$ccname);
+ if($ccaddress<>'') $mailo->AddCC($ccaddress, $ccname);
if($bcc<>'') $mailo->AddBCC($bcc);
$mailo->AddReplyTo($fromaddress, $fromname);
diff --git a/lib/migrate.php b/lib/migrate.php
index 409d77a1a96..616417a2271 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -91,7 +91,7 @@ class OC_Migrate{
if( self::$exporttype == 'user' ) {
// Check user exists
self::$uid = is_null($uid) ? OC_User::getUser() : $uid;
- if(!OC_User::userExists(self::$uid)){
+ if(!OC_User::userExists(self::$uid)) {
return json_encode( array( 'success' => false) );
}
}
@@ -611,11 +611,11 @@ class OC_Migrate{
if( file_exists( $db ) ) {
// Connect to the db
if(!self::connectDB( $db )) {
- OC_Log::write('migration','Failed to connect to migration.db',OC_Log::ERROR);
+ OC_Log::write('migration','Failed to connect to migration.db', OC_Log::ERROR);
return false;
}
} else {
- OC_Log::write('migration','Migration.db not found at: '.$db, OC_Log::FATAL );
+ OC_Log::write('migration', 'Migration.db not found at: '.$db, OC_Log::FATAL );
return false;
}
diff --git a/lib/migration/content.php b/lib/migration/content.php
index 87f8da68c9d..54982b3c847 100644
--- a/lib/migration/content.php
+++ b/lib/migration/content.php
@@ -53,7 +53,7 @@ class OC_Migration_Content{
if( !is_null( $this->db ) ) {
// Get db path
$db = $this->db->getDatabase();
- if(!in_array($db, $this->tmpfiles)){
+ if(!in_array($db, $this->tmpfiles)) {
$this->tmpfiles[] = $db;
}
}
@@ -152,7 +152,7 @@ class OC_Migration_Content{
$sql = "INSERT INTO `" . $options['table'] . '` ( `';
$fieldssql = implode( '`, `', $fields );
$sql .= $fieldssql . "` ) VALUES( ";
- $valuessql = substr( str_repeat( '?, ', count( $fields ) ),0,-2 );
+ $valuessql = substr( str_repeat( '?, ', count( $fields ) ), 0, -2 );
$sql .= $valuessql . " )";
// Make the query
$query = $this->prepare( $sql );
@@ -205,7 +205,7 @@ class OC_Migration_Content{
}
closedir($dirhandle);
} else {
- OC_Log::write('admin_export',"Was not able to open directory: " . $dir,OC_Log::ERROR);
+ OC_Log::write('admin_export',"Was not able to open directory: " . $dir, OC_Log::ERROR);
return false;
}
return true;
diff --git a/lib/minimizer.php b/lib/minimizer.php
index deffa8e65df..33106245963 100644
--- a/lib/minimizer.php
+++ b/lib/minimizer.php
@@ -48,11 +48,11 @@ abstract class OC_Minimizer {
}
if (!function_exists('gzdecode')) {
- function gzdecode($data,$maxlength=null,&$filename='',&$error='')
+ function gzdecode($data, $maxlength=null, &$filename='', &$error='')
{
- if (strcmp(substr($data,0,9),"\x1f\x8b\x8\0\0\0\0\0\0")) {
+ if (strcmp(substr($data, 0, 9),"\x1f\x8b\x8\0\0\0\0\0\0")) {
return null; // Not the GZIP format we expect (See RFC 1952)
}
- return gzinflate(substr($data,10,-8));
+ return gzinflate(substr($data, 10, -8));
}
}
diff --git a/lib/ocsclient.php b/lib/ocsclient.php
index 32c2cfe6e48..ceeb78570fd 100644
--- a/lib/ocsclient.php
+++ b/lib/ocsclient.php
@@ -105,18 +105,18 @@ class OC_OCSClient{
*
* This function returns a list of all the applications on the OCS server
*/
- public static function getApplications($categories,$page,$filter) {
+ public static function getApplications($categories, $page, $filter) {
if(OC_Config::getValue('appstoreenabled', true)==false) {
return(array());
}
if(is_array($categories)) {
- $categoriesstring=implode('x',$categories);
+ $categoriesstring=implode('x', $categories);
}else{
$categoriesstring=$categories;
}
- $version='&version='.implode('x',\OC_Util::getVersion());
+ $version='&version='.implode('x', \OC_Util::getVersion());
$filterurl='&filter='.urlencode($filter);
$url=OC_OCSClient::getAppStoreURL().'/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page='.urlencode($page).'&pagesize=100'.$filterurl.$version;
$apps=array();
@@ -162,7 +162,7 @@ class OC_OCSClient{
$xml=OC_OCSClient::getOCSresponse($url);
if($xml==false) {
- OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
+ OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL);
return null;
}
$data=simplexml_load_string($xml);
@@ -192,7 +192,7 @@ class OC_OCSClient{
*
* This function returns an download url for an applications from the OCS server
*/
- public static function getApplicationDownload($id,$item) {
+ public static function getApplicationDownload($id, $item) {
if(OC_Config::getValue('appstoreenabled', true)==false) {
return null;
}
@@ -200,7 +200,7 @@ class OC_OCSClient{
$xml=OC_OCSClient::getOCSresponse($url);
if($xml==false) {
- OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
+ OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL);
return null;
}
$data=simplexml_load_string($xml);
@@ -222,7 +222,7 @@ class OC_OCSClient{
*
* This function returns a list of all the knowledgebase entries from the OCS server
*/
- public static function getKnownledgebaseEntries($page,$pagesize,$search='') {
+ public static function getKnownledgebaseEntries($page, $pagesize, $search='') {
if(OC_Config::getValue('knowledgebaseenabled', true)==false) {
$kbe=array();
$kbe['totalitems']=0;
@@ -238,7 +238,7 @@ class OC_OCSClient{
$xml=OC_OCSClient::getOCSresponse($url);
if($xml==false) {
- OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL);
+ OC_Log::write('core','Unable to parse knowledgebase content', OC_Log::FATAL);
return null;
}
$data=simplexml_load_string($xml);
diff --git a/lib/preferences.php b/lib/preferences.php
index b198a18415c..6270457834d 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -139,7 +139,7 @@ class OC_Preferences{
public static function setValue( $user, $app, $key, $value ) {
// Check if the key does exist
$query = OC_DB::prepare( 'SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
- $values=$query->execute(array($user,$app,$key))->fetchAll();
+ $values=$query->execute(array($user, $app, $key))->fetchAll();
$exists=(count($values)>0);
if( !$exists ) {
diff --git a/lib/public/db.php b/lib/public/db.php
index 6ce62b27ca2..d2484b6eb83 100644
--- a/lib/public/db.php
+++ b/lib/public/db.php
@@ -42,7 +42,7 @@ class DB {
* SQL query via MDB2 prepare(), needs to be execute()'d!
*/
static public function prepare( $query, $limit=null, $offset=null ) {
- return(\OC_DB::prepare($query,$limit,$offset));
+ return(\OC_DB::prepare($query, $limit, $offset));
}
/**
diff --git a/lib/public/util.php b/lib/public/util.php
index 38da7e82171..6ce79715b6f 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -107,8 +107,8 @@ class Util {
* @param int timestamp $timestamp
* @param bool dateOnly option to ommit time from the result
*/
- public static function formatDate( $timestamp,$dateOnly=false) {
- return(\OC_Util::formatDate( $timestamp,$dateOnly ));
+ public static function formatDate( $timestamp, $dateOnly=false) {
+ return(\OC_Util::formatDate( $timestamp, $dateOnly ));
}
/**
diff --git a/lib/request.php b/lib/request.php
index 87262d98625..287d20d1a5d 100644
--- a/lib/request.php
+++ b/lib/request.php
@@ -63,7 +63,7 @@ class OC_Request {
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
// following is taken from Sabre_DAV_URLUtil::decodePathSegment
$path_info = rawurldecode($path_info);
- $encoding = mb_detect_encoding($path_info, array('UTF-8','ISO-8859-1'));
+ $encoding = mb_detect_encoding($path_info, array('UTF-8', 'ISO-8859-1'));
switch($encoding) {
@@ -98,7 +98,7 @@ class OC_Request {
$HTTP_ACCEPT_ENCODING = $_SERVER["HTTP_ACCEPT_ENCODING"];
if( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false )
return 'x-gzip';
- else if( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false )
+ else if( strpos($HTTP_ACCEPT_ENCODING, 'gzip') !== false )
return 'gzip';
return false;
}
diff --git a/lib/route.php b/lib/route.php
index d5233d79861..5901717c094 100644
--- a/lib/route.php
+++ b/lib/route.php
@@ -108,7 +108,7 @@ class OC_Route extends Route {
public function actionInclude($file) {
$function = create_function('$param',
'unset($param["_route"]);'
- .'$_GET=array_merge($_GET,$param);'
+ .'$_GET=array_merge($_GET, $param);'
.'unset($param);'
.'require_once "'.$file.'";');
$this->action($function);
diff --git a/lib/router.php b/lib/router.php
index 7bbc546d757..8cb8fd4f33b 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -34,7 +34,7 @@ class OC_Router {
public function getRoutingFiles() {
if (!isset($this->routing_files)) {
$this->routing_files = array();
- foreach(OC_APP::getEnabledApps() as $app){
+ foreach(OC_APP::getEnabledApps() as $app) {
$file = OC_App::getAppPath($app).'/appinfo/routes.php';
if(file_exists($file)) {
$this->routing_files[$app] = $file;
diff --git a/lib/search.php b/lib/search.php
index 0b6ad050024..3c3378ad13c 100644
--- a/lib/search.php
+++ b/lib/search.php
@@ -40,8 +40,8 @@ class OC_Search{
* register a new search provider to be used
* @param string $provider class name of a OC_Search_Provider
*/
- public static function registerProvider($class,$options=array()) {
- self::$registeredProviders[]=array('class'=>$class,'options'=>$options);
+ public static function registerProvider($class, $options=array()) {
+ self::$registeredProviders[]=array('class'=>$class, 'options'=>$options);
}
/**
diff --git a/lib/search/result.php b/lib/search/result.php
index 63b5cfabce6..08beaea151c 100644
--- a/lib/search/result.php
+++ b/lib/search/result.php
@@ -15,7 +15,7 @@ class OC_Search_Result{
* @param string $link link for the result
* @param string $type the type of result as human readable string ('File', 'Music', etc)
*/
- public function __construct($name,$text,$link,$type) {
+ public function __construct($name, $text, $link, $type) {
$this->name=$name;
$this->text=$text;
$this->link=$link;
diff --git a/lib/setup.php b/lib/setup.php
index 4e4a32e7362..726b3352d50 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -70,7 +70,7 @@ class OC_Setup {
if(empty($options['dbname'])) {
$error[] = "$dbprettyname enter the database name.";
}
- if(substr_count($options['dbname'], '.') >= 1){
+ if(substr_count($options['dbname'], '.') >= 1) {
$error[] = "$dbprettyname you may not use dots in the database name";
}
if($dbtype != 'oci' && empty($options['dbhost'])) {
@@ -95,7 +95,7 @@ class OC_Setup {
//write the config file
OC_Config::setValue('datadirectory', $datadir);
OC_Config::setValue('dbtype', $dbtype);
- OC_Config::setValue('version', implode('.',OC_Util::getVersion()));
+ OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
if($dbtype == 'mysql') {
$dbuser = $options['dbuser'];
$dbpass = $options['dbpass'];
@@ -251,7 +251,7 @@ class OC_Setup {
mysql_close($connection);
}
- private static function createMySQLDatabase($name,$user,$connection) {
+ private static function createMySQLDatabase($name, $user, $connection) {
//we cant use OC_BD functions here because we need to connect as the administrative user.
$query = "CREATE DATABASE IF NOT EXISTS `$name`";
$result = mysql_query($query, $connection);
@@ -264,7 +264,7 @@ class OC_Setup {
$result = mysql_query($query, $connection); //this query will fail if there aren't the right permissons, ignore the error
}
- private static function createDBUser($name,$password,$connection) {
+ private static function createDBUser($name, $password, $connection) {
// we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one,
// the anonymous user would take precedence when there is one.
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
@@ -339,7 +339,7 @@ class OC_Setup {
}
}
- private static function pg_createDatabase($name,$user,$connection) {
+ private static function pg_createDatabase($name, $user, $connection) {
//we cant use OC_BD functions here because we need to connect as the administrative user.
$e_name = pg_escape_string($name);
$e_user = pg_escape_string($user);
@@ -364,7 +364,7 @@ class OC_Setup {
$result = pg_query($connection, $query);
}
- private static function pg_createDBUser($name,$password,$connection) {
+ private static function pg_createDBUser($name, $password, $connection) {
$e_name = pg_escape_string($name);
$e_password = pg_escape_string($password);
$query = "select * from pg_roles where rolname='$e_name';";
diff --git a/lib/streamwrappers.php b/lib/streamwrappers.php
index 63b795f4c4d..981c280f0dd 100644
--- a/lib/streamwrappers.php
+++ b/lib/streamwrappers.php
@@ -5,7 +5,7 @@ class OC_FakeDirStream{
private $name;
private $index;
- public function dir_opendir($path,$options) {
+ public function dir_opendir($path, $options) {
$this->name=substr($path, strlen('fakedir://'));
$this->index=0;
if(!isset(self::$dirs[$this->name])) {
@@ -225,7 +225,7 @@ class OC_CloseStreamWrapper{
public function stream_open($path, $mode, $options, &$opened_path) {
$path=substr($path, strlen('close://'));
$this->path=$path;
- $this->source=fopen($path,$mode);
+ $this->source=fopen($path, $mode);
if(is_resource($this->source)) {
$this->meta=stream_get_meta_data($this->source);
}
@@ -234,7 +234,7 @@ class OC_CloseStreamWrapper{
}
public function stream_seek($offset, $whence=SEEK_SET) {
- fseek($this->source,$offset,$whence);
+ fseek($this->source, $offset, $whence);
}
public function stream_tell() {
@@ -242,23 +242,23 @@ class OC_CloseStreamWrapper{
}
public function stream_read($count) {
- return fread($this->source,$count);
+ return fread($this->source, $count);
}
public function stream_write($data) {
- return fwrite($this->source,$data);
+ return fwrite($this->source, $data);
}
- public function stream_set_option($option,$arg1,$arg2) {
+ public function stream_set_option($option, $arg1, $arg2) {
switch($option) {
case STREAM_OPTION_BLOCKING:
- stream_set_blocking($this->source,$arg1);
+ stream_set_blocking($this->source, $arg1);
break;
case STREAM_OPTION_READ_TIMEOUT:
- stream_set_timeout($this->source,$arg1,$arg2);
+ stream_set_timeout($this->source, $arg1, $arg2);
break;
case STREAM_OPTION_WRITE_BUFFER:
- stream_set_write_buffer($this->source,$arg1,$arg2);
+ stream_set_write_buffer($this->source, $arg1, $arg2);
}
}
@@ -267,7 +267,7 @@ class OC_CloseStreamWrapper{
}
public function stream_lock($mode) {
- flock($this->source,$mode);
+ flock($this->source, $mode);
}
public function stream_flush() {
@@ -290,7 +290,7 @@ class OC_CloseStreamWrapper{
public function stream_close() {
fclose($this->source);
if(isset(self::$callBacks[$this->path])) {
- call_user_func(self::$callBacks[$this->path],$this->path);
+ call_user_func(self::$callBacks[$this->path], $this->path);
}
}
diff --git a/lib/template.php b/lib/template.php
index 1ad47cbe52c..efcc6e82c4c 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -25,7 +25,7 @@
* Prints an XSS escaped string
* @param string $string the string which will be escaped and printed
*/
-function p($string){
+function p($string) {
print(OC_Util::sanitizeHTML($string));
}
@@ -33,7 +33,7 @@ function p($string){
* Prints an unescaped string
* @param string $string the string which will be printed as it is
*/
-function print_unescaped($string){
+function print_unescaped($string) {
print($string);
}
@@ -85,7 +85,7 @@ function human_file_size( $bytes ) {
}
function simple_file_size($bytes) {
- $mbytes = round($bytes/(1024*1024),1);
+ $mbytes = round($bytes/(1024*1024), 1);
if($bytes == 0) { return '0'; }
else if($mbytes < 0.1) { return '&lt; 0.1'; }
else if($mbytes > 1000) { return '&gt; 1000'; }
@@ -102,12 +102,12 @@ function relative_modified_date($timestamp) {
if($timediff < 60) { return $l->t('seconds ago'); }
else if($timediff < 120) { return $l->t('1 minute ago'); }
- else if($timediff < 3600) { return $l->t('%d minutes ago',$diffminutes); }
+ else if($timediff < 3600) { return $l->t('%d minutes ago', $diffminutes); }
//else if($timediff < 7200) { return '1 hour ago'; }
//else if($timediff < 86400) { return $diffhours.' hours ago'; }
else if((date('G')-$diffhours) > 0) { return $l->t('today'); }
else if((date('G')-$diffhours) > -24) { return $l->t('yesterday'); }
- else if($timediff < 2678400) { return $l->t('%d days ago',$diffdays); }
+ else if($timediff < 2678400) { return $l->t('%d days ago', $diffdays); }
else if($timediff < 5184000) { return $l->t('last month'); }
else if((date('n')-$diffmonths) > 0) { return $l->t('months ago'); }
else if($timediff < 63113852) { return $l->t('last year'); }
@@ -172,7 +172,6 @@ class OC_Template{
$this->application = $app;
$this->vars = array();
$this->vars['requesttoken'] = OC_Util::callRegister();
- $this->vars['requestlifespan'] = OC_Util::$callLifespan;
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
$this->l10n = OC_L10N::get($parts[0]);
@@ -196,11 +195,11 @@ class OC_Template{
public static function detectFormfactor() {
// please add more useragent strings for other devices
if(isset($_SERVER['HTTP_USER_AGENT'])) {
- if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) {
+ if(stripos($_SERVER['HTTP_USER_AGENT'], 'ipad')>0) {
$mode='tablet';
- }elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0) {
+ }elseif(stripos($_SERVER['HTTP_USER_AGENT'], 'iphone')>0) {
$mode='mobile';
- }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)) {
+ }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'], 'nokia')>0)) {
$mode='mobile';
}else{
$mode='default';
@@ -357,7 +356,7 @@ class OC_Template{
* @param string $text the text content for the element
*/
public function addHeader( $tag, $attributes, $text='') {
- $this->headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
+ $this->headers[]=array('tag'=>$tag,'attributes'=>$attributes, 'text'=>$text);
}
/**
@@ -391,13 +390,12 @@ class OC_Template{
$page = new OC_TemplateLayout($this->renderas);
if($this->renderas == 'user') {
$page->assign('requesttoken', $this->vars['requesttoken']);
- $page->assign('requestlifespan', $this->vars['requestlifespan']);
}
// Add custom headers
- $page->assign('headers',$this->headers, false);
+ $page->assign('headers', $this->headers, false);
foreach(OC_Util::$headers as $header) {
- $page->append('headers',$header);
+ $page->append('headers', $header);
}
$page->assign( "content", $data, false );
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index c3da172a7c1..1a0570a270d 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -12,10 +12,10 @@ class OC_TemplateLayout extends OC_Template {
if( $renderas == 'user' ) {
parent::__construct( 'core', 'layout.user' );
- if(in_array(OC_APP::getCurrentApp(), array('settings','admin','help'))!==false) {
- $this->assign('bodyid','body-settings', false);
+ if(in_array(OC_APP::getCurrentApp(), array('settings','admin', 'help'))!==false) {
+ $this->assign('bodyid', 'body-settings', false);
}else{
- $this->assign('bodyid','body-user', false);
+ $this->assign('bodyid', 'body-user', false);
}
// Add navigation entry
diff --git a/lib/updater.php b/lib/updater.php
index f55e55985d9..11081eded63 100644
--- a/lib/updater.php
+++ b/lib/updater.php
@@ -30,7 +30,7 @@ class OC_Updater{
*/
public static function check() {
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
- if(OC_Appconfig::getValue('core', 'installedat','')=='') OC_Appconfig::setValue('core', 'installedat', microtime(true));
+ if(OC_Appconfig::getValue('core', 'installedat', '')=='') OC_Appconfig::setValue('core', 'installedat', microtime(true));
$updaterurl='http://apps.owncloud.com/updater.php';
$version=OC_Util::getVersion();
@@ -38,7 +38,7 @@ class OC_Updater{
$version['updated']=OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel']='stable';
$version['edition']=OC_Util::getEditionString();
- $versionstring=implode('x',$version);
+ $versionstring=implode('x', $version);
//fetch xml data from updater
$url=$updaterurl.'?version='.$versionstring;
diff --git a/lib/user.php b/lib/user.php
index 869984a16eb..be0e525d868 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -133,7 +133,7 @@ class OC_User {
self::useBackend($backend);
$_setupedBackends[]=$i;
}else{
- OC_Log::write('core','User backend '.$class.' not found.',OC_Log::ERROR);
+ OC_Log::write('core','User backend '.$class.' not found.', OC_Log::ERROR);
}
}
}
@@ -179,7 +179,7 @@ class OC_User {
if(!$backend->implementsActions(OC_USER_BACKEND_CREATE_USER))
continue;
- $backend->createUser($uid,$password);
+ $backend->createUser($uid, $password);
OC_Hook::emit( "OC_User", "post_createUser", array( "uid" => $uid, "password" => $password ));
return true;
@@ -329,7 +329,7 @@ class OC_User {
foreach(self::$_usedBackends as $backend) {
if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) {
if($backend->userExists($uid)) {
- $success |= $backend->setPassword($uid,$password);
+ $success |= $backend->setPassword($uid, $password);
}
}
}
diff --git a/lib/user/database.php b/lib/user/database.php
index b8c90615067..f33e338e2e4 100644
--- a/lib/user/database.php
+++ b/lib/user/database.php
@@ -48,7 +48,7 @@ class OC_User_Database extends OC_User_Backend {
if(!self::$hasher) {
//we don't want to use DES based crypt(), since it doesn't return a has with a recognisable prefix
$forcePortable=(CRYPT_BLOWFISH!=1);
- self::$hasher=new PasswordHash(8,$forcePortable);
+ self::$hasher=new PasswordHash(8, $forcePortable);
}
return self::$hasher;
@@ -137,7 +137,7 @@ class OC_User_Database extends OC_User_Backend {
}else{//old sha1 based hashing
if(sha1($password)==$storedHash) {
//upgrade to new hashing
- $this->setPassword($row['uid'],$password);
+ $this->setPassword($row['uid'], $password);
return $row['uid'];
}else{
return false;
@@ -155,7 +155,7 @@ class OC_User_Database extends OC_User_Backend {
* Get a list of all users.
*/
public function getUsers($search = '', $limit = null, $offset = null) {
- $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)',$limit,$offset);
+ $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset);
$result = $query->execute(array($search.'%'));
$users = array();
while ($row = $result->fetchRow()) {
diff --git a/lib/user/http.php b/lib/user/http.php
index 2668341408d..944ede73a0b 100644
--- a/lib/user/http.php
+++ b/lib/user/http.php
@@ -40,7 +40,7 @@ class OC_User_HTTP extends OC_User_Backend {
if(isset($parts['query'])) {
$url.='?'.$parts['query'];
}
- return array($parts['user'],$url);
+ return array($parts['user'], $url);
}
@@ -50,7 +50,7 @@ class OC_User_HTTP extends OC_User_Backend {
* @return boolean
*/
private function matchUrl($url) {
- return ! is_null(parse_url($url,PHP_URL_USER));
+ return ! is_null(parse_url($url, PHP_URL_USER));
}
/**
@@ -66,7 +66,7 @@ class OC_User_HTTP extends OC_User_Backend {
if(!$this->matchUrl($uid)) {
return false;
}
- list($user,$url)=$this->parseUrl($uid);
+ list($user, $url)=$this->parseUrl($uid);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
diff --git a/lib/util.php b/lib/util.php
index de89e339d99..d16424ce4e1 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -95,7 +95,7 @@ class OC_Util {
*/
public static function getVersion() {
// hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user
- return array(4,91,00);
+ return array(4, 91, 00);
}
/**
@@ -157,7 +157,7 @@ class OC_Util {
* @param string $text the text content for the element
*/
public static function addHeader( $tag, $attributes, $text='') {
- self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
+ self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes, 'text'=>$text);
}
/**
@@ -166,7 +166,7 @@ class OC_Util {
* @param int timestamp $timestamp
* @param bool dateOnly option to ommit time from the result
*/
- 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
$systemTimeZone = intval(date('O'));
$systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100);
@@ -186,7 +186,7 @@ class OC_Util {
* @param string $url
* @return OC_Template
*/
- public static function getPageNavi($pagecount,$page,$url) {
+ public static function getPageNavi($pagecount, $page, $url) {
$pagelinkcount=8;
if ($pagecount>1) {
@@ -217,7 +217,7 @@ class OC_Util {
$web_server_restart= false;
//check for database drivers
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')) {
- $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>','hint'=>'');//TODO: sane hint
+ $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>', 'hint'=>'');//TODO: sane hint
$web_server_restart= true;
}
@@ -226,13 +226,13 @@ class OC_Util {
// Check if config folder is writable.
if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
- $errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
+ $errors[]=array('error'=>"Can't write into config directory 'config'", 'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
}
// Check if there is a writable install folder.
if(OC_Config::getValue('appstoreenabled', true)) {
if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath()) ) {
- $errors[]=array('error'=>"Can't write into apps directory",'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
+ $errors[]=array('error'=>"Can't write into apps directory", 'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
in owncloud or disabling the appstore in the config file.");
}
}
@@ -269,57 +269,57 @@ class OC_Util {
if(!is_dir($CONFIG_DATADIRECTORY)) {
$success=@mkdir($CONFIG_DATADIRECTORY);
if(!$success) {
- $errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")",'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
+ $errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")", 'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
}
} else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
- $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud<br/>','hint'=>$permissionsHint);
+ $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud<br/>', 'hint'=>$permissionsHint);
}
// check if all required php modules are present
if(!class_exists('ZipArchive')) {
- $errors[]=array('error'=>'PHP module zip not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module zip not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('mb_detect_encoding')) {
- $errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('ctype_digit')) {
- $errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module ctype is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('json_encode')) {
- $errors[]=array('error'=>'PHP module JSON is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module JSON is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('imagepng')) {
- $errors[]=array('error'=>'PHP module GD is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module GD is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('gzencode')) {
- $errors[]=array('error'=>'PHP module zlib is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module zlib is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('iconv')) {
- $errors[]=array('error'=>'PHP module iconv is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module iconv is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('simplexml_load_string')) {
- $errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(floatval(phpversion())<5.3) {
- $errors[]=array('error'=>'PHP 5.3 is required.<br/>','hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
+ $errors[]=array('error'=>'PHP 5.3 is required.<br/>', 'hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
$web_server_restart= false;
}
if(!defined('PDO::ATTR_DRIVER_NAME')) {
- $errors[]=array('error'=>'PHP PDO module is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ $errors[]=array('error'=>'PHP PDO module is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if($web_server_restart) {
- $errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>','hint'=>'Please ask your server administrator to restart the web server.');
+ $errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>', 'hint'=>'Please ask your server administrator to restart the web server.');
}
return $errors;
@@ -473,17 +473,6 @@ class OC_Util {
}
/**
- * @brief Static lifespan (in seconds) when a request token expires.
- * @see OC_Util::callRegister()
- * @see OC_Util::isCallRegistered()
- * @description
- * Also required for the client side to compute the piont in time when to
- * request a fresh token. The client will do so when nearly 97% of the
- * timespan coded here has expired.
- */
- public static $callLifespan = 3600; // 3600 secs = 1 hour
-
- /**
* @brief Register an get/post call. Important to prevent CSRF attacks.
* @todo Write howto: CSRF protection guide
* @return $token Generated token.
@@ -491,30 +480,24 @@ class OC_Util {
* Creates a 'request token' (random) and stores it inside the session.
* Ever subsequent (ajax) request must use such a valid token to succeed,
* otherwise the request will be denied as a protection against CSRF.
- * The tokens expire after a fixed lifespan.
- * @see OC_Util::$callLifespan
* @see OC_Util::isCallRegistered()
*/
public static function callRegister() {
// Check if a token exists
- if(!isset($_SESSION['requesttoken']) || time() >$_SESSION['requesttoken']['time']) {
+ if(!isset($_SESSION['requesttoken'])) {
// No valid token found, generate a new one.
- $requestTokenArray = array(
- "requesttoken" => self::generate_random_bytes(20),
- "time" => time()+self::$callLifespan,
- );
- $_SESSION['requesttoken']=$requestTokenArray;
+ $requestToken = self::generate_random_bytes(20);
+ $_SESSION['requesttoken']=$requestToken;
} else {
// Valid token already exists, send it
- $requestTokenArray = $_SESSION['requesttoken'];
+ $requestToken = $_SESSION['requesttoken'];
}
- return($requestTokenArray['requesttoken']);
+ return($requestToken);
}
/**
* @brief Check an ajax get/post call if the request token is valid.
* @return boolean False if request token is not set or is invalid.
- * @see OC_Util::$callLifespan
* @see OC_Util::callRegister()
*/
public static function isCallRegistered() {
@@ -530,7 +513,7 @@ class OC_Util {
}
// Check if the token is valid
- if(!isset($_SESSION['requesttoken']) || time() > $_SESSION['requesttoken']["time"]) {
+ if($token !== $_SESSION['requesttoken']) {
// Not valid
return false;
} else {
diff --git a/lib/vcategories.php b/lib/vcategories.php
index ba6569a244d..46256def9c4 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -66,7 +66,7 @@ class OC_VCategories {
* @returns array containing the categories as strings.
*/
public function categories() {
- //OC_Log::write('core','OC_VCategories::categories: '.print_r($this->categories, true), OC_Log::DEBUG);
+ //OC_Log::write('core', 'OC_VCategories::categories: '.print_r($this->categories, true), OC_Log::DEBUG);
if(!$this->categories) {
return array();
}
@@ -139,12 +139,12 @@ class OC_VCategories {
$this->categories = array();
}
foreach($objects as $object) {
- //OC_Log::write('core','OC_VCategories::rescan: '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
+ //OC_Log::write('core', 'OC_VCategories::rescan: '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
$vobject = OC_VObject::parse($object);
if(!is_null($vobject)) {
$this->loadFromVObject($vobject, $sync);
} else {
- OC_Log::write('core','OC_VCategories::rescan, unable to parse. ID: '.', '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::rescan, unable to parse. ID: '.', '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
}
}
$this->save();
@@ -158,9 +158,9 @@ class OC_VCategories {
usort($this->categories, 'strnatcasecmp'); // usort to also renumber the keys
$escaped_categories = serialize($this->categories);
OC_Preferences::setValue($this->user, $this->app, self::PREF_CATEGORIES_LABEL, $escaped_categories);
- OC_Log::write('core','OC_VCategories::save: '.print_r($this->categories, true), OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::save: '.print_r($this->categories, true), OC_Log::DEBUG);
} else {
- OC_Log::write('core','OC_VCategories::save: $this->categories is not an array! '.print_r($this->categories, true), OC_Log::ERROR);
+ OC_Log::write('core', 'OC_VCategories::save: $this->categories is not an array! '.print_r($this->categories, true), OC_Log::ERROR);
}
}
@@ -173,37 +173,37 @@ class OC_VCategories {
if(!is_array($names)) {
$names = array($names);
}
- OC_Log::write('core','OC_VCategories::delete, before: '.print_r($this->categories, true), OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::delete, before: '.print_r($this->categories, true), OC_Log::DEBUG);
foreach($names as $name) {
- OC_Log::write('core','OC_VCategories::delete: '.$name, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::delete: '.$name, OC_Log::DEBUG);
if($this->hasCategory($name)) {
- //OC_Log::write('core','OC_VCategories::delete: '.$name.' got it', OC_Log::DEBUG);
+ //OC_Log::write('core', 'OC_VCategories::delete: '.$name.' got it', OC_Log::DEBUG);
unset($this->categories[$this->array_searchi($name, $this->categories)]);
}
}
$this->save();
- OC_Log::write('core','OC_VCategories::delete, after: '.print_r($this->categories, true), OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::delete, after: '.print_r($this->categories, true), OC_Log::DEBUG);
if(!is_null($objects)) {
foreach($objects as $key=>&$value) {
$vobject = OC_VObject::parse($value[1]);
if(!is_null($vobject)) {
$categories = $vobject->getAsArray('CATEGORIES');
- //OC_Log::write('core','OC_VCategories::delete, before: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
+ //OC_Log::write('core', 'OC_VCategories::delete, before: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
foreach($names as $name) {
$idx = $this->array_searchi($name, $categories);
- //OC_Log::write('core','OC_VCategories::delete, loop: '.$name.', '.print_r($idx, true), OC_Log::DEBUG);
+ //OC_Log::write('core', 'OC_VCategories::delete, loop: '.$name.', '.print_r($idx, true), OC_Log::DEBUG);
if($idx !== false) {
- OC_Log::write('core','OC_VCategories::delete, unsetting: '.$categories[$this->array_searchi($name, $categories)], OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::delete, unsetting: '.$categories[$this->array_searchi($name, $categories)], OC_Log::DEBUG);
unset($categories[$this->array_searchi($name, $categories)]);
//unset($categories[$idx]);
}
}
- //OC_Log::write('core','OC_VCategories::delete, after: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
+ //OC_Log::write('core', 'OC_VCategories::delete, after: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
$vobject->setString('CATEGORIES', implode(',', $categories));
$value[1] = $vobject->serialize();
$objects[$key] = $value;
} else {
- OC_Log::write('core','OC_VCategories::delete, unable to parse. ID: '.$value[0].', '.substr($value[1], 0, 50).'(...)', OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_VCategories::delete, unable to parse. ID: '.$value[0].', '.substr($value[1], 0, 50).'(...)', OC_Log::DEBUG);
}
}
}
@@ -222,7 +222,7 @@ class OC_VCategories {
if(!is_array($haystack)) {
return false;
}
- return array_search(strtolower($needle), array_map('strtolower',$haystack));
+ return array_search(strtolower($needle), array_map('strtolower', $haystack));
}
}
diff --git a/lib/vobject.php b/lib/vobject.php
index 44a5fbafdb3..267176ebc07 100644
--- a/lib/vobject.php
+++ b/lib/vobject.php
@@ -201,7 +201,7 @@ class OC_VObject{
return $this->vobject->__isset($name);
}
- public function __call($function,$arguments) {
+ public function __call($function, $arguments) {
return call_user_func_array(array($this->vobject, $function), $arguments);
}
}