This commit is contained in:
Bart Visscher 2012-08-29 08:38:33 +02:00
Родитель 76bc4753e9
Коммит 52f2e7112e
57 изменённых файлов: 322 добавлений и 326 удалений

Просмотреть файл

@ -100,7 +100,7 @@ class OC_Appconfig{
return $default;
}
}
/**
* @brief check if a key is set in the appconfig
* @param string $app
@ -111,7 +111,7 @@ class OC_Appconfig{
$exists = self::getKeys( $app );
return in_array( $key, $exists );
}
/**
* @brief sets a value in the appconfig
* @param $app app
@ -163,7 +163,7 @@ class OC_Appconfig{
return true;
}
/**
* get multiply values, either the app or key can be used as wildcard by setting it to false
* @param app

Просмотреть файл

@ -28,7 +28,7 @@ abstract class OC_Archive{
return new OC_Archive_TAR($path);
}
}
abstract function __construct($source);
/**
* add an empty folder to the archive

Просмотреть файл

@ -14,7 +14,7 @@ class OC_Archive_TAR extends OC_Archive{
const BZIP=2;
private $fileList;
/**
* @var Archive_Tar tar
*/
@ -127,7 +127,7 @@ class OC_Archive_TAR extends OC_Archive{
}
return null;
}
/**
* get the uncompressed size of a file in the archive
* @param string path
@ -254,7 +254,7 @@ class OC_Archive_TAR extends OC_Archive{
return false;
}
}
/**
* remove a file or folder from the archive
* @param string path

Просмотреть файл

@ -12,7 +12,7 @@ class OC_Archive_ZIP extends OC_Archive{
*/
private $zip=null;
private $path;
function __construct($source){
$this->path=$source;
$this->zip=new ZipArchive();

Просмотреть файл

@ -22,7 +22,7 @@
/**
* This class does the dirty work.
*
*
* TODO: locking in doAllSteps
*/
class OC_BackgroundJob_Worker{
@ -56,7 +56,7 @@ class OC_BackgroundJob_Worker{
OC_BackgroundJob_QueuedTask::delete( $task['id'] );
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
}
return true;
}
@ -70,7 +70,7 @@ class OC_BackgroundJob_Worker{
*/
public static function doNextStep(){
$laststep = OC_Appconfig::getValue( 'core', 'backgroundjobs_step', 'regular_tasks' );
if( $laststep == 'regular_tasks' ){
// get last app
$lasttask = OC_Appconfig::getValue( 'core', 'backgroundjobs_task', '' );
@ -79,7 +79,7 @@ class OC_BackgroundJob_Worker{
$regular_tasks = OC_BackgroundJob_RegularTask::all();
ksort( $regular_tasks );
$done = false;
// search for next background job
foreach( $regular_tasks as $key => $value ){
if( strcmp( $key, $lasttask ) > 0 ){
@ -112,7 +112,7 @@ class OC_BackgroundJob_Worker{
OC_Appconfig::setValue( 'core', 'backgroundjobs_task', '' );
}
}
return true;
}
}

Просмотреть файл

@ -239,7 +239,7 @@ class OC{
OC_Util::addScript( 'backgroundjobs' );
}
}
OC_Util::addStyle( "styles" );
OC_Util::addStyle( "multiselect" );
OC_Util::addStyle( "jquery-ui-1.8.16.custom" );
@ -473,7 +473,7 @@ class OC{
// Someone wants to log in :
} elseif (OC::tryFormLogin()) {
$error = true;
// The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
} elseif (OC::tryBasicAuthLogin()) {
$error = true;

Просмотреть файл

@ -38,7 +38,7 @@ class OC_Cache {
if (!self::$global_cache_fast && function_exists('apc_store')) {
self::$global_cache_fast = new OC_Cache_APC(true);
}
self::$global_cache = new OC_Cache_FileGlobal();
if (self::$global_cache_fast) {
self::$global_cache = new OC_Cache_Broker(self::$global_cache_fast, self::$global_cache);
@ -67,7 +67,7 @@ class OC_Cache {
if (!self::$user_cache_fast && function_exists('apc_store')) {
self::$user_cache_fast = new OC_Cache_APC();
}
self::$user_cache = new OC_Cache_File();
if (self::$user_cache_fast) {
self::$user_cache = new OC_Cache_Broker(self::$user_cache_fast, self::$user_cache);

Просмотреть файл

@ -45,4 +45,4 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
}
}
}
}
}

Просмотреть файл

@ -203,4 +203,3 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
return $props;
}
}

Просмотреть файл

@ -126,4 +126,3 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
}
}

Просмотреть файл

@ -42,7 +42,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
// pure sql. MySQL's non-standard string concatination prevents us
// from doing this though.
// NOTE: SQLite requires time() to be inserted directly. That's ugly
// but otherwise reading locks from SQLite Databases will return
// but otherwise reading locks from SQLite Databases will return
// nothing
$query = 'SELECT * FROM `*PREFIX*locks` WHERE `userid` = ? AND (`created` + `timeout`) > '.time().' AND (( `uri` = ?)';
$params = array(OC_User::getUser(),$uri);
@ -75,7 +75,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
$stmt = OC_DB::prepare( $query );
$result = $stmt->execute( $params );
$lockList = array();
while( $row = $result->fetchRow()){
@ -114,7 +114,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
foreach($locks as $lock) {
if ($lock->token == $lockInfo->token) $exists = true;
}
if ($exists) {
$query = OC_DB::prepare( 'UPDATE `*PREFIX*locks` SET `owner` = ?, `timeout` = ?, `scope` = ?, `depth` = ?, `uri` = ?, `created` = ? WHERE `userid` = ? AND `token` = ?' );
$result = $query->execute( array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,OC_User::getUser(),$lockInfo->token));

Просмотреть файл

@ -80,9 +80,9 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
$oldPath = $this->path;
OC_Filesystem::rename($this->path,$newPath);
$this->path = $newPath;
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ? WHERE `userid` = ? AND `propertypath` = ?' );
$query->execute( array( $newPath,OC_User::getUser(), $oldPath ));
@ -123,8 +123,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
}
/**
* sets the last modification time of the file (mtime) to the value given
/**
* sets the last modification time of the file (mtime) to the value given
* in the second parameter or to now if the second param is empty.
* Even if the modification time is set to a custom value the access time is set to now.
*/
@ -195,7 +195,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
if(count($properties) == 0){
return $this->property_cache;
}
$props = array();
foreach($properties as $property) {
if (isset($this->property_cache[$property])) $props[$property] = $this->property_cache[$property];

Просмотреть файл

@ -27,7 +27,7 @@
class OC_DB {
const BACKEND_PDO=0;
const BACKEND_MDB2=1;
static private $connection; //the prefered connection to use, either PDO or MDB2
static private $backend=null;
static private $MDB2=false;
@ -55,7 +55,7 @@ class OC_DB {
}
return self::BACKEND_MDB2;
}
/**
* @brief connects to the database
* @returns true if connection can be established or nothing (die())
@ -104,7 +104,7 @@ class OC_DB {
}
$opts = array();
$datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' );
// do nothing if the connection already has been established
if(!self::$PDO){
// Add the dsn according to the database type
@ -158,7 +158,7 @@ class OC_DB {
}
return true;
}
/**
* connect to the database using mdb2
*/
@ -234,10 +234,10 @@ class OC_DB {
}
break;
}
// Try to establish connection
self::$MDB2 = MDB2::factory( $dsn, $options );
// Die if we could not connect
if( PEAR::isError( self::$MDB2 )){
echo( '<b>can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')</center>');
@ -245,11 +245,11 @@ class OC_DB {
OC_Log::write('core',self::$MDB2->getMessage(),OC_Log::FATAL);
die( $error );
}
// We always, really always want associative arrays
self::$MDB2->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
// we are done. great!
return true;
}
@ -262,7 +262,7 @@ class OC_DB {
* SQL query via MDB2 prepare(), needs to be execute()'d!
*/
static public function prepare( $query , $limit=null, $offset=null ){
if (!is_null($limit) && $limit != -1) {
if (self::$backend == self::BACKEND_MDB2) {
//MDB2 uses or emulates limits & offset internally
@ -394,7 +394,7 @@ class OC_DB {
// read file
$content = file_get_contents( $file );
// Make changes and save them to an in-memory file
$file2 = 'static://db_scheme';
$content = str_replace( '*dbname*', $CONFIG_DBNAME, $content );
@ -414,7 +414,7 @@ class OC_DB {
// Try to create tables
$definition = self::$schema->parseDatabaseDefinitionFile( $file2 );
//clean up memory
unlink( $file2 );
@ -427,7 +427,7 @@ class OC_DB {
$oldname = $definition['name'];
$definition['name']=OC_Config::getValue( "dbuser", $oldname );
}
$ret=self::$schema->createDatabase( $definition );
// Die in case something went wrong
@ -438,7 +438,7 @@ class OC_DB {
return true;
}
/**
* @brief update the database scheme
* @param $file file to read structure from
@ -451,7 +451,7 @@ class OC_DB {
// read file
$content = file_get_contents( $file );
$previousSchema = self::$schema->getDefinitionFromDatabase();
if (PEAR::isError($previousSchema)) {
$error = $previousSchema->getMessage();
@ -475,10 +475,10 @@ class OC_DB {
*/
file_put_contents( $file2, $content );
$op = self::$schema->updateDatabase($file2, $previousSchema, array(), false);
//clean up memory
unlink( $file2 );
if (PEAR::isError($op)) {
$error = $op->getMessage();
$detail = $op->getDebugInfo();
@ -528,7 +528,7 @@ class OC_DB {
self::$prefix=OC_Config::getValue( "dbtableprefix", "oc_" );
}
$prefix = self::$prefix;
// differences in escaping of table names ('`' for mysql) and getting the current timestamp
if( $type == 'sqlite' || $type == 'sqlite3' ){
$query = str_replace( '`', '"', $query );
@ -547,7 +547,7 @@ class OC_DB {
return $query;
}
/**
* @brief drop a table
* @param string $tableNamme the table to drop
@ -557,7 +557,7 @@ class OC_DB {
self::$MDB2->loadModule('Manager');
self::$MDB2->dropTable($tableName);
}
/**
* remove all tables defined in a database structure xml file
* @param string $file the xml file describing the tables
@ -578,7 +578,7 @@ class OC_DB {
// get the tables
$definition = self::$schema->parseDatabaseDefinitionFile( $file2 );
// Delete our temporary file
unlink( $file2 );
$tables=array_keys($definition['tables']);
@ -586,7 +586,7 @@ class OC_DB {
self::dropTable($table);
}
}
/**
* @brief replaces the owncloud tables with a new set
* @param $file string path to the MDB2 xml db export file
@ -596,20 +596,20 @@ class OC_DB {
self::beginTransaction();
// Delete the old tables
self::removeDBStructure( OC::$SERVERROOT . '/db_structure.xml' );
foreach($apps as $app){
$path = OC_App::getAppPath($app).'/appinfo/database.xml';
if(file_exists($path)){
self::removeDBStructure( $path );
self::removeDBStructure( $path );
}
}
// Create new tables
self::createDBFromStructure( $file );
self::commit();
}
/**
* Start a transaction
*/
@ -660,7 +660,7 @@ class PDOStatementWrapper{
public function __construct($statement){
$this->statement=$statement;
}
/**
* make execute return the result instead of a bool
*/
@ -677,7 +677,7 @@ class PDOStatementWrapper{
return false;
}
}
/**
* provide numRows
*/
@ -690,21 +690,21 @@ class PDOStatementWrapper{
return $this->statement->rowCount();
}
}
/**
* provide an alias for fetch
*/
public function fetchRow(){
return $this->statement->fetch();
}
/**
* pass all other function directly to the PDOStatement
*/
public function __call($name,$arguments){
return call_user_func_array(array($this->statement,$name),$arguments);
}
/**
* Provide a simple fetchOne.
* fetch single column from the next row
@ -714,4 +714,3 @@ class PDOStatementWrapper{
return $this->statement->fetchColumn($colnum);
}
}

Просмотреть файл

@ -30,7 +30,7 @@
class OC_EventSource{
private $fallback;
private $fallBackId=0;
public function __construct(){
@ob_end_clean();
header('Cache-Control: no-cache');

Просмотреть файл

@ -76,14 +76,14 @@ class OC_FileCache{
self::update($id,$data);
return;
}
// add parent directory to the file cache if it does not exist yet.
if ($parent == -1 && $fullpath != $root) {
$parentDir = substr(dirname($path), 0, strrpos(dirname($path), DIRECTORY_SEPARATOR));
self::scanFile($parentDir);
$parent = self::getParentId($fullpath);
}
if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
OC_FileCache_Cached::$savedData[$fullpath]=$data;
return;
@ -136,7 +136,7 @@ class OC_FileCache{
$queryParts[]='`mimepart`=?';
}
$arguments[]=$id;
$sql = 'UPDATE `*PREFIX*fscache` SET '.implode(' , ',$queryParts).' WHERE `id`=?';
$query=OC_DB::prepare($sql);
$result=$query->execute($arguments);
@ -192,14 +192,14 @@ class OC_FileCache{
}
$query=OC_DB::prepare('DELETE FROM `*PREFIX*fscache` WHERE `path_hash`=?');
$query->execute(array(md5($root.$path)));
//delete everything inside the folder
$query=OC_DB::prepare('DELETE FROM `*PREFIX*fscache` WHERE `path` LIKE ?');
$query->execute(array($root.$path.'/%'));
OC_Cache::remove('fileid/'.$root.$path);
}
/**
* return array of filenames matching the querty
* @param string $query
@ -277,14 +277,14 @@ class OC_FileCache{
if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$fullPath)){
return $cache->get('fileid/'.$fullPath);
}
$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);
return -1;
}
$result=$result->fetchRow();
if(is_array($result)){
$id=$result['id'];
@ -294,10 +294,10 @@ class OC_FileCache{
if($cache=OC_Cache::getUserCache(true)){
$cache->set('fileid/'.$fullPath,$id);
}
return $id;
}
/**
* get the file path from the id, relative to the home folder of the user
* @param int id
@ -331,7 +331,7 @@ class OC_FileCache{
return self::getId(dirname($path),'');
}
}
/**
* adjust the size of the parent folders
* @param string $path
@ -390,7 +390,7 @@ class OC_FileCache{
}
}
}
OC_FileCache_Update::cleanFolder($path,$root);
self::increaseSize($path,$totalSize,$root);
}

Просмотреть файл

@ -12,7 +12,7 @@
*/
class OC_FileCache_Cached{
public static $savedData=array();
public static function get($path,$root=false){
if($root===false){
$root=OC_Filesystem::getRoot();

Просмотреть файл

@ -42,7 +42,7 @@ class OC_FileCache_Update{
return true;
}
}
/**
* delete non existing files from the cache
*/
@ -148,7 +148,7 @@ class OC_FileCache_Update{
}
$mimetype=$view->getMimeType($path);
$size=0;
$cached=OC_FileCache_Cached::get($path,$root);
$cachedSize=isset($cached['size'])?$cached['size']:0;

Просмотреть файл

@ -43,7 +43,7 @@
class OC_FileProxy{
private static $proxies=array();
public static $enabled=true;
/**
* fallback function when a proxy operation is not implemented
* @param string $function the name of the proxy operation
@ -58,7 +58,7 @@ class OC_FileProxy{
return $arguments[1];
}
}
/**
* register a proxy to be used
* @param OC_FileProxy $proxy
@ -66,7 +66,7 @@ class OC_FileProxy{
public static function register($proxy){
self::$proxies[]=$proxy;
}
public static function getProxies($operation){
$proxies=array();
foreach(self::$proxies as $proxy){

Просмотреть файл

@ -27,7 +27,7 @@
class OC_FileProxy_Quota extends OC_FileProxy{
private $userQuota=-1;
/**
* get the quota for the current user
* @return int
@ -46,9 +46,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
$this->userQuota=OC_Helper::computerFileSize($userQuota);
}
return $this->userQuota;
}
/**
* get the free space in the users home folder
* @return int
@ -69,7 +69,7 @@ class OC_FileProxy_Quota extends OC_FileProxy{
}
return $totalSpace-$usedSpace;
}
public function postFree_space($path,$space){
$free=$this->getFreeSpace();
if($free==0){

Просмотреть файл

@ -406,9 +406,9 @@ class OC_Files {
//check for write permissions
if(is_writable(OC::$SERVERROOT.'/.htaccess')) {
file_put_contents(OC::$SERVERROOT.'/.htaccess', $htaccess);
return OC_Helper::computerFileSize($size);
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); }
return false;
}

Просмотреть файл

@ -21,11 +21,11 @@
*/
/**
* Storage backend class for providing common filesystem operation methods
* Storage backend class for providing common filesystem operation methods
* which are not storage-backend specific.
*
* OC_Filestorage_Common is never used directly; it is extended by all other
* storage backends, where its methods may be overridden, and additional
* storage backends, where its methods may be overridden, and additional
* (backend-specific) methods are defined.
*
* Some OC_Filestorage_Common methods call functions which are first defined
@ -115,71 +115,71 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
* @param $empty Flag indicating whether directory will be emptied
* @returns true/false
*
* @note By default the directory specified by $directory will be
* @note By default the directory specified by $directory will be
* deleted together with its contents. To avoid this set $empty to true
*/
public function deleteAll( $directory, $empty = false ) {
// strip leading slash
if( substr( $directory, 0, 1 ) == "/" ) {
$directory = substr( $directory, 1 );
}
// strip trailing slash
if( substr( $directory, -1) == "/" ) {
$directory = substr( $directory, 0, -1 );
}
if ( !$this->file_exists( \OCP\USER::getUser() . '/' . $directory ) || !$this->is_dir( \OCP\USER::getUser() . '/' . $directory ) ) {
return false;
} elseif( !$this->is_readable( \OCP\USER::getUser() . '/' . $directory ) ) {
return false;
} else {
$directoryHandle = $this->opendir( \OCP\USER::getUser() . '/' . $directory );
while ( $contents = readdir( $directoryHandle ) ) {
if ( $contents != '.' && $contents != '..') {
$path = $directory . "/" . $contents;
if ( $this->is_dir( $path ) ) {
deleteAll( $path );
} else {
$this->unlink( \OCP\USER::getUser() .'/' . $path ); // TODO: make unlink use same system path as is_dir
}
}
}
//$this->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
if ( $empty == false ) {
if ( !$this->rmdir( $directory ) ) {
return false;
}
}
return true;
}
}
public function getMimeType($path){
if(!$this->file_exists($path)){

Просмотреть файл

@ -31,11 +31,11 @@ class OC_Filestorage_CommonTest extends OC_Filestorage_Common{
* @var OC_FileStorage_Local
*/
private $storage;
public function __construct($params){
$this->storage=new OC_Filestorage_Local($params);
}
public function mkdir($path){
return $this->storage->mkdir($path);
}

Просмотреть файл

@ -61,7 +61,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
return filemtime($this->datadir.$path);
}
public function touch($path, $mtime=null){
// sets the modification time of the file to the given value.
// sets the modification time of the file to the given value.
// If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time.
if(!is_null($mtime)){
@ -72,7 +72,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
if( $result ) {
clearstatcache( true, $this->datadir.$path );
}
return $result;
}
public function file_get_contents($path){

Просмотреть файл

@ -3,22 +3,22 @@
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
* 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
* 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
*
* 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/>.
*
*
*/
@ -193,7 +193,7 @@ class OC_Filesystem{
return OC_Filesystem::$storages[$mountpoint];
}
}
static public function init($root){
if(self::$defaultInstance){
return false;
@ -237,7 +237,7 @@ class OC_Filesystem{
}
}
}
self::$loaded=true;
}
@ -257,14 +257,14 @@ class OC_Filesystem{
static public function getView(){
return self::$defaultInstance;
}
/**
* tear down the filesystem, removing all storage providers
*/
static public function tearDown(){
self::$storages=array();
}
/**
* create a new storage of a specific type
* @param string type
@ -284,7 +284,7 @@ class OC_Filesystem{
return false;
}
}
/**
* change the root to a fake root
* @param string fakeRoot
@ -326,7 +326,7 @@ class OC_Filesystem{
}
self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
}
/**
* return the path to a local version of the file
* we need this because we can't know if a file is stored local or not from outside the filestorage and for some purposes a local file is needed
@ -343,7 +343,7 @@ class OC_Filesystem{
static public function getLocalFolder($path){
return self::$defaultInstance->getLocalFolder($path);
}
/**
* return path to file which reflects one visible in browser
* @param string path
@ -357,7 +357,7 @@ class OC_Filesystem{
}
return $newpath;
}
/**
* check if the requested path is valid
* @param string path
@ -372,7 +372,7 @@ class OC_Filesystem{
}
return true;
}
/**
* checks if a file is blacklsited for storage in the filesystem
* Listens to write and rename hooks
@ -392,7 +392,7 @@ class OC_Filesystem{
}
}
}
/**
* following functions are equivilent to their php buildin equivilents for arguments/return values.
*/
@ -496,11 +496,11 @@ class OC_Filesystem{
static public function hash($type,$path, $raw = false){
return self::$defaultInstance->hash($type,$path, $raw);
}
static public function free_space($path='/'){
return self::$defaultInstance->free_space($path);
}
static public function search($query){
return OC_FileCache::search($query);
}

Просмотреть файл

@ -56,7 +56,7 @@ class OC_FilesystemView {
}
return $this->fakeRoot.$path;
}
/**
* change the root to a fake toor
* @param string fakeRoot
@ -325,7 +325,7 @@ class OC_FilesystemView {
if(OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
if($path1 == null or $path2 == null) {
return false;
}
@ -352,7 +352,7 @@ class OC_FilesystemView {
$storage1 = $this->getStorage($path1);
$storage1->unlink($this->getInternalPath($path1.$postFix1));
$result = $count>0;
}
}
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_post_rename,
@ -373,7 +373,7 @@ class OC_FilesystemView {
if(OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
if($path1 == null or $path2 == null) {
return false;
}

Просмотреть файл

@ -12,7 +12,7 @@ class OC_Geo{
* @param (string) $longitude - Longitude
* @return (string) $timezone - closest timezone
*/
public static function timezone($latitude, $longitude){
public static function timezone($latitude, $longitude){
$alltimezones = DateTimeZone::listIdentifiers();
$variances = array();
//calculate for all timezones the system know

Просмотреть файл

@ -271,7 +271,7 @@ class OC_Group {
}
return $users;
}
/**
* @brief get a list of all users in several groups
* @param array $gids

Просмотреть файл

@ -83,4 +83,3 @@ class OC_Hook{
}
}
}

Просмотреть файл

@ -383,7 +383,7 @@ class OC_Image {
/**
* @brief Loads an image from an open file handle.
* It is the responsibility of the caller to position the pointer at the correct place and to close the handle again.
* @param $handle
* @param $handle
* @returns An image resource or false on error
*/
public function loadFromFileHandle($handle) {
@ -468,7 +468,7 @@ class OC_Image {
break;
*/
default:
// this is mostly file created from encrypted file
$this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents(\OC_Filesystem::getLocalPath($imagepath)));
$itype = IMAGETYPE_PNG;
@ -534,7 +534,7 @@ class OC_Image {
$width_orig=imageSX($this->resource);
$height_orig=imageSY($this->resource);
$ratio_orig = $width_orig/$height_orig;
if ($ratio_orig > 1) {
$new_height = round($maxsize/$ratio_orig);
$new_width = $maxsize;
@ -564,7 +564,7 @@ class OC_Image {
public function preciseResize($width, $height) {
if (!$this->valid()) {
OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
return false;
}
$width_orig=imageSX($this->resource);
$height_orig=imageSY($this->resource);

Просмотреть файл

@ -52,7 +52,7 @@ class OC_JSON{
exit();
}
}
/**
* Check if the user is a admin, send json error msg if not
*/
@ -64,7 +64,7 @@ class OC_JSON{
exit();
}
}
/**
* Check if the user is a subadmin, send json error msg if not
*/

Просмотреть файл

@ -28,17 +28,17 @@ class OC_L10N{
* cached instances
*/
protected static $instances=array();
/**
* cache
*/
protected static $cache = array();
/**
* The best language
*/
protected static $language = '';
/**
* App of this object
*/
@ -53,7 +53,7 @@ class OC_L10N{
* Translations
*/
private $translations = array();
/**
* Localization
*/
@ -61,7 +61,7 @@ class OC_L10N{
'date' => 'd.m.Y',
'datetime' => 'd.m.Y H:i:s',
'time' => 'H:i:s');
/**
* get an L10N instance
* @return OC_L10N
@ -76,7 +76,7 @@ class OC_L10N{
return new OC_L10N($app,$lang);
}
}
/**
* @brief The constructor
* @param $app the app requesting l10n
@ -90,7 +90,7 @@ class OC_L10N{
$this->app = $app;
$this->lang = $lang;
}
protected function init(){
if ($this->app === true) {
return;
@ -119,7 +119,7 @@ class OC_L10N{
if(isset($TRANSLATIONS) && is_array($TRANSLATIONS)){
$this->translations = $TRANSLATIONS;
}
}
}
if(file_exists(OC::$SERVERROOT.'/core/l10n/l10n-'.$lang.'.php')){
// Include the file, save the data from $CONFIG
@ -188,7 +188,7 @@ class OC_L10N{
* @returns String or false
*
* Returns the localized data.
*
*
* Implemented types:
* - date
* - Creates a date
@ -241,7 +241,7 @@ class OC_L10N{
* @returns language
*
* If $app is an array, ownCloud assumes that these are the available
* languages. Otherwise ownCloud tries to find the files in the l10n
* languages. Otherwise ownCloud tries to find the files in the l10n
* folder.
*
* If nothing works it returns 'en'

Просмотреть файл

@ -17,7 +17,7 @@ require_once('class.phpmailer.php');
class OC_Mail {
/**
* send an email
* send an email
*
* @param string $toaddress
* @param string $toname
@ -31,9 +31,9 @@ class OC_Mail {
$SMTPMODE = OC_Config::getValue( 'mail_smtpmode', 'sendmail' );
$SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' );
$SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', false );
$SMTPUSERNAME = OC_Config::getValue( 'mail_smtpname', '' );
$SMTPPASSWORD = OC_Config::getValue( 'mail_smtppassword', '' );
$SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', false );
$SMTPUSERNAME = OC_Config::getValue( 'mail_smtpname', '' );
$SMTPPASSWORD = OC_Config::getValue( 'mail_smtppassword', '' );
$mailo = new PHPMailer(true);

Просмотреть файл

@ -196,7 +196,7 @@ class OC_Migrate{
* @param optional $uid userid of new user
*/
public static function import( $path, $type='user', $uid=null ){
$datadir = OC_Config::getValue( 'datadirectory' );
// Extract the zip
if( !$extractpath = self::extractZip( $path ) ){
@ -222,13 +222,13 @@ class OC_Migrate{
if( self::$exporttype == 'user' ){
self::$uid = !is_null($uid) ? $uid : $currentuser;
}
// We need to be an admin if we are not importing our own data
if(($type == 'user' && self::$uid != $currentuser) || $type != 'user' ){
if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
// Naughty.
OC_Log::write( 'migration', 'Import not permitted.', OC_Log::ERROR );
return json_encode( array( 'success' => false ) );
return json_encode( array( 'success' => false ) );
}
}
@ -411,7 +411,7 @@ class OC_Migrate{
$success = false;
}
}
// Run the export function?
if( $success ){
// Set the provider properties
@ -421,7 +421,7 @@ class OC_Migrate{
$return['apps'][$provider->getID()]['success'] = false;
$return['apps'][$provider->getID()]['message'] = 'failed to create the app tables';
}
// Now add some app info the the return array
$appinfo = OC_App::getAppInfo( $provider->getID() );
$return['apps'][$provider->getID()]['version'] = OC_App::getAppVersion($provider->getID());

Просмотреть файл

@ -25,13 +25,13 @@
* provides methods to add and access data from the migration
*/
class OC_Migration_Content{
private $zip=false;
// Holds the MDB2 object
private $db=null;
// Holds an array of tmpfiles to delete after zip creation
private $tmpfiles=false;
/**
* @brief sets up the
* @param $zip ZipArchive object
@ -42,25 +42,25 @@ class OC_Migration_Content{
$this->zip = $zip;
$this->db = $db;
if( !is_null( $db ) ){
// Get db path
$db = $this->db->getDatabase();
$this->tmpfiles[] = $db;
}
}
// @brief prepares the db
// @param $query the sql query to prepare
public function prepare( $query ){
// Optimize the query
$query = $this->processQuery( $query );
// Optimize the query
$query = $this->db->prepare( $query );
// Die if we have an error (error means: bad query, not 0 results!)
if( PEAR::isError( $query ) ) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
@ -68,11 +68,11 @@ class OC_Migration_Content{
OC_Log::write( 'migration', $entry, OC_Log::FATAL );
return false;
} else {
return $query;
return $query;
}
}
/**
* @brief processes the db query
* @param $query the query to process
@ -86,7 +86,7 @@ class OC_Migration_Content{
$query = str_replace( '*PREFIX*', '', $query );
return $query;
}
/**
* @brief copys rows to migration.db from the main database
* @param $options array of options.
@ -94,19 +94,19 @@ class OC_Migration_Content{
*/
public function copyRows( $options ){
if( !array_key_exists( 'table', $options ) ){
return false;
return false;
}
$return = array();
// Need to include 'where' in the query?
if( array_key_exists( 'matchval', $options ) && array_key_exists( 'matchcol', $options ) ){
// If only one matchval, create an array
if(!is_array($options['matchval'])){
$options['matchval'] = array( $options['matchval'] );
$options['matchval'] = array( $options['matchval'] );
}
foreach( $options['matchval'] as $matchval ){
// Run the query for this match value (where x = y value)
$sql = 'SELECT * FROM `*PREFIX*' . $options['table'] . '` WHERE `' . $options['matchcol'] . '` LIKE ?';
@ -122,13 +122,13 @@ class OC_Migration_Content{
$query = OC_DB::prepare( $sql );
$results = $query->execute();
$return = $this->insertData( $results, $options );
}
return $return;
}
/**
* @brief saves a sql data set into migration.db
* @param $data a sql data set returned from self::prepare()->query()
@ -144,7 +144,7 @@ class OC_Migration_Content{
$fields[] = $field;
$values[] = $value;
}
// Generate some sql
$sql = "INSERT INTO `" . $options['table'] . '` ( `';
$fieldssql = implode( '`, `', $fields );
@ -154,7 +154,7 @@ class OC_Migration_Content{
// Make the query
$query = $this->prepare( $sql );
if( !$query ){
OC_Log::write( 'migration', 'Invalid sql produced: '.$sql, OC_Log::FATAL );
OC_Log::write( 'migration', 'Invalid sql produced: '.$sql, OC_Log::FATAL );
return false;
exit();
} else {
@ -162,10 +162,10 @@ class OC_Migration_Content{
// Do we need to return some values?
if( array_key_exists( 'idcol', $options ) ){
// Yes we do
$return[] = $row[$options['idcol']];
$return[] = $row[$options['idcol']];
} else {
// Take a guess and return the first field :)
$return[] = reset($row);
$return[] = reset($row);
}
}
$fields = '';
@ -173,11 +173,11 @@ class OC_Migration_Content{
}
return $return;
}
/**
* @brief adds a directory to the zip object
* @param $dir string path of the directory to add
* @param $recursive bool
* @param $recursive bool
* @param $internaldir string path of folder to add dir to in zip
* @return bool
*/
@ -186,13 +186,13 @@ class OC_Migration_Content{
$this->zip->addEmptyDir($internaldir . $dirname);
$internaldir.=$dirname.='/';
if( !file_exists( $dir ) ){
return false;
return false;
}
if ($dirhandle = opendir($dir)) {
while (false !== ( $file = readdir($dirhandle))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($dir . '/' . $file) && $recursive) {
$this->addDir($dir . '/' . $file, $recursive, $internaldir);
} elseif (is_file($dir . '/' . $file)) {
@ -207,7 +207,7 @@ class OC_Migration_Content{
}
return true;
}
/**
* @brief adds a file to the zip from a given string
* @param $data string of data to add
@ -220,13 +220,13 @@ class OC_Migration_Content{
$this->tmpfiles[] = $file;
if( !file_put_contents( $file, $data ) ){
OC_Log::write( 'migation', 'Failed to save data to a temporary file', OC_Log::ERROR );
return false;
return false;
}
// Add file to the zip
$this->zip->addFile( $file, $path );
return true;
}
/**
* @brief closes the zip, removes temp files
* @return bool
@ -234,19 +234,19 @@ class OC_Migration_Content{
public function finish(){
if( !$this->zip->close() ){
OC_Log::write( 'migration', 'Failed to write the zip file with error: '.$this->zip->getStatusString(), OC_Log::ERROR );
return false;
return false;
}
$this->cleanup();
return true;
}
return true;
}
/**
* @brief cleans up after the zip
*/
private function cleanup(){
// Delete tmp files
foreach($this->tmpfiles as $i){
unlink( $i );
}
unlink( $i );
}
}
}

Просмотреть файл

@ -3,37 +3,37 @@
* provides search functionalty
*/
abstract class OC_Migration_Provider{
protected $id=false;
protected $content=false;
protected $content=false;
protected $uid=false;
protected $olduid=false;
protected $appinfo=false;
public function __construct( $appid ){
// Set the id
$this->id = $appid;
OC_Migrate::registerProvider( $this );
}
/**
* @brief exports data for apps
* @return array appdata to be exported
*/
abstract function export( );
/**
* @brief imports data for the app
* @return void
*/
abstract function import( );
/**
* @brief sets the OC_Migration_Content object to $this->content
* @param $content a OC_Migration_Content object
*/
public function setData( $uid, $content, $info=null ){
$this->content = $content;
$this->content = $content;
$this->uid = $uid;
$id = $this->id;
if( !is_null( $info ) ){
@ -41,12 +41,12 @@ abstract class OC_Migration_Provider{
$this->appinfo = $info->apps->$id;
}
}
/**
* @brief returns the appid of the provider
* @return string
*/
public function getID(){
return $this->id;
return $this->id;
}
}

Просмотреть файл

@ -153,27 +153,27 @@ class OC_OCS {
OC_OCS::privatedatadelete($format, $app, $key);
// CLOUD
// systemWebApps
// systemWebApps
}elseif(($method=='get') and ($ex[$paracount-5] == 'v1.php') and ($ex[$paracount-4]=='cloud') and ($ex[$paracount-3] == 'system') and ($ex[$paracount-2] == 'webapps')){
OC_OCS::systemwebapps($format);
// quotaget
// quotaget
}elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'quota')){
$user=$ex[$paracount-3];
OC_OCS::quotaget($format,$user);
// quotaset
// quotaset
}elseif(($method=='post') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'quota')){
$user=$ex[$paracount-3];
$quota = self::readData('post', 'quota', 'int');
OC_OCS::quotaset($format,$user,$quota);
// keygetpublic
// keygetpublic
}elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'publickey')){
$user=$ex[$paracount-3];
OC_OCS::publicKeyGet($format,$user);
// keygetprivate
// keygetprivate
}elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'privatekey')){
$user=$ex[$paracount-3];
OC_OCS::privateKeyGet($format,$user);
@ -501,7 +501,7 @@ class OC_OCS {
echo(OC_OCS::generatexml($format,'ok',100,''));
}
}
/**
* get private data
* @param string $user

Просмотреть файл

@ -29,7 +29,7 @@
class OC_OCSClient{
/**
* @brief Get the url of the OCS AppStore server.
* @brief Get the url of the OCS AppStore server.
* @returns string of the AppStore server
*
* This function returns the url of the OCS AppStore server. It´s possible to set it in the config file or it will fallback to the default
@ -40,7 +40,7 @@ class OC_OCSClient{
}
/**
* @brief Get the url of the OCS KB server.
* @brief Get the url of the OCS KB server.
* @returns string of the KB server
* This function returns the url of the OCS knowledge base server. It´s possible to set it in the config file or it will fallback to the default
*/
@ -61,13 +61,13 @@ class OC_OCSClient{
return NULL;
}
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
$xml=@file_get_contents($url);
if($xml==FALSE){
return NULL;
}
$data=simplexml_load_string($xml);
$tmp=$data->data;
$cats=array();
@ -119,9 +119,9 @@ class OC_OCSClient{
$app['preview']=(string)$tmp[$i]->smallpreviewpic1;
$app['changed']=strtotime($tmp[$i]->changed);
$app['description']=(string)$tmp[$i]->description;
$apps[]=$app;
}
}
return $apps;
}
@ -184,7 +184,7 @@ class OC_OCSClient{
$tmp=$data->data->content;
$app=array();
if(isset($tmp->downloadlink)) {
if(isset($tmp->downloadlink)) {
$app['downloadlink']=$tmp->downloadlink;
}else{
$app['downloadlink']='';
@ -199,7 +199,7 @@ class OC_OCSClient{
*
* This function returns a list of all the knowledgebase entries from the OCS server
*/
public static function getKnownledgebaseEntries($page,$pagesize,$search=''){
public static function getKnownledgebaseEntries($page,$pagesize,$search=''){
if(OC_Config::getValue('knowledgebaseenabled', true)==false){
$kbe=array();
$kbe['totalitems']=0;

Просмотреть файл

@ -116,7 +116,7 @@ class OC_Preferences{
// Try to fetch the value, return default if not exists.
$query = OC_DB::prepare( 'SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
$result = $query->execute( array( $user, $app, $key ));
$row = $result->fetchRow();
if($row){
return $row["configvalue"];

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
@ -130,7 +130,7 @@ class App {
/**
* @brief Check if the app is enabled, redirects to home if not
* @brief Check if the app is enabled, redirects to home if not
* @param $app app
* @returns true/false
*/
@ -140,7 +140,7 @@ class App {
/**
* @brief Get the last version of the app, either from appinfo/version or from appinfo/info.xml
* @brief Get the last version of the app, either from appinfo/version or from appinfo/info.xml
* @param $app app
* @returns true/false
*/

Просмотреть файл

@ -24,7 +24,7 @@
* Public interface of ownCloud forbackground jobs.
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
@ -42,7 +42,7 @@ namespace OCP;
* An example of the queued task would be the creation of the thumbnail. As
* soon as the user uploads a picture the gallery app registers the queued
* task "create thumbnail" and saves the path in the parameter instead of doing
* the work right away. This makes the app more responsive. As soon as the task
* the work right away. This makes the app more responsive. As soon as the task
* is done it will be deleted from the list.
*/
class BackgroundJob {

Просмотреть файл

@ -27,7 +27,7 @@
*/
/**
* @brief use OCP namespace for all classes that are considered public.
* @brief use OCP namespace for all classes that are considered public.
*
* Classes that use this namespace are for use by apps, and not for use by internal
* OC classes

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
@ -47,17 +47,17 @@ class JSON {
/**
* Check if the user is logged in, send json error msg if not.
*
*
* This method checks if a user is logged in. If not, a json error
* response will be return and the method will exit from execution
* of the script.
* The returned json will be in the format:
*
*
* {"status":"error","data":{"message":"Authentication error."}}
*
*
* Add this call to the start of all ajax method files that requires
* an authenticated user.
*
*
* @return string json formatted error string if not authenticated.
*/
public static function checkLoggedIn(){
@ -66,22 +66,22 @@ class JSON {
/**
* Check an ajax get/post call if the request token is valid.
*
*
* This method checks for a valid variable 'requesttoken' in $_GET,
* $_POST and $_SERVER. If a valid token is not found, a json error
* response will be return and the method will exit from execution
* of the script.
* The returned json will be in the format:
*
*
* {"status":"error","data":{"message":"Token expired. Please reload page."}}
*
* Add this call to the start of all ajax method files that creates,
*
* Add this call to the start of all ajax method files that creates,
* updates or deletes anything.
* In cases where you e.g. use an ajax call to load a dialog containing
* a submittable form, you will need to add the requesttoken first as a
* parameter to the ajax call, then assign it to the template and finally
* add a hidden input field also named 'requesttoken' containing the value.
*
*
* @return string json formatted error string if not valid.
*/
public static function callCheck(){
@ -90,10 +90,10 @@ class JSON {
/**
* Send json success msg
*
*
* Return a json success message with optional extra data.
* @see OCP\JSON::error() for the format to use.
*
*
* @param array $data The data to use
* @return string json formatted string.
*/
@ -103,19 +103,19 @@ class JSON {
/**
* Send json error msg
*
* Return a json error message with optional extra data for
*
* Return a json error message with optional extra data for
* error message or app specific data.
*
*
* Example use:
*
*
* $id = [some value]
* OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id)));
*
*
* Will return the json formatted string:
*
*
* {"status":"error","data":{"message":"An error happened", "id":[some value]}}
*
*
* @param array $data The data to use
* @return string json formatted error string.
*/
@ -134,17 +134,17 @@ class JSON {
/**
* Check if the App is enabled and send JSON error message instead
*
*
* This method checks if a specific app is enabled. If not, a json error
* response will be return and the method will exit from execution
* of the script.
* The returned json will be in the format:
*
*
* {"status":"error","data":{"message":"Application is not enabled."}}
*
*
* Add this call to the start of all ajax method files that requires
* a specific app to be enabled.
*
*
* @param string $app The app to check
* @return string json formatted string if not enabled.
*/
@ -154,17 +154,17 @@ class JSON {
/**
* Check if the user is a admin, send json error msg if not
*
*
* This method checks if the current user has admin rights. If not, a json error
* response will be return and the method will exit from execution
* of the script.
* The returned json will be in the format:
*
*
* {"status":"error","data":{"message":"Authentication error."}}
*
*
* Add this call to the start of all ajax method files that requires
* administrative rights.
*
*
* @return string json formatted string if not admin user.
*/
public static function checkAdminUser(){

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
@ -88,13 +88,13 @@ function simple_file_size($bytes) {
/**
* @brief Generate html code for an options block.
* @param $options the options
* @param $selected which one is selected?
* @param $params the parameters
* @param $options the options
* @param $selected which one is selected?
* @param $params the parameters
* @returns html options
*/
function html_select_options($options, $selected, $params=array()) {
return(\html_select_options($options, $selected, $params));
return(\html_select_options($options, $selected, $params));
}

Просмотреть файл

@ -26,7 +26,7 @@
*
*/
// use OCP namespace for all classes that are considered public.
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;

Просмотреть файл

@ -27,7 +27,7 @@
class OC_Search{
static private $providers=array();
static private $registeredProviders=array();
/**
* remove all registered search providers
*/
@ -35,7 +35,7 @@ class OC_Search{
self::$providers=array();
self::$registeredProviders=array();
}
/**
* register a new search provider to be used
* @param string $provider class name of a OC_Search_Provider
@ -43,7 +43,7 @@ class OC_Search{
public static function registerProvider($class,$options=array()){
self::$registeredProviders[]=array('class'=>$class,'options'=>$options);
}
/**
* search all provider for $query
* @param string query
@ -57,7 +57,7 @@ class OC_Search{
}
return $results;
}
/**
* create instances of all the registered search providers
*/

Просмотреть файл

@ -4,11 +4,11 @@
*/
abstract class OC_Search_Provider {
private $options;
public function __construct($options){
$this->options=$options;
}
/**
* search for $query
* @param string $query

Просмотреть файл

@ -18,7 +18,7 @@ if(isset($_POST['install']) AND $_POST['install']=='true') {
// We have to launch the installation process :
$e = OC_Setup::install($_POST);
$errors = array('errors' => $e);
if(count($e) > 0) {
//OC_Template::printGuestPage("", "error", array("errors" => $errors));
$options = array_merge($_POST, $opts, $errors);
@ -37,7 +37,7 @@ class OC_Setup {
public static function install($options) {
$error = array();
$dbtype = $options['dbtype'];
if(empty($options['adminlogin'])) {
$error[] = 'Set an admin username.';
}
@ -72,7 +72,7 @@ class OC_Setup {
$username = htmlspecialchars_decode($options['adminlogin']);
$password = htmlspecialchars_decode($options['adminpass']);
$datadir = htmlspecialchars_decode($options['directory']);
//use sqlite3 when available, otherise sqlite2 will be used.
if($dbtype=='sqlite' and class_exists('SQLite3')){
$dbtype='sqlite3';
@ -107,7 +107,7 @@ class OC_Setup {
}
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
@ -184,9 +184,9 @@ class OC_Setup {
$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);
@ -257,7 +257,7 @@ class OC_Setup {
);
return $error;
} else {
//check for roles creation rights in oracle
//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);
@ -342,7 +342,7 @@ class OC_Setup {
}
}
}
}
}
else {
//delete the old sqlite database first, might cause infinte loops otherwise
if(file_exists("$datadir/owncloud.db")){
@ -428,7 +428,7 @@ class OC_Setup {
}
}
$query = "REVOKE ALL PRIVILEGES ON DATABASE \"$e_name\" FROM PUBLIC";
$result = pg_query($connection, $query);
$result = pg_query($connection, $query);
}
private static function pg_createDBUser($name,$password,$connection) {
@ -463,7 +463,7 @@ class OC_Setup {
}
}
/**
*
*
* @param String $name
* @param String $password
* @param String $tablespace

Просмотреть файл

@ -3,7 +3,7 @@
* ownCloud
*
* @author Georg Ehrke
* @copyright 2012 Georg Ehrke
* @copyright 2012 Georg Ehrke
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@ -85,7 +85,7 @@ class OC_SubAdmin{
}
return $uids;
}
/**
* @brief get all SubAdmins
* @return array
@ -99,7 +99,7 @@ class OC_SubAdmin{
}
return $subadmins;
}
/**
* @brief checks if a user is a SubAdmin of a group
* @param $uid uid of the subadmin
@ -115,7 +115,7 @@ class OC_SubAdmin{
}
return false;
}
/**
* @brief checks if a user is a SubAdmin
* @param $uid uid of the subadmin
@ -130,7 +130,7 @@ class OC_SubAdmin{
}
return false;
}
/**
* @brief checks if a user is a accessible by a subadmin
* @param $subadmin uid of the subadmin
@ -152,7 +152,7 @@ class OC_SubAdmin{
}
return false;
}
/*
* @brief alias for self::isSubAdminofGroup()
*/
@ -162,7 +162,7 @@ class OC_SubAdmin{
/**
* @brief delete all SubAdmins by uid
* @param $parameters
* @param $parameters
* @return boolean
*/
public static function post_deleteUser($parameters){

Просмотреть файл

@ -161,7 +161,7 @@ class OC_Template{
header('X-Frame-Options: Sameorigin');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
$this->findTemplate($name);
}
@ -208,13 +208,13 @@ class OC_Template{
$_SESSION['formfactor']=$_GET['formfactor'];
}
$formfactor=$_SESSION['formfactor'];
if($formfactor=='default') {
if($formfactor=='default') {
$fext='';
}elseif($formfactor=='mobile') {
}elseif($formfactor=='mobile') {
$fext='.mobile';
}elseif($formfactor=='tablet') {
}elseif($formfactor=='tablet') {
$fext='.tablet';
}elseif($formfactor=='standalone') {
}elseif($formfactor=='standalone') {
$fext='.standalone';
}else{
$fext='';

Просмотреть файл

@ -385,7 +385,7 @@ class OC_User {
}
return false;
}
/**
* disables a user
* @param string $userid the user to disable
@ -395,7 +395,7 @@ class OC_User {
$query = OC_DB::prepare($query);
$query->execute(array($userid, 'core', 'enabled', 'false'));
}
/**
* enable a user
* @param string $userid
@ -405,7 +405,7 @@ class OC_User {
$query = OC_DB::prepare($query);
$query->execute(array($userid, 'core', 'enabled', 'false'));
}
/**
* checks if a user is enabled
* @param string $userid

Просмотреть файл

@ -43,7 +43,7 @@ class OC_User_Database extends OC_User_Backend {
* @var PasswordHash
*/
static private $hasher=null;
private function getHasher(){
if(!self::$hasher){
//we don't want to use DES based crypt(), since it doesn't return a has with a recognisable prefix
@ -53,7 +53,7 @@ class OC_User_Database extends OC_User_Backend {
return self::$hasher;
}
/**
* @brief Create a new user
* @param $uid The username of the user to create
@ -172,7 +172,7 @@ class OC_User_Database extends OC_User_Backend {
public function userExists($uid){
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' );
$result = $query->execute( array( $uid ));
return $result->numRows() > 0;
}

Просмотреть файл

@ -41,9 +41,9 @@ class OC_User_HTTP extends OC_User_Backend {
$url.='?'.$parts['query'];
}
return array($parts['user'],$url);
}
/**
* check if an url is a valid login
* @param string url
@ -52,7 +52,7 @@ class OC_User_HTTP extends OC_User_Backend {
private function matchUrl($url){
return ! is_null(parse_url($url,PHP_URL_USER));
}
/**
* @brief Check if the password is correct
* @param $uid The username
@ -67,7 +67,7 @@ class OC_User_HTTP extends OC_User_Backend {
return false;
}
list($user,$url)=$this->parseUrl($uid);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
@ -76,7 +76,7 @@ class OC_User_HTTP extends OC_User_Backend {
curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $status==200;

Просмотреть файл

@ -40,7 +40,7 @@ class OC_Util {
mkdir( $userdirectory, 0755, true );
}
OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$user_root), $user);
//jail the user into his "home" directory
OC_Filesystem::init($user_dir);
$quotaProxy=new OC_FileProxy_Quota();
@ -62,9 +62,9 @@ class OC_Util {
public static function setupFS4all(){
foreach(OC_User::getUsers() as $user){
OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>OC_User::getHome($singleuser)), $user);
}
}
}
public static function tearDownFS(){
OC_Filesystem::tearDown();
self::$fsSetup=false;
@ -211,7 +211,7 @@ class OC_Util {
// Check if there is a writable install folder.
if(OC_Config::getValue('appstoreenabled', true)) {
if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath())) {
$errors[]=array('error'=>"Can't write into apps directory",'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
$errors[]=array('error'=>"Can't write into apps directory",'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
in owncloud or disabling the appstore in the config file.");
}
}
@ -410,15 +410,15 @@ class OC_Util {
// cleanup old tokens garbage collector
// only run every 20th time so we don't waste cpu cycles
if(rand(0,20)==0) {
if(rand(0,20)==0) {
foreach($_SESSION as $key=>$value) {
// search all tokens in the session
if(substr($key,0,12)=='requesttoken') {
if($value+$maxtime<time()){
// remove outdated tokens
unset($_SESSION[$key]);
unset($_SESSION[$key]);
}
}
}
}
}
// return the token
@ -465,13 +465,13 @@ class OC_Util {
exit;
}
}
/**
* @brief Public function to sanitize HTML
*
* This function is used to sanitize HTML and should be applied on any
* string or array of strings before displaying it on a web page.
*
*
* @param string or array of strings
* @return array with sanitized strings or a single sanitized string, depends on the input parameter.
*/

Просмотреть файл

@ -219,7 +219,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));
}
}