diff options
Diffstat (limited to 'lib')
94 files changed, 1022 insertions, 513 deletions
diff --git a/lib/MDB2/Driver/Function/sqlite3.php b/lib/MDB2/Driver/Function/sqlite3.php index 235a106e183..0bddde5bf3f 100644 --- a/lib/MDB2/Driver/Function/sqlite3.php +++ b/lib/MDB2/Driver/Function/sqlite3.php @@ -94,7 +94,7 @@ class MDB2_Driver_Function_sqlite3 extends MDB2_Driver_Function_Common if (!is_null($length)) { return "substr($value,$position,$length)"; } - return "substr($value,$position,length($value))"; + return "substr($value, $position, length($value))"; } // }}} diff --git a/lib/app.php b/lib/app.php index 21ba14f1db1..9e1b88635c8 100755 --- a/lib/app.php +++ b/lib/app.php @@ -555,17 +555,14 @@ class OC_App{ foreach ( OC::$APPSROOTS as $apps_dir ) { if(! is_readable($apps_dir['path'])) { - OC_Log::write('core', 'unable to read app folder : ' .$apps_dir['path'] , OC_Log::WARN); + OC_Log::write('core', 'unable to read app folder : ' .$apps_dir['path'], OC_Log::WARN); continue; } $dh = opendir( $apps_dir['path'] ); while( $file = readdir( $dh ) ) { - if ( - $file[0] != '.' - and is_file($apps_dir['path'].'/'.$file.'/appinfo/app.php' ) - ) { + if ($file[0] != '.' and is_file($apps_dir['path'].'/'.$file.'/appinfo/app.php')) { $apps[] = $file; @@ -694,6 +691,10 @@ class OC_App{ * @param string $appid */ public static function updateApp($appid) { + if(file_exists(self::getAppPath($appid).'/appinfo/preupdate.php')) { + self::loadApp($appid); + include self::getAppPath($appid).'/appinfo/preupdate.php'; + } if(file_exists(self::getAppPath($appid).'/appinfo/database.xml')) { OC_DB::updateDbFromStructure(self::getAppPath($appid).'/appinfo/database.xml'); } diff --git a/lib/appconfig.php b/lib/appconfig.php index 6604e854d55..ed0e8f1d0bd 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -123,7 +123,7 @@ class OC_Appconfig{ */ public static function setValue( $app, $key, $value ) { // Does the key exist? yes: update. No: insert - if(! self::hasKey($app,$key)) { + if(! self::hasKey($app, $key)) { $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*appconfig` ( `appid`, `configkey`, `configvalue` ) VALUES( ?, ?, ? )' ); $query->execute( array( $app, $key, $value )); } diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php new file mode 100644 index 00000000000..6415f5b84aa --- /dev/null +++ b/lib/backgroundjob.php @@ -0,0 +1,52 @@ +<?php +/** +* ownCloud +* +* @author Jakob Sack +* @copyright 2012 Jakob Sack owncloud@jakobsack.de +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/** + * This class does the dirty work. + */ +class OC_BackgroundJob{ + /** + * @brief get the execution type of background jobs + * @return string + * + * This method returns the type how background jobs are executed. If the user + * did not select something, the type is ajax. + */ + public static function getExecutionType() { + return OC_Appconfig::getValue( 'core', 'backgroundjobs_mode', 'ajax' ); + } + + /** + * @brief sets the background jobs execution type + * @param $type execution type + * @return boolean + * + * This method sets the execution type of the background jobs. Possible types + * are "none", "ajax", "webcron", "cron" + */ + public static function setExecutionType( $type ) { + 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 c688d785339..15dc34f63d2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -183,7 +183,7 @@ class OC{ OC::$SERVERROOT.'/lib'.PATH_SEPARATOR. OC::$SERVERROOT.'/config'.PATH_SEPARATOR. OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR. - implode($paths,PATH_SEPARATOR).PATH_SEPARATOR. + implode($paths, PATH_SEPARATOR).PATH_SEPARATOR. get_include_path().PATH_SEPARATOR. OC::$SERVERROOT ); diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php index 0c34c7ea29f..db8f005745a 100644 --- a/lib/connector/sabre/auth.php +++ b/lib/connector/sabre/auth.php @@ -37,7 +37,7 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic { } else { OC_Util::setUpFS();//login hooks may need early access to the filesystem if(OC_User::login($username, $password)) { - OC_Util::setUpFS($username); + OC_Util::setUpFS(OC_User::getUser()); return true; } else{ diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php index dbcc57558e0..8ebe324602c 100644 --- a/lib/connector/sabre/locks.php +++ b/lib/connector/sabre/locks.php @@ -109,7 +109,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract { $lockInfo->created = time(); $lockInfo->uri = $uri; - $locks = $this->getLocks($uri,false); + $locks = $this->getLocks($uri, false); $exists = false; foreach($locks as $lock) { if ($lock->token == $lockInfo->token) $exists = true; diff --git a/lib/eventsource.php b/lib/eventsource.php index 900b5b101e6..3bada131bdd 100644 --- a/lib/eventsource.php +++ b/lib/eventsource.php @@ -38,7 +38,7 @@ class OC_EventSource{ if($this->fallback) { $this->fallBackId=$_GET['fallback_id']; header("Content-Type: text/html"); - echo str_repeat('<span></span>'.PHP_EOL,10); //dummy data to keep IE happy + echo str_repeat('<span></span>'.PHP_EOL, 10); //dummy data to keep IE happy }else{ header("Content-Type: text/event-stream"); } @@ -78,6 +78,6 @@ class OC_EventSource{ * close the connection of the even source */ public function close() { - $this->send('__internal__','close');//server side closing can be an issue, let the client do it + $this->send('__internal__', 'close');//server side closing can be an issue, let the client do it } -}
\ No newline at end of file +} diff --git a/lib/filecache.php b/lib/filecache.php index a36cfef6759..fee3b398251 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -43,14 +43,14 @@ class OC_FileCache{ * - versioned */ public static function get($path,$root=false) { - if(OC_FileCache_Update::hasUpdated($path,$root)) { + 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)); + OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$path)); }else{ - OC_FileCache_Update::update($path,$root); + OC_FileCache_Update::update($path, $root); } } - return OC_FileCache_Cached::get($path,$root); + return OC_FileCache_Cached::get($path, $root); } /** @@ -65,15 +65,15 @@ class OC_FileCache{ if($root===false) { $root=OC_Filesystem::getRoot(); } - $fullpath=$root.$path; + $fullpath=OC_Filesystem::normalizePath($root.'/'.$path); $parent=self::getParentId($fullpath); - $id=self::getId($fullpath,''); + $id=self::getId($fullpath, ''); if(isset(OC_FileCache_Cached::$savedData[$fullpath])) { - $data=array_merge(OC_FileCache_Cached::$savedData[$fullpath],$data); + $data=array_merge(OC_FileCache_Cached::$savedData[$fullpath], $data); unset(OC_FileCache_Cached::$savedData[$fullpath]); } if($id!=-1) { - self::update($id,$data); + self::update($id, $data); return; } @@ -102,9 +102,9 @@ class OC_FileCache{ $data['versioned']=(int)$data['versioned']; $user=OC_User::getUser(); $query=OC_DB::prepare('INSERT INTO `*PREFIX*fscache`(`parent`, `name`, `path`, `path_hash`, `size`, `mtime`, `ctime`, `mimetype`, `mimepart`,`user`,`writable`,`encrypted`,`versioned`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'); - $result=$query->execute(array($parent,basename($fullpath),$fullpath,md5($fullpath),$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable'],$data['encrypted'],$data['versioned'])); + $result=$query->execute(array($parent, basename($fullpath), $fullpath, md5($fullpath), $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], $mimePart, $user, $data['writable'], $data['encrypted'], $data['versioned'])); if(OC_DB::isError($result)) { - OC_Log::write('files','error while writing file('.$fullpath.') to cache',OC_Log::ERROR); + OC_Log::write('files', 'error while writing file('.$fullpath.') to cache', OC_Log::ERROR); } if($cache=OC_Cache::getUserCache(true)) { @@ -137,11 +137,11 @@ class OC_FileCache{ } $arguments[]=$id; - $sql = 'UPDATE `*PREFIX*fscache` SET '.implode(' , ',$queryParts).' WHERE `id`=?'; + $sql = 'UPDATE `*PREFIX*fscache` SET '.implode(' , ', $queryParts).' WHERE `id`=?'; $query=OC_DB::prepare($sql); $result=$query->execute($arguments); if(OC_DB::isError($result)) { - OC_Log::write('files','error while updating file('.$id.') in cache',OC_Log::ERROR); + OC_Log::write('files', 'error while updating file('.$id.') in cache', OC_Log::ERROR); } } @@ -163,10 +163,10 @@ class OC_FileCache{ $newPath=$root.$newPath; $newParent=self::getParentId($newPath); $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `parent`=? ,`name`=?, `path`=?, `path_hash`=? WHERE `path_hash`=?'); - $query->execute(array($newParent,basename($newPath),$newPath,md5($newPath),md5($oldPath))); + $query->execute(array($newParent, basename($newPath), $newPath, md5($newPath), md5($oldPath))); if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$oldPath)) { - $cache->set('fileid/'.$newPath,$cache->get('fileid/'.$oldPath)); + $cache->set('fileid/'.$newPath, $cache->get('fileid/'.$oldPath)); $cache->remove('fileid/'.$oldPath); } @@ -175,11 +175,11 @@ class OC_FileCache{ $updateQuery=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `path`=?, `path_hash`=? WHERE `path_hash`=?'); while($row= $query->execute(array($oldPath.'/%'))->fetchRow()) { $old=$row['path']; - $new=$newPath.substr($old,$oldLength); - $updateQuery->execute(array($new,md5($new),md5($old))); + $new=$newPath.substr($old, $oldLength); + $updateQuery->execute(array($new, md5($new), md5($old))); if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$old)) { - $cache->set('fileid/'.$new,$cache->get('fileid/'.$old)); + $cache->set('fileid/'.$new, $cache->get('fileid/'.$old)); $cache->remove('fileid/'.$old); } } @@ -217,17 +217,23 @@ class OC_FileCache{ } $rootLen=strlen($root); if(!$returnData) { - $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `name` LIKE ? AND `user`=?'); + $select = '`path`'; }else{ - $query=OC_DB::prepare('SELECT * FROM `*PREFIX*fscache` WHERE `name` LIKE ? AND `user`=?'); + $select = '*'; } + if (OC_Config::getValue('dbtype') === 'oci8') { + $where = 'LOWER(`name`) LIKE LOWER(?) AND `user`=?'; + } else { + $where = '`name` LIKE ? AND `user`=?'; + } + $query=OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*fscache` WHERE '.$where); $result=$query->execute(array("%$search%",OC_User::getUser())); $names=array(); while($row=$result->fetchRow()) { if(!$returnData) { - $names[]=substr($row['path'],$rootLen); + $names[]=substr($row['path'], $rootLen); }else{ - $row['path']=substr($row['path'],$rootLen); + $row['path']=substr($row['path'], $rootLen); $names[]=$row; } } @@ -250,10 +256,10 @@ class OC_FileCache{ * - versioned */ public static function getFolderContent($path,$root=false,$mimetype_filter='') { - if(OC_FileCache_Update::hasUpdated($path,$root,true)) { - OC_FileCache_Update::updateFolder($path,$root); + if(OC_FileCache_Update::hasUpdated($path, $root, true)) { + OC_FileCache_Update::updateFolder($path, $root); } - return OC_FileCache_Cached::getFolderContent($path,$root,$mimetype_filter); + return OC_FileCache_Cached::getFolderContent($path, $root, $mimetype_filter); } /** @@ -263,7 +269,7 @@ class OC_FileCache{ * @return bool */ public static function inCache($path,$root=false) { - return self::getId($path,$root)!=-1; + return self::getId($path, $root)!=-1; } /** @@ -285,7 +291,7 @@ class OC_FileCache{ $query=OC_DB::prepare('SELECT `id` FROM `*PREFIX*fscache` WHERE `path_hash`=?'); $result=$query->execute(array(md5($fullPath))); if(OC_DB::isError($result)) { - OC_Log::write('files','error while getting file id of '.$path,OC_Log::ERROR); + OC_Log::write('files', 'error while getting file id of '.$path, OC_Log::ERROR); return -1; } @@ -296,7 +302,7 @@ class OC_FileCache{ $id=-1; } if($cache=OC_Cache::getUserCache(true)) { - $cache->set('fileid/'.$fullPath,$id); + $cache->set('fileid/'.$fullPath, $id); } return $id; @@ -313,14 +319,14 @@ class OC_FileCache{ $user=OC_User::getUser(); } $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `id`=? AND `user`=?'); - $result=$query->execute(array($id,$user)); + $result=$query->execute(array($id, $user)); $row=$result->fetchRow(); $path=$row['path']; $root='/'.$user.'/files'; - if(substr($path,0,strlen($root))!=$root) { + if(substr($path, 0, strlen($root))!=$root) { return false; } - return substr($path,strlen($root)); + return substr($path, strlen($root)); } /** @@ -332,7 +338,7 @@ class OC_FileCache{ if($path=='/') { return -1; }else{ - return self::getId(dirname($path),''); + return self::getId(dirname($path), ''); } } @@ -344,7 +350,7 @@ class OC_FileCache{ */ public static function increaseSize($path,$sizeDiff, $root=false) { if($sizeDiff==0) return; - $id=self::getId($path,$root); + $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)); @@ -362,7 +368,7 @@ class OC_FileCache{ */ public static function scan($path,$eventSource=false,&$count=0,$root=false) { if($eventSource) { - $eventSource->send('scanning',array('file'=>$path,'count'=>$count)); + $eventSource->send('scanning', array('file'=>$path, 'count'=>$count)); } $lastSend=$count; // NOTE: Ugly hack to prevent shared files from going into the cache (the source already exists somewhere in the cache) @@ -374,7 +380,7 @@ class OC_FileCache{ }else{ $view=new OC_FilesystemView($root); } - self::scanFile($path,$root); + self::scanFile($path, $root); $dh=$view->opendir($path.'/'); $totalSize=0; if($dh) { @@ -382,13 +388,13 @@ class OC_FileCache{ if($filename != '.' and $filename != '..') { $file=$path.'/'.$filename; if($view->is_dir($file.'/')) { - self::scan($file,$eventSource,$count,$root); + self::scan($file, $eventSource, $count, $root); }else{ - $totalSize+=self::scanFile($file,$root); + $totalSize+=self::scanFile($file, $root); $count++; if($count>$lastSend+25 and $eventSource) { $lastSend=$count; - $eventSource->send('scanning',array('file'=>$path,'count'=>$count)); + $eventSource->send('scanning', array('file'=>$path, 'count'=>$count)); } } } @@ -430,7 +436,7 @@ class OC_FileCache{ if($path=='/') { $path=''; } - self::put($path,$stat,$root); + self::put($path, $stat, $root); return $stat['size']; } @@ -456,14 +462,14 @@ class OC_FileCache{ $user=OC_User::getUser(); if(!$part2) { $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `mimepart`=? AND `user`=? AND `path` LIKE ?'); - $result=$query->execute(array($part1,$user, $root)); + $result=$query->execute(array($part1, $user, $root)); }else{ $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `mimetype`=? AND `user`=? AND `path` LIKE ? '); - $result=$query->execute(array($part1.'/'.$part2,$user, $root)); + $result=$query->execute(array($part1.'/'.$part2, $user, $root)); } $names=array(); while($row=$result->fetchRow()) { - $names[]=substr($row['path'],$rootLen); + $names[]=substr($row['path'], $rootLen); } return $names; } @@ -506,7 +512,7 @@ class OC_FileCache{ } //watch for changes and try to keep the cache up to date -OC_Hook::connect('OC_Filesystem','post_write','OC_FileCache_Update','fileSystemWatcherWrite'); -OC_Hook::connect('OC_Filesystem','post_delete','OC_FileCache_Update','fileSystemWatcherDelete'); -OC_Hook::connect('OC_Filesystem','post_rename','OC_FileCache_Update','fileSystemWatcherRename'); -OC_Hook::connect('OC_User','post_deleteUser','OC_FileCache_Update','deleteFromUser'); +OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_FileCache_Update', 'fileSystemWatcherWrite'); +OC_Hook::connect('OC_Filesystem', 'post_delete', 'OC_FileCache_Update', 'fileSystemWatcherDelete'); +OC_Hook::connect('OC_Filesystem', 'post_rename', 'OC_FileCache_Update', 'fileSystemWatcherRename'); +OC_Hook::connect('OC_User', 'post_deleteUser', 'OC_FileCache_Update', 'deleteFromUser'); diff --git a/lib/filechunking.php b/lib/filechunking.php index 5ab33c77ad7..55a4d730430 100644 --- a/lib/filechunking.php +++ b/lib/filechunking.php @@ -59,7 +59,7 @@ class OC_FileChunking { for($i=0; $i < $this->info['chunkcount']; $i++) { $chunk = $cache->get($prefix.$i); $cache->remove($prefix.$i); - $count += fwrite($f,$chunk); + $count += fwrite($f, $chunk); } return $count; } diff --git a/lib/fileproxy.php b/lib/fileproxy.php index 17380c656a3..3e7f1aa1c41 100644 --- a/lib/fileproxy.php +++ b/lib/fileproxy.php @@ -52,7 +52,7 @@ class OC_FileProxy{ * this implements a dummy proxy for all operations */ public function __call($function,$arguments) { - if(substr($function,0,3)=='pre') { + if(substr($function, 0, 3)=='pre') { return true; }else{ return $arguments[1]; @@ -70,7 +70,7 @@ class OC_FileProxy{ public static function getProxies($operation) { $proxies=array(); foreach(self::$proxies as $proxy) { - if(method_exists($proxy,$operation)) { + if(method_exists($proxy, $operation)) { $proxies[]=$proxy; } } diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 5a0dbdb6fe2..012be582a51 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -27,52 +27,58 @@ class OC_FileProxy_Quota extends OC_FileProxy{ static $rootView; - private $userQuota=-1; + private $userQuota=array(); /** - * get the quota for the current user + * get the quota for the user + * @param user * @return int */ - private function getQuota() { - if($this->userQuota!=-1) { - return $this->userQuota; + private function getQuota($user) { + if(in_array($user, $this->userQuota)) { + return $this->userQuota[$user]; } - $userQuota=OC_Preferences::getValue(OC_User::getUser(),'files','quota','default'); + $userQuota=OC_Preferences::getValue($user,'files','quota','default'); if($userQuota=='default') { $userQuota=OC_AppConfig::getValue('files','default_quota','none'); } if($userQuota=='none') { - $this->userQuota=0; + $this->userQuota[$user]=0; }else{ - $this->userQuota=OC_Helper::computerFileSize($userQuota); + $this->userQuota[$user]=OC_Helper::computerFileSize($userQuota); } - return $this->userQuota; + return $this->userQuota[$user]; } /** - * get the free space in the users home folder + * get the free space in the path's owner home folder + * @param path * @return int */ - private function getFreeSpace() { - $rootInfo=OC_FileCache_Cached::get(''); + private function getFreeSpace($path) { + $storage=OC_Filesystem::getStorage($path); + $owner=$storage->getOwner($path); + + $totalSpace=$this->getQuota($owner); + if($totalSpace==0) { + return 0; + } + + $rootInfo=OC_FileCache::get('', "/".$owner."/files"); // TODO Remove after merge of share_api - if (OC_FileCache::inCache('/Shared')) { - $sharedInfo=OC_FileCache_Cached::get('/Shared'); + if (OC_FileCache::inCache('/Shared', "/".$owner."/files")) { + $sharedInfo=OC_FileCache::get('/Shared', "/".$owner."/files"); } else { $sharedInfo = null; } $usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0; $usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace; - $totalSpace=$this->getQuota(); - if($totalSpace==0) { - return 0; - } return $totalSpace-$usedSpace; } - + public function postFree_space($path,$space) { - $free=$this->getFreeSpace(); + $free=$this->getFreeSpace($path); if($free==0) { return $space; } @@ -83,21 +89,21 @@ class OC_FileProxy_Quota extends OC_FileProxy{ if (is_resource($data)) { $data = '';//TODO: find a way to get the length of the stream without emptying it } - return (strlen($data)<$this->getFreeSpace() or $this->getFreeSpace()==0); + return (strlen($data)<$this->getFreeSpace($path) or $this->getFreeSpace($path)==0); } public function preCopy($path1,$path2) { if(!self::$rootView){ self::$rootView = new OC_FilesystemView(''); } - return (self::$rootView->filesize($path1)<$this->getFreeSpace() or $this->getFreeSpace()==0); + return (self::$rootView->filesize($path1)<$this->getFreeSpace($path2) or $this->getFreeSpace($path2)==0); } public function preFromTmpFile($tmpfile,$path) { - return (filesize($tmpfile)<$this->getFreeSpace() or $this->getFreeSpace()==0); + return (filesize($tmpfile)<$this->getFreeSpace($path) or $this->getFreeSpace($path)==0); } public function preFromUploadedFile($tmpfile,$path) { - return (filesize($tmpfile)<$this->getFreeSpace() or $this->getFreeSpace()==0); + return (filesize($tmpfile)<$this->getFreeSpace($path) or $this->getFreeSpace($path)==0); } } diff --git a/lib/files.php b/lib/files.php index 2b2b8b42dc4..b4d4de1c995 100644 --- a/lib/files.php +++ b/lib/files.php @@ -136,17 +136,17 @@ class OC_Files { * @param boolean $only_header ; boolean to only send header of the request */ public static function get($dir,$files, $only_header = false) { - if(strpos($files,';')) { - $files=explode(';',$files); + if(strpos($files, ';')) { + $files=explode(';', $files); } if(is_array($files)) { - self::validateZipDownload($dir,$files); + self::validateZipDownload($dir, $files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); $filename = OC_Helper::tmpFile('.zip'); - if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) { + if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) { exit("cannot open <$filename>\n"); } foreach($files as $file) { @@ -154,24 +154,24 @@ class OC_Files { if(OC_Filesystem::is_file($file)) { $tmpFile=OC_Filesystem::toTmpFile($file); self::$tmpFiles[]=$tmpFile; - $zip->addFile($tmpFile,basename($file)); + $zip->addFile($tmpFile, basename($file)); }elseif(OC_Filesystem::is_dir($file)) { - self::zipAddDir($file,$zip); + self::zipAddDir($file, $zip); } } $zip->close(); set_time_limit($executionTime); }elseif(OC_Filesystem::is_dir($dir.'/'.$files)) { - self::validateZipDownload($dir,$files); + self::validateZipDownload($dir, $files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); $filename = OC_Helper::tmpFile('.zip'); - if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) { + if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) { exit("cannot open <$filename>\n"); } $file=$dir.'/'.$files; - self::zipAddDir($file,$zip); + self::zipAddDir($file, $zip); $zip->close(); set_time_limit($executionTime); }else{ @@ -193,7 +193,7 @@ class OC_Files { }elseif($zip or !OC_Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template( '', '404', 'guest' ); - $tmpl->assign('file',$filename); + $tmpl->assign('file', $filename); $tmpl->printPage(); }else{ header("HTTP/1.0 403 Forbidden"); @@ -205,7 +205,7 @@ class OC_Files { return ; } if($zip) { - $handle=fopen($filename,'r'); + $handle=fopen($filename, 'r'); if ($handle) { $chunkSize = 8*1024;// 1 MB chunks while (!feof($handle)) { @@ -235,9 +235,9 @@ class OC_Files { if(OC_Filesystem::is_file($file)) { $tmpFile=OC_Filesystem::toTmpFile($file); OC_Files::$tmpFiles[]=$tmpFile; - $zip->addFile($tmpFile,$internalDir.$filename); + $zip->addFile($tmpFile, $internalDir.$filename); }elseif(OC_Filesystem::is_dir($file)) { - self::zipAddDir($file,$zip,$internalDir); + self::zipAddDir($file, $zip, $internalDir); } } } @@ -253,7 +253,7 @@ class OC_Files { if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')) { $targetFile=self::normalizePath($targetDir.'/'.$target); $sourceFile=self::normalizePath($sourceDir.'/'.$source); - return OC_Filesystem::rename($sourceFile,$targetFile); + return OC_Filesystem::rename($sourceFile, $targetFile); } else { return false; } @@ -271,7 +271,7 @@ class OC_Files { if(OC_User::isLoggedIn()) { $targetFile=$targetDir.'/'.$target; $sourceFile=$sourceDir.'/'.$source; - return OC_Filesystem::copy($sourceFile,$targetFile); + return OC_Filesystem::copy($sourceFile, $targetFile); } } @@ -390,11 +390,11 @@ class OC_Files { * @return string guessed mime type */ static function pull($source,$token,$dir,$file) { - $tmpfile=tempnam(get_temp_dir(),'remoteCloudFile'); + $tmpfile=tempnam(get_temp_dir(), 'remoteCloudFile'); $fp=fopen($tmpfile,'w+'); $url=$source.="/files/pull.php?token=$token"; $ch=curl_init(); - curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); fclose($fp); @@ -402,7 +402,7 @@ class OC_Files { $httpCode=$info['http_code']; curl_close($ch); if($httpCode==200 or $httpCode==0) { - OC_Filesystem::fromTmpFile($tmpfile,$dir.'/'.$file); + OC_Filesystem::fromTmpFile($tmpfile, $dir.'/'.$file); return true; }else{ return false; @@ -423,8 +423,8 @@ class OC_Files { $size -=1; } else { $size=OC_Helper::humanFileSize($size); - $size=substr($size,0,-1);//strip the B - $size=str_replace(' ','',$size); //remove the space between the size and the postfix + $size=substr($size, 0, -1);//strip the B + $size=str_replace(' ', '', $size); //remove the space between the size and the postfix } //don't allow user to break his config -- broken or malicious size input @@ -447,7 +447,7 @@ class OC_Files { $setting = 'php_value '.$key.' '.$size; $hasReplaced = 0; $content = preg_replace($pattern, $setting, $htaccess, 1, $hasReplaced); - if($content !== NULL) { + if($content !== null) { $htaccess = $content; } if($hasReplaced == 0) { @@ -459,7 +459,7 @@ class OC_Files { if(is_writable(OC::$SERVERROOT.'/.htaccess')) { file_put_contents(OC::$SERVERROOT.'/.htaccess', $htaccess); return OC_Helper::computerFileSize($size); - } else { OC_Log::write('files','Can\'t write upload limit to '.OC::$SERVERROOT.'/.htaccess. Please check the file permissions',OC_Log::WARN); } + } else { OC_Log::write('files', 'Can\'t write upload limit to '.OC::$SERVERROOT.'/.htaccess. Please check the file permissions', OC_Log::WARN); } return false; } @@ -474,7 +474,7 @@ class OC_Files { $old=''; while($old!=$path) {//replace any multiplicity of slashes with a single one $old=$path; - $path=str_replace('//','/',$path); + $path=str_replace('//', '/', $path); } return $path; } @@ -486,6 +486,6 @@ function fileCmp($a,$b) { }elseif($a['type']!='dir' and $b['type']=='dir') { return 1; }else{ - return strnatcasecmp($a['name'],$b['name']); + return strnatcasecmp($a['name'], $b['name']); } } diff --git a/lib/filestorage.php b/lib/filestorage.php index 5bfd09253d5..146cecf4efa 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -63,4 +63,5 @@ abstract class OC_Filestorage{ * returning true for other changes in the folder is optional */ abstract public function hasUpdated($path,$time); + abstract public function getOwner($path); } diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php index 351714437c5..f24a5704913 100644 --- a/lib/filestorage/common.php +++ b/lib/filestorage/common.php @@ -260,7 +260,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { if($dh) { while($item=readdir($dh)) { if ($item == '.' || $item == '..') continue; - if(strstr(strtolower($item),strtolower($query))!==false) { + if(strstr(strtolower($item), strtolower($query))!==false) { $files[]=$dir.'/'.$item; } if($this->is_dir($dir.'/'.$item)) { @@ -279,4 +279,13 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { public function hasUpdated($path,$time) { return $this->filemtime($path)>$time; } + + /** + * get the owner of a path + * @param $path The path to get the owner + * @return string uid or false + */ + public function getOwner($path) { + return OC_User::getUser(); + } } diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 80aa548047c..731ac4a3c72 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -103,7 +103,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ 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); @@ -178,7 +178,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ $files=array(); foreach (scandir($this->datadir.$dir) as $item) { if ($item == '.' || $item == '..') continue; - if(strstr(strtolower($item),strtolower($query))!==false) { + if(strstr(strtolower($item), strtolower($query))!==false) { $files[]=$dir.'/'.$item; } if(is_dir($this->datadir.$dir.'/'.$item)) { diff --git a/lib/filesystem.php b/lib/filesystem.php index da524d7f181..bc30dac7fa1 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -46,6 +46,7 @@ class OC_Filesystem{ static private $storages=array(); static private $mounts=array(); + static private $loadedUsers=array(); public static $loaded=false; /** * @var OC_Filestorage $defaultInstance @@ -147,7 +148,7 @@ class OC_Filesystem{ * @return string */ static public function getMountPoint($path) { - OC_Hook::emit(self::CLASSNAME,'get_mountpoint',array('path'=>$path)); + OC_Hook::emit(self::CLASSNAME,'get_mountpoint', array('path'=>$path)); if(!$path) { $path='/'; } @@ -175,15 +176,28 @@ class OC_Filesystem{ */ static public function getInternalPath($path) { $mountPoint=self::getMountPoint($path); - $internalPath=substr($path,strlen($mountPoint)); + $internalPath=substr($path, strlen($mountPoint)); return $internalPath; } + + static private function mountPointsLoaded($user) { + return in_array($user, self::$loadedUsers); + } + /** * get the storage object for a path * @param string path * @return OC_Filestorage */ static public function getStorage($path) { + $user = ltrim(substr($path, 0, strpos($path, '/', 1)), '/'); + // check mount points if file was shared from a different user + if ($user != OC_User::getUser() && !self::mountPointsLoaded($user)) { + OC_Util::loadUserMountPoints($user); + self::loadSystemMountPoints($user); + self::$loadedUsers[] = $user; + } + $mountpoint=self::getMountPoint($path); if($mountpoint) { if(!isset(OC_Filesystem::$storages[$mountpoint])) { @@ -194,56 +208,63 @@ class OC_Filesystem{ } } - static public function init($root) { + static private function loadSystemMountPoints($user) { + if(is_file(OC::$SERVERROOT.'/config/mount.php')) {
+ $mountConfig=include OC::$SERVERROOT.'/config/mount.php';
+ if(isset($mountConfig['global'])) {
+ foreach($mountConfig['global'] as $mountPoint=>$options) {
+ self::mount($options['class'],$options['options'],$mountPoint);
+ }
+ }
+
+ if(isset($mountConfig['group'])) {
+ foreach($mountConfig['group'] as $group=>$mounts) {
+ if(OC_Group::inGroup($user,$group)) {
+ foreach($mounts as $mountPoint=>$options) {
+ $mountPoint=self::setUserVars($mountPoint, $user);
+ foreach($options as &$option) {
+ $option=self::setUserVars($option, $user);
+ }
+ self::mount($options['class'],$options['options'],$mountPoint);
+ }
+ }
+ }
+ }
+
+ if(isset($mountConfig['user'])) {
+ foreach($mountConfig['user'] as $user=>$mounts) {
+ if($user==='all' or strtolower($user)===strtolower($user)) {
+ foreach($mounts as $mountPoint=>$options) {
+ $mountPoint=self::setUserVars($mountPoint, $user);
+ foreach($options as &$option) {
+ $option=self::setUserVars($option, $user);
+ }
+ self::mount($options['class'],$options['options'],$mountPoint);
+ }
+ }
+ }
+ }
+
+ $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php');
+ $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);
+ }
+ } + } + + static public function init($root, $user = '') { if(self::$defaultInstance) { return false; } self::$defaultInstance=new OC_FilesystemView($root); //load custom mount config - if(is_file(OC::$SERVERROOT.'/config/mount.php')) { - $mountConfig=include(OC::$SERVERROOT.'/config/mount.php'); - if(isset($mountConfig['global'])) { - foreach($mountConfig['global'] as $mountPoint=>$options) { - self::mount($options['class'],$options['options'],$mountPoint); - } - } - - if(isset($mountConfig['group'])) { - foreach($mountConfig['group'] as $group=>$mounts) { - if(OC_Group::inGroup(OC_User::getUser(),$group)) { - foreach($mounts as $mountPoint=>$options) { - $mountPoint=self::setUserVars($mountPoint); - foreach($options as &$option) { - $option=self::setUserVars($option); - } - self::mount($options['class'],$options['options'],$mountPoint); - } - } - } - } - - if(isset($mountConfig['user'])) { - foreach($mountConfig['user'] as $user=>$mounts) { - if($user==='all' or strtolower($user)===strtolower(OC_User::getUser())) { - foreach($mounts as $mountPoint=>$options) { - $mountPoint=self::setUserVars($mountPoint); - foreach($options as &$option) { - $option=self::setUserVars($option); - } - self::mount($options['class'],$options['options'],$mountPoint); - } - } - } - } - - $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php'); - $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); - } + if (!isset($user)) { + $user = OC_User::getUser(); } + self::loadSystemMountPoints($user); self::$loaded=true; } @@ -253,8 +274,12 @@ class OC_Filesystem{ * @param string intput * @return string */ - private static function setUserVars($input) { - return str_replace('$user',OC_User::getUser(),$input); + private static function setUserVars($input, $user) { + if (isset($user)) { + return str_replace('$user', $user,$input); + } else { + return str_replace('$user',OC_User::getUser(),$input); + } } /** diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 2950ced5f9e..872da992fab 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -251,6 +251,9 @@ class OC_FilesystemView { return $this->basicOperation('filemtime', $path); } public function touch($path, $mtime=null) { + if(!is_null($mtime) and !is_numeric($mtime)){ + $mtime = strtotime($mtime); + } return $this->basicOperation('touch', $path, array('write'), $mtime); } public function file_get_contents($path) { @@ -585,7 +588,7 @@ class OC_FilesystemView { $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result); if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()) { if($operation!='fopen') {//no post hooks for fopen, the file stream is still open - $this->runHooks($hooks,$path,true); + $this->runHooks($hooks,$path, true); } } return $result; diff --git a/lib/group.php b/lib/group.php index 66892a99b60..a89c6c55e36 100644 --- a/lib/group.php +++ b/lib/group.php @@ -65,15 +65,8 @@ class OC_Group { * * Tries to create a new group. If the group name already exists, false will * be returned. Basic checking of Group name - * - * Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-" */ public static function createGroup( $gid ) { - // Check the name for bad characters - // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" - if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $gid )) { - return false; - } // No empty group names! if( !$gid ) { return false; diff --git a/lib/helper.php b/lib/helper.php index 290d281c04c..060d887fd67 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -203,7 +203,7 @@ class OC_Helper { return OC::$WEBROOT."/core/img/filetypes/$mimetype.png"; } //try only the first part of the filetype - $mimetype=substr($mimetype,0,strpos($mimetype,'-')); + $mimetype=substr($mimetype,0, strpos($mimetype,'-')); if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.png" )) { return OC::$WEBROOT."/core/img/filetypes/$mimetype.png"; } @@ -288,18 +288,18 @@ class OC_Helper { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if(is_link($fullpath)) - return FALSE; + return false; elseif(!is_dir($fullpath) && !@chmod($fullpath, $filemode)) - return FALSE; + return false; elseif(!self::chmodr($fullpath, $filemode)) - return FALSE; + return false; } } closedir($dh); if(@chmod($path, $filemode)) - return TRUE; + return true; else - return FALSE; + return false; } /** @@ -364,8 +364,8 @@ class OC_Helper { if(strpos($path,'.')) { //try to guess the type by the file extension - if(!self::$mimetypes || self::$mimetypes != include('mimetypes.list.php')) { - self::$mimetypes=include('mimetypes.list.php'); + if(!self::$mimetypes || self::$mimetypes != include 'mimetypes.list.php') { + self::$mimetypes=include 'mimetypes.list.php'; } $extension=strtolower(strrchr(basename($path), ".")); $extension=substr($extension,1);//remove leading . @@ -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); } @@ -387,20 +387,15 @@ class OC_Helper { } if (!$isWrapped and $mimeType=='application/octet-stream' && OC_Helper::canExecute("file")) { // it looks like we have a 'file' command, - // lets see it it does have mime support + // lets see if it does have mime support $path=escapeshellarg($path); $fp = popen("file -i -b $path 2>/dev/null", "r"); $reply = fgets($fp); pclose($fp); - //trim the character set from the end of the response - $mimeType=substr($reply,0,strrpos($reply,' ')); - $mimeType=substr($mimeType,0,strrpos($mimeType,"\n")); - - //trim ; - if (strpos($mimeType, ';') !== false) { - $mimeType = strstr($mimeType, ';', true); - } + // we have smth like 'text/x-c++; charset=us-ascii\n' + // and need to eliminate everything starting with semicolon including trailing LF + $mimeType = preg_replace('/;.*/ms', '', trim($reply)); } return $mimeType; @@ -509,7 +504,7 @@ class OC_Helper { } $count=0; while(!feof($source)) { - $count+=fwrite($target,fread($source,8192)); + $count+=fwrite($target, fread($source,8192)); } return $count; } diff --git a/lib/installer.php b/lib/installer.php index 9135c60fc05..83d082b804a 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -125,7 +125,7 @@ class OC_Installer{ } return false; } - $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml',true); + $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); // check the code for not allowed calls if(!OC_Installer::checkCode($info['id'],$extractDir)) { OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR); @@ -187,7 +187,7 @@ class OC_Installer{ //run appinfo/install.php if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')) { - include($basedir.'/appinfo/install.php'); + include $basedir.'/appinfo/install.php'; } //set the installed version @@ -320,7 +320,7 @@ class OC_Installer{ //run appinfo/install.php if(is_file(OC_App::getAppPath($app)."/appinfo/install.php")) { - include(OC_App::getAppPath($app)."/appinfo/install.php"); + include OC_App::getAppPath($app)."/appinfo/install.php"; } $info=OC_App::getAppInfo($app); OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app)); diff --git a/lib/json.php b/lib/json.php index cc504907261..cc6cee6caff 100644 --- a/lib/json.php +++ b/lib/json.php @@ -83,7 +83,7 @@ class OC_JSON{ * Check if the user verified the login with his password */ public static function verifyUser() { - if(OC_Config::getValue('enhancedauth', true) === true) { + if(OC_Config::getValue('enhancedauth', false) === true) { if(!isset($_SESSION['verifiedLogin']) OR $_SESSION['verifiedLogin'] < time()) { $l = OC_L10N::get('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); diff --git a/lib/l10n.php b/lib/l10n.php index 4eb4c323d88..f1a2523c307 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -58,9 +58,11 @@ class OC_L10N{ * Localization */ private $localizations = array( - 'date' => 'd.m.Y', - 'datetime' => 'd.m.Y H:i:s', - 'time' => 'H:i:s'); + 'jsdate' => 'dd.mm.yy', + 'date' => '%d.%m.%Y', + 'datetime' => '%d.%m.%Y %H:%M:%S', + 'time' => '%H:%M:%S', + 'firstday' => 0); /** * get an L10N instance @@ -118,7 +120,7 @@ class OC_L10N{ OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/lib/l10n/') || OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/settings')) && file_exists($i18ndir.$lang.'.php')) { // Include the file, save the data from $CONFIG - include(strip_tags($i18ndir).strip_tags($lang).'.php'); + include strip_tags($i18ndir).strip_tags($lang).'.php'; if(isset($TRANSLATIONS) && is_array($TRANSLATIONS)) { $this->translations = $TRANSLATIONS; } @@ -126,7 +128,7 @@ class OC_L10N{ if(file_exists(OC::$SERVERROOT.'/core/l10n/l10n-'.$lang.'.php')) { // Include the file, save the data from $CONFIG - include(OC::$SERVERROOT.'/core/l10n/l10n-'.$lang.'.php'); + include OC::$SERVERROOT.'/core/l10n/l10n-'.$lang.'.php'; if(isset($LOCALIZATIONS) && is_array($LOCALIZATIONS)) { $this->localizations = array_merge($this->localizations, $LOCALIZATIONS); } @@ -216,8 +218,21 @@ class OC_L10N{ case 'time': if($data instanceof DateTime) return $data->format($this->localizations[$type]); elseif(is_string($data)) $data = strtotime($data); - return date($this->localizations[$type], $data); + $locales = array(self::findLanguage()); + if (strlen($locales[0]) == 2) { + $locales[] = $locales[0].'_'.strtoupper($locales[0]); + } + setlocale(LC_TIME, $locales); + $format = $this->localizations[$type]; + // Check for Windows to find and replace the %e modifier correctly + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format); + } + return strftime($format, $data); break; + case 'firstday': + case 'jsdate': + return $this->localizations[$type]; default: return false; } diff --git a/lib/l10n/ar.php b/lib/l10n/ar.php new file mode 100644 index 00000000000..4934e25a5f6 --- /dev/null +++ b/lib/l10n/ar.php @@ -0,0 +1,8 @@ +<?php $TRANSLATIONS = array( +"Help" => "المساعدة", +"Personal" => "شخصي", +"Settings" => "تعديلات", +"Users" => "المستخدمين", +"Authentication error" => "لم يتم التأكد من الشخصية بنجاح", +"Text" => "معلومات إضافية" +); diff --git a/lib/l10n/bg_BG.php b/lib/l10n/bg_BG.php new file mode 100644 index 00000000000..3eb0660d944 --- /dev/null +++ b/lib/l10n/bg_BG.php @@ -0,0 +1,4 @@ +<?php $TRANSLATIONS = array( +"Personal" => "Лично", +"Authentication error" => "Проблем с идентификацията" +); diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php index 031207227ec..fa7c27af5a5 100644 --- a/lib/l10n/ca.php +++ b/lib/l10n/ca.php @@ -12,6 +12,9 @@ "Application is not enabled" => "L'aplicació no està habilitada", "Authentication error" => "Error d'autenticació", "Token expired. Please reload page." => "El testimoni ha expirat. Torneu a carregar la pàgina.", +"Files" => "Fitxers", +"Text" => "Text", +"Images" => "Imatges", "seconds ago" => "segons enrere", "1 minute ago" => "fa 1 minut", "%d minutes ago" => "fa %d minuts", diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php index 00815f97533..72d9b955a41 100644 --- a/lib/l10n/cs_CZ.php +++ b/lib/l10n/cs_CZ.php @@ -12,6 +12,9 @@ "Application is not enabled" => "Aplikace není povolena", "Authentication error" => "Chyba ověření", "Token expired. Please reload page." => "Token vypršel. Obnovte prosím stránku.", +"Files" => "Soubory", +"Text" => "Text", +"Images" => "Obrázky", "seconds ago" => "před vteřinami", "1 minute ago" => "před 1 minutou", "%d minutes ago" => "před %d minutami", diff --git a/lib/l10n/da.php b/lib/l10n/da.php index 09124c18290..ca4a6c6eca6 100644 --- a/lib/l10n/da.php +++ b/lib/l10n/da.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Programmet er ikke aktiveret", "Authentication error" => "Adgangsfejl", "Token expired. Please reload page." => "Adgang er udløbet. Genindlæs siden.", +"Files" => "Filer", +"Text" => "SMS", "seconds ago" => "sekunder siden", "1 minute ago" => "1 minut siden", "%d minutes ago" => "%d minutter siden", diff --git a/lib/l10n/de.php b/lib/l10n/de.php index 8c81be16582..4f415e7cbfd 100644 --- a/lib/l10n/de.php +++ b/lib/l10n/de.php @@ -12,6 +12,9 @@ "Application is not enabled" => "Die Anwendung ist nicht aktiviert", "Authentication error" => "Authentifizierungs-Fehler", "Token expired. Please reload page." => "Token abgelaufen. Bitte lade die Seite neu.", +"Files" => "Dateien", +"Text" => "Text", +"Images" => "Bilder", "seconds ago" => "Vor wenigen Sekunden", "1 minute ago" => "Vor einer Minute", "%d minutes ago" => "Vor %d Minuten", @@ -19,9 +22,9 @@ "yesterday" => "Gestern", "%d days ago" => "Vor %d Tag(en)", "last month" => "Letzten Monat", -"months ago" => "Vor Monaten", +"months ago" => "Vor wenigen Monaten", "last year" => "Letztes Jahr", -"years ago" => "Vor Jahren", +"years ago" => "Vor wenigen Jahren", "%s is available. Get <a href=\"%s\">more information</a>" => "%s ist verfügbar. <a href=\"%s\">Weitere Informationen</a>", "up to date" => "aktuell", "updates check is disabled" => "Die Update-Überprüfung ist ausgeschaltet" diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php index 8c81be16582..0f08a3ea71d 100644 --- a/lib/l10n/de_DE.php +++ b/lib/l10n/de_DE.php @@ -11,7 +11,10 @@ "Selected files too large to generate zip file." => "Die gewählten Dateien sind zu groß, um eine ZIP-Datei zu erstellen.", "Application is not enabled" => "Die Anwendung ist nicht aktiviert", "Authentication error" => "Authentifizierungs-Fehler", -"Token expired. Please reload page." => "Token abgelaufen. Bitte lade die Seite neu.", +"Token expired. Please reload page." => "Token abgelaufen. Bitte laden Sie die Seite neu.", +"Files" => "Dateien", +"Text" => "Text", +"Images" => "Bilder", "seconds ago" => "Vor wenigen Sekunden", "1 minute ago" => "Vor einer Minute", "%d minutes ago" => "Vor %d Minuten", @@ -19,9 +22,9 @@ "yesterday" => "Gestern", "%d days ago" => "Vor %d Tag(en)", "last month" => "Letzten Monat", -"months ago" => "Vor Monaten", +"months ago" => "Vor wenigen Monaten", "last year" => "Letztes Jahr", -"years ago" => "Vor Jahren", +"years ago" => "Vor wenigen Jahren", "%s is available. Get <a href=\"%s\">more information</a>" => "%s ist verfügbar. <a href=\"%s\">Weitere Informationen</a>", "up to date" => "aktuell", "updates check is disabled" => "Die Update-Überprüfung ist ausgeschaltet" diff --git a/lib/l10n/el.php b/lib/l10n/el.php index e4e12490711..e6475ec08aa 100644 --- a/lib/l10n/el.php +++ b/lib/l10n/el.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Δεν ενεργοποιήθηκε η εφαρμογή", "Authentication error" => "Σφάλμα πιστοποίησης", "Token expired. Please reload page." => "Το αναγνωριστικό έληξε. Παρακαλώ φορτώστε ξανά την σελίδα.", +"Files" => "Αρχεία", +"Text" => "Κείμενο", "seconds ago" => "δευτερόλεπτα πριν", "1 minute ago" => "1 λεπτό πριν", "%d minutes ago" => "%d λεπτά πριν", diff --git a/lib/l10n/eo.php b/lib/l10n/eo.php index b3c1c52ecee..e569101fc6b 100644 --- a/lib/l10n/eo.php +++ b/lib/l10n/eo.php @@ -12,6 +12,8 @@ "Application is not enabled" => "La aplikaĵo ne estas kapabligita", "Authentication error" => "Aŭtentiga eraro", "Token expired. Please reload page." => "Ĵetono eksvalidiĝis. Bonvolu reŝargi la paĝon.", +"Files" => "Dosieroj", +"Text" => "Teksto", "seconds ago" => "sekundojn antaŭe", "1 minute ago" => "antaŭ 1 minuto", "%d minutes ago" => "antaŭ %d minutoj", diff --git a/lib/l10n/es.php b/lib/l10n/es.php index 6d2a310ca3b..5064fe2d2f0 100644 --- a/lib/l10n/es.php +++ b/lib/l10n/es.php @@ -12,6 +12,8 @@ "Application is not enabled" => "La aplicación no está habilitada", "Authentication error" => "Error de autenticación", "Token expired. Please reload page." => "Token expirado. Por favor, recarga la página.", +"Files" => "Archivos", +"Text" => "Texto", "seconds ago" => "hace segundos", "1 minute ago" => "hace 1 minuto", "%d minutes ago" => "hace %d minutos", diff --git a/lib/l10n/es_AR.php b/lib/l10n/es_AR.php index fd50027d8a1..a9d9b35b265 100644 --- a/lib/l10n/es_AR.php +++ b/lib/l10n/es_AR.php @@ -12,6 +12,9 @@ "Application is not enabled" => "La aplicación no está habilitada", "Authentication error" => "Error de autenticación", "Token expired. Please reload page." => "Token expirado. Por favor, recargá la página.", +"Files" => "Archivos", +"Text" => "Texto", +"Images" => "Imágenes", "seconds ago" => "hace unos segundos", "1 minute ago" => "hace 1 minuto", "%d minutes ago" => "hace %d minutos", diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php index 87f222af838..52d91d37655 100644 --- a/lib/l10n/et_EE.php +++ b/lib/l10n/et_EE.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Rakendus pole sisse lülitatud", "Authentication error" => "Autentimise viga", "Token expired. Please reload page." => "Kontrollkood aegus. Paelun lae leht uuesti.", +"Files" => "Failid", +"Text" => "Tekst", "seconds ago" => "sekundit tagasi", "1 minute ago" => "1 minut tagasi", "%d minutes ago" => "%d minutit tagasi", diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php index 461bf458778..c6c0e18ea99 100644 --- a/lib/l10n/eu.php +++ b/lib/l10n/eu.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Aplikazioa ez dago gaituta", "Authentication error" => "Autentikazio errorea", "Token expired. Please reload page." => "Tokena iraungitu da. Mesedez birkargatu orria.", +"Files" => "Fitxategiak", +"Text" => "Testua", "seconds ago" => "orain dela segundu batzuk", "1 minute ago" => "orain dela minutu 1", "%d minutes ago" => "orain dela %d minutu", diff --git a/lib/l10n/fa.php b/lib/l10n/fa.php index 3579329820f..31f936b8c98 100644 --- a/lib/l10n/fa.php +++ b/lib/l10n/fa.php @@ -4,6 +4,8 @@ "Settings" => "تنظیمات", "Users" => "کاربران", "Admin" => "مدیر", +"Files" => "پروندهها", +"Text" => "متن", "seconds ago" => "ثانیهها پیش", "1 minute ago" => "1 دقیقه پیش", "%d minutes ago" => "%d دقیقه پیش", diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php index 6f0ebcd16e6..47d734ca365 100644 --- a/lib/l10n/fi_FI.php +++ b/lib/l10n/fi_FI.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Sovellusta ei ole otettu käyttöön", "Authentication error" => "Todennusvirhe", "Token expired. Please reload page." => "Valtuutus vanheni. Lataa sivu uudelleen.", +"Files" => "Tiedostot", +"Text" => "Teksti", "seconds ago" => "sekuntia sitten", "1 minute ago" => "1 minuutti sitten", "%d minutes ago" => "%d minuuttia sitten", diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php index c10259e6376..ff2356464a2 100644 --- a/lib/l10n/fr.php +++ b/lib/l10n/fr.php @@ -12,6 +12,9 @@ "Application is not enabled" => "L'application n'est pas activée", "Authentication error" => "Erreur d'authentification", "Token expired. Please reload page." => "La session a expiré. Veuillez recharger la page.", +"Files" => "Fichiers", +"Text" => "Texte", +"Images" => "Images", "seconds ago" => "à l'instant", "1 minute ago" => "il y a 1 minute", "%d minutes ago" => "il y a %d minutes", diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php index 7a9de627c2d..96368ef03db 100644 --- a/lib/l10n/gl.php +++ b/lib/l10n/gl.php @@ -12,6 +12,7 @@ "Application is not enabled" => "O aplicativo non está habilitado", "Authentication error" => "Erro na autenticación", "Token expired. Please reload page." => "Testemuño caducado. Por favor recargue a páxina.", +"Text" => "Texto", "seconds ago" => "hai segundos", "1 minute ago" => "hai 1 minuto", "%d minutes ago" => "hai %d minutos", diff --git a/lib/l10n/he.php b/lib/l10n/he.php index 149637d09d2..27bcf7655d5 100644 --- a/lib/l10n/he.php +++ b/lib/l10n/he.php @@ -12,6 +12,7 @@ "Application is not enabled" => "יישומים אינם מופעלים", "Authentication error" => "שגיאת הזדהות", "Token expired. Please reload page." => "פג תוקף. נא לטעון שוב את הדף.", +"Text" => "טקסט", "seconds ago" => "שניות", "1 minute ago" => "לפני דקה אחת", "%d minutes ago" => "לפני %d דקות", diff --git a/lib/l10n/hr.php b/lib/l10n/hr.php new file mode 100644 index 00000000000..0d2a0f46248 --- /dev/null +++ b/lib/l10n/hr.php @@ -0,0 +1,16 @@ +<?php $TRANSLATIONS = array( +"Help" => "Pomoć", +"Personal" => "Osobno", +"Settings" => "Postavke", +"Users" => "Korisnici", +"Authentication error" => "Greška kod autorizacije", +"Files" => "Datoteke", +"Text" => "Tekst", +"seconds ago" => "sekundi prije", +"today" => "danas", +"yesterday" => "jučer", +"last month" => "prošli mjesec", +"months ago" => "mjeseci", +"last year" => "prošlu godinu", +"years ago" => "godina" +); diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php index eb074b79c61..3abf96e85a8 100644 --- a/lib/l10n/hu_HU.php +++ b/lib/l10n/hu_HU.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Az alkalmazás nincs engedélyezve", "Authentication error" => "Hitelesítési hiba", "Token expired. Please reload page." => "A token lejárt. Frissítsd az oldalt.", +"Files" => "Fájlok", +"Text" => "Szöveg", "seconds ago" => "másodperccel ezelőtt", "1 minute ago" => "1 perccel ezelőtt", "%d minutes ago" => "%d perccel ezelőtt", diff --git a/lib/l10n/ia.php b/lib/l10n/ia.php new file mode 100644 index 00000000000..fb7595d564e --- /dev/null +++ b/lib/l10n/ia.php @@ -0,0 +1,7 @@ +<?php $TRANSLATIONS = array( +"Help" => "Adjuta", +"Personal" => "Personal", +"Settings" => "Configurationes", +"Users" => "Usatores", +"Text" => "Texto" +); diff --git a/lib/l10n/id.php b/lib/l10n/id.php new file mode 100644 index 00000000000..40c4532bdd0 --- /dev/null +++ b/lib/l10n/id.php @@ -0,0 +1,29 @@ +<?php $TRANSLATIONS = array( +"Help" => "bantu", +"Personal" => "perseorangan", +"Settings" => "pengaturan", +"Users" => "pengguna", +"Apps" => "aplikasi", +"Admin" => "admin", +"ZIP download is turned off." => "download ZIP sedang dimatikan", +"Files need to be downloaded one by one." => "file harus di unduh satu persatu", +"Back to Files" => "kembali ke daftar file", +"Selected files too large to generate zip file." => "file yang dipilih terlalu besar untuk membuat file zip", +"Application is not enabled" => "aplikasi tidak diaktifkan", +"Authentication error" => "autentikasi bermasalah", +"Token expired. Please reload page." => "token kadaluarsa.mohon perbaharui laman.", +"Text" => "teks", +"seconds ago" => "beberapa detik yang lalu", +"1 minute ago" => "1 menit lalu", +"%d minutes ago" => "%d menit lalu", +"today" => "hari ini", +"yesterday" => "kemarin", +"%d days ago" => "%d hari lalu", +"last month" => "bulan kemarin", +"months ago" => "beberapa bulan lalu", +"last year" => "tahun kemarin", +"years ago" => "beberapa tahun lalu", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s tersedia. dapatkan <a href=\"%s\"> info lebih lanjut</a>", +"up to date" => "terbaru", +"updates check is disabled" => "pengecekan pembaharuan sedang non-aktifkan" +); diff --git a/lib/l10n/it.php b/lib/l10n/it.php index c4c7d90610b..98ba5973a4a 100644 --- a/lib/l10n/it.php +++ b/lib/l10n/it.php @@ -12,6 +12,9 @@ "Application is not enabled" => "L'applicazione non è abilitata", "Authentication error" => "Errore di autenticazione", "Token expired. Please reload page." => "Token scaduto. Ricarica la pagina.", +"Files" => "File", +"Text" => "Testo", +"Images" => "Immagini", "seconds ago" => "secondi fa", "1 minute ago" => "1 minuto fa", "%d minutes ago" => "%d minuti fa", diff --git a/lib/l10n/ja_JP.php b/lib/l10n/ja_JP.php index 10f7276703a..eb3316b4ab1 100644 --- a/lib/l10n/ja_JP.php +++ b/lib/l10n/ja_JP.php @@ -12,6 +12,9 @@ "Application is not enabled" => "アプリケーションは無効です", "Authentication error" => "認証エラー", "Token expired. Please reload page." => "トークンが無効になりました。ページを再読込してください。", +"Files" => "ファイル", +"Text" => "TTY TDD", +"Images" => "画像", "seconds ago" => "秒前", "1 minute ago" => "1分前", "%d minutes ago" => "%d 分前", diff --git a/lib/l10n/ka_GE.php b/lib/l10n/ka_GE.php new file mode 100644 index 00000000000..69b72e04130 --- /dev/null +++ b/lib/l10n/ka_GE.php @@ -0,0 +1,20 @@ +<?php $TRANSLATIONS = array( +"Help" => "დახმარება", +"Personal" => "პირადი", +"Settings" => "პარამეტრები", +"Users" => "მომხმარებელი", +"Apps" => "აპლიკაციები", +"Admin" => "ადმინისტრატორი", +"Authentication error" => "ავთენტიფიკაციის შეცდომა", +"Text" => "ტექსტი", +"seconds ago" => "წამის წინ", +"1 minute ago" => "1 წუთის წინ", +"today" => "დღეს", +"yesterday" => "გუშინ", +"last month" => "გასულ თვეში", +"months ago" => "თვის წინ", +"last year" => "ბოლო წელს", +"years ago" => "წლის წინ", +"up to date" => "განახლებულია", +"updates check is disabled" => "განახლების ძებნა გათიშულია" +); diff --git a/lib/l10n/ko.php b/lib/l10n/ko.php new file mode 100644 index 00000000000..8648eba63b2 --- /dev/null +++ b/lib/l10n/ko.php @@ -0,0 +1,8 @@ +<?php $TRANSLATIONS = array( +"Help" => "도움말", +"Personal" => "개인의", +"Settings" => "설정", +"Users" => "사용자", +"Authentication error" => "인증 오류", +"Text" => "문자 번호" +); diff --git a/lib/l10n/ku_IQ.php b/lib/l10n/ku_IQ.php new file mode 100644 index 00000000000..f89871f23c9 --- /dev/null +++ b/lib/l10n/ku_IQ.php @@ -0,0 +1,5 @@ +<?php $TRANSLATIONS = array( +"Help" => "یارمەتی", +"Settings" => "دهستكاری", +"Users" => "بهكارهێنهر" +); diff --git a/lib/l10n/lb.php b/lib/l10n/lb.php new file mode 100644 index 00000000000..baee630e897 --- /dev/null +++ b/lib/l10n/lb.php @@ -0,0 +1,6 @@ +<?php $TRANSLATIONS = array( +"Personal" => "Perséinlech", +"Settings" => "Astellungen", +"Authentication error" => "Authentifikatioun's Fehler", +"Text" => "SMS" +); diff --git a/lib/l10n/lt_LT.php b/lib/l10n/lt_LT.php index c6702a62287..b34c602af2a 100644 --- a/lib/l10n/lt_LT.php +++ b/lib/l10n/lt_LT.php @@ -11,11 +11,20 @@ "Selected files too large to generate zip file." => "Pasirinkti failai per dideli archyvavimui į ZIP.", "Application is not enabled" => "Programa neįjungta", "Authentication error" => "Autentikacijos klaida", +"Token expired. Please reload page." => "Sesija baigėsi. Prašome perkrauti puslapį.", +"Files" => "Failai", +"Text" => "Žinučių", +"seconds ago" => "prieš kelias sekundes", "1 minute ago" => "prieš 1 minutę", "%d minutes ago" => "prieš %d minučių", "today" => "šiandien", "yesterday" => "vakar", "%d days ago" => "prieš %d dienų", "last month" => "praėjusį mėnesį", -"last year" => "pereitais metais" +"months ago" => "prieš mėnesį", +"last year" => "pereitais metais", +"years ago" => "prieš metus", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s yra galimas. Platesnė <a href=\"%s\">informacija čia</a>", +"up to date" => "pilnai atnaujinta", +"updates check is disabled" => "atnaujinimų tikrinimas išjungtas" ); diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php new file mode 100644 index 00000000000..fb333bd55c3 --- /dev/null +++ b/lib/l10n/lv.php @@ -0,0 +1,7 @@ +<?php $TRANSLATIONS = array( +"Help" => "Palīdzība", +"Personal" => "Personīgi", +"Settings" => "Iestatījumi", +"Users" => "Lietotāji", +"Authentication error" => "Ielogošanās kļūme" +); diff --git a/lib/l10n/mk.php b/lib/l10n/mk.php new file mode 100644 index 00000000000..55e010d61ad --- /dev/null +++ b/lib/l10n/mk.php @@ -0,0 +1,7 @@ +<?php $TRANSLATIONS = array( +"Help" => "Помош", +"Personal" => "Лично", +"Settings" => "Параметри", +"Users" => "Корисници", +"Text" => "Текст" +); diff --git a/lib/l10n/ms_MY.php b/lib/l10n/ms_MY.php new file mode 100644 index 00000000000..86c7e51b486 --- /dev/null +++ b/lib/l10n/ms_MY.php @@ -0,0 +1,8 @@ +<?php $TRANSLATIONS = array( +"Personal" => "Peribadi", +"Settings" => "Tetapan", +"Users" => "Pengguna", +"Authentication error" => "Ralat pengesahan", +"Files" => "Fail-fail", +"Text" => "Teks" +); diff --git a/lib/l10n/nb_NO.php b/lib/l10n/nb_NO.php index c43ada258d4..afb80288b53 100644 --- a/lib/l10n/nb_NO.php +++ b/lib/l10n/nb_NO.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Applikasjon er ikke påslått", "Authentication error" => "Autentiseringsfeil", "Token expired. Please reload page." => "Symbol utløpt. Vennligst last inn siden på nytt.", +"Files" => "Filer", +"Text" => "Tekst", "seconds ago" => "sekunder siden", "1 minute ago" => "1 minuitt siden", "%d minutes ago" => "%d minutter siden", diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php index 583956c66e6..e209592d96d 100644 --- a/lib/l10n/nl.php +++ b/lib/l10n/nl.php @@ -12,6 +12,9 @@ "Application is not enabled" => "De applicatie is niet actief", "Authentication error" => "Authenticatie fout", "Token expired. Please reload page." => "Token verlopen. Herlaad de pagina.", +"Files" => "Bestanden", +"Text" => "Tekst", +"Images" => "Afbeeldingen", "seconds ago" => "seconden geleden", "1 minute ago" => "1 minuut geleden", "%d minutes ago" => "%d minuten geleden", diff --git a/lib/l10n/nn_NO.php b/lib/l10n/nn_NO.php new file mode 100644 index 00000000000..56ce733fc19 --- /dev/null +++ b/lib/l10n/nn_NO.php @@ -0,0 +1,8 @@ +<?php $TRANSLATIONS = array( +"Help" => "Hjelp", +"Personal" => "Personleg", +"Settings" => "Innstillingar", +"Users" => "Brukarar", +"Authentication error" => "Feil i autentisering", +"Text" => "Tekst" +); diff --git a/lib/l10n/oc.php b/lib/l10n/oc.php index ffc0588becc..2ac89fc74c1 100644 --- a/lib/l10n/oc.php +++ b/lib/l10n/oc.php @@ -9,6 +9,7 @@ "Files need to be downloaded one by one." => "Los fichièrs devan èsser avalcargats un per un.", "Back to Files" => "Torna cap als fichièrs", "Authentication error" => "Error d'autentificacion", +"Files" => "Fichièrs", "seconds ago" => "segonda a", "1 minute ago" => "1 minuta a", "%d minutes ago" => "%d minutas a", diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php index 087aaa227d3..0fb29cbedbf 100644 --- a/lib/l10n/pl.php +++ b/lib/l10n/pl.php @@ -12,6 +12,9 @@ "Application is not enabled" => "Aplikacja nie jest włączona", "Authentication error" => "Błąd uwierzytelniania", "Token expired. Please reload page." => "Token wygasł. Proszę ponownie załadować stronę.", +"Files" => "Pliki", +"Text" => "Połączenie tekstowe", +"Images" => "Obrazy", "seconds ago" => "sekund temu", "1 minute ago" => "1 minutę temu", "%d minutes ago" => "%d minut temu", diff --git a/lib/l10n/pl_PL.php b/lib/l10n/pl_PL.php new file mode 100644 index 00000000000..67cf0a33259 --- /dev/null +++ b/lib/l10n/pl_PL.php @@ -0,0 +1,3 @@ +<?php $TRANSLATIONS = array( +"Settings" => "Ustawienia" +); diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php index 1455eabbc94..5eb2348100a 100644 --- a/lib/l10n/pt_BR.php +++ b/lib/l10n/pt_BR.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Aplicação não está habilitada", "Authentication error" => "Erro de autenticação", "Token expired. Please reload page." => "Token expirou. Por favor recarregue a página.", +"Files" => "Arquivos", +"Text" => "Texto", "seconds ago" => "segundos atrás", "1 minute ago" => "1 minuto atrás", "%d minutes ago" => "%d minutos atrás", diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php index c3cee207a16..3809e4bdbcc 100644 --- a/lib/l10n/pt_PT.php +++ b/lib/l10n/pt_PT.php @@ -12,6 +12,9 @@ "Application is not enabled" => "A aplicação não está activada", "Authentication error" => "Erro na autenticação", "Token expired. Please reload page." => "O token expirou. Por favor recarregue a página.", +"Files" => "Ficheiros", +"Text" => "Texto", +"Images" => "Imagens", "seconds ago" => "há alguns segundos", "1 minute ago" => "há 1 minuto", "%d minutes ago" => "há %d minutos", diff --git a/lib/l10n/ro.php b/lib/l10n/ro.php index 5fffeec2335..818b3f3eeed 100644 --- a/lib/l10n/ro.php +++ b/lib/l10n/ro.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Aplicația nu este activată", "Authentication error" => "Eroare la autentificare", "Token expired. Please reload page." => "Token expirat. Te rugăm să reîncarci pagina.", +"Files" => "Fișiere", +"Text" => "Text", "seconds ago" => "secunde în urmă", "1 minute ago" => "1 minut în urmă", "%d minutes ago" => "%d minute în urmă", diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php index 74425f0e134..c703c30ac44 100644 --- a/lib/l10n/ru.php +++ b/lib/l10n/ru.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Приложение не разрешено", "Authentication error" => "Ошибка аутентификации", "Token expired. Please reload page." => "Токен просрочен. Перезагрузите страницу.", +"Files" => "Файлы", +"Text" => "Текст", "seconds ago" => "менее минуты", "1 minute ago" => "1 минуту назад", "%d minutes ago" => "%d минут назад", diff --git a/lib/l10n/ru_RU.php b/lib/l10n/ru_RU.php index decf63efb97..36cc85e8d28 100644 --- a/lib/l10n/ru_RU.php +++ b/lib/l10n/ru_RU.php @@ -12,6 +12,8 @@ "Application is not enabled" => "Приложение не запущено", "Authentication error" => "Ошибка аутентификации", "Token expired. Please reload page." => "Маркер истек. Пожалуйста, перезагрузите страницу.", +"Files" => "Файлы", +"Text" => "Текст", "seconds ago" => "секунд назад", "1 minute ago" => "1 минуту назад", "%d minutes ago" => "%d минут назад", diff --git a/lib/l10n/si_LK.php b/lib/l10n/si_LK.php new file mode 100644 index 00000000000..040c6d2d171 --- /dev/null +++ b/lib/l10n/si_LK.php @@ -0,0 +1,31 @@ +<?php $TRANSLATIONS = array( +"Help" => "උදව්", +"Personal" => "පෞද්ගලික", +"Settings" => "සිටුවම්", +"Users" => "පරිශීලකයන්", +"Apps" => "යෙදුම්", +"Admin" => "පරිපාලක", +"ZIP download is turned off." => "ZIP භාගත කිරීම් අක්රියයි", +"Files need to be downloaded one by one." => "ගොනු එකින් එක භාගත යුතුයි", +"Back to Files" => "ගොනු වෙතට නැවත යන්න", +"Selected files too large to generate zip file." => "තෝරාගත් ගොනු ZIP ගොනුවක් තැනීමට විශාල වැඩිය.", +"Application is not enabled" => "යෙදුම සක්රිය කර නොමැත", +"Authentication error" => "සත්යාපනය කිරීමේ දෝශයක්", +"Token expired. Please reload page." => "ටෝකනය කල් ඉකුත් වී ඇත. පිටුව නැවුම් කරන්න", +"Files" => "ගොනු", +"Text" => "පෙළ", +"Images" => "අනු රූ", +"seconds ago" => "තත්පරයන්ට පෙර", +"1 minute ago" => "1 මිනිත්තුවකට පෙර", +"%d minutes ago" => "%d මිනිත්තුවන්ට පෙර", +"today" => "අද", +"yesterday" => "ඊයේ", +"%d days ago" => "%d දිනකට පෙර", +"last month" => "පෙර මාසයේ", +"months ago" => "මාස කීපයකට පෙර", +"last year" => "පෙර අවුරුද්දේ", +"years ago" => "අවුරුදු කීපයකට පෙර", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s යොදාගත හැක. <a href=\"%s\">තව විස්තර</a> ලබාගන්න", +"up to date" => "යාවත්කාලීනයි", +"updates check is disabled" => "යාවත්කාලීන බව පරීක්ෂණය අක්රියයි" +); diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php index 8c77e82b7a6..9d5e4b9013b 100644 --- a/lib/l10n/sk_SK.php +++ b/lib/l10n/sk_SK.php @@ -11,6 +11,10 @@ "Selected files too large to generate zip file." => "Zvolené súbory sú príliž veľké na vygenerovanie zip súboru.", "Application is not enabled" => "Aplikácia nie je zapnutá", "Authentication error" => "Chyba autentifikácie", +"Token expired. Please reload page." => "Token vypršal. Obnovte, prosím, stránku.", +"Files" => "Súbory", +"Text" => "Text", +"Images" => "Obrázky", "seconds ago" => "pred sekundami", "1 minute ago" => "pred 1 minútou", "%d minutes ago" => "pred %d minútami", @@ -21,6 +25,7 @@ "months ago" => "pred mesiacmi", "last year" => "minulý rok", "years ago" => "pred rokmi", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s je dostupné. Získať <a href=\"%s\">viac informácií</a>", "up to date" => "aktuálny", "updates check is disabled" => "sledovanie aktualizácií je vypnuté" ); diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php index eac839e78f3..3dc8753a436 100644 --- a/lib/l10n/sl.php +++ b/lib/l10n/sl.php @@ -3,15 +3,17 @@ "Personal" => "Osebno", "Settings" => "Nastavitve", "Users" => "Uporabniki", -"Apps" => "Aplikacije", -"Admin" => "Skrbnik", -"ZIP download is turned off." => "ZIP prenos je onemogočen.", -"Files need to be downloaded one by one." => "Datoteke morajo biti prenešene posamezno.", +"Apps" => "Programi", +"Admin" => "Skrbništvo", +"ZIP download is turned off." => "Prejem datotek ZIP je onemogočen.", +"Files need to be downloaded one by one." => "Datoteke je mogoče prejeti le posamič.", "Back to Files" => "Nazaj na datoteke", -"Selected files too large to generate zip file." => "Izbrane datoteke so prevelike, da bi lahko ustvarili zip datoteko.", -"Application is not enabled" => "Aplikacija ni omogočena", +"Selected files too large to generate zip file." => "Izbrane datoteke so prevelike za ustvarjanje datoteke arhiva zip.", +"Application is not enabled" => "Program ni omogočen", "Authentication error" => "Napaka overitve", -"Token expired. Please reload page." => "Žeton je potekel. Prosimo, če spletno stran znova naložite.", +"Token expired. Please reload page." => "Žeton je potekel. Spletišče je traba znova naložiti.", +"Files" => "Datoteke", +"Text" => "Besedilo", "seconds ago" => "pred nekaj sekundami", "1 minute ago" => "pred minuto", "%d minutes ago" => "pred %d minutami", @@ -22,7 +24,7 @@ "months ago" => "pred nekaj meseci", "last year" => "lani", "years ago" => "pred nekaj leti", -"%s is available. Get <a href=\"%s\">more information</a>" => "%s je na voljo. <a href=\"%s\">Več informacij.</a>", -"up to date" => "ažuren", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s je na voljo. <a href=\"%s\">Več podrobnosti.</a>", +"up to date" => "posodobljeno", "updates check is disabled" => "preverjanje za posodobitve je onemogočeno" ); diff --git a/lib/l10n/sr.php b/lib/l10n/sr.php new file mode 100644 index 00000000000..cec7ea703fb --- /dev/null +++ b/lib/l10n/sr.php @@ -0,0 +1,8 @@ +<?php $TRANSLATIONS = array( +"Help" => "Помоћ", +"Personal" => "Лично", +"Settings" => "Подешавања", +"Users" => "Корисници", +"Authentication error" => "Грешка при аутентификацији", +"Text" => "Текст" +); diff --git a/lib/l10n/sr@latin.php b/lib/l10n/sr@latin.php new file mode 100644 index 00000000000..c692ec3c4b7 --- /dev/null +++ b/lib/l10n/sr@latin.php @@ -0,0 +1,8 @@ +<?php $TRANSLATIONS = array( +"Help" => "Pomoć", +"Personal" => "Lično", +"Settings" => "Podešavanja", +"Users" => "Korisnici", +"Authentication error" => "Greška pri autentifikaciji", +"Text" => "Tekst" +); diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php index 3d377133f22..cc1e09ea76a 100644 --- a/lib/l10n/sv.php +++ b/lib/l10n/sv.php @@ -12,6 +12,9 @@ "Application is not enabled" => "Applikationen är inte aktiverad", "Authentication error" => "Fel vid autentisering", "Token expired. Please reload page." => "Ogiltig token. Ladda om sidan.", +"Files" => "Filer", +"Text" => "Text", +"Images" => "Bilder", "seconds ago" => "sekunder sedan", "1 minute ago" => "1 minut sedan", "%d minutes ago" => "%d minuter sedan", diff --git a/lib/l10n/ta_LK.php b/lib/l10n/ta_LK.php new file mode 100644 index 00000000000..3c82233cb69 --- /dev/null +++ b/lib/l10n/ta_LK.php @@ -0,0 +1,31 @@ +<?php $TRANSLATIONS = array( +"Help" => "உதவி", +"Personal" => "தனிப்பட்ட", +"Settings" => "அமைப்புகள்", +"Users" => "பயனாளர்கள்", +"Apps" => "செயலிகள்", +"Admin" => "நிர்வாகம்", +"ZIP download is turned off." => "வீசொலிப் பூட்டு பதிவிறக்கம் நிறுத்தப்பட்டுள்ளது.", +"Files need to be downloaded one by one." => "கோப்புகள்ஒன்றன் பின் ஒன்றாக பதிவிறக்கப்படவேண்டும்.", +"Back to Files" => "கோப்புகளுக்கு செல்க", +"Selected files too large to generate zip file." => "வீ சொலிக் கோப்புகளை உருவாக்குவதற்கு தெரிவுசெய்யப்பட்ட கோப்புகள் மிகப்பெரியவை", +"Application is not enabled" => "செயலி இயலுமைப்படுத்தப்படவில்லை", +"Authentication error" => "அத்தாட்சிப்படுத்தலில் வழு", +"Token expired. Please reload page." => "அடையாளவில்லை காலாவதியாகிவிட்டது. தயவுசெய்து பக்கத்தை மீள் ஏற்றுக.", +"Files" => "கோப்புகள்", +"Text" => "உரை", +"Images" => "படங்கள்", +"seconds ago" => "செக்கன்களுக்கு முன்", +"1 minute ago" => "1 நிமிடத்திற்கு முன் ", +"%d minutes ago" => "%d நிமிடங்களுக்கு முன்", +"today" => "இன்று", +"yesterday" => "நேற்று", +"%d days ago" => "%d நாட்களுக்கு முன்", +"last month" => "கடந்த மாதம்", +"months ago" => "மாதங்களுக்கு முன்", +"last year" => "கடந்த வருடம்", +"years ago" => "வருடங்களுக்கு முன்", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s இன்னும் இருக்கின்றன. <a href=\"%s\">மேலதிக தகவல்களுக்கு</a> எடுக்க", +"up to date" => "நவீன", +"updates check is disabled" => "இற்றைப்படுத்தலை சரிபார்ப்பதை செயலற்றதாக்குக" +); diff --git a/lib/l10n/th_TH.php b/lib/l10n/th_TH.php index 2aa2ffaba8c..2767ed643a6 100644 --- a/lib/l10n/th_TH.php +++ b/lib/l10n/th_TH.php @@ -12,6 +12,8 @@ "Application is not enabled" => "แอพพลิเคชั่นดังกล่าวยังไม่ได้เปิดใช้งาน", "Authentication error" => "เกิดข้อผิดพลาดในสิทธิ์การเข้าใช้งาน", "Token expired. Please reload page." => "รหัสยืนยันความถูกต้องหมดอายุแล้ว กรุณาโหลดหน้าเว็บใหม่อีกครั้ง", +"Files" => "ไฟล์", +"Text" => "ข้อความ", "seconds ago" => "วินาทีที่ผ่านมา", "1 minute ago" => "1 นาทีมาแล้ว", "%d minutes ago" => "%d นาทีที่ผ่านมา", diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php new file mode 100644 index 00000000000..69067d7ec57 --- /dev/null +++ b/lib/l10n/tr.php @@ -0,0 +1,9 @@ +<?php $TRANSLATIONS = array( +"Help" => "Yardı", +"Personal" => "Kişisel", +"Settings" => "Ayarlar", +"Users" => "Kullanıcılar", +"Authentication error" => "Kimlik doğrulama hatası", +"Files" => "Dosyalar", +"Text" => "Metin" +); diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php index 423aa12b2d7..b08f559595b 100644 --- a/lib/l10n/uk.php +++ b/lib/l10n/uk.php @@ -11,6 +11,8 @@ "Selected files too large to generate zip file." => "Вибрані фали завеликі для генерування zip файлу.", "Application is not enabled" => "Додаток не увімкнений", "Authentication error" => "Помилка автентифікації", +"Files" => "Файли", +"Text" => "Текст", "seconds ago" => "секунди тому", "1 minute ago" => "1 хвилину тому", "%d minutes ago" => "%d хвилин тому", diff --git a/lib/l10n/vi.php b/lib/l10n/vi.php index fc41d69819a..cfc39e5b7a8 100644 --- a/lib/l10n/vi.php +++ b/lib/l10n/vi.php @@ -12,6 +12,9 @@ "Application is not enabled" => "Ứng dụng không được BẬT", "Authentication error" => "Lỗi xác thực", "Token expired. Please reload page." => "Mã Token đã hết hạn. Hãy tải lại trang.", +"Files" => "Các tập tin", +"Text" => "Văn bản", +"Images" => "Hình ảnh", "seconds ago" => "1 giây trước", "1 minute ago" => "1 phút trước", "%d minutes ago" => "%d phút trước", diff --git a/lib/l10n/zh_CN.GB2312.php b/lib/l10n/zh_CN.GB2312.php index 4b0a5e9f4d2..adc5c3bc6a9 100644 --- a/lib/l10n/zh_CN.GB2312.php +++ b/lib/l10n/zh_CN.GB2312.php @@ -12,6 +12,8 @@ "Application is not enabled" => "应用未启用", "Authentication error" => "验证错误", "Token expired. Please reload page." => "会话过期。请刷新页面。", +"Files" => "文件", +"Text" => "文本", "seconds ago" => "秒前", "1 minute ago" => "1 分钟前", "%d minutes ago" => "%d 分钟前", diff --git a/lib/l10n/zh_CN.php b/lib/l10n/zh_CN.php index 8229c77d2dd..6cdfd472510 100644 --- a/lib/l10n/zh_CN.php +++ b/lib/l10n/zh_CN.php @@ -12,6 +12,9 @@ "Application is not enabled" => "不需要程序", "Authentication error" => "认证错误", "Token expired. Please reload page." => "Token 过期,请刷新页面。", +"Files" => "文件", +"Text" => "文本", +"Images" => "图像", "seconds ago" => "几秒前", "1 minute ago" => "1分钟前", "%d minutes ago" => "%d 分钟前", diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php index c9a26a53b2a..3122695033a 100644 --- a/lib/l10n/zh_TW.php +++ b/lib/l10n/zh_TW.php @@ -12,6 +12,8 @@ "Application is not enabled" => "應用程式未啟用", "Authentication error" => "認證錯誤", "Token expired. Please reload page." => "Token 過期. 請重新整理頁面", +"Files" => "檔案", +"Text" => "文字", "seconds ago" => "幾秒前", "1 minute ago" => "1 分鐘前", "%d minutes ago" => "%d 分鐘前", diff --git a/lib/migrate.php b/lib/migrate.php index 611a935ee5d..409d77a1a96 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -66,7 +66,7 @@ class OC_Migrate{ foreach($apps as $app) { $path = OC_App::getAppPath($app) . '/appinfo/migrate.php'; if( file_exists( $path ) ) { - include( $path ); + include $path; } } } @@ -347,7 +347,7 @@ class OC_Migrate{ OC_Log::write( 'migration', 'Zip not found', OC_Log::ERROR ); return false; } - if ( self::$zip->open( $path ) != TRUE ) { + if ( self::$zip->open( $path ) != true ) { OC_Log::write( 'migration', "Failed to open zip file", OC_Log::ERROR ); return false; } @@ -576,7 +576,7 @@ class OC_Migrate{ OC_Log::write('migration', 'createZip() called but $zip and/or $zippath have not been set', OC_Log::ERROR); return false; } - if ( self::$zip->open( self::$zippath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ) !== TRUE ) { + if ( self::$zip->open( self::$zippath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ) !== true ) { OC_Log::write('migration', 'Failed to create the zip with error: '.self::$zip->getStatusString(), OC_Log::ERROR); return false; } else { diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 3c80f319662..32c2cfe6e48 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -76,12 +76,12 @@ class OC_OCSClient{ */ public static function getCategories() { if(OC_Config::getValue('appstoreenabled', true)==false) { - return NULL; + return null; } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { - return NULL; + if($xml==false) { + return null; } $data=simplexml_load_string($xml); @@ -122,8 +122,8 @@ class OC_OCSClient{ $apps=array(); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { - return NULL; + if($xml==false) { + return null; } $data=simplexml_load_string($xml); @@ -156,14 +156,14 @@ class OC_OCSClient{ */ public static function getApplication($id) { if(OC_Config::getValue('appstoreenabled', true)==false) { - return NULL; + return null; } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); - return NULL; + return null; } $data=simplexml_load_string($xml); @@ -194,14 +194,14 @@ class OC_OCSClient{ */ public static function getApplicationDownload($id,$item) { if(OC_Config::getValue('appstoreenabled', true)==false) { - return NULL; + return null; } $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); - return NULL; + return null; } $data=simplexml_load_string($xml); @@ -237,9 +237,9 @@ class OC_OCSClient{ $kbe=array(); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL); - return NULL; + return null; } $data=simplexml_load_string($xml); diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index aba7d2b7620..24a17836f7f 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -47,6 +47,29 @@ namespace OCP; */ class BackgroundJob { /** + * @brief get the execution type of background jobs + * @return string + * + * This method returns the type how background jobs are executed. If the user + * did not select something, the type is ajax. + */ + public static function getExecutionType() { + return \OC_BackgroundJob::getExecutionType(); + } + + /** + * @brief sets the background jobs execution type + * @param $type execution type + * @return boolean + * + * This method sets the execution type of the background jobs. Possible types + * are "none", "ajax", "webcron", "cron" + */ + public static function setExecutionType( $type ) { + return \OC_BackgroundJob::setExecutionType( $type ); + } + + /** * @brief creates a regular task * @param $klass class name * @param $method method name diff --git a/lib/public/share.php b/lib/public/share.php index d27802b52f7..da1c0616390 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -28,6 +28,9 @@ namespace OCP; /** * This class provides the ability for apps to share their content between users. * Apps must create a backend class that implements OCP\Share_Backend and register it with this class. +* +* It provides the following hooks: +* - post_shared */ class Share { @@ -934,10 +937,23 @@ class Share { } else { $fileTarget = null; } + \OC_Hook::emit('OCP\Share', 'post_shared', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'itemTarget' => $itemTarget, + 'parent' => $parent, + 'shareType' => self::$shareTypeGroupUserUnique, + 'shareWith' => $uid, + 'uidOwner' => $uidOwner, + 'permissions' => $permissions, + 'fileSource' => $fileSource, + 'fileTarget' => $fileTarget, + 'id' => $parent + )); // Insert an extra row for the group share if the item or file target is unique for this user if ($itemTarget != $groupItemTarget || (isset($fileSource) && $fileTarget != $groupFileTarget)) { $query->execute(array($itemType, $itemSource, $itemTarget, $parent, self::$shareTypeGroupUserUnique, $uid, $uidOwner, $permissions, time(), $fileSource, $fileTarget)); - \OC_DB::insertid('*PREFIX*share'); + $id = \OC_DB::insertid('*PREFIX*share'); } } if ($parentFolder === true) { @@ -963,6 +979,19 @@ class Share { } $query->execute(array($itemType, $itemSource, $itemTarget, $parent, $shareType, $shareWith, $uidOwner, $permissions, time(), $fileSource, $fileTarget)); $id = \OC_DB::insertid('*PREFIX*share'); + \OC_Hook::emit('OCP\Share', 'post_shared', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'itemTarget' => $itemTarget, + 'parent' => $parent, + 'shareType' => $shareType, + 'shareWith' => $shareWith, + 'uidOwner' => $uidOwner, + 'permissions' => $permissions, + 'fileSource' => $fileSource, + 'fileTarget' => $fileTarget, + 'id' => $id + )); if ($parentFolder === true) { $parentFolders['id'] = $id; // Return parent folder to preserve file target paths for potential children diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php index 6cd6ef78f2f..ea536ef77de 100644 --- a/lib/search/provider/file.php +++ b/lib/search/provider/file.php @@ -2,8 +2,9 @@ class OC_Search_Provider_File extends OC_Search_Provider{ function search($query) { - $files=OC_FileCache::search($query,true); + $files=OC_FileCache::search($query, true); $results=array(); + $l=OC_L10N::get('lib'); foreach($files as $fileData) { $path = $fileData['path']; $mime = $fileData['mimetype']; @@ -13,7 +14,7 @@ class OC_Search_Provider_File extends OC_Search_Provider{ $skip = false; if($mime=='httpd/unix-directory') { $link = OC_Helper::linkTo( 'files', 'index.php', array('dir' => $path)); - $type = 'Files'; + $type = (string)$l->t('Files'); }else{ $link = OC_Helper::linkToRoute( 'download', array('file' => $path)); $mimeBase = $fileData['mimepart']; @@ -22,16 +23,16 @@ class OC_Search_Provider_File extends OC_Search_Provider{ $skip = true; break; case 'text': - $type = 'Text'; + $type = (string)$l->t('Text'); break; case 'image': - $type = 'Images'; + $type = (string)$l->t('Images'); break; default: if($mime=='application/xml') { - $type = 'Text'; + $type = (string)$l->t('Text'); }else{ - $type = 'Files'; + $type = (string)$l->t('Files'); } } } diff --git a/lib/setup.php b/lib/setup.php index 3c92e9c5599..a072e00f91e 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -92,69 +92,27 @@ 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']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; $dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_'; + OC_Config::setValue('dbname', $dbname); OC_Config::setValue('dbhost', $dbhost); OC_Config::setValue('dbtableprefix', $dbtableprefix); - //check if the database user has admin right - $connection = @mysql_connect($dbhost, $dbuser, $dbpass); - if(!$connection) { + try { + self::setupMySQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username); + } catch (Exception $e) { $error[] = array( 'error' => 'MySQL username and/or password not valid', 'hint' => 'You need to enter either an existing account or the administrator.' ); return($error); } - else { - $oldUser=OC_Config::getValue('dbuser', false); - - $query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql - if(mysql_query($query, $connection)) { - //use the admin login data for the new database user - - //add prefix to the mysql user name to prevent collisions - $dbusername=substr('oc_'.$username,0,16); - if($dbusername!=$oldUser) { - //hash the password so we don't need to store the admin config in the config file - $dbpassword=md5(time().$password); - - self::createDBUser($dbusername, $dbpassword, $connection); - - OC_Config::setValue('dbuser', $dbusername); - OC_Config::setValue('dbpassword', $dbpassword); - } - - //create the database - self::createDatabase($dbname, $dbusername, $connection); - } - else { - if($dbuser!=$oldUser) { - OC_Config::setValue('dbuser', $dbuser); - OC_Config::setValue('dbpassword', $dbpass); - } - - //create the database - self::createDatabase($dbname, $dbuser, $connection); - } - - //fill the database if needed - $query="select count(*) from information_schema.tables where table_schema='$dbname' AND table_name = '{$dbtableprefix}users';"; - $result = mysql_query($query,$connection); - if($result) { - $row=mysql_fetch_row($result); - } - if(!$result or $row[0]==0) { - OC_DB::createDbFromStructure('db_structure.xml'); - } - mysql_close($connection); - } } elseif($dbtype == 'pgsql') { $dbuser = $options['dbuser']; @@ -162,82 +120,20 @@ class OC_Setup { $dbname = $options['dbname']; $dbhost = $options['dbhost']; $dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_'; - OC_CONFIG::setValue('dbname', $dbname); - OC_CONFIG::setValue('dbhost', $dbhost); - OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); - - $e_host = addslashes($dbhost); - $e_user = addslashes($dbuser); - $e_password = addslashes($dbpass); - //check if the database user has admin right - $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'"; - $connection = @pg_connect($connection_string); - if(!$connection) { + + OC_Config::setValue('dbname', $dbname); + OC_Config::setValue('dbhost', $dbhost); + OC_Config::setValue('dbtableprefix', $dbtableprefix); + + try { + self::setupPostgreSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username); + } catch (Exception $e) { $error[] = array( 'error' => 'PostgreSQL username and/or password not valid', 'hint' => 'You need to enter either an existing account or the administrator.' ); return $error; } - else { - $e_user = pg_escape_string($dbuser); - //check for roles creation rights in postgresql - $query="SELECT 1 FROM pg_roles WHERE rolcreaterole=TRUE AND rolname='$e_user'"; - $result = pg_query($connection, $query); - if($result and pg_num_rows($result) > 0) { - //use the admin login data for the new database user - - //add prefix to the postgresql user name to prevent collisions - $dbusername='oc_'.$username; - //create a new password so we don't need to store the admin config in the config file - $dbpassword=md5(time()); - - self::pg_createDBUser($dbusername, $dbpassword, $connection); - - OC_CONFIG::setValue('dbuser', $dbusername); - OC_CONFIG::setValue('dbpassword', $dbpassword); - - //create the database - self::pg_createDatabase($dbname, $dbusername, $connection); - } - else { - OC_CONFIG::setValue('dbuser', $dbuser); - OC_CONFIG::setValue('dbpassword', $dbpass); - - //create the database - self::pg_createDatabase($dbname, $dbuser, $connection); - } - - // the connection to dbname=postgres is not needed anymore - pg_close($connection); - - // connect to the ownCloud database (dbname=$dbname) an check if it needs to be filled - $dbuser = OC_CONFIG::getValue('dbuser'); - $dbpass = OC_CONFIG::getValue('dbpassword'); - - $e_host = addslashes($dbhost); - $e_dbname = addslashes($dbname); - $e_user = addslashes($dbuser); - $e_password = addslashes($dbpass); - - $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'"; - $connection = @pg_connect($connection_string); - if(!$connection) { - $error[] = array( - 'error' => 'PostgreSQL username and/or password not valid', - 'hint' => 'You need to enter either an existing account or the administrator.' - ); - } else { - $query = "select count(*) FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1"; - $result = pg_query($connection, $query); - if($result) { - $row = pg_fetch_row($result); - } - if(!$result or $row[0]==0) { - OC_DB::createDbFromStructure('db_structure.xml'); - } - } - } } elseif($dbtype == 'oci') { $dbuser = $options['dbuser']; @@ -246,116 +142,20 @@ class OC_Setup { $dbtablespace = $options['dbtablespace']; $dbhost = isset($options['dbhost'])?$options['dbhost']:''; $dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_'; - OC_CONFIG::setValue('dbname', $dbname); - OC_CONFIG::setValue('dbtablespace', $dbtablespace); - OC_CONFIG::setValue('dbhost', $dbhost); - OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); - - $e_host = addslashes($dbhost); - $e_dbname = addslashes($dbname); - //check if the database user has admin right - if ($e_host == '') { - $easy_connect_string = $e_dbname; // use dbname as easy connect name - } else { - $easy_connect_string = '//'.$e_host.'/'.$e_dbname; - } - $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); - if(!$connection) { - $e = oci_error(); + + OC_Config::setValue('dbname', $dbname); + OC_Config::setValue('dbtablespace', $dbtablespace); + OC_Config::setValue('dbhost', $dbhost); + OC_Config::setValue('dbtableprefix', $dbtableprefix); + + try { + self::setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username); + } catch (Exception $e) { $error[] = array( 'error' => 'Oracle username and/or password not valid', 'hint' => 'You need to enter either an existing account or the administrator.' ); return $error; - } else { - //check for roles creation rights in oracle - - $query="SELECT count(*) FROM user_role_privs, role_sys_privs WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'"; - $stmt = oci_parse($connection, $query); - if (!$stmt) { - $entry='DB Error: "'.oci_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - $result = oci_execute($stmt); - if($result) { - $row = oci_fetch_row($stmt); - } - if($result and $row[0] > 0) { - //use the admin login data for the new database user - - //add prefix to the oracle user name to prevent collisions - $dbusername='oc_'.$username; - //create a new password so we don't need to store the admin config in the config file - $dbpassword=md5(time().$dbpass); - - //oracle passwords are treated as identifiers: - // must start with aphanumeric char - // needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length. - $dbpassword=substr($dbpassword, 0, 30); - - self::oci_createDBUser($dbusername, $dbpassword, $dbtablespace, $connection); - - OC_CONFIG::setValue('dbuser', $dbusername); - OC_CONFIG::setValue('dbname', $dbusername); - OC_CONFIG::setValue('dbpassword', $dbpassword); - - //create the database not neccessary, oracle implies user = schema - //self::oci_createDatabase($dbname, $dbusername, $connection); - } else { - - OC_CONFIG::setValue('dbuser', $dbuser); - OC_CONFIG::setValue('dbname', $dbname); - OC_CONFIG::setValue('dbpassword', $dbpass); - - //create the database not neccessary, oracle implies user = schema - //self::oci_createDatabase($dbname, $dbuser, $connection); - } - - //FIXME check tablespace exists: select * from user_tablespaces - - // the connection to dbname=oracle is not needed anymore - oci_close($connection); - - // connect to the oracle database (schema=$dbuser) an check if the schema needs to be filled - $dbuser = OC_CONFIG::getValue('dbuser'); - //$dbname = OC_CONFIG::getValue('dbname'); - $dbpass = OC_CONFIG::getValue('dbpassword'); - - $e_host = addslashes($dbhost); - $e_dbname = addslashes($dbname); - - if ($e_host == '') { - $easy_connect_string = $e_dbname; // use dbname as easy connect name - } else { - $easy_connect_string = '//'.$e_host.'/'.$e_dbname; - } - $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); - if(!$connection) { - $error[] = array( - 'error' => 'Oracle username and/or password not valid', - 'hint' => 'You need to enter either an existing account or the administrator.' - ); - return $error; - } else { - $query = "SELECT count(*) FROM user_tables WHERE table_name = :un"; - $stmt = oci_parse($connection, $query); - $un = $dbtableprefix.'users'; - oci_bind_by_name($stmt, ':un', $un); - if (!$stmt) { - $entry='DB Error: "'.oci_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - $result = oci_execute($stmt); - - if($result) { - $row = oci_fetch_row($stmt); - } - if(!$result or $row[0]==0) { - OC_DB::createDbFromStructure('db_structure.xml'); - } - } } } else { @@ -376,8 +176,8 @@ class OC_Setup { } if(count($error) == 0) { - OC_Appconfig::setValue('core', 'installedat',microtime(true)); - OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); + OC_Appconfig::setValue('core', 'installedat', microtime(true)); + OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true)); OC_Group::createGroup('admin'); OC_Group::addToGroup($username, 'admin'); @@ -399,7 +199,56 @@ class OC_Setup { return $error; } - public static function createDatabase($name,$user,$connection) { + private static function setupMySQLDatabase($dbhost, $dbuser, $dbpass, $dbtableprefix, $username) { + //check if the database user has admin right + $connection = @mysql_connect($dbhost, $dbuser, $dbpass); + if(!$connection) { + throw new Exception('MySQL username and/or password not valid'); + } + $oldUser=OC_Config::getValue('dbuser', false); + + $query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql + if(mysql_query($query, $connection)) { + //use the admin login data for the new database user + + //add prefix to the mysql user name to prevent collisions + $dbusername=substr('oc_'.$username, 0, 16); + if($dbusername!=$oldUser) { + //hash the password so we don't need to store the admin config in the config file + $dbpassword=md5(time().$password); + + self::createDBUser($dbusername, $dbpassword, $connection); + + OC_Config::setValue('dbuser', $dbusername); + OC_Config::setValue('dbpassword', $dbpassword); + } + + //create the database + self::createMySQLDatabase($dbname, $dbusername, $connection); + } + else { + if($dbuser!=$oldUser) { + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbpassword', $dbpass); + } + + //create the database + self::createMySQLDatabase($dbname, $dbuser, $connection); + } + + //fill the database if needed + $query="select count(*) from information_schema.tables where table_schema='$dbname' AND table_name = '{$dbtableprefix}users';"; + $result = mysql_query($query, $connection); + if($result) { + $row=mysql_fetch_row($result); + } + if(!$result or $row[0]==0) { + OC_DB::createDbFromStructure('db_structure.xml'); + } + mysql_close($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); @@ -421,7 +270,73 @@ class OC_Setup { $result = mysql_query($query, $connection); } - public static function pg_createDatabase($name,$user,$connection) { + private static function setupPostgreSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) { + $e_host = addslashes($dbhost); + $e_user = addslashes($dbuser); + $e_password = addslashes($dbpass); + + //check if the database user has admin rights + $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'"; + $connection = @pg_connect($connection_string); + if(!$connection) { + throw new Exception('PostgreSQL username and/or password not valid'); + } + $e_user = pg_escape_string($dbuser); + //check for roles creation rights in postgresql + $query="SELECT 1 FROM pg_roles WHERE rolcreaterole=TRUE AND rolname='$e_user'"; + $result = pg_query($connection, $query); + if($result and pg_num_rows($result) > 0) { + //use the admin login data for the new database user + + //add prefix to the postgresql user name to prevent collisions + $dbusername='oc_'.$username; + //create a new password so we don't need to store the admin config in the config file + $dbpassword=md5(time()); + + self::pg_createDBUser($dbusername, $dbpassword, $connection); + + OC_Config::setValue('dbuser', $dbusername); + OC_Config::setValue('dbpassword', $dbpassword); + + //create the database + self::pg_createDatabase($dbname, $dbusername, $connection); + } + else { + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbpassword', $dbpass); + + //create the database + self::pg_createDatabase($dbname, $dbuser, $connection); + } + + // the connection to dbname=postgres is not needed anymore + pg_close($connection); + + // connect to the ownCloud database (dbname=$dbname) and check if it needs to be filled + $dbuser = OC_Config::getValue('dbuser'); + $dbpass = OC_Config::getValue('dbpassword'); + + $e_host = addslashes($dbhost); + $e_dbname = addslashes($dbname); + $e_user = addslashes($dbuser); + $e_password = addslashes($dbpass); + + $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'"; + $connection = @pg_connect($connection_string); + if(!$connection) { + throw new Exception('PostgreSQL username and/or password not valid'); + } + $query = "select count(*) FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1"; + $result = pg_query($connection, $query); + if($result) { + $row = pg_fetch_row($result); + } + if(!$result or $row[0]==0) { + OC_DB::createDbFromStructure('db_structure.xml'); + } + } + + 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); @@ -477,6 +392,106 @@ class OC_Setup { } } } + + private static function setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username) { + $e_host = addslashes($dbhost); + $e_dbname = addslashes($dbname); + //check if the database user has admin right + if ($e_host == '') { + $easy_connect_string = $e_dbname; // use dbname as easy connect name + } else { + $easy_connect_string = '//'.$e_host.'/'.$e_dbname; + } + $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); + if(!$connection) { + $e = oci_error(); + throw new Exception('Oracle username and/or password not valid'); + } + //check for roles creation rights in oracle + + $query="SELECT count(*) FROM user_role_privs, role_sys_privs WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'"; + $stmt = oci_parse($connection, $query); + if (!$stmt) { + $entry='DB Error: "'.oci_last_error($connection).'"<br />'; + $entry.='Offending command was: '.$query.'<br />'; + echo($entry); + } + $result = oci_execute($stmt); + if($result) { + $row = oci_fetch_row($stmt); + } + if($result and $row[0] > 0) { + //use the admin login data for the new database user + + //add prefix to the oracle user name to prevent collisions + $dbusername='oc_'.$username; + //create a new password so we don't need to store the admin config in the config file + $dbpassword=md5(time().$dbpass); + + //oracle passwords are treated as identifiers: + // must start with aphanumeric char + // needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length. + $dbpassword=substr($dbpassword, 0, 30); + + self::oci_createDBUser($dbusername, $dbpassword, $dbtablespace, $connection); + + OC_Config::setValue('dbuser', $dbusername); + OC_Config::setValue('dbname', $dbusername); + OC_Config::setValue('dbpassword', $dbpassword); + + //create the database not neccessary, oracle implies user = schema + //self::oci_createDatabase($dbname, $dbusername, $connection); + } else { + + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbname', $dbname); + OC_Config::setValue('dbpassword', $dbpass); + + //create the database not neccessary, oracle implies user = schema + //self::oci_createDatabase($dbname, $dbuser, $connection); + } + + //FIXME check tablespace exists: select * from user_tablespaces + + // the connection to dbname=oracle is not needed anymore + oci_close($connection); + + // connect to the oracle database (schema=$dbuser) an check if the schema needs to be filled + $dbuser = OC_Config::getValue('dbuser'); + //$dbname = OC_Config::getValue('dbname'); + $dbpass = OC_Config::getValue('dbpassword'); + + $e_host = addslashes($dbhost); + $e_dbname = addslashes($dbname); + + if ($e_host == '') { + $easy_connect_string = $e_dbname; // use dbname as easy connect name + } else { + $easy_connect_string = '//'.$e_host.'/'.$e_dbname; + } + $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); + if(!$connection) { + throw new Exception('Oracle username and/or password not valid'); + } + $query = "SELECT count(*) FROM user_tables WHERE table_name = :un"; + $stmt = oci_parse($connection, $query); + $un = $dbtableprefix.'users'; + oci_bind_by_name($stmt, ':un', $un); + if (!$stmt) { + $entry='DB Error: "'.oci_last_error($connection).'"<br />'; + $entry.='Offending command was: '.$query.'<br />'; + echo($entry); + } + $result = oci_execute($stmt); + + if($result) { + $row = oci_fetch_row($stmt); + } + if(!$result or $row[0]==0) { + OC_DB::createDbFromStructure('db_structure.xml'); + } + } + /** * * @param String $name diff --git a/lib/streamwrappers.php b/lib/streamwrappers.php index 1e5b19a11f0..63b795f4c4d 100644 --- a/lib/streamwrappers.php +++ b/lib/streamwrappers.php @@ -6,7 +6,7 @@ class OC_FakeDirStream{ private $index; public function dir_opendir($path,$options) { - $this->name=substr($path,strlen('fakedir://')); + $this->name=substr($path, strlen('fakedir://')); $this->index=0; if(!isset(self::$dirs[$this->name])) { self::$dirs[$this->name]=array(); @@ -223,7 +223,7 @@ class OC_CloseStreamWrapper{ private $source; private static $open=array(); public function stream_open($path, $mode, $options, &$opened_path) { - $path=substr($path,strlen('close://')); + $path=substr($path, strlen('close://')); $this->path=$path; $this->source=fopen($path,$mode); if(is_resource($this->source)) { @@ -279,7 +279,7 @@ class OC_CloseStreamWrapper{ } public function url_stat($path) { - $path=substr($path,strlen('close://')); + $path=substr($path, strlen('close://')); if(file_exists($path)) { return stat($path); }else{ @@ -295,7 +295,7 @@ class OC_CloseStreamWrapper{ } public function unlink($path) { - $path=substr($path,strlen('close://')); + $path=substr($path, strlen('close://')); return unlink($path); } } diff --git a/lib/template.php b/lib/template.php index 1c529932a30..972d75807c7 100644 --- a/lib/template.php +++ b/lib/template.php @@ -405,7 +405,7 @@ class OC_Template{ // Execute the template ob_start(); - include( $this->template ); // <-- we have to use include because we pass $_! + include $this->template; // <-- we have to use include because we pass $_! $data = ob_get_contents(); @ob_end_clean(); @@ -430,7 +430,7 @@ class OC_Template{ // Include ob_start(); - include( $this->path.$file.'.php' ); + include $this->path.$file.'.php'; $data = ob_get_contents(); @ob_end_clean(); diff --git a/lib/templatelayout.php b/lib/templatelayout.php index 78893457f47..c3da172a7c1 100644 --- a/lib/templatelayout.php +++ b/lib/templatelayout.php @@ -12,7 +12,7 @@ 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) { + if(in_array(OC_APP::getCurrentApp(), array('settings','admin','help'))!==false) { $this->assign('bodyid','body-settings', false); }else{ $this->assign('bodyid','body-user', false); @@ -38,7 +38,7 @@ class OC_TemplateLayout extends OC_Template { foreach(OC_App::getEnabledApps() as $app) { $apps_paths[$app] = OC_App::getAppWebPath($app); } - $this->assign( 'apps_paths', str_replace('\\/', '/',json_encode($apps_paths)),false ); // Ugly unescape slashes waiting for better solution + $this->assign( 'apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) { OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); diff --git a/lib/updater.php b/lib/updater.php index cb22da4f906..f55e55985d9 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -29,8 +29,8 @@ class OC_Updater{ * Check if a new version is available */ public static function check() { - OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); - if(OC_Appconfig::getValue('core', 'installedat','')=='') OC_Appconfig::setValue('core', 'installedat',microtime(true)); + OC_Appconfig::setValue('core', 'lastupdatedat', 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(); @@ -52,7 +52,7 @@ class OC_Updater{ ) ); $xml=@file_get_contents($url, 0, $ctx); - if($xml==FALSE) { + if($xml==false) { return array(); } $data=@simplexml_load_string($xml); @@ -72,7 +72,7 @@ class OC_Updater{ if(OC_Config::getValue('updatechecker', true)==true) { $data=OC_Updater::check(); if(isset($data['version']) and $data['version']<>'') { - $txt='<span style="color:#AA0000; font-weight:bold;">'.$l->t('%s is available. Get <a href="%s">more information</a>',array($data['versionstring'], $data['web'])).'</span>'; + $txt='<span style="color:#AA0000; font-weight:bold;">'.$l->t('%s is available. Get <a href="%s">more information</a>', array($data['versionstring'], $data['web'])).'</span>'; }else{ $txt=$l->t('up to date'); } diff --git a/lib/user.php b/lib/user.php index 77bfe0de92a..064fcbad96f 100644 --- a/lib/user.php +++ b/lib/user.php @@ -120,11 +120,11 @@ class OC_User { * setup the configured backends in config.php */ public static function setupBackends() { - $backends=OC_Config::getValue('user_backends',array()); + $backends=OC_Config::getValue('user_backends', array()); foreach($backends as $i=>$config) { $class=$config['class']; $arguments=$config['arguments']; - if(class_exists($class) and array_search($i,self::$_setupedBackends)===false) { + if(class_exists($class) and array_search($i, self::$_setupedBackends)===false) { // make a reflection object $reflectionObj = new ReflectionClass($class); @@ -491,8 +491,8 @@ class OC_User { unset($_COOKIE["oc_username"]); unset($_COOKIE["oc_token"]); unset($_COOKIE["oc_remember_login"]); - setcookie("oc_username", NULL, -1); - setcookie("oc_token", NULL, -1); - setcookie("oc_remember_login", NULL, -1); + setcookie("oc_username", null, -1); + setcookie("oc_token", null, -1); + setcookie("oc_remember_login", null, -1); } } diff --git a/lib/util.php b/lib/util.php index 5771b89f265..4ca84ba75af 100755 --- a/lib/util.php +++ b/lib/util.php @@ -34,7 +34,7 @@ class OC_Util { $CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ); //first set up the local "root" storage if(!self::$rootMounted) { - OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$CONFIG_DATADIRECTORY),'/'); + OC_Filesystem::mount('OC_Filestorage_Local', array('datadir'=>$CONFIG_DATADIRECTORY),'/'); self::$rootMounted=true; } @@ -47,27 +47,13 @@ class OC_Util { } //jail the user into his "home" directory OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $user_root), $user); - OC_Filesystem::init($user_dir); + OC_Filesystem::init($user_dir, $user); $quotaProxy=new OC_FileProxy_Quota(); $fileOperationProxy = new OC_FileProxy_FileOperations(); OC_FileProxy::register($quotaProxy); OC_FileProxy::register($fileOperationProxy); // Load personal mount config - if (is_file($user_root.'/mount.php')) { - $mountConfig = include($user_root.'/mount.php'); - if (isset($mountConfig['user'][$user])) { - foreach ($mountConfig['user'][$user] as $mountPoint => $options) { - OC_Filesystem::mount($options['class'], $options['options'], $mountPoint); - } - } - - $mtime=filemtime($user_root.'/mount.php'); - $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0); - if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated - OC_FileCache::triggerUpdate($user); - OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime); - } - } + self::loadUserMountPoints($user); OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $user_dir)); } } @@ -76,6 +62,27 @@ class OC_Util { OC_Filesystem::tearDown(); self::$fsSetup=false; } + + public static function loadUserMountPoints($user) { + $user_dir = '/'.$user.'/files'; + $user_root = OC_User::getHome($user); + $userdirectory = $user_root . '/files'; + if (is_file($user_root.'/mount.php')) { + $mountConfig = include $user_root.'/mount.php'; + if (isset($mountConfig['user'][$user])) { + foreach ($mountConfig['user'][$user] as $mountPoint => $options) { + OC_Filesystem::mount($options['class'], $options['options'], $mountPoint); + } + } + + $mtime=filemtime($user_root.'/mount.php'); + $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0); + if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated + OC_FileCache::triggerUpdate($user); + OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime); + } + } + } /** * get the current installed version of ownCloud @@ -162,8 +169,8 @@ class OC_Util { $offset=$clientTimeZone-$systemTimeZone; $timestamp=$timestamp+$offset*60; } - $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; - return date($timeformat,$timestamp); + $l=OC_L10N::get('lib'); + return $l->l($dateOnly ? 'date' : 'datetime', $timestamp); } /** @@ -289,7 +296,10 @@ class OC_Util { $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.'); + $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.'); $web_server_restart= false; @@ -391,7 +401,7 @@ class OC_Util { * If not, the user will be shown a password verification page */ public static function verifyUser() { - if(OC_Config::getValue('enhancedauth', true) === true) { + if(OC_Config::getValue('enhancedauth', false) === true) { // Check password to set session if(isset($_POST['password'])) { if (OC_User::login(OC_User::getUser(), $_POST["password"] ) === true) { @@ -412,12 +422,12 @@ class OC_Util { * @return bool */ public static function isUserVerified() { - if(OC_Config::getValue('enhancedauth', true) === true) { + if(OC_Config::getValue('enhancedauth', false) === true) { if(!isset($_SESSION['verifiedLogin']) OR $_SESSION['verifiedLogin'] < time()) { return false; } - return true; } + return true; } /** @@ -449,7 +459,7 @@ class OC_Util { * @return string */ public static function getInstanceId() { - $id=OC_Config::getValue('instanceid',null); + $id=OC_Config::getValue('instanceid', null); if(is_null($id)) { $id=uniqid(); OC_Config::setValue('instanceid',$id); @@ -572,6 +582,11 @@ class OC_Util { // creating a test file $testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename; + + if(file_exists($testfile)){// already running this test, possible recursive call + return false; + } + $fp = @fopen($testfile, 'w'); @fwrite($fp, $testcontent); @fclose($fp); @@ -604,14 +619,14 @@ class OC_Util { // Try to use openssl_random_pseudo_bytes if(function_exists('openssl_random_pseudo_bytes')) { $pseudo_byte = bin2hex(openssl_random_pseudo_bytes($length, $strong)); - if($strong == TRUE) { + if($strong == true) { return substr($pseudo_byte, 0, $length); // Truncate it to match the length } } // Try to use /dev/urandom $fp = @file_get_contents('/dev/urandom', false, null, 0, $length); - if ($fp !== FALSE) { + if ($fp !== false) { $string = substr(bin2hex($fp), 0, $length); return $string; } @@ -638,14 +653,14 @@ class OC_Util { // Check openssl_random_pseudo_bytes if(function_exists('openssl_random_pseudo_bytes')) { openssl_random_pseudo_bytes(1, $strong); - if($strong == TRUE) { + if($strong == true) { return true; } } // Check /dev/urandom $fp = @file_get_contents('/dev/urandom', false, null, 0, 1); - if ($fp !== FALSE) { + if ($fp !== false) { return true; } diff --git a/lib/vcategories.php b/lib/vcategories.php index 6b1d6a316f1..ba6569a244d 100644 --- a/lib/vcategories.php +++ b/lib/vcategories.php @@ -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 b5a04b4bf65..2ccf8eda685 100644 --- a/lib/vobject.php +++ b/lib/vobject.php @@ -62,7 +62,7 @@ class OC_VObject{ foreach($value as &$i ) { $i = implode("\\\\;", explode(';', $i)); } - return implode(';',$value); + return implode(';', $value); } /** @@ -71,15 +71,15 @@ class OC_VObject{ * @return array */ public static function unescapeSemicolons($value) { - $array = explode(';',$value); + $array = explode(';', $value); for($i=0;$i<count($array);$i++) { - if(substr($array[$i],-2,2)=="\\\\") { + if(substr($array[$i], -2, 2)=="\\\\") { if(isset($array[$i+1])) { - $array[$i] = substr($array[$i],0,count($array[$i])-2).';'.$array[$i+1]; + $array[$i] = substr($array[$i], 0, count($array[$i])-2).';'.$array[$i+1]; unset($array[$i+1]); } else{ - $array[$i] = substr($array[$i],0,count($array[$i])-2).';'; + $array[$i] = substr($array[$i], 0, count($array[$i])-2).';'; } $i = $i - 1; } @@ -127,8 +127,8 @@ class OC_VObject{ } public function setUID() { - $uid = substr(md5(rand().time()),0,10); - $this->vobject->add('UID',$uid); + $uid = substr(md5(rand().time()), 0, 10); + $this->vobject->add('UID', $uid); } public function setString($name, $string) { |