From 7b7994b56b60cd44d1e28252505319235557c23c Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Wed, 20 Feb 2013 23:11:38 +0100 Subject: [PATCH 01/30] WebDAV-Testing: - write the exception to the log - in case curl is missing we should return true as well --- lib/util.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 636f3127f4..5d3286204e 100755 --- a/lib/util.php +++ b/lib/util.php @@ -562,7 +562,7 @@ class OC_Util { */ public static function isWebDAVWorking() { if (!function_exists('curl_init')) { - return; + return true; } $settings = array( @@ -578,6 +578,7 @@ class OC_Util { } catch(\Sabre_DAV_Exception_NotAuthenticated $e) { $return = true; } catch(\Exception $e) { + OC_Log::write('core', 'isWebDAVWorking: NO - Reason: '.$e, OC_Log::WARN); $return = false; } From c5e0dda8874244ac3c9acdf92bfd5e97405438c0 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Thu, 21 Feb 2013 11:09:00 +0100 Subject: [PATCH 02/30] add a safe_mode check --- lib/util.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/util.php b/lib/util.php index ab47e404c9..87facda180 100755 --- a/lib/util.php +++ b/lib/util.php @@ -269,6 +269,11 @@ class OC_Util { 'hint'=>'Please ask your server administrator to install the module.'); $web_server_restart= false; } + if(ini_get('safe_mode')) { + $errors[]=array('error'=>'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.
', + 'hint'=>'PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config.'); + $web_server_restart= false; + } $handler = ini_get("session.save_handler"); if($handler == "files") { From eceb7341bb48edae49bec93f5df58f04c9eb99ab Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 21 Feb 2013 16:25:47 +0100 Subject: [PATCH 03/30] make number-input fields look like they should --- core/css/styles.css | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index 8a01211d8b..0c16b36873 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -36,8 +36,8 @@ filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', endC .header-right > * { vertical-align:middle; } /* INPUTS */ -input[type="text"], input[type="password"] { cursor:text; } -input[type="text"], input[type="password"], input[type="search"], +input[type="text"], input[type="password"], input[type="number"] { cursor:text; } +input[type="text"], input[type="password"], input[type="search"], input[type="number"], textarea, select, button, .button, #quota, div.jp-progress, .pager li a { width:10em; margin:.3em; padding:.6em .5em .4em; font-size:1em; font-family:Arial, Verdana, sans-serif; @@ -46,10 +46,11 @@ textarea, select, button, .button, #quota, div.jp-progress, .pager li a { -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } input[type="hidden"] { height:0; width:0; } -input[type="text"], input[type="password"], input[type="search"], textarea { background:#f8f8f8; color:#555; cursor:text; } -input[type="text"], input[type="password"], input[type="search"] { -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; } +input[type="text"], input[type="password"], input[type="search"], input[type="number"], textarea { background:#f8f8f8; color:#555; cursor:text; } +input[type="text"], input[type="password"], input[type="search"], input[type="number"] { -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; } input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active, input[type="password"]:hover, input[type="password"]:focus, input[type="password"]:active, +input[type="number"]:hover, input[type="number"]:focus, input[type="number"]:active, .searchbox input[type="search"]:hover, .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active, textarea:hover, textarea:focus, textarea:active { background-color:#fff; color:#333; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } input[type="checkbox"] { margin:0; padding:0; height:auto; width:auto; } @@ -196,7 +197,7 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } #show, #personal-show { display:none; } #show + label { right:1em; top:1.25em!important; } #show:checked + label, #personal-show:checked + label { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; } -#show + label, #personal-show + label { +#show + label, #personal-show + label { position:absolute!important; height:14px; width:24px; background-image:url("../img/actions/toggle.png"); background-repeat:no-repeat; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; filter:alpha(opacity=30); opacity:.3; From 89ef06cd799a59f113a354a4fd0311d4e479fe36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 21 Feb 2013 16:34:22 +0100 Subject: [PATCH 04/30] rename app to 'deleted files' --- apps/files_trashbin/appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_trashbin/appinfo/info.xml b/apps/files_trashbin/appinfo/info.xml index e421733960..7f807da579 100644 --- a/apps/files_trashbin/appinfo/info.xml +++ b/apps/files_trashbin/appinfo/info.xml @@ -1,7 +1,7 @@ files_trashbin - Trash bin + Deleted files Keep a copy of deleted files so that they can be restored if needed AGPL Bjoern Schiessle From e7d1bbfae34afce54f7652c815aed7a269d1160e Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 21 Feb 2013 18:20:14 +0100 Subject: [PATCH 05/30] fix giant advanced caret in installation --- core/img/actions/caret-dark.png | Bin 0 -> 256 bytes core/img/actions/caret-dark.svg | 102 ++++++++++++++++++++++++++++++++ core/templates/installation.php | 2 +- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 core/img/actions/caret-dark.png create mode 100644 core/img/actions/caret-dark.svg diff --git a/core/img/actions/caret-dark.png b/core/img/actions/caret-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..ce7e1e6980298b86b6eb5bbf9008ea7dfb67699f GIT binary patch literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4u@pObhHwBu4M$1`kk47*5m^jW ze;tGwoit`w00kvWTq8(3{0JJ<;>(%z3q(K9nDUfavC`*#6aC7@ ucWthV%HO>3fAYD?)ema8nY^Qq^8MFhS8 + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/core/templates/installation.php b/core/templates/installation.php index b3b7cfc4b8..9cb1d4600d 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -49,7 +49,7 @@
- t( 'Advanced' ); ?> + t( 'Advanced' ); ?>
From 88bea55f9736bc0ddd1da5a2e055bd6b3494f73b Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 21 Feb 2013 21:30:25 +0100 Subject: [PATCH 06/30] Update hint by the internal version number. So we don't repeat the 4.5 <=> 4.90 mixup --- lib/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index 5d3286204e..ab47e404c9 100755 --- a/lib/util.php +++ b/lib/util.php @@ -73,8 +73,8 @@ class OC_Util { * @return array */ public static function getVersion() { - // hint: We only can count up. So the internal version number - // of ownCloud 4.5 will be 4.90.0. This is not visible to the user + // hint: We only can count up. Reset minor/patchlevel when + // updating major/minor version number. return array(4, 93, 10); } From 59a3238d1a0494987546b5ecc14622981b4a2778 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 14 Feb 2013 22:37:49 +0100 Subject: [PATCH 07/30] Style cleanup files_sharing --- apps/files_sharing/appinfo/update.php | 5 ++++- apps/files_sharing/lib/cache.php | 5 +++-- apps/files_sharing/lib/permissions.php | 3 ++- apps/files_sharing/lib/share/file.php | 14 ++++++++++++-- apps/files_sharing/lib/share/folder.php | 5 +++-- apps/files_sharing/lib/sharedstorage.php | 10 +++++++--- apps/files_sharing/public.php | 7 +++++-- apps/files_sharing/templates/public.php | 20 ++++++++++++++------ 8 files changed, 50 insertions(+), 19 deletions(-) diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php index 1d22b32b50..48e41e9304 100644 --- a/apps/files_sharing/appinfo/update.php +++ b/apps/files_sharing/appinfo/update.php @@ -52,7 +52,10 @@ if (version_compare($installedVersion, '0.3', '<')) { } catch (Exception $e) { $update_error = true; - OCP\Util::writeLog('files_sharing', 'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith.'" (error is "'.$e->getMessage().'")', OCP\Util::WARN); + OCP\Util::writeLog('files_sharing', + 'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith + .'" (error is "'.$e->getMessage().'")', + OCP\Util::WARN); } OC_Util::tearDownFS(); } diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 9655e44787..fb0f6c7b5a 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -71,8 +71,9 @@ class Shared_Cache extends Cache { } } else { $query = \OC_DB::prepare( - 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted` - FROM `*PREFIX*filecache` WHERE `fileid` = ?'); + 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,' + .' `size`, `mtime`, `encrypted`' + .' FROM `*PREFIX*filecache` WHERE `fileid` = ?'); $result = $query->execute(array($file)); $data = $result->fetchRow(); $data['fileid'] = (int)$data['fileid']; diff --git a/apps/files_sharing/lib/permissions.php b/apps/files_sharing/lib/permissions.php index 2b068ff935..72c1ec96c4 100644 --- a/apps/files_sharing/lib/permissions.php +++ b/apps/files_sharing/lib/permissions.php @@ -33,7 +33,8 @@ class Shared_Permissions extends Permissions { if ($fileId == -1) { return \OCP\PERMISSION_READ; } - $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE, null, true); + $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE, + null, true); if ($source) { return $source['permissions']; } else { diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 6d3c55a008..0aeb763d89 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -72,7 +72,11 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { public function formatItems($items, $format, $parameters = null) { if ($format == self::FORMAT_SHARED_STORAGE) { // Only 1 item should come through for this format call - return array('path' => $items[key($items)]['path'], 'permissions' => $items[key($items)]['permissions'], 'uid_owner' => $items[key($items)]['uid_owner']); + return array( + 'path' => $items[key($items)]['path'], + 'permissions' => $items[key($items)]['permissions'], + 'uid_owner' => $items[key($items)]['uid_owner'] + ); } else if ($format == self::FORMAT_GET_FOLDER_CONTENTS) { $files = array(); foreach ($items as $item) { @@ -99,7 +103,13 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { } $size += (int)$item['size']; } - return array('fileid' => -1, 'name' => 'Shared', 'mtime' => $mtime, 'mimetype' => 'httpd/unix-directory', 'size' => $size); + return array( + 'fileid' => -1, + 'name' => 'Shared', + 'mtime' => $mtime, + 'mimetype' => 'httpd/unix-directory', + 'size' => $size + ); } else if ($format == self::FORMAT_OPENDIR) { $files = array(); foreach ($items as $item) { diff --git a/apps/files_sharing/lib/share/folder.php b/apps/files_sharing/lib/share/folder.php index 11c8c6b1e8..4426beec63 100644 --- a/apps/files_sharing/lib/share/folder.php +++ b/apps/files_sharing/lib/share/folder.php @@ -33,7 +33,8 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share } while (!empty($parents)) { $parents = "'".implode("','", $parents)."'"; - $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache` WHERE `parent` IN ('.$parents.')'); + $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache`' + .' WHERE `parent` IN ('.$parents.')'); $result = $query->execute(); $parents = array(); while ($file = $result->fetchRow()) { @@ -47,4 +48,4 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share return $children; } -} \ No newline at end of file +} diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 65812b7e2f..c7521949da 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -240,7 +240,8 @@ class Shared extends \OC\Files\Storage\Common { public function file_put_contents($path, $data) { if ($source = $this->getSourcePath($path)) { // Check if permission is granted - if (($this->file_exists($path) && !$this->isUpdatable($path)) || ($this->is_dir($path) && !$this->isCreatable($path))) { + if (($this->file_exists($path) && !$this->isUpdatable($path)) + || ($this->is_dir($path) && !$this->isCreatable($path))) { return false; } $info = array( @@ -390,9 +391,12 @@ class Shared extends \OC\Files\Storage\Common { } public static function setup($options) { - if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || \OCP\Share::getItemsSharedWith('file')) { + if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] + || \OCP\Share::getItemsSharedWith('file')) { $user_dir = $options['user_dir']; - \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/'); + \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared', + array('sharedFolder' => '/Shared'), + $user_dir.'/Shared/'); } } diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 38d598f778..f265a7dd01 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -171,7 +171,9 @@ if (isset($path)) { $list->assign('files', $files, false); $list->assign('disableSharing', true); $list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false); - $list->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=', false); + $list->assign('downloadURL', + OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=', + false); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb, false); $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false); @@ -188,7 +190,8 @@ if (isset($path)) { $folder->assign('usedSpacePercent', 0); $tmpl->assign('folder', $folder->fetchPage(), false); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); - $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath)); + $tmpl->assign('downloadURL', + OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath)); } else { $tmpl->assign('dir', $dir); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 7776fd63b3..f9ff12679b 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -3,15 +3,20 @@
@@ -27,9 +32,12 @@
-

ownCloudt('web services under your control'); ?>

+

ownCloud – +t('web services under your control'); ?>

From fb7de774741c939ffc03b083fe75bae0560b1c85 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 14 Feb 2013 22:46:28 +0100 Subject: [PATCH 08/30] Style cleanup files_trashbin --- apps/files_trashbin/lib/trash.php | 53 +++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 8d54a471b4..2b8b32c3a1 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -23,9 +23,11 @@ namespace OCA\Files_Trashbin; class Trashbin { - - const DEFAULT_RETENTION_OBLIGATION=180; // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days) - const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota + // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days) + const DEFAULT_RETENTION_OBLIGATION=180; + + // unit: percentage; 50% of available disk space/quota + const DEFAULTMAXSIZE=50; /** * move file to the trash bin @@ -60,7 +62,8 @@ class Trashbin { $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/'.$deleted.'.d'.$timestamp, $view); if ( $view->file_exists('files_trashbin/'.$deleted.'.d'.$timestamp) ) { - $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)"); + $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user)" + ." VALUES (?,?,?,?,?,?)"); $result = $query->execute(array($deleted, $timestamp, $location, $type, $mime, $user)); if ( !$result ) { // if file couldn't be added to the database than also don't store it in the trash bin. $view->deleteAll('files_trashbin/'.$deleted.'.d'.$timestamp); @@ -70,12 +73,15 @@ class Trashbin { if ( \OCP\App::isEnabled('files_versions') ) { if ( $view->is_dir('files_versions'.$file_path) ) { - $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)); + $trashbinSize += self::calculateSize( + new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path) + ); $view->rename('files_versions'.$file_path, 'versions_trashbin/'. $deleted.'.d'.$timestamp); } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) { foreach ($versions as $v) { $trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']); - $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp); + $view->rename('files_versions'.$v['path'].'.v'.$v['version'], + 'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp); } } } @@ -121,7 +127,8 @@ class Trashbin { $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); } if ( $timestamp ) { - $query = \OC_DB::prepare('SELECT location,type FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?'); + $query = \OC_DB::prepare('SELECT location,type FROM *PREFIX*files_trash' + .' WHERE user=? AND id=? AND timestamp=?'); $result = $query->execute(array($user,$filename,$timestamp))->fetchAll(); if ( count($result) != 1 ) { \OC_Log::write('files_trashbin', 'trash bin database inconsistent!', \OC_Log::ERROR); @@ -131,7 +138,7 @@ class Trashbin { // if location no longer exists, restore file in the root directory $location = $result[0]['location']; if ( $result[0]['location'] != '/' && - (!$view->is_dir('files'.$result[0]['location']) || + (!$view->is_dir('files'.$result[0]['location']) || !$view->isUpdatable('files'.$result[0]['location'])) ) { $location = ''; } @@ -165,16 +172,21 @@ class Trashbin { $versionedFile = $file; } if ( $result[0]['type'] == 'dir' ) { - $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file)); - $view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); + $trashbinSize -= self::calculateSize( + new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file) + ); + $view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file), + \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); } else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) { foreach ($versions as $v) { if ($timestamp ) { $trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp); - $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); + $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp, + 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); } else { $trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v); - $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); + $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v, + 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); } } } @@ -280,7 +292,8 @@ class Trashbin { $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash WHERE user=?'); $result = $query->execute(array($user))->fetchAll(); - $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', self::DEFAULT_RETENTION_OBLIGATION); + $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', + self::DEFAULT_RETENTION_OBLIGATION); $limit = time() - ($retention_obligation * 86400); @@ -289,13 +302,17 @@ class Trashbin { $filename = $r['id']; if ( $r['timestamp'] < $limit ) { if ($view->is_dir('files_trashbin/'.$filename.'.d'.$timestamp)) { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp)); + $size += self::calculateSize( + new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp) + ); } else { $size += $view->filesize('files_trashbin/'.$filename.'.d'.$timestamp); } $view->unlink('files_trashbin/'.$filename.'.d'.$timestamp); if ($r['type'] == 'dir') { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp)); + $size += self::calculateSize( + new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp) + ); $view->unlink('versions_trashbin/'.$filename.'.d'.$timestamp); } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { foreach ($versions as $v) { @@ -312,7 +329,8 @@ class Trashbin { $availableSpace = $availableSpace + $size; // if size limit for trash bin reached, delete oldest files in trash bin if ($availableSpace < 0) { - $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash WHERE user=? ORDER BY timestamp ASC'); + $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash' + .' WHERE user=? ORDER BY timestamp ASC'); $result = $query->execute(array($user))->fetchAll(); $length = count($result); $i = 0; @@ -418,7 +436,8 @@ class Trashbin { if (!file_exists($root)) { return 0; } - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), \RecursiveIteratorIterator::CHILD_FIRST); + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), + \RecursiveIteratorIterator::CHILD_FIRST); $size = 0; foreach ($iterator as $path) { From db8dbb9847da1a6f1146153414f8bd3bac4ca980 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 14 Feb 2013 22:53:30 +0100 Subject: [PATCH 09/30] Style cleanup files_versions --- apps/files_versions/lib/versions.php | 35 ++++++++++++---------- apps/files_versions/templates/history.php | 3 +- apps/files_versions/templates/settings.php | 5 +++- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index ba9f8ba41c..39c00001b4 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -20,19 +20,18 @@ class Storage { const DEFAULTENABLED=true; const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota - private static $max_versions_per_interval = array( - 1 => array('intervalEndsAfter' => 10, //first 10sec, one version every 2sec - 'step' => 2), - 2 => array('intervalEndsAfter' => 60, //next minute, one version every 10sec - 'step' => 10), - 3 => array('intervalEndsAfter' => 3600, //next hour, one version every minute - 'step' => 60), - 4 => array('intervalEndsAfter' => 86400, //next 24h, one version every hour - 'step' => 3600), - 5 => array('intervalEndsAfter' => 2592000, //next 30days, one version per day - 'step' => 86400), - 6 => array('intervalEndsAfter' => -1, //until the end one version per week - 'step' => 604800), + private static $max_versions_per_interval = array( //first 10sec, one version every 2sec + 1 => array('intervalEndsAfter' => 10, 'step' => 2), + //next minute, one version every 10sec + 2 => array('intervalEndsAfter' => 60, 'step' => 10), + //next hour, one version every minute + 3 => array('intervalEndsAfter' => 3600, 'step' => 60), + //next 24h, one version every hour + 4 => array('intervalEndsAfter' => 86400, 'step' => 3600), + //next 30days, one version per day + 5 => array('intervalEndsAfter' => 2592000, 'step' => 86400), + //until the end one version per week + 6 => array('intervalEndsAfter' => -1, 'step' => 604800), ); private static function getUidAndFilename($filename) { @@ -238,7 +237,10 @@ class Storage { $versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions'); $versionsRoot = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath(''); - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($versionsRoot), \RecursiveIteratorIterator::CHILD_FIRST); + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($versionsRoot), + \RecursiveIteratorIterator::CHILD_FIRST + ); $size = 0; @@ -263,7 +265,10 @@ class Storage { $versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions'); $versionsRoot = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath(''); - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($versionsRoot), \RecursiveIteratorIterator::CHILD_FIRST); + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($versionsRoot), + \RecursiveIteratorIterator::CHILD_FIRST + ); $versions = array(); diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php index 850ece89c9..c450af66ad 100644 --- a/apps/files_versions/templates/history.php +++ b/apps/files_versions/templates/history.php @@ -22,7 +22,8 @@ if( isset( $_['message'] ) ) { foreach ( $_['versions'] as $v ) { echo ' '; echo OCP\Util::formatDate( doubleval($v['version']) ); - echo ' Revert

'; + echo ' Revert

'; if ( $v['cur'] ) { echo ' (Current)'; } diff --git a/apps/files_versions/templates/settings.php b/apps/files_versions/templates/settings.php index bfca8366f5..3b8e4baf11 100644 --- a/apps/files_versions/templates/settings.php +++ b/apps/files_versions/templates/settings.php @@ -1,6 +1,9 @@
t('Files Versioning');?> - />
+ />
From 1a747b3e480a2b44969b1306a5d354e721781c81 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 14 Feb 2013 23:19:12 +0100 Subject: [PATCH 10/30] Style cleanup core dir --- core/ajax/share.php | 62 +++++++++++++++++++++++++++------ core/js/config.php | 30 ++++++++++++++-- core/templates/exception.php | 4 ++- core/templates/installation.php | 53 +++++++++++++++++++--------- core/templates/layout.base.php | 3 +- core/templates/layout.guest.php | 6 ++-- core/templates/layout.user.php | 22 ++++++++---- core/templates/login.php | 3 +- core/templates/update.php | 3 +- 9 files changed, 143 insertions(+), 43 deletions(-) diff --git a/core/ajax/share.php b/core/ajax/share.php index 6704a00c5a..332b6a0bed 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -34,7 +34,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $shareWith = null; } - $token = OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], $shareType, $shareWith, $_POST['permissions']); + $token = OCP\Share::shareItem( + $_POST['itemType'], + $_POST['itemSource'], + $shareType, + $shareWith, + $_POST['permissions'] + ); if (is_string($token)) { OC_JSON::success(array('data' => array('token' => $token))); @@ -59,7 +65,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo break; case 'setPermissions': if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) { - $return = OCP\Share::setPermissions($_POST['itemType'], $_POST['itemSource'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']); + $return = OCP\Share::setPermissions( + $_POST['itemType'], + $_POST['itemSource'], + $_POST['shareType'], + $_POST['shareWith'], + $_POST['permissions'] + ); ($return) ? OC_JSON::success() : OC_JSON::error(); } break; @@ -86,9 +98,11 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo if ($type === 'dir') $subject = (string)$l->t('User %s shared a folder with you', $displayName); - $text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', array($displayName, $file, $link)); + $text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', + array($displayName, $file, $link)); if ($type === 'dir') - $text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', array($displayName, $file, $link)); + $text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', + array($displayName, $file, $link)); $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply'); @@ -112,14 +126,29 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } break; case 'getItem': - if (isset($_GET['itemType']) && isset($_GET['itemSource']) && isset($_GET['checkReshare']) && isset($_GET['checkShares'])) { + if (isset($_GET['itemType']) + && isset($_GET['itemSource']) + && isset($_GET['checkReshare']) + && isset($_GET['checkShares'])) { if ($_GET['checkReshare'] == 'true') { - $reshare = OCP\Share::getItemSharedWithBySource($_GET['itemType'], $_GET['itemSource'], OCP\Share::FORMAT_NONE, null, true); + $reshare = OCP\Share::getItemSharedWithBySource( + $_GET['itemType'], + $_GET['itemSource'], + OCP\Share::FORMAT_NONE, + null, + true + ); } else { $reshare = false; } if ($_GET['checkShares'] == 'true') { - $shares = OCP\Share::getItemShared($_GET['itemType'], $_GET['itemSource'], OCP\Share::FORMAT_NONE, null, true); + $shares = OCP\Share::getItemShared( + $_GET['itemType'], + $_GET['itemSource'], + OCP\Share::FORMAT_NONE, + null, + true + ); } else { $shares = false; } @@ -165,8 +194,15 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } $offset += $limit; foreach ($users as $uid => $displayName) { - if ((!isset($_GET['itemShares']) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($uid, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $uid != OC_User::getUser()) { - $shareWith[] = array('label' => $displayName, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $uid)); + if ((!isset($_GET['itemShares']) + || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) + || !in_array($uid, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) + && $uid != OC_User::getUser()) { + $shareWith[] = array( + 'label' => $displayName, + 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, + 'shareWith' => $uid) + ); $count++; } } @@ -179,7 +215,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) { - $shareWith[] = array('label' => $group.' (group)', 'value' => array('shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group)); + $shareWith[] = array( + 'label' => $group.' (group)', + 'value' => array( + 'shareType' => OCP\Share::SHARE_TYPE_GROUP, + 'shareWith' => $group + ) + ); $count++; } } else { diff --git a/core/js/config.php b/core/js/config.php index 9069175ed6..0aaa448228 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -29,8 +29,33 @@ $array = array( "oc_current_user" => "\"".OC_User::getUser(). "\"", "oc_requesttoken" => "\"".OC_Util::callRegister(). "\"", "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), - "dayNames" => json_encode(array((string)$l->t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))), - "monthNames" => json_encode(array((string)$l->t('January'), (string)$l->t('February'), (string)$l->t('March'), (string)$l->t('April'), (string)$l->t('May'), (string)$l->t('June'), (string)$l->t('July'), (string)$l->t('August'), (string)$l->t('September'), (string)$l->t('October'), (string)$l->t('November'), (string)$l->t('December'))), + "dayNames" => json_encode( + array( + (string)$l->t('Sunday'), + (string)$l->t('Monday'), + (string)$l->t('Tuesday'), + (string)$l->t('Wednesday'), + (string)$l->t('Thursday'), + (string)$l->t('Friday'), + (string)$l->t('Saturday') + ) + ), + "monthNames" => json_encode( + array( + (string)$l->t('January'), + (string)$l->t('February'), + (string)$l->t('March'), + (string)$l->t('April'), + (string)$l->t('May'), + (string)$l->t('June'), + (string)$l->t('July'), + (string)$l->t('August'), + (string)$l->t('September'), + (string)$l->t('October'), + (string)$l->t('November'), + (string)$l->t('December') + ) + ), "firstDay" => json_encode($l->l('firstday', 'firstday')) , ); @@ -38,4 +63,3 @@ $array = array( foreach ($array as $setting => $value) { echo("var ". $setting ."=".$value.";\n"); } -?> \ No newline at end of file diff --git a/core/templates/exception.php b/core/templates/exception.php index 62d6cf2ade..4059c7e047 100644 --- a/core/templates/exception.php +++ b/core/templates/exception.php @@ -5,7 +5,9 @@

bug tracker, please copy the following informations into the description.