From 1205749f8cec19c30c9f58f7f97832fac9a4c502 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:18:03 +0100 Subject: [PATCH 1/8] Checkstyle: Fix the last two SpaceBeforeOpenBrace --- apps/files_external/lib/webdav.php | 2 +- lib/util.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 2503fb80b1..02fe540d06 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -46,7 +46,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ if($caview = \OCP\Files::getStorage('files_external')) { $certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt'; - if (file_exists($certPath)) { + if (file_exists($certPath)) { $this->client->addTrustedCertificates($certPath); } } diff --git a/lib/util.php b/lib/util.php index d16424ce4e..40b44bf9d6 100755 --- a/lib/util.php +++ b/lib/util.php @@ -559,7 +559,7 @@ 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 + if(file_exists($testfile)) {// already running this test, possible recursive call return false; } From 0e70ea9d8baa449ee3c8309f2b6a59ce06a55926 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:28:29 +0100 Subject: [PATCH 2/8] Checkstyle: Fix the last 25 NoSpaceAfterComma --- apps/files_encryption/lib/proxy.php | 2 +- apps/files_external/lib/smb.php | 4 ++-- apps/user_ldap/templates/settings.php | 2 +- lib/MDB2/Driver/Reverse/sqlite3.php | 2 +- lib/fileproxy/quota.php | 4 ++-- lib/filestorage/local.php | 8 ++++---- lib/filesystem.php | 4 ++-- lib/installer.php | 8 ++++---- lib/migrate.php | 2 +- lib/migration/content.php | 2 +- lib/ocsclient.php | 6 +++--- lib/template.php | 2 +- lib/user.php | 2 +- settings/users.php | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index cacf7d7920..4a390013d2 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -92,7 +92,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ }elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb') { if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0) { //first encrypt the target file so we don't end up with a half encrypted file - OCP\Util::writeLog('files_encryption','Decrypting '.$path.' before writing', OCP\Util::DEBUG); + OCP\Util::writeLog('files_encryption', 'Decrypting '.$path.' before writing', OCP\Util::DEBUG); $tmp=fopen('php://temp'); OCP\Files::streamCopy($result, $tmp); fclose($result); diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index d763689434..802d80d8d1 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -24,7 +24,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ if(!$this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } - if(substr($this->root,-1, 1)!='/') { + if(substr($this->root, -1, 1)!='/') { $this->root.='/'; } if(!$this->share || $this->share[0]!='/') { @@ -41,7 +41,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ } public function constructUrl($path) { - if(substr($path,-1)=='/') { + if(substr($path, -1)=='/') { $path=substr($path, 0, -1); } return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path; diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 3a653ad720..d10062c1d9 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -29,7 +29,7 @@

- t('Help');?> + t('Help');?> diff --git a/lib/MDB2/Driver/Reverse/sqlite3.php b/lib/MDB2/Driver/Reverse/sqlite3.php index 36626478ce..9703780954 100644 --- a/lib/MDB2/Driver/Reverse/sqlite3.php +++ b/lib/MDB2/Driver/Reverse/sqlite3.php @@ -476,7 +476,7 @@ class MDB2_Driver_Reverse_sqlite3 extends MDB2_Driver_Reverse_Common $definition['unique'] = true; $count = count($column_names); for ($i=0; $i<$count; ++$i) { - $column_name = strtok($column_names[$i]," "); + $column_name = strtok($column_names[$i], " "); $collation = strtok(" "); $definition['fields'][$column_name] = array( 'position' => $i+1 diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 81376fb6fc..46bc8dc16d 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -38,9 +38,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{ if(in_array($user, $this->userQuota)) { return $this->userQuota[$user]; } - $userQuota=OC_Preferences::getValue($user,'files','quota', 'default'); + $userQuota=OC_Preferences::getValue($user, 'files', 'quota', 'default'); if($userQuota=='default') { - $userQuota=OC_AppConfig::getValue('files','default_quota', 'none'); + $userQuota=OC_AppConfig::getValue('files', 'default_quota', 'none'); } if($userQuota=='none') { $this->userQuota[$user]=0; diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 2dde0093d4..6fe45acf8c 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -6,7 +6,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ protected $datadir; public function __construct($arguments) { $this->datadir=$arguments['datadir']; - if(substr($this->datadir,-1)!=='/') { + if(substr($this->datadir, -1)!=='/') { $this->datadir.='/'; } } @@ -20,7 +20,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ return opendir($this->datadir.$path); } public function is_dir($path) { - if(substr($path,-1)=='/') { + if(substr($path, -1)=='/') { $path=substr($path, 0, -1); } return is_dir($this->datadir.$path); @@ -86,11 +86,11 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ } public function rename($path1, $path2) { if (!$this->isUpdatable($path1)) { - OC_Log::write('core','unable to rename, file is not writable : '.$path1, OC_Log::ERROR); + OC_Log::write('core', 'unable to rename, file is not writable : '.$path1, OC_Log::ERROR); return false; } if(! $this->file_exists($path1)) { - OC_Log::write('core','unable to rename, file does not exists : '.$path1, OC_Log::ERROR); + OC_Log::write('core', 'unable to rename, file does not exists : '.$path1, OC_Log::ERROR); return false; } diff --git a/lib/filesystem.php b/lib/filesystem.php index aeafb14939..e4c0e2e1eb 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -246,7 +246,7 @@ class OC_Filesystem{ } $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php'); - $previousMTime=OC_Appconfig::getValue('files','mountconfigmtime', 0); + $previousMTime=OC_Appconfig::getValue('files', 'mountconfigmtime', 0); if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated OC_FileCache::triggerUpdate(); OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime); @@ -312,7 +312,7 @@ class OC_Filesystem{ return false; } }else{ - OC_Log::write('core','storage backend '.$class.' not found', OC_Log::ERROR); + OC_Log::write('core', 'storage backend '.$class.' not found', OC_Log::ERROR); return false; } } diff --git a/lib/installer.php b/lib/installer.php index 266c07d5c2..7dc8b0cef8 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -57,7 +57,7 @@ class OC_Installer{ */ public static function installApp( $data = array()) { if(!isset($data['source'])) { - OC_Log::write('core','No source specified when installing app', OC_Log::ERROR); + OC_Log::write('core', 'No source specified when installing app', OC_Log::ERROR); return false; } @@ -65,13 +65,13 @@ class OC_Installer{ if($data['source']=='http') { $path=OC_Helper::tmpFile(); if(!isset($data['href'])) { - OC_Log::write('core','No href specified when installing app from http', OC_Log::ERROR); + OC_Log::write('core', 'No href specified when installing app from http', OC_Log::ERROR); return false; } copy($data['href'], $path); }else{ if(!isset($data['path'])) { - OC_Log::write('core','No path specified when installing app from local file', OC_Log::ERROR); + OC_Log::write('core', 'No path specified when installing app from local file', OC_Log::ERROR); return false; } $path=$data['path']; @@ -86,7 +86,7 @@ class OC_Installer{ rename($path, $path.'.tgz'); $path.='.tgz'; }else{ - OC_Log::write('core','Archives of type '.$mime.' are not supported', OC_Log::ERROR); + OC_Log::write('core', 'Archives of type '.$mime.' are not supported', OC_Log::ERROR); return false; } diff --git a/lib/migrate.php b/lib/migrate.php index 616417a227..96f5a0001f 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -611,7 +611,7 @@ class OC_Migrate{ if( file_exists( $db ) ) { // Connect to the db if(!self::connectDB( $db )) { - OC_Log::write('migration','Failed to connect to migration.db', OC_Log::ERROR); + OC_Log::write('migration', 'Failed to connect to migration.db', OC_Log::ERROR); return false; } } else { diff --git a/lib/migration/content.php b/lib/migration/content.php index 54982b3c84..00df62f0c7 100644 --- a/lib/migration/content.php +++ b/lib/migration/content.php @@ -205,7 +205,7 @@ class OC_Migration_Content{ } closedir($dirhandle); } else { - OC_Log::write('admin_export',"Was not able to open directory: " . $dir, OC_Log::ERROR); + OC_Log::write('admin_export', "Was not able to open directory: " . $dir, OC_Log::ERROR); return false; } return true; diff --git a/lib/ocsclient.php b/lib/ocsclient.php index ceeb78570f..b6b5ad8f0a 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -162,7 +162,7 @@ class OC_OCSClient{ $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { - OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL); + OC_Log::write('core', 'Unable to parse OCS content', OC_Log::FATAL); return null; } $data=simplexml_load_string($xml); @@ -200,7 +200,7 @@ class OC_OCSClient{ $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { - OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL); + OC_Log::write('core', 'Unable to parse OCS content', OC_Log::FATAL); return null; } $data=simplexml_load_string($xml); @@ -238,7 +238,7 @@ class OC_OCSClient{ $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { - OC_Log::write('core','Unable to parse knowledgebase content', OC_Log::FATAL); + OC_Log::write('core', 'Unable to parse knowledgebase content', OC_Log::FATAL); return null; } $data=simplexml_load_string($xml); diff --git a/lib/template.php b/lib/template.php index efcc6e82c4..3d3589abd1 100644 --- a/lib/template.php +++ b/lib/template.php @@ -199,7 +199,7 @@ class OC_Template{ $mode='tablet'; }elseif(stripos($_SERVER['HTTP_USER_AGENT'], 'iphone')>0) { $mode='mobile'; - }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'], 'nokia')>0)) { + }elseif((stripos($_SERVER['HTTP_USER_AGENT'], 'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'], 'nokia')>0)) { $mode='mobile'; }else{ $mode='default'; diff --git a/lib/user.php b/lib/user.php index be0e525d86..801ab7f608 100644 --- a/lib/user.php +++ b/lib/user.php @@ -133,7 +133,7 @@ class OC_User { self::useBackend($backend); $_setupedBackends[]=$i; }else{ - OC_Log::write('core','User backend '.$class.' not found.', OC_Log::ERROR); + OC_Log::write('core', 'User backend '.$class.' not found.', OC_Log::ERROR); } } } diff --git a/settings/users.php b/settings/users.php index 6eaae47453..395712dbd5 100644 --- a/settings/users.php +++ b/settings/users.php @@ -42,7 +42,7 @@ foreach( $accessiblegroups as $i ) { $groups[] = array( "name" => $i ); } $quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', 'default,none,1 GB, 5 GB, 10 GB'); -$quotaPreset=explode(',',$quotaPreset); +$quotaPreset=explode(',', $quotaPreset); foreach($quotaPreset as &$preset) { $preset=trim($preset); } From bc4382c5c5649c3ad0e9e3be18a747815473f9fe Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:31:44 +0100 Subject: [PATCH 3/8] Checkstyle: fix the last NoSpaceAfterEquals --- lib/public/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/public/util.php b/lib/public/util.php index 6ce79715b6..7b5b1abbde 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -61,7 +61,7 @@ class Util { */ public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc='') { // call the internal mail class - \OC_MAIL::send( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc=''); + \OC_MAIL::send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = ''); } /** From 27ab0357ae00541bbcff52453c2d86e723a992e0 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:36:16 +0100 Subject: [PATCH 4/8] Checkstyle: Fix last six NewlineBeforeOpenBrace --- lib/MDB2/Driver/sqlite3.php | 3 +-- lib/archive/tar.php | 3 +-- lib/base.php | 6 ++---- settings/ajax/changepassword.php | 3 +-- settings/templates/help.php | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php index bccb8cbbf0..fa4c91c126 100644 --- a/lib/MDB2/Driver/sqlite3.php +++ b/lib/MDB2/Driver/sqlite3.php @@ -397,8 +397,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common } if ($this->fix_assoc_fields_names || - $this->options['portability'] & MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES) - { + $this->options['portability'] & MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES) { $this->connection->exec("PRAGMA short_column_names = 1"); $this->fix_assoc_fields_names = true; } diff --git a/lib/archive/tar.php b/lib/archive/tar.php index 6c26468699..0fa633c603 100644 --- a/lib/archive/tar.php +++ b/lib/archive/tar.php @@ -130,8 +130,7 @@ class OC_Archive_TAR extends OC_Archive{ if( $file == $header['filename'] or $file.'/' == $header['filename'] or '/'.$file.'/' == $header['filename'] - or '/'.$file == $header['filename']) - { + or '/'.$file == $header['filename']) { return $header; } } diff --git a/lib/base.php b/lib/base.php index f494716bd8..084cca92e8 100644 --- a/lib/base.php +++ b/lib/base.php @@ -524,8 +524,7 @@ class OC{ } $file_ext = substr($param['file'], -3); if ($file_ext != 'php' - || !self::loadAppScriptFile($param)) - { + || !self::loadAppScriptFile($param)) { header('HTTP/1.0 404 Not Found'); } } @@ -595,8 +594,7 @@ class OC{ if(!isset($_COOKIE["oc_remember_login"]) || !isset($_COOKIE["oc_token"]) || !isset($_COOKIE["oc_username"]) - || !$_COOKIE["oc_remember_login"]) - { + || !$_COOKIE["oc_remember_login"]) { return false; } OC_App::loadApps(array('authentication')); diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php index a0fe5947b6..b2db261151 100644 --- a/settings/ajax/changepassword.php +++ b/settings/ajax/changepassword.php @@ -16,8 +16,7 @@ if(OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) { $userstatus = 'subadmin'; } if(OC_User::getUser() === $username) { - if (OC_User::checkPassword($username, $oldPassword)) - { + if (OC_User::checkPassword($username, $oldPassword)) { $userstatus = 'user'; } else { if (!OC_Util::isUserVerified()) { diff --git a/settings/templates/help.php b/settings/templates/help.php index b2a78ff851..56d4385344 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -12,8 +12,7 @@ printPage(); } ?> From 9795bc19bfbe7ebaffd1f88c0ccd47df94504b2e Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:42:18 +0100 Subject: [PATCH 5/8] Checkstyle: Fix the last two InvalidEOLChar --- apps/files_sharing/public.php | 446 ++++++++++----------- apps/files_versions/lib/versions.php | 554 +++++++++++++-------------- 2 files changed, 500 insertions(+), 500 deletions(-) diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 105e94f114..dca87cd687 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -1,223 +1,223 @@ -execute(array($_GET['token']))->fetchOne(); - if(isset($filepath)) { - $info = OC_FileCache_Cached::get($filepath, ''); - if(strtolower($info['mimetype']) == 'httpd/unix-directory') { - $_GET['dir'] = $filepath; - } else { - $_GET['file'] = $filepath; - } - \OCP\Util::writeLog('files_sharing', 'You have files that are shared by link originating from ownCloud 4.0. Redistribute the new links, because backwards compatibility will be removed in ownCloud 5.', \OCP\Util::WARN); - } -} -// Enf of backward compatibility - -function getID($path) { - // use the share table from the db to find the item source if the file was reshared because shared files - //are not stored in the file cache. - if (substr(OC_Filesystem::getMountPoint($path), -7, 6) == "Shared") { - $path_parts = explode('/', $path, 5); - $user = $path_parts[1]; - $intPath = '/'.$path_parts[4]; - $query = \OC_DB::prepare('SELECT item_source FROM *PREFIX*share WHERE uid_owner = ? AND file_target = ? '); - $result = $query->execute(array($user, $intPath)); - $row = $result->fetchRow(); - $fileSource = $row['item_source']; - } else { - $fileSource = OC_Filecache::getId($path, ''); - } - - return $fileSource; -} - -if (isset($_GET['file']) || isset($_GET['dir'])) { - if (isset($_GET['dir'])) { - $type = 'folder'; - $path = $_GET['dir']; - if(strlen($path)>1 and substr($path, -1, 1)==='/') { - $path=substr($path, 0, -1); - } - $baseDir = $path; - $dir = $baseDir; - } else { - $type = 'file'; - $path = $_GET['file']; - if(strlen($path)>1 and substr($path, -1, 1)==='/') { - $path=substr($path, 0, -1); - } - } - $uidOwner = substr($path, 1, strpos($path, '/', 1) - 1); - if (OCP\User::userExists($uidOwner)) { - OC_Util::setupFS($uidOwner); - $fileSource = getId($path); - if ($fileSource != -1 && ($linkItem = OCP\Share::getItemSharedWithByLink($type, $fileSource, $uidOwner))) { - // TODO Fix in the getItems - if (!isset($linkItem['item_type']) || $linkItem['item_type'] != $type) { - header('HTTP/1.0 404 Not Found'); - $tmpl = new OCP\Template('', '404', 'guest'); - $tmpl->printPage(); - exit(); - } - if (isset($linkItem['share_with'])) { - // Check password - if (isset($_GET['file'])) { - $url = OCP\Util::linkToPublic('files').'&file='.$_GET['file']; - } else { - $url = OCP\Util::linkToPublic('files').'&dir='.$_GET['dir']; - } - if (isset($_POST['password'])) { - $password = $_POST['password']; - $storedHash = $linkItem['share_with']; - $forcePortable = (CRYPT_BLOWFISH != 1); - $hasher = new PasswordHash(8, $forcePortable); - if (!($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash))) { - $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); - $tmpl->assign('URL', $url); - $tmpl->assign('error', true); - $tmpl->printPage(); - exit(); - } else { - // Save item id in session for future requests - $_SESSION['public_link_authenticated'] = $linkItem['id']; - } - // Check if item id is set in session - } else if (!isset($_SESSION['public_link_authenticated']) || $_SESSION['public_link_authenticated'] !== $linkItem['id']) { - // Prompt for password - $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); - $tmpl->assign('URL', $url); - $tmpl->printPage(); - exit(); - } - } - $path = $linkItem['path']; - if (isset($_GET['path'])) { - $path .= $_GET['path']; - $dir .= $_GET['path']; - if (!OC_Filesystem::file_exists($path)) { - header('HTTP/1.0 404 Not Found'); - $tmpl = new OCP\Template('', '404', 'guest'); - $tmpl->printPage(); - exit(); - } - } - // Download the file - if (isset($_GET['download'])) { - if (isset($_GET['dir'])) { - if ( isset($_GET['files']) ) { // download selected files - OC_Files::get($path, $_GET['files'], $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); - } else if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory - OC_Files::get('', $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); - } else { // download the whole shared directory - OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); - } - } else { // download a single shared file - OC_Files::get("", $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); - } - - } else { - OCP\Util::addStyle('files_sharing', 'public'); - OCP\Util::addScript('files_sharing', 'public'); - OCP\Util::addScript('files', 'fileactions'); - $tmpl = new OCP\Template('files_sharing', 'public', 'base'); - $tmpl->assign('owner', $uidOwner); - // Show file list - if (OC_Filesystem::is_dir($path)) { - OCP\Util::addStyle('files', 'files'); - OCP\Util::addScript('files', 'files'); - OCP\Util::addScript('files', 'filelist'); - $files = array(); - $rootLength = strlen($baseDir) + 1; - foreach (OC_Files::getDirectoryContent($path) as $i) { - $i['date'] = OCP\Util::formatDate($i['mtime']); - if ($i['type'] == 'file') { - $fileinfo = pathinfo($i['name']); - $i['basename'] = $fileinfo['filename']; - $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; - } - $i['directory'] = '/'.substr('/'.$uidOwner.'/files'.$i['directory'], $rootLength); - if ($i['directory'] == '/') { - $i['directory'] = ''; - } - $i['permissions'] = OCP\Share::PERMISSION_READ; - $files[] = $i; - } - // Make breadcrumb - $breadcrumb = array(); - $pathtohere = ''; - $count = 1; - foreach (explode('/', $dir) as $i) { - if ($i != '') { - if ($i != $baseDir) { - $pathtohere .= '/'.$i; - } - if ( strlen($pathtohere) < strlen($_GET['dir'])) { - continue; - } - $breadcrumb[] = array('dir' => str_replace($_GET['dir'], "", $pathtohere, $count), 'name' => $i); - } - } - $list = new OCP\Template('files', 'part.list', ''); - $list->assign('files', $files, false); - $list->assign('publicListView', true); - $list->assign('baseURL', OCP\Util::linkToPublic('files').'&dir='.urlencode($_GET['dir']).'&path=', false); - $list->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.urlencode($_GET['dir']).'&path=', false); - $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '' ); - $breadcrumbNav->assign('breadcrumb', $breadcrumb, false); - $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files').'&dir='.urlencode($_GET['dir']).'&path=', false); - $folder = new OCP\Template('files', 'index', ''); - $folder->assign('fileList', $list->fetchPage(), false); - $folder->assign('breadcrumb', $breadcrumbNav->fetchPage(), false); - $folder->assign('dir', basename($dir)); - $folder->assign('isCreatable', false); - $folder->assign('permissions', 0); - $folder->assign('files', $files); - $folder->assign('uploadMaxFilesize', 0); - $folder->assign('uploadMaxHumanFilesize', 0); - $folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); - $tmpl->assign('folder', $folder->fetchPage(), false); - $tmpl->assign('uidOwner', $uidOwner); - $tmpl->assign('dir', basename($dir)); - $tmpl->assign('filename', basename($path)); - $tmpl->assign('mimetype', OC_Filesystem::getMimeType($path)); - $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); - if (isset($_GET['path'])) { - $getPath = $_GET['path']; - } else { - $getPath = ''; - } - $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.urlencode($_GET['dir']).'&path='.urlencode($getPath), false); - } else { - // Show file preview if viewer is available - $tmpl->assign('uidOwner', $uidOwner); - $tmpl->assign('dir', dirname($path)); - $tmpl->assign('filename', basename($path)); - $tmpl->assign('mimetype', OC_Filesystem::getMimeType($path)); - if ($type == 'file') { - $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&file='.urlencode($_GET['file']).'&download', false); - } else { - if (isset($_GET['path'])) { - $getPath = $_GET['path']; - } else { - $getPath = ''; - } - $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.urlencode($_GET['dir']).'&path='.urlencode($getPath), false); - } - } - $tmpl->printPage(); - } - exit(); - } - } -} -header('HTTP/1.0 404 Not Found'); -$tmpl = new OCP\Template('', '404', 'guest'); -$tmpl->printPage(); +execute(array($_GET['token']))->fetchOne(); + if(isset($filepath)) { + $info = OC_FileCache_Cached::get($filepath, ''); + if(strtolower($info['mimetype']) == 'httpd/unix-directory') { + $_GET['dir'] = $filepath; + } else { + $_GET['file'] = $filepath; + } + \OCP\Util::writeLog('files_sharing', 'You have files that are shared by link originating from ownCloud 4.0. Redistribute the new links, because backwards compatibility will be removed in ownCloud 5.', \OCP\Util::WARN); + } +} +// Enf of backward compatibility + +function getID($path) { + // use the share table from the db to find the item source if the file was reshared because shared files + //are not stored in the file cache. + if (substr(OC_Filesystem::getMountPoint($path), -7, 6) == "Shared") { + $path_parts = explode('/', $path, 5); + $user = $path_parts[1]; + $intPath = '/'.$path_parts[4]; + $query = \OC_DB::prepare('SELECT item_source FROM *PREFIX*share WHERE uid_owner = ? AND file_target = ? '); + $result = $query->execute(array($user, $intPath)); + $row = $result->fetchRow(); + $fileSource = $row['item_source']; + } else { + $fileSource = OC_Filecache::getId($path, ''); + } + + return $fileSource; +} + +if (isset($_GET['file']) || isset($_GET['dir'])) { + if (isset($_GET['dir'])) { + $type = 'folder'; + $path = $_GET['dir']; + if(strlen($path)>1 and substr($path, -1, 1)==='/') { + $path=substr($path, 0, -1); + } + $baseDir = $path; + $dir = $baseDir; + } else { + $type = 'file'; + $path = $_GET['file']; + if(strlen($path)>1 and substr($path, -1, 1)==='/') { + $path=substr($path, 0, -1); + } + } + $uidOwner = substr($path, 1, strpos($path, '/', 1) - 1); + if (OCP\User::userExists($uidOwner)) { + OC_Util::setupFS($uidOwner); + $fileSource = getId($path); + if ($fileSource != -1 && ($linkItem = OCP\Share::getItemSharedWithByLink($type, $fileSource, $uidOwner))) { + // TODO Fix in the getItems + if (!isset($linkItem['item_type']) || $linkItem['item_type'] != $type) { + header('HTTP/1.0 404 Not Found'); + $tmpl = new OCP\Template('', '404', 'guest'); + $tmpl->printPage(); + exit(); + } + if (isset($linkItem['share_with'])) { + // Check password + if (isset($_GET['file'])) { + $url = OCP\Util::linkToPublic('files').'&file='.$_GET['file']; + } else { + $url = OCP\Util::linkToPublic('files').'&dir='.$_GET['dir']; + } + if (isset($_POST['password'])) { + $password = $_POST['password']; + $storedHash = $linkItem['share_with']; + $forcePortable = (CRYPT_BLOWFISH != 1); + $hasher = new PasswordHash(8, $forcePortable); + if (!($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash))) { + $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); + $tmpl->assign('URL', $url); + $tmpl->assign('error', true); + $tmpl->printPage(); + exit(); + } else { + // Save item id in session for future requests + $_SESSION['public_link_authenticated'] = $linkItem['id']; + } + // Check if item id is set in session + } else if (!isset($_SESSION['public_link_authenticated']) || $_SESSION['public_link_authenticated'] !== $linkItem['id']) { + // Prompt for password + $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); + $tmpl->assign('URL', $url); + $tmpl->printPage(); + exit(); + } + } + $path = $linkItem['path']; + if (isset($_GET['path'])) { + $path .= $_GET['path']; + $dir .= $_GET['path']; + if (!OC_Filesystem::file_exists($path)) { + header('HTTP/1.0 404 Not Found'); + $tmpl = new OCP\Template('', '404', 'guest'); + $tmpl->printPage(); + exit(); + } + } + // Download the file + if (isset($_GET['download'])) { + if (isset($_GET['dir'])) { + if ( isset($_GET['files']) ) { // download selected files + OC_Files::get($path, $_GET['files'], $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } else if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory + OC_Files::get('', $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } else { // download the whole shared directory + OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } + } else { // download a single shared file + OC_Files::get("", $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } + + } else { + OCP\Util::addStyle('files_sharing', 'public'); + OCP\Util::addScript('files_sharing', 'public'); + OCP\Util::addScript('files', 'fileactions'); + $tmpl = new OCP\Template('files_sharing', 'public', 'base'); + $tmpl->assign('owner', $uidOwner); + // Show file list + if (OC_Filesystem::is_dir($path)) { + OCP\Util::addStyle('files', 'files'); + OCP\Util::addScript('files', 'files'); + OCP\Util::addScript('files', 'filelist'); + $files = array(); + $rootLength = strlen($baseDir) + 1; + foreach (OC_Files::getDirectoryContent($path) as $i) { + $i['date'] = OCP\Util::formatDate($i['mtime']); + if ($i['type'] == 'file') { + $fileinfo = pathinfo($i['name']); + $i['basename'] = $fileinfo['filename']; + $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; + } + $i['directory'] = '/'.substr('/'.$uidOwner.'/files'.$i['directory'], $rootLength); + if ($i['directory'] == '/') { + $i['directory'] = ''; + } + $i['permissions'] = OCP\Share::PERMISSION_READ; + $files[] = $i; + } + // Make breadcrumb + $breadcrumb = array(); + $pathtohere = ''; + $count = 1; + foreach (explode('/', $dir) as $i) { + if ($i != '') { + if ($i != $baseDir) { + $pathtohere .= '/'.$i; + } + if ( strlen($pathtohere) < strlen($_GET['dir'])) { + continue; + } + $breadcrumb[] = array('dir' => str_replace($_GET['dir'], "", $pathtohere, $count), 'name' => $i); + } + } + $list = new OCP\Template('files', 'part.list', ''); + $list->assign('files', $files, false); + $list->assign('publicListView', true); + $list->assign('baseURL', OCP\Util::linkToPublic('files').'&dir='.urlencode($_GET['dir']).'&path=', false); + $list->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.urlencode($_GET['dir']).'&path=', false); + $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '' ); + $breadcrumbNav->assign('breadcrumb', $breadcrumb, false); + $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files').'&dir='.urlencode($_GET['dir']).'&path=', false); + $folder = new OCP\Template('files', 'index', ''); + $folder->assign('fileList', $list->fetchPage(), false); + $folder->assign('breadcrumb', $breadcrumbNav->fetchPage(), false); + $folder->assign('dir', basename($dir)); + $folder->assign('isCreatable', false); + $folder->assign('permissions', 0); + $folder->assign('files', $files); + $folder->assign('uploadMaxFilesize', 0); + $folder->assign('uploadMaxHumanFilesize', 0); + $folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); + $tmpl->assign('folder', $folder->fetchPage(), false); + $tmpl->assign('uidOwner', $uidOwner); + $tmpl->assign('dir', basename($dir)); + $tmpl->assign('filename', basename($path)); + $tmpl->assign('mimetype', OC_Filesystem::getMimeType($path)); + $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); + if (isset($_GET['path'])) { + $getPath = $_GET['path']; + } else { + $getPath = ''; + } + $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.urlencode($_GET['dir']).'&path='.urlencode($getPath), false); + } else { + // Show file preview if viewer is available + $tmpl->assign('uidOwner', $uidOwner); + $tmpl->assign('dir', dirname($path)); + $tmpl->assign('filename', basename($path)); + $tmpl->assign('mimetype', OC_Filesystem::getMimeType($path)); + if ($type == 'file') { + $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&file='.urlencode($_GET['file']).'&download', false); + } else { + if (isset($_GET['path'])) { + $getPath = $_GET['path']; + } else { + $getPath = ''; + } + $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.urlencode($_GET['dir']).'&path='.urlencode($getPath), false); + } + } + $tmpl->printPage(); + } + exit(); + } + } +} +header('HTTP/1.0 404 Not Found'); +$tmpl = new OCP\Template('', '404', 'guest'); +$tmpl->printPage(); diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 8f80718746..dc83ab12af 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -1,278 +1,278 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -/** - * Versions - * - * A class to handle the versioning of files. - */ - -namespace OCA_Versions; - -class Storage { - - - // config.php configuration: - // - files_versions - // - files_versionsfolder - // - files_versionsblacklist - // - files_versionsmaxfilesize - // - files_versionsinterval - // - files_versionmaxversions - // - // todo: - // - finish porting to OC_FilesystemView to enable network transparency - // - add transparent compression. first test if it´s worth it. - - const DEFAULTENABLED=true; - const DEFAULTBLACKLIST='avi mp3 mpg mp4 ctmp'; - const DEFAULTMAXFILESIZE=1048576; // 10MB - const DEFAULTMININTERVAL=60; // 1 min - const DEFAULTMAXVERSIONS=50; - - private static function getUidAndFilename($filename) - { - if (\OCP\App::isEnabled('files_sharing') - && substr($filename, 0, 7) == '/Shared' - && $source = \OCP\Share::getItemSharedWith('file', - substr($filename, 7), - \OC_Share_Backend_File::FORMAT_SHARED_STORAGE)) { - $filename = $source['path']; - $pos = strpos($filename, '/files', 1); - $uid = substr($filename, 1, $pos - 1); - $filename = substr($filename, $pos + 6); - } else { - $uid = \OCP\User::getUser(); - } - return array($uid, $filename); - } - - /** - * store a new version of a file. - */ - public function store($filename) { - if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { - list($uid, $filename) = self::getUidAndFilename($filename); - $files_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/files'); - $users_view = new \OC_FilesystemView('/'.\OCP\User::getUser()); - - //check if source file already exist as version to avoid recursions. - // todo does this check work? - if ($users_view->file_exists($filename)) { - return false; - } - - // check if filename is a directory - if($files_view->is_dir($filename)) { - return false; - } - - // check filetype blacklist - $blacklist=explode(' ', \OCP\Config::getSystemValue('files_versionsblacklist', Storage::DEFAULTBLACKLIST)); - foreach($blacklist as $bl) { - $parts=explode('.', $filename); - $ext=end($parts); - if(strtolower($ext)==$bl) { - return false; - } - } - // we should have a source file to work with - if (!$files_view->file_exists($filename)) { - return false; - } - - // check filesize - if($files_view->filesize($filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)) { - return false; - } - - - // check mininterval if the file is being modified by the owner (all shared files should be versioned despite mininterval) - if ($uid == \OCP\User::getUser()) { - $versions_fileview = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_versions'); - $versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); - $versionsFolderName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath(''); - $matches=glob($versionsName.'.v*'); - sort($matches); - $parts=explode('.v', end($matches)); - if((end($parts)+Storage::DEFAULTMININTERVAL)>time()) { - return false; - } - } - - - // create all parent folders - $info=pathinfo($filename); - if(!file_exists($versionsFolderName.'/'.$info['dirname'])) { - mkdir($versionsFolderName.'/'.$info['dirname'], 0750, true); - } - - // store a new version of a file - $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.time()); - - // expire old revisions if necessary - Storage::expire($filename); - } - } - - - /** - * rollback to an old version of a file. - */ - public static function rollback($filename, $revision) { - - if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { - list($uid, $filename) = self::getUidAndFilename($filename); - $users_view = new \OC_FilesystemView('/'.\OCP\User::getUser()); - - // rollback - if( @$users_view->copy('files_versions'.$filename.'.v'.$revision, 'files'.$filename) ) { - - return true; - - }else{ - - return false; - - } - - } - - } - - /** - * check if old versions of a file exist. - */ - public static function isversioned($filename) { - if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { - list($uid, $filename) = self::getUidAndFilename($filename); - $versions_fileview = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_versions'); - - $versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); - - // check for old versions - $matches=glob($versionsName.'.v*'); - if(count($matches)>0) { - return true; - }else{ - return false; - } - }else{ - return(false); - } - } - - - - /** - * @brief get a list of all available versions of a file in descending chronological order - * @param $filename file to find versions of, relative to the user files dir - * @param $count number of versions to return - * @returns array - */ - public static function getVersions( $filename, $count = 0 ) { - if( \OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' ) { - list($uid, $filename) = self::getUidAndFilename($filename); - $versions_fileview = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_versions'); - - $versionsName = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); - $versions = array(); - // fetch for old versions - $matches = glob( $versionsName.'.v*' ); - - sort( $matches ); - - $i = 0; - - $files_view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files'); - $local_file = $files_view->getLocalFile($filename); - foreach( $matches as $ma ) { - - $i++; - $versions[$i]['cur'] = 0; - $parts = explode( '.v', $ma ); - $versions[$i]['version'] = ( end( $parts ) ); - - // if file with modified date exists, flag it in array as currently enabled version - ( \md5_file( $ma ) == \md5_file( $local_file ) ? $versions[$i]['fileMatch'] = 1 : $versions[$i]['fileMatch'] = 0 ); - - } - - $versions = array_reverse( $versions ); - - foreach( $versions as $key => $value ) { - - // flag the first matched file in array (which will have latest modification date) as current version - if ( $value['fileMatch'] ) { - - $value['cur'] = 1; - break; - - } - - } - - $versions = array_reverse( $versions ); - - // only show the newest commits - if( $count != 0 and ( count( $versions )>$count ) ) { - - $versions = array_slice( $versions, count( $versions ) - $count ); - - } - - return( $versions ); - - - } else { - - // if versioning isn't enabled then return an empty array - return( array() ); - - } - - } - - /** - * @brief Erase a file's versions which exceed the set quota - */ - public static function expire($filename) { - if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { - list($uid, $filename) = self::getUidAndFilename($filename); - $versions_fileview = new \OC_FilesystemView('/'.$uid.'/files_versions'); - - $versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); - - // check for old versions - $matches = glob( $versionsName.'.v*' ); - - if( count( $matches ) > \OCP\Config::getSystemValue( 'files_versionmaxversions', Storage::DEFAULTMAXVERSIONS ) ) { - - $numberToDelete = count($matches) - \OCP\Config::getSystemValue( 'files_versionmaxversions', Storage::DEFAULTMAXVERSIONS ); - - // delete old versions of a file - $deleteItems = array_slice( $matches, 0, $numberToDelete ); - - foreach( $deleteItems as $de ) { - - unlink( $versionsName.'.v'.$de ); - - } - } - } - } - - /** - * @brief Erase all old versions of all user files - * @return true/false - */ - public function expireAll() { - $view = \OCP\Files::getStorage('files_versions'); - return $view->deleteAll('', true); - } + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +/** + * Versions + * + * A class to handle the versioning of files. + */ + +namespace OCA_Versions; + +class Storage { + + + // config.php configuration: + // - files_versions + // - files_versionsfolder + // - files_versionsblacklist + // - files_versionsmaxfilesize + // - files_versionsinterval + // - files_versionmaxversions + // + // todo: + // - finish porting to OC_FilesystemView to enable network transparency + // - add transparent compression. first test if it´s worth it. + + const DEFAULTENABLED=true; + const DEFAULTBLACKLIST='avi mp3 mpg mp4 ctmp'; + const DEFAULTMAXFILESIZE=1048576; // 10MB + const DEFAULTMININTERVAL=60; // 1 min + const DEFAULTMAXVERSIONS=50; + + private static function getUidAndFilename($filename) + { + if (\OCP\App::isEnabled('files_sharing') + && substr($filename, 0, 7) == '/Shared' + && $source = \OCP\Share::getItemSharedWith('file', + substr($filename, 7), + \OC_Share_Backend_File::FORMAT_SHARED_STORAGE)) { + $filename = $source['path']; + $pos = strpos($filename, '/files', 1); + $uid = substr($filename, 1, $pos - 1); + $filename = substr($filename, $pos + 6); + } else { + $uid = \OCP\User::getUser(); + } + return array($uid, $filename); + } + + /** + * store a new version of a file. + */ + public function store($filename) { + if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + list($uid, $filename) = self::getUidAndFilename($filename); + $files_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/files'); + $users_view = new \OC_FilesystemView('/'.\OCP\User::getUser()); + + //check if source file already exist as version to avoid recursions. + // todo does this check work? + if ($users_view->file_exists($filename)) { + return false; + } + + // check if filename is a directory + if($files_view->is_dir($filename)) { + return false; + } + + // check filetype blacklist + $blacklist=explode(' ', \OCP\Config::getSystemValue('files_versionsblacklist', Storage::DEFAULTBLACKLIST)); + foreach($blacklist as $bl) { + $parts=explode('.', $filename); + $ext=end($parts); + if(strtolower($ext)==$bl) { + return false; + } + } + // we should have a source file to work with + if (!$files_view->file_exists($filename)) { + return false; + } + + // check filesize + if($files_view->filesize($filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)) { + return false; + } + + + // check mininterval if the file is being modified by the owner (all shared files should be versioned despite mininterval) + if ($uid == \OCP\User::getUser()) { + $versions_fileview = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_versions'); + $versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); + $versionsFolderName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath(''); + $matches=glob($versionsName.'.v*'); + sort($matches); + $parts=explode('.v', end($matches)); + if((end($parts)+Storage::DEFAULTMININTERVAL)>time()) { + return false; + } + } + + + // create all parent folders + $info=pathinfo($filename); + if(!file_exists($versionsFolderName.'/'.$info['dirname'])) { + mkdir($versionsFolderName.'/'.$info['dirname'], 0750, true); + } + + // store a new version of a file + $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.time()); + + // expire old revisions if necessary + Storage::expire($filename); + } + } + + + /** + * rollback to an old version of a file. + */ + public static function rollback($filename, $revision) { + + if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + list($uid, $filename) = self::getUidAndFilename($filename); + $users_view = new \OC_FilesystemView('/'.\OCP\User::getUser()); + + // rollback + if( @$users_view->copy('files_versions'.$filename.'.v'.$revision, 'files'.$filename) ) { + + return true; + + }else{ + + return false; + + } + + } + + } + + /** + * check if old versions of a file exist. + */ + public static function isversioned($filename) { + if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + list($uid, $filename) = self::getUidAndFilename($filename); + $versions_fileview = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_versions'); + + $versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); + + // check for old versions + $matches=glob($versionsName.'.v*'); + if(count($matches)>0) { + return true; + }else{ + return false; + } + }else{ + return(false); + } + } + + + + /** + * @brief get a list of all available versions of a file in descending chronological order + * @param $filename file to find versions of, relative to the user files dir + * @param $count number of versions to return + * @returns array + */ + public static function getVersions( $filename, $count = 0 ) { + if( \OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' ) { + list($uid, $filename) = self::getUidAndFilename($filename); + $versions_fileview = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_versions'); + + $versionsName = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); + $versions = array(); + // fetch for old versions + $matches = glob( $versionsName.'.v*' ); + + sort( $matches ); + + $i = 0; + + $files_view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files'); + $local_file = $files_view->getLocalFile($filename); + foreach( $matches as $ma ) { + + $i++; + $versions[$i]['cur'] = 0; + $parts = explode( '.v', $ma ); + $versions[$i]['version'] = ( end( $parts ) ); + + // if file with modified date exists, flag it in array as currently enabled version + ( \md5_file( $ma ) == \md5_file( $local_file ) ? $versions[$i]['fileMatch'] = 1 : $versions[$i]['fileMatch'] = 0 ); + + } + + $versions = array_reverse( $versions ); + + foreach( $versions as $key => $value ) { + + // flag the first matched file in array (which will have latest modification date) as current version + if ( $value['fileMatch'] ) { + + $value['cur'] = 1; + break; + + } + + } + + $versions = array_reverse( $versions ); + + // only show the newest commits + if( $count != 0 and ( count( $versions )>$count ) ) { + + $versions = array_slice( $versions, count( $versions ) - $count ); + + } + + return( $versions ); + + + } else { + + // if versioning isn't enabled then return an empty array + return( array() ); + + } + + } + + /** + * @brief Erase a file's versions which exceed the set quota + */ + public static function expire($filename) { + if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + list($uid, $filename) = self::getUidAndFilename($filename); + $versions_fileview = new \OC_FilesystemView('/'.$uid.'/files_versions'); + + $versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename); + + // check for old versions + $matches = glob( $versionsName.'.v*' ); + + if( count( $matches ) > \OCP\Config::getSystemValue( 'files_versionmaxversions', Storage::DEFAULTMAXVERSIONS ) ) { + + $numberToDelete = count($matches) - \OCP\Config::getSystemValue( 'files_versionmaxversions', Storage::DEFAULTMAXVERSIONS ); + + // delete old versions of a file + $deleteItems = array_slice( $matches, 0, $numberToDelete ); + + foreach( $deleteItems as $de ) { + + unlink( $versionsName.'.v'.$de ); + + } + } + } + } + + /** + * @brief Erase all old versions of all user files + * @return true/false + */ + public function expireAll() { + $view = \OCP\Files::getStorage('files_versions'); + return $view->deleteAll('', true); + } } From 1e33ad9cbcd2282db5cb64b933bfe8844d582acf Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 19:11:53 +0100 Subject: [PATCH 6/8] Style: Different line endings in one file are bad for sure I think Checkstyle did not find this occurence, however consistant line endings are preferred. @DeepDiver can Checkstyle find this? --- lib/filesystem.php | 84 +++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/filesystem.php b/lib/filesystem.php index e4c0e2e1eb..4635f8b4f3 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -209,48 +209,48 @@ class OC_Filesystem{ } 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); - } + 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); + } } } From a4b2ea586dea5e02a91a873d16a20144db7292a0 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 22:16:04 +0100 Subject: [PATCH 7/8] Style: Remove all the dangling white spaces --- apps/files_sharing/public.php | 2 +- lib/backgroundjob.php | 2 +- lib/base.php | 4 ++-- lib/connector/sabre/quotaplugin.php | 16 ++++++++-------- lib/log.php | 2 +- lib/public/backgroundjob.php | 2 +- lib/public/share.php | 2 +- ocs/providers.php | 16 ++++++++-------- ocs/v1.php | 16 ++++++++-------- settings/ajax/createuser.php | 6 +++--- settings/ajax/getlog.php | 2 +- settings/ajax/userlist.php | 10 +++++----- settings/apps.php | 8 ++++---- settings/languageCodes.php | 2 +- settings/templates/help.php | 2 +- settings/templates/users.php | 2 +- settings/users.php | 2 +- tests/lib/share/share.php | 4 ++-- tests/lib/user/backend.php | 4 ++-- tests/lib/util.php | 6 +++--- tests/preseed-config.php | 6 +++--- 21 files changed, 58 insertions(+), 58 deletions(-) diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index dca87cd687..295273d842 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -22,7 +22,7 @@ if (isset($_GET['token'])) { // Enf of backward compatibility function getID($path) { - // use the share table from the db to find the item source if the file was reshared because shared files + // use the share table from the db to find the item source if the file was reshared because shared files //are not stored in the file cache. if (substr(OC_Filesystem::getMountPoint($path), -7, 6) == "Shared") { $path_parts = explode('/', $path, 5); diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php index f486519bf0..28b5ce3af2 100644 --- a/lib/backgroundjob.php +++ b/lib/backgroundjob.php @@ -40,7 +40,7 @@ class OC_BackgroundJob{ * @param $type execution type * @return boolean * - * This method sets the execution type of the background jobs. Possible types + * This method sets the execution type of the background jobs. Possible types * are "none", "ajax", "webcron", "cron" */ public static function setExecutionType( $type ) { diff --git a/lib/base.php b/lib/base.php index 084cca92e8..d4eeac82da 100644 --- a/lib/base.php +++ b/lib/base.php @@ -619,9 +619,9 @@ class OC{ OC_Util::redirectToDefaultPage(); // doesn't return } - // if you reach this point you have changed your password + // if you reach this point you have changed your password // or you are an attacker - // we can not delete tokens here because users may reach + // we can not delete tokens here because users may reach // this point multiple times after a password change OC_Log::write('core', 'Authentication cookie rejected for user '.$_COOKIE['oc_username'], OC_Log::WARN); } diff --git a/lib/connector/sabre/quotaplugin.php b/lib/connector/sabre/quotaplugin.php index 5b8ef94171..a56a65ad86 100644 --- a/lib/connector/sabre/quotaplugin.php +++ b/lib/connector/sabre/quotaplugin.php @@ -2,7 +2,7 @@ /** * This plugin check user quota and deny creating files when they exceeds the quota. - * + * * @copyright Copyright (C) 2012 entreCables S.L. All rights reserved. * @author Sergio Cambra * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License @@ -10,9 +10,9 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { /** - * Reference to main server object - * - * @var Sabre_DAV_Server + * Reference to main server object + * + * @var Sabre_DAV_Server */ private $server; @@ -23,8 +23,8 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { * addPlugin is called. * * This method should set up the requires event subscriptions. - * - * @param Sabre_DAV_Server $server + * + * @param Sabre_DAV_Server $server * @return void */ public function initialize(Sabre_DAV_Server $server) { @@ -37,10 +37,10 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { /** * This method is called before any HTTP method and forces users to be authenticated - * + * * @param string $method * @throws Sabre_DAV_Exception - * @return bool + * @return bool */ public function checkQuota($uri, $data = null) { $expected = $this->server->httpRequest->getHeader('X-Expected-Entity-Length'); diff --git a/lib/log.php b/lib/log.php index b5e8e1b06a..e9cededa5c 100644 --- a/lib/log.php +++ b/lib/log.php @@ -47,7 +47,7 @@ class OC_Log { //ob_end_clean(); self::write('PHP', $error['message'] . ' at ' . $error['file'] . '#' . $error['line'], self::FATAL); } else { - return true; + return true; } } diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index 24a17836f7..601046fe69 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -62,7 +62,7 @@ class BackgroundJob { * @param $type execution type * @return boolean * - * This method sets the execution type of the background jobs. Possible types + * This method sets the execution type of the background jobs. Possible types * are "none", "ajax", "webcron", "cron" */ public static function setExecutionType( $type ) { diff --git a/lib/public/share.php b/lib/public/share.php index da1c061639..071304ec24 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -28,7 +28,7 @@ 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 */ diff --git a/ocs/providers.php b/ocs/providers.php index 4c68ded914..bdbfe0c4ee 100644 --- a/ocs/providers.php +++ b/ocs/providers.php @@ -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 -* License along with this library. If not, see . * +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see . +* */ require_once '../lib/base.php'; diff --git a/ocs/v1.php b/ocs/v1.php index b12ea5ef18..3593f1822c 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -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 -* License along with this library. If not, see . * +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see . +* */ require_once '../lib/base.php'; diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index c87ff422f6..16b48c8a9c 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -43,9 +43,9 @@ try { } OC_Group::addToGroup( $username, $i ); } - OC_JSON::success(array("data" => - array( - "username" => $username, + OC_JSON::success(array("data" => + array( + "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username ))))); } catch (Exception $exception) { OC_JSON::error(array("data" => array( "message" => $exception->getMessage()))); diff --git a/settings/ajax/getlog.php b/settings/ajax/getlog.php index 273b02e382..043124fa17 100644 --- a/settings/ajax/getlog.php +++ b/settings/ajax/getlog.php @@ -12,5 +12,5 @@ $offset=(isset($_GET['offset']))?$_GET['offset']:0; $entries=OC_Log_Owncloud::getEntries($count, $offset); OC_JSON::success(array( - "data" => OC_Util::sanitizeHTML($entries), + "data" => OC_Util::sanitizeHTML($entries), "remain"=>(count(OC_Log_Owncloud::getEntries(1, $offset + $offset)) != 0) ? true : false)); diff --git a/settings/ajax/userlist.php b/settings/ajax/userlist.php index 61b1a388fc..eaeade60a3 100644 --- a/settings/ajax/userlist.php +++ b/settings/ajax/userlist.php @@ -32,9 +32,9 @@ if (OC_Group::inGroup(OC_User::getUser(), 'admin')) { $batch = OC_User::getUsers('', 10, $offset); foreach ($batch as $user) { $users[] = array( - 'name' => $user, - 'groups' => join(', ', OC_Group::getUserGroups($user)), - 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), + 'name' => $user, + 'groups' => join(', ', OC_Group::getUserGroups($user)), + 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); } } else { @@ -42,8 +42,8 @@ if (OC_Group::inGroup(OC_User::getUser(), 'admin')) { $batch = OC_Group::usersInGroups($groups, '', 10, $offset); foreach ($batch as $user) { $users[] = array( - 'name' => $user, - 'groups' => join(', ', OC_Group::getUserGroups($user)), + 'name' => $user, + 'groups' => join(', ', OC_Group::getUserGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); } } diff --git a/settings/apps.php b/settings/apps.php index 8134b44143..155291333f 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -95,11 +95,11 @@ if ( $remoteApps ) { foreach ( $remoteApps AS $key => $remote ) { - if ( + if ( $app['name'] == $remote['name'] - // To set duplicate detection to use OCS ID instead of string name, - // enable this code, remove the line of code above, - // and add [ID] to info.xml of each 3rd party app: + // To set duplicate detection to use OCS ID instead of string name, + // enable this code, remove the line of code above, + // and add [ID] to info.xml of each 3rd party app: // OR $app['ocs_id'] == $remote['ocs_id'] ) { diff --git a/settings/languageCodes.php b/settings/languageCodes.php index 221aa13cf6..7165580085 100644 --- a/settings/languageCodes.php +++ b/settings/languageCodes.php @@ -3,7 +3,7 @@ * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ - + return array( 'bg_BG'=>'български език', 'ca'=>'Català', diff --git a/settings/templates/help.php b/settings/templates/help.php index 56d4385344..9bb46740f5 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -1,4 +1,4 @@ -; - + diff --git a/settings/users.php b/settings/users.php index 395712dbd5..93a259f1cd 100644 --- a/settings/users.php +++ b/settings/users.php @@ -31,7 +31,7 @@ if($isadmin) { foreach($accessibleusers as $i) { $users[] = array( - "name" => $i, + "name" => $i, "groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($i)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/), 'quota'=>OC_Preferences::getValue($i, 'files', 'quota', 'default'), 'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($i))); diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 3cad3a2868..2cb6f7417d 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -181,7 +181,7 @@ class Test_Share extends UnitTestCase { $this->assertEquals($message, $exception->getMessage()); } - // Owner grants share and update permission + // Owner grants share and update permission OC_User::setUserId($this->user1); $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_SHARE)); @@ -375,7 +375,7 @@ class Test_Share extends UnitTestCase { $this->assertTrue(in_array('test.txt', $to_test)); $this->assertTrue(in_array('test1.txt', $to_test)); - // Valid reshare + // Valid reshare $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE)); OC_User::setUserId($this->user4); $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php index 79653481f9..0b744770ea 100644 --- a/tests/lib/user/backend.php +++ b/tests/lib/user/backend.php @@ -23,10 +23,10 @@ /** * Abstract class to provide the basis of backend-specific unit test classes. * - * All subclasses MUST assign a backend property in setUp() which implements + * All subclasses MUST assign a backend property in setUp() which implements * user operations (add, remove, etc.). Test methods in this class will then be * run on each separate subclass and backend therein. - * + * * For an example see /tests/lib/user/dummy.php */ diff --git a/tests/lib/util.php b/tests/lib/util.php index a8e5b81026..27635cb805 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -10,7 +10,7 @@ class Test_Util extends UnitTestCase { // Constructor function Test_Util() { - date_default_timezone_set("UTC"); + date_default_timezone_set("UTC"); } function testFormatDate() { @@ -36,10 +36,10 @@ class Test_Util extends UnitTestCase { $goodString = "This is an harmless string."; $result = OC_Util::sanitizeHTML($goodString); $this->assertEquals("This is an harmless string.", $result); - } + } function testGenerate_random_bytes() { $result = strlen(OC_Util::generate_random_bytes(59)); $this->assertEquals(59, $result); - } + } } \ No newline at end of file diff --git a/tests/preseed-config.php b/tests/preseed-config.php index 7eadccbe76..9791e713da 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -1,15 +1,15 @@ false, - 'apps_paths' => + 'apps_paths' => array ( - 0 => + 0 => array ( 'path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => false, ), - 1 => + 1 => array ( 'path' => OC::$SERVERROOT.'/apps2', 'url' => '/apps2', From 02ec677e3c665da98056496270c22078c4b7aac0 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 22:57:40 +0100 Subject: [PATCH 8/8] Style: The last two spaces --- ocs/providers.php | 2 +- ocs/v1.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ocs/providers.php b/ocs/providers.php index bdbfe0c4ee..43c9dc2aa4 100644 --- a/ocs/providers.php +++ b/ocs/providers.php @@ -15,7 +15,7 @@ * 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 . * diff --git a/ocs/v1.php b/ocs/v1.php index 3593f1822c..1652b0bedb 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -15,7 +15,7 @@ * 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 . *