From f828b51ede75ef25db3859156691fb582b76fe39 Mon Sep 17 00:00:00 2001 From: kondou Date: Sat, 12 Oct 2013 17:28:20 +0200 Subject: Hide files list header, when theres no files to see --- apps/files/index.php | 6 +++++- apps/files/js/filelist.js | 3 +++ apps/files/templates/index.php | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index 8d877be8ac9..7db3fd96380 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -118,6 +118,9 @@ if ($needUpgrade) { $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); } + $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); + $emptyContent = (!isset($files) or !$isCreatable or count($files) > 0 or $ajaxLoad); + OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); OCP\Util::addscript('files', 'keyboardshortcuts'); @@ -125,7 +128,7 @@ if ($needUpgrade) { $tmpl->assign('fileList', $list->fetchPage()); $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); $tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($dir)); - $tmpl->assign('isCreatable', \OC\Files\Filesystem::isCreatable($dir . '/')); + $tmpl->assign('isCreatable', $isCreatable); $tmpl->assign('permissions', $permissions); $tmpl->assign('files', $files); $tmpl->assign('trash', $trashEnabled); @@ -141,6 +144,7 @@ if ($needUpgrade) { $tmpl->assign("encryptionInitStatus", $encryptionInitStatus); $tmpl->assign('disableSharing', false); $tmpl->assign('ajaxLoad', $ajaxLoad); + $tmpl->assign('emptyContent', $emptyContent); $tmpl->printPage(); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a9297996778..7a0cfa83255 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -12,6 +12,7 @@ var FileList={ isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; $fileList.empty().html(fileListHtml); $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); + $('#filestable th').toggleClass('hidden', !(!isCreatable || $fileList.find('tr').length > 0)); $fileList.find('tr').each(function () { FileActions.display($(this).children('td.filename')); }); @@ -257,6 +258,7 @@ var FileList={ FileList.updateFileSummary(); if($('tr[data-file]').length==0){ $('#emptycontent').removeClass('hidden'); + $('#filescontent th').addClass('hidden'); } }, insertElement:function(name,type,element){ @@ -287,6 +289,7 @@ var FileList={ $('#fileList').append(element); } $('#emptycontent').addClass('hidden'); + $('#filestable th').removeClass('hidden'); FileList.updateFileSummary(); }, loadingDone:function(name, id){ diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 32a59f1e1a6..af9cdffa5a3 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -42,14 +42,14 @@ -
0 or $_['ajaxLoad']):?>class="hidden">t('Nothing in here. Upload something!'))?>
+
class="hidden">t('Nothing in here. Upload something!'))?>
- - - +
+ class="hidden" id='headerName'>
@@ -65,8 +65,8 @@
t('Size')); ?> + class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> t( 'Modified' )); ?> -- cgit v1.2.3 From e55d2359b1746e29b764a0d366afbb857b797341 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 17 Oct 2013 14:54:37 +0200 Subject: removing pointless calls on quoteIdentifier() - reason: name on $tableDiff doesn't exist and my design the name cannot be changed adding PHPDoc --- lib/private/db/mdb2schemamanager.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php index fc13e881bff..8a818466f74 100644 --- a/lib/private/db/mdb2schemamanager.php +++ b/lib/private/db/mdb2schemamanager.php @@ -61,6 +61,7 @@ class MDB2SchemaManager { $toSchema = $schemaReader->loadSchemaFromFile($file); // remove tables we don't know about + /** @var $table \Doctrine\DBAL\Schema\Table */ foreach($fromSchema->getTables() as $table) { if (!$toSchema->hasTable($table->getName())) { $fromSchema->dropTable($table->getName()); @@ -76,12 +77,6 @@ class MDB2SchemaManager { $comparator = new \Doctrine\DBAL\Schema\Comparator(); $schemaDiff = $comparator->compare($fromSchema, $toSchema); - $platform = $this->conn->getDatabasePlatform(); - $tables = $schemaDiff->newTables + $schemaDiff->changedTables + $schemaDiff->removedTables; - foreach($tables as $tableDiff) { - $tableDiff->name = $platform->quoteIdentifier($tableDiff->name); - } - if ($generateSql) { return $this->generateChangeScript($schemaDiff); } @@ -110,6 +105,7 @@ class MDB2SchemaManager { $schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $this->conn->getDatabasePlatform()); $fromSchema = $schemaReader->loadSchemaFromFile($file); $toSchema = clone $fromSchema; + /** @var $table \Doctrine\DBAL\Schema\Table */ foreach($toSchema->getTables() as $table) { $toSchema->dropTable($table->getName()); } -- cgit v1.2.3 From 60b25a2e975c6824b3d5a5d4c14960a253aaa705 Mon Sep 17 00:00:00 2001 From: kondou Date: Sun, 20 Oct 2013 22:47:44 +0200 Subject: Create FileList.updateEmptyContent() and fix not showing emptycontent after deletion --- apps/files/js/filelist.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 7a0cfa83255..5d1b797ab5e 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -7,12 +7,9 @@ var FileList={ }); }, update:function(fileListHtml) { - var $fileList = $('#fileList'), - permissions = $('#permissions').val(), - isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; + var $fileList = $('#fileList'); $fileList.empty().html(fileListHtml); - $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); - $('#filestable th').toggleClass('hidden', !(!isCreatable || $fileList.find('tr').length > 0)); + FileList.updateEmptyContent(); $fileList.find('tr').each(function () { FileActions.display($(this).children('td.filename')); }); @@ -508,6 +505,7 @@ var FileList={ procesSelection(); checkTrashStatus(); FileList.updateFileSummary(); + FileList.updateEmptyContent(); } else { $.each(files,function(index,file) { var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete"); @@ -621,6 +619,13 @@ var FileList={ } } }, + updateEmptyContent: function(){ + var $fileList = $('#fileList'); + var permissions = $('#permissions').val(); + var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; + $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); + $('#filestable th').toggleClass('hidden', !(!isCreatable || $fileList.find('tr').length > 0)); + }, showMask: function(){ // in case one was shown before var $mask = $('#content .mask'); -- cgit v1.2.3 From 40cc57ab3e34a99ec28485fd76a7b052b0da17aa Mon Sep 17 00:00:00 2001 From: kondou Date: Sun, 20 Oct 2013 22:55:49 +0200 Subject: Improve updateEmptyContent logic --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 5d1b797ab5e..9b66a2e69ae 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -624,7 +624,7 @@ var FileList={ var permissions = $('#permissions').val(); var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); - $('#filestable th').toggleClass('hidden', !(!isCreatable || $fileList.find('tr').length > 0)); + $('#filestable th').toggleClass('hidden', isCreatable && $fileList.find('tr').length === 0); }, showMask: function(){ // in case one was shown before -- cgit v1.2.3 From 7864a3bf07fab1183bc003e771ee365fc1376c73 Mon Sep 17 00:00:00 2001 From: kondou Date: Mon, 21 Oct 2013 17:41:03 +0200 Subject: Fix shared folder still showing fileheader --- apps/files/index.php | 2 +- apps/files/js/filelist.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index 7db3fd96380..22240deadca 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -119,7 +119,7 @@ if ($needUpgrade) { } $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); - $emptyContent = (!isset($files) or !$isCreatable or count($files) > 0 or $ajaxLoad); + $emptyContent = (!isset($files) or count($files) > 0 or $ajaxLoad); OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 9b66a2e69ae..20930b2dce8 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -623,8 +623,8 @@ var FileList={ var $fileList = $('#fileList'); var permissions = $('#permissions').val(); var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; - $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); - $('#filestable th').toggleClass('hidden', isCreatable && $fileList.find('tr').length === 0); + $('#emptycontent').toggleClass('hidden', $fileList.find('tr').length > 0); + $('#filestable th').toggleClass('hidden', $fileList.find('tr').length === 0); }, showMask: function(){ // in case one was shown before -- cgit v1.2.3 From 581cd9bb9c9307894f60d900e82d9a0df83818fc Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Mon, 21 Oct 2013 18:58:46 +0200 Subject: Support existing sessions within OCS API calls --- lib/private/api.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/private/api.php b/lib/private/api.php index 31f3f968d9b..26091657b31 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -46,6 +46,7 @@ class OC_API { * api actions */ protected static $actions = array(); + private static $logoutRequired = false; /** * registers an api call @@ -115,7 +116,9 @@ class OC_API { $formats = array('json', 'xml'); $format = !empty($_GET['format']) && in_array($_GET['format'], $formats) ? $_GET['format'] : 'xml'; - OC_User::logout(); + if (self::$logoutRequired) { + OC_User::logout(); + } self::respond($response, $format); } @@ -235,10 +238,23 @@ class OC_API { * http basic auth * @return string|false (username, or false on failure) */ - private static function loginUser(){ + private static function loginUser(){ + // basic auth $authUser = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : ''; $authPw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; - return OC_User::login($authUser, $authPw) ? $authUser : false; + $return = OC_User::login($authUser, $authPw); + if ($return === true) { + self::$logoutRequired = true; + return $authUser; + } + + // reuse existing login + $loggedIn = OC_User::isLoggedIn(); + if ($loggedIn === true) { + return OC_User::getUser(); + } + + return false; } /** -- cgit v1.2.3 From 732e7db31902e88e4ca6582c56af14b5e3d2bc39 Mon Sep 17 00:00:00 2001 From: kondou Date: Mon, 21 Oct 2013 19:49:09 +0200 Subject: Fix mind-boggling emptycontent logic --- apps/files/index.php | 4 +++- apps/files/js/filelist.js | 2 +- apps/files/templates/index.php | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index 22240deadca..c2c0ba02a99 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -119,7 +119,8 @@ if ($needUpgrade) { } $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); - $emptyContent = (!isset($files) or count($files) > 0 or $ajaxLoad); + $fileHeader = (!isset($files) or count($files) > 0); + $emptyContent = $isCreatable or $fileHeader or $ajaxLoad; OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); @@ -145,6 +146,7 @@ if ($needUpgrade) { $tmpl->assign('disableSharing', false); $tmpl->assign('ajaxLoad', $ajaxLoad); $tmpl->assign('emptyContent', $emptyContent); + $tmpl->assign('fileHeader', $fileHeader); $tmpl->printPage(); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 20930b2dce8..17e7fb6440e 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -623,7 +623,7 @@ var FileList={ var $fileList = $('#fileList'); var permissions = $('#permissions').val(); var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; - $('#emptycontent').toggleClass('hidden', $fileList.find('tr').length > 0); + $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); $('#filestable th').toggleClass('hidden', $fileList.find('tr').length === 0); }, showMask: function(){ diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index af9cdffa5a3..c1373c3e9d5 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -42,14 +42,14 @@ -
class="hidden">t('Nothing in here. Upload something!'))?>
+
class="hidden">t('Nothing in here. Upload something!'))?>
- - - +
class="hidden" id='headerName'> + class="hidden" id='headerName'>
@@ -65,8 +65,8 @@
class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> + class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> t( 'Modified' )); ?> -- cgit v1.2.3 From 97aff7c64ee8164a6ba468b6ccb2ee05fa689cf1 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Mon, 21 Oct 2013 22:31:57 +0300 Subject: Use quoteIdentifier with proper objects --- lib/private/db/mdb2schemamanager.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php index 8a818466f74..416e2f55426 100644 --- a/lib/private/db/mdb2schemamanager.php +++ b/lib/private/db/mdb2schemamanager.php @@ -77,6 +77,11 @@ class MDB2SchemaManager { $comparator = new \Doctrine\DBAL\Schema\Comparator(); $schemaDiff = $comparator->compare($fromSchema, $toSchema); + $platform = $this->conn->getDatabasePlatform(); + foreach($schemaDiff->changedTables as $tableDiff) { + $tableDiff->name = $platform->quoteIdentifier($tableDiff->name); + } + if ($generateSql) { return $this->generateChangeScript($schemaDiff); } -- cgit v1.2.3 From d1c27e08e56562c7b522c43d1f1b485ee9f1cd77 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 21 Oct 2013 22:18:10 +0200 Subject: Fixed empty content logic - Remove obsolete code that used another approach for hiding emptycontent - Fixed logic for the showing of the empty content message --- apps/files/index.php | 2 +- apps/files/templates/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index c2c0ba02a99..0b56d9c19a8 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -120,7 +120,7 @@ if ($needUpgrade) { $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); $fileHeader = (!isset($files) or count($files) > 0); - $emptyContent = $isCreatable or $fileHeader or $ajaxLoad; + $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index c1373c3e9d5..5a686da43f8 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,6 +1,6 @@
-
+
t('New'));?>
    -- cgit v1.2.3 From 3bb7cf939ec56f97a5fb01c16282ed7d831e338f Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 22 Oct 2013 12:08:05 +0200 Subject: Fixed ugly white space while loading file thumbnail Preview images are now pre-loaded before being set on the file element. This fixes #5135 and prevents a white space to be displayed while the thumbnails is being loaded. --- apps/files/js/files.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index c3a8d81b50d..ec2dc7c62ea 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -663,8 +663,16 @@ function lazyLoadPreview(path, mime, ready, width, height) { $.get(previewURL, function() { previewURL = previewURL.replace('(', '%28'); previewURL = previewURL.replace(')', '%29'); - //set preview thumbnail URL - ready(previewURL + '&reload=true'); + previewURL += '&reload=true'; + + // preload image to prevent delay + // this will make the browser cache the image + var img = new Image(); + img.onload = function(){ + //set preview thumbnail URL + ready(previewURL); + } + img.src = previewURL; }); }); } -- cgit v1.2.3 From e23433f7718c41cf385ded0c50b8c185836eea2b Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 22 Oct 2013 14:02:44 +0200 Subject: display the original file name - this will change in case of renames --- apps/files_sharing/templates/public.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 1f5453468b4..ef4c1c433da 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -15,10 +15,10 @@
    t('%s shared the folder %s with you', - array($_['displayName'], $_['fileTarget']))) ?> + array($_['displayName'], $_['filename']))) ?> t('%s shared the file %s with you', - array($_['displayName'], $_['fileTarget']))) ?> + array($_['displayName'], $_['filename']))) ?> @@ -88,7 +88,7 @@
    • - t('No preview available for').' '.$_['fileTarget']); ?>
      + t('No preview available for').' '.$_['filename']); ?>
      Download" />t('Download'))?> -- cgit v1.2.3 From bd450d6f6b32b3174968ff81e3a376366b836387 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 22 Oct 2013 16:15:19 +0200 Subject: add post_enable hook if a app gets enabled --- lib/private/app.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/app.php b/lib/private/app.php index 6f45b6e6dd7..eca40a81cc1 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -249,6 +249,7 @@ class OC_App{ if(isset($appdata['id'])) { OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] ); } + \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app)); } }else{ throw new \Exception($l->t("No app name specified")); -- cgit v1.2.3 From eb348b776c4e6d317a42e979c9bbd379c7462b99 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 22 Oct 2013 16:15:24 +0200 Subject: set the init status to "NOT_INITIALIZED" if the encryption app gets enabled --- apps/files_encryption/hooks/hooks.php | 12 ++++++++++++ apps/files_encryption/lib/helper.php | 1 + apps/files_encryption/lib/util.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index d9a76becf25..ef216c2e2e7 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -555,4 +555,16 @@ class Hooks { } } + /** + * set the init status to 'NOT_INITIALIZED' (0) if the app gets enabled + * @param array $params contains the app ID + */ + public static function postEnable($params) { + error_log("app was enabled!"); + if ($params['app'] === 'files_encryption') { + $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); + $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED); + } + } + } diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index a754f9f28c4..91dd08ec08d 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -69,6 +69,7 @@ class Helper { public static function registerAppHooks() { \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable'); + \OCP\Util::connectHook('OC_App', 'post_disable', 'OCA\Encryption\Hooks', 'postEnable'); } /** diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 53d58fbf40d..b9592a32cb2 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1278,7 +1278,7 @@ class Util { // If no record is found if (empty($migrationStatus)) { \OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $this->userId . ", no record found", \OCP\Util::ERROR); - return false; + return self::MIGRATION_OPEN; // If a record is found } else { return (int)$migrationStatus[0]; -- cgit v1.2.3 From 3d1d44352979436e2cd9dc93d5a097184907f335 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 22 Oct 2013 16:21:04 +0200 Subject: remove debug output --- apps/files_encryption/hooks/hooks.php | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index ef216c2e2e7..6e2d360917b 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -560,7 +560,6 @@ class Hooks { * @param array $params contains the app ID */ public static function postEnable($params) { - error_log("app was enabled!"); if ($params['app'] === 'files_encryption') { $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED); -- cgit v1.2.3 From 09903aa36c54f68f38bece19e418ba34ac6d1491 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 22 Oct 2013 19:41:26 +0200 Subject: - delete properties on node delete - move properties on node move --- lib/private/connector/sabre/file.php | 3 +++ lib/private/connector/sabre/node.php | 11 +++++++++++ lib/private/connector/sabre/objecttree.php | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 3402946a136..6ace8d14484 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -148,6 +148,9 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D } \OC\Files\Filesystem::unlink($this->path); + // remove properties + $this->removeProperties(); + } /** diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php index c38e9f86375..3c2ad60f1dd 100644 --- a/lib/private/connector/sabre/node.php +++ b/lib/private/connector/sabre/node.php @@ -190,6 +190,17 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr return true; } + /** + * removes all properties for this node and user + */ + public function removeProperties() { + $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*properties`' + .' WHERE `userid` = ? AND `propertypath` = ?' ); + $query->execute( array( OC_User::getUser(), $this->path)); + + $this->setPropertyCache(null); + } + /** * @brief Returns a list of properties for this nodes.; * @param array $properties diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php index df8902f66e2..cd3f081f7cc 100644 --- a/lib/private/connector/sabre/objecttree.php +++ b/lib/private/connector/sabre/objecttree.php @@ -97,6 +97,11 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { throw new \Sabre_DAV_Exception_Forbidden(''); } + // update properties + $query = \OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ?' + .' WHERE `userid` = ? AND `propertypath` = ?' ); + $query->execute( array( $destinationPath, \OC_User::getUser(), $sourcePath )); + $this->markDirty($sourceDir); $this->markDirty($destinationDir); -- cgit v1.2.3 From ad017285e15b077bf0ca3457f05a7b082abea6b0 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 23 Oct 2013 05:57:34 +0200 Subject: Fix namespace for OCP\Appframework\Http To avoid having to use OCP\Appframework\Http\Http in the public - and stable - API OCP\Appframework\Http is now both a class and a namespace. --- .../dependencyinjection/dicontainer.php | 2 +- lib/private/appframework/http.php | 149 +++++++++++++++++++++ lib/private/appframework/http/dispatcher.php | 1 + lib/private/appframework/http/http.php | 148 -------------------- lib/private/appframework/http/redirectresponse.php | 3 +- .../middleware/security/securitymiddleware.php | 2 +- lib/public/appframework/http.php | 89 ++++++++++++ lib/public/appframework/http/http.php | 89 ------------ lib/public/appframework/http/jsonresponse.php | 1 + lib/public/appframework/http/response.php | 1 + tests/lib/appframework/http/DispatcherTest.php | 4 +- tests/lib/appframework/http/HttpTest.php | 1 + .../lib/appframework/http/RedirectResponseTest.php | 1 + tests/lib/appframework/http/ResponseTest.php | 3 +- .../middleware/security/SecurityMiddlewareTest.php | 2 +- 15 files changed, 252 insertions(+), 244 deletions(-) create mode 100644 lib/private/appframework/http.php delete mode 100644 lib/private/appframework/http/http.php create mode 100644 lib/public/appframework/http.php delete mode 100644 lib/public/appframework/http/http.php diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index 81910df6990..ae2c5e8546b 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -24,7 +24,7 @@ namespace OC\AppFramework\DependencyInjection; -use OC\AppFramework\Http\Http; +use OC\AppFramework\Http; use OC\AppFramework\Http\Request; use OC\AppFramework\Http\Dispatcher; use OC\AppFramework\Core\API; diff --git a/lib/private/appframework/http.php b/lib/private/appframework/http.php new file mode 100644 index 00000000000..41fc0db6b38 --- /dev/null +++ b/lib/private/appframework/http.php @@ -0,0 +1,149 @@ +. + * + */ + + +namespace OC\AppFramework; + +use OCP\AppFramework\Http as BaseHttp; + +class Http extends BaseHttp { + + private $server; + private $protocolVersion; + protected $headers; + + /** + * @param $_SERVER $server + * @param string $protocolVersion the http version to use defaults to HTTP/1.1 + */ + public function __construct($server, $protocolVersion='HTTP/1.1') { + $this->server = $server; + $this->protocolVersion = $protocolVersion; + + $this->headers = array( + self::STATUS_CONTINUE => 'Continue', + self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols', + self::STATUS_PROCESSING => 'Processing', + self::STATUS_OK => 'OK', + self::STATUS_CREATED => 'Created', + self::STATUS_ACCEPTED => 'Accepted', + self::STATUS_NON_AUTHORATIVE_INFORMATION => 'Non-Authorative Information', + self::STATUS_NO_CONTENT => 'No Content', + self::STATUS_RESET_CONTENT => 'Reset Content', + self::STATUS_PARTIAL_CONTENT => 'Partial Content', + self::STATUS_MULTI_STATUS => 'Multi-Status', // RFC 4918 + self::STATUS_ALREADY_REPORTED => 'Already Reported', // RFC 5842 + self::STATUS_IM_USED => 'IM Used', // RFC 3229 + self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices', + self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently', + self::STATUS_FOUND => 'Found', + self::STATUS_SEE_OTHER => 'See Other', + self::STATUS_NOT_MODIFIED => 'Not Modified', + self::STATUS_USE_PROXY => 'Use Proxy', + self::STATUS_RESERVED => 'Reserved', + self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect', + self::STATUS_BAD_REQUEST => 'Bad request', + self::STATUS_UNAUTHORIZED => 'Unauthorized', + self::STATUS_PAYMENT_REQUIRED => 'Payment Required', + self::STATUS_FORBIDDEN => 'Forbidden', + self::STATUS_NOT_FOUND => 'Not Found', + self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed', + self::STATUS_NOT_ACCEPTABLE => 'Not Acceptable', + self::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required', + self::STATUS_REQUEST_TIMEOUT => 'Request Timeout', + self::STATUS_CONFLICT => 'Conflict', + self::STATUS_GONE => 'Gone', + self::STATUS_LENGTH_REQUIRED => 'Length Required', + self::STATUS_PRECONDITION_FAILED => 'Precondition failed', + self::STATUS_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large', + self::STATUS_REQUEST_URI_TOO_LONG => 'Request-URI Too Long', + self::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type', + self::STATUS_REQUEST_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', + self::STATUS_EXPECTATION_FAILED => 'Expectation Failed', + self::STATUS_IM_A_TEAPOT => 'I\'m a teapot', // RFC 2324 + self::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', // RFC 4918 + self::STATUS_LOCKED => 'Locked', // RFC 4918 + self::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', // RFC 4918 + self::STATUS_UPGRADE_REQUIRED => 'Upgrade required', + self::STATUS_PRECONDITION_REQUIRED => 'Precondition required', // draft-nottingham-http-new-status + self::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', // draft-nottingham-http-new-status + self::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', // draft-nottingham-http-new-status + self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error', + self::STATUS_NOT_IMPLEMENTED => 'Not Implemented', + self::STATUS_BAD_GATEWAY => 'Bad Gateway', + self::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable', + self::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout', + self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported', + self::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates', + self::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', // RFC 4918 + self::STATUS_LOOP_DETECTED => 'Loop Detected', // RFC 5842 + self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard + self::STATUS_NOT_EXTENDED => 'Not extended', + self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status + ); + } + + + /** + * Gets the correct header + * @param Http::CONSTANT $status the constant from the Http class + * @param \DateTime $lastModified formatted last modified date + * @param string $Etag the etag + */ + public function getStatusHeader($status, \DateTime $lastModified=null, + $ETag=null) { + + if(!is_null($lastModified)) { + $lastModified = $lastModified->format(\DateTime::RFC2822); + } + + // if etag or lastmodified have not changed, return a not modified + if ((isset($this->server['HTTP_IF_NONE_MATCH']) + && trim($this->server['HTTP_IF_NONE_MATCH']) === $ETag) + + || + + (isset($this->server['HTTP_IF_MODIFIED_SINCE']) + && trim($this->server['HTTP_IF_MODIFIED_SINCE']) === + $lastModified)) { + + $status = self::STATUS_NOT_MODIFIED; + } + + // we have one change currently for the http 1.0 header that differs + // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND + // if this differs any more, we want to create childclasses for this + if($status === self::STATUS_TEMPORARY_REDIRECT + && $this->protocolVersion === 'HTTP/1.0') { + + $status = self::STATUS_FOUND; + } + + return $this->protocolVersion . ' ' . $status . ' ' . + $this->headers[$status]; + } + + +} + + diff --git a/lib/private/appframework/http/dispatcher.php b/lib/private/appframework/http/dispatcher.php index 51283fd64e7..a2afb53f0fa 100644 --- a/lib/private/appframework/http/dispatcher.php +++ b/lib/private/appframework/http/dispatcher.php @@ -25,6 +25,7 @@ namespace OC\AppFramework\Http; use \OC\AppFramework\Middleware\MiddlewareDispatcher; +use \OC\AppFramework\Http; use OCP\AppFramework\Controller; diff --git a/lib/private/appframework/http/http.php b/lib/private/appframework/http/http.php deleted file mode 100644 index e00dc9cdc4a..00000000000 --- a/lib/private/appframework/http/http.php +++ /dev/null @@ -1,148 +0,0 @@ -. - * - */ - - -namespace OC\AppFramework\Http; - - -class Http extends \OCP\AppFramework\Http\Http{ - - private $server; - private $protocolVersion; - protected $headers; - - /** - * @param $_SERVER $server - * @param string $protocolVersion the http version to use defaults to HTTP/1.1 - */ - public function __construct($server, $protocolVersion='HTTP/1.1') { - $this->server = $server; - $this->protocolVersion = $protocolVersion; - - $this->headers = array( - self::STATUS_CONTINUE => 'Continue', - self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols', - self::STATUS_PROCESSING => 'Processing', - self::STATUS_OK => 'OK', - self::STATUS_CREATED => 'Created', - self::STATUS_ACCEPTED => 'Accepted', - self::STATUS_NON_AUTHORATIVE_INFORMATION => 'Non-Authorative Information', - self::STATUS_NO_CONTENT => 'No Content', - self::STATUS_RESET_CONTENT => 'Reset Content', - self::STATUS_PARTIAL_CONTENT => 'Partial Content', - self::STATUS_MULTI_STATUS => 'Multi-Status', // RFC 4918 - self::STATUS_ALREADY_REPORTED => 'Already Reported', // RFC 5842 - self::STATUS_IM_USED => 'IM Used', // RFC 3229 - self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices', - self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently', - self::STATUS_FOUND => 'Found', - self::STATUS_SEE_OTHER => 'See Other', - self::STATUS_NOT_MODIFIED => 'Not Modified', - self::STATUS_USE_PROXY => 'Use Proxy', - self::STATUS_RESERVED => 'Reserved', - self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect', - self::STATUS_BAD_REQUEST => 'Bad request', - self::STATUS_UNAUTHORIZED => 'Unauthorized', - self::STATUS_PAYMENT_REQUIRED => 'Payment Required', - self::STATUS_FORBIDDEN => 'Forbidden', - self::STATUS_NOT_FOUND => 'Not Found', - self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed', - self::STATUS_NOT_ACCEPTABLE => 'Not Acceptable', - self::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required', - self::STATUS_REQUEST_TIMEOUT => 'Request Timeout', - self::STATUS_CONFLICT => 'Conflict', - self::STATUS_GONE => 'Gone', - self::STATUS_LENGTH_REQUIRED => 'Length Required', - self::STATUS_PRECONDITION_FAILED => 'Precondition failed', - self::STATUS_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large', - self::STATUS_REQUEST_URI_TOO_LONG => 'Request-URI Too Long', - self::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type', - self::STATUS_REQUEST_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', - self::STATUS_EXPECTATION_FAILED => 'Expectation Failed', - self::STATUS_IM_A_TEAPOT => 'I\'m a teapot', // RFC 2324 - self::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', // RFC 4918 - self::STATUS_LOCKED => 'Locked', // RFC 4918 - self::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', // RFC 4918 - self::STATUS_UPGRADE_REQUIRED => 'Upgrade required', - self::STATUS_PRECONDITION_REQUIRED => 'Precondition required', // draft-nottingham-http-new-status - self::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', // draft-nottingham-http-new-status - self::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', // draft-nottingham-http-new-status - self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error', - self::STATUS_NOT_IMPLEMENTED => 'Not Implemented', - self::STATUS_BAD_GATEWAY => 'Bad Gateway', - self::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable', - self::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout', - self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported', - self::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates', - self::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', // RFC 4918 - self::STATUS_LOOP_DETECTED => 'Loop Detected', // RFC 5842 - self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard - self::STATUS_NOT_EXTENDED => 'Not extended', - self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status - ); - } - - - /** - * Gets the correct header - * @param Http::CONSTANT $status the constant from the Http class - * @param \DateTime $lastModified formatted last modified date - * @param string $Etag the etag - */ - public function getStatusHeader($status, \DateTime $lastModified=null, - $ETag=null) { - - if(!is_null($lastModified)) { - $lastModified = $lastModified->format(\DateTime::RFC2822); - } - - // if etag or lastmodified have not changed, return a not modified - if ((isset($this->server['HTTP_IF_NONE_MATCH']) - && trim($this->server['HTTP_IF_NONE_MATCH']) === $ETag) - - || - - (isset($this->server['HTTP_IF_MODIFIED_SINCE']) - && trim($this->server['HTTP_IF_MODIFIED_SINCE']) === - $lastModified)) { - - $status = self::STATUS_NOT_MODIFIED; - } - - // we have one change currently for the http 1.0 header that differs - // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND - // if this differs any more, we want to create childclasses for this - if($status === self::STATUS_TEMPORARY_REDIRECT - && $this->protocolVersion === 'HTTP/1.0') { - - $status = self::STATUS_FOUND; - } - - return $this->protocolVersion . ' ' . $status . ' ' . - $this->headers[$status]; - } - - -} - - diff --git a/lib/private/appframework/http/redirectresponse.php b/lib/private/appframework/http/redirectresponse.php index 688447f1618..c4e21059480 100644 --- a/lib/private/appframework/http/redirectresponse.php +++ b/lib/private/appframework/http/redirectresponse.php @@ -24,7 +24,8 @@ namespace OC\AppFramework\Http; -use OCP\AppFramework\Http\Response; +use OCP\AppFramework\Http\Response, + OCP\AppFramework\Http; /** diff --git a/lib/private/appframework/middleware/security/securitymiddleware.php b/lib/private/appframework/middleware/security/securitymiddleware.php index f103a40ee7f..c3143754823 100644 --- a/lib/private/appframework/middleware/security/securitymiddleware.php +++ b/lib/private/appframework/middleware/security/securitymiddleware.php @@ -24,7 +24,7 @@ namespace OC\AppFramework\Middleware\Security; -use OC\AppFramework\Http\Http; +use OC\AppFramework\Http; use OC\AppFramework\Http\RedirectResponse; use OC\AppFramework\Utility\MethodAnnotationReader; use OCP\AppFramework\Middleware; diff --git a/lib/public/appframework/http.php b/lib/public/appframework/http.php new file mode 100644 index 00000000000..c05d8f8e46e --- /dev/null +++ b/lib/public/appframework/http.php @@ -0,0 +1,89 @@ +. + * + */ + + +namespace OCP\AppFramework; + + +class Http { + + const STATUS_CONTINUE = 100; + const STATUS_SWITCHING_PROTOCOLS = 101; + const STATUS_PROCESSING = 102; + const STATUS_OK = 200; + const STATUS_CREATED = 201; + const STATUS_ACCEPTED = 202; + const STATUS_NON_AUTHORATIVE_INFORMATION = 203; + const STATUS_NO_CONTENT = 204; + const STATUS_RESET_CONTENT = 205; + const STATUS_PARTIAL_CONTENT = 206; + const STATUS_MULTI_STATUS = 207; + const STATUS_ALREADY_REPORTED = 208; + const STATUS_IM_USED = 226; + const STATUS_MULTIPLE_CHOICES = 300; + const STATUS_MOVED_PERMANENTLY = 301; + const STATUS_FOUND = 302; + const STATUS_SEE_OTHER = 303; + const STATUS_NOT_MODIFIED = 304; + const STATUS_USE_PROXY = 305; + const STATUS_RESERVED = 306; + const STATUS_TEMPORARY_REDIRECT = 307; + const STATUS_BAD_REQUEST = 400; + const STATUS_UNAUTHORIZED = 401; + const STATUS_PAYMENT_REQUIRED = 402; + const STATUS_FORBIDDEN = 403; + const STATUS_NOT_FOUND = 404; + const STATUS_METHOD_NOT_ALLOWED = 405; + const STATUS_NOT_ACCEPTABLE = 406; + const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407; + const STATUS_REQUEST_TIMEOUT = 408; + const STATUS_CONFLICT = 409; + const STATUS_GONE = 410; + const STATUS_LENGTH_REQUIRED = 411; + const STATUS_PRECONDITION_FAILED = 412; + const STATUS_REQUEST_ENTITY_TOO_LARGE = 413; + const STATUS_REQUEST_URI_TOO_LONG = 414; + const STATUS_UNSUPPORTED_MEDIA_TYPE = 415; + const STATUS_REQUEST_RANGE_NOT_SATISFIABLE = 416; + const STATUS_EXPECTATION_FAILED = 417; + const STATUS_IM_A_TEAPOT = 418; + const STATUS_UNPROCESSABLE_ENTITY = 422; + const STATUS_LOCKED = 423; + const STATUS_FAILED_DEPENDENCY = 424; + const STATUS_UPGRADE_REQUIRED = 426; + const STATUS_PRECONDITION_REQUIRED = 428; + const STATUS_TOO_MANY_REQUESTS = 429; + const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + const STATUS_INTERNAL_SERVER_ERROR = 500; + const STATUS_NOT_IMPLEMENTED = 501; + const STATUS_BAD_GATEWAY = 502; + const STATUS_SERVICE_UNAVAILABLE = 503; + const STATUS_GATEWAY_TIMEOUT = 504; + const STATUS_HTTP_VERSION_NOT_SUPPORTED = 505; + const STATUS_VARIANT_ALSO_NEGOTIATES = 506; + const STATUS_INSUFFICIENT_STORAGE = 507; + const STATUS_LOOP_DETECTED = 508; + const STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509; + const STATUS_NOT_EXTENDED = 510; + const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511; +} diff --git a/lib/public/appframework/http/http.php b/lib/public/appframework/http/http.php deleted file mode 100644 index 9eafe782726..00000000000 --- a/lib/public/appframework/http/http.php +++ /dev/null @@ -1,89 +0,0 @@ -. - * - */ - - -namespace OCP\AppFramework\Http; - - -class Http { - - const STATUS_CONTINUE = 100; - const STATUS_SWITCHING_PROTOCOLS = 101; - const STATUS_PROCESSING = 102; - const STATUS_OK = 200; - const STATUS_CREATED = 201; - const STATUS_ACCEPTED = 202; - const STATUS_NON_AUTHORATIVE_INFORMATION = 203; - const STATUS_NO_CONTENT = 204; - const STATUS_RESET_CONTENT = 205; - const STATUS_PARTIAL_CONTENT = 206; - const STATUS_MULTI_STATUS = 207; - const STATUS_ALREADY_REPORTED = 208; - const STATUS_IM_USED = 226; - const STATUS_MULTIPLE_CHOICES = 300; - const STATUS_MOVED_PERMANENTLY = 301; - const STATUS_FOUND = 302; - const STATUS_SEE_OTHER = 303; - const STATUS_NOT_MODIFIED = 304; - const STATUS_USE_PROXY = 305; - const STATUS_RESERVED = 306; - const STATUS_TEMPORARY_REDIRECT = 307; - const STATUS_BAD_REQUEST = 400; - const STATUS_UNAUTHORIZED = 401; - const STATUS_PAYMENT_REQUIRED = 402; - const STATUS_FORBIDDEN = 403; - const STATUS_NOT_FOUND = 404; - const STATUS_METHOD_NOT_ALLOWED = 405; - const STATUS_NOT_ACCEPTABLE = 406; - const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407; - const STATUS_REQUEST_TIMEOUT = 408; - const STATUS_CONFLICT = 409; - const STATUS_GONE = 410; - const STATUS_LENGTH_REQUIRED = 411; - const STATUS_PRECONDITION_FAILED = 412; - const STATUS_REQUEST_ENTITY_TOO_LARGE = 413; - const STATUS_REQUEST_URI_TOO_LONG = 414; - const STATUS_UNSUPPORTED_MEDIA_TYPE = 415; - const STATUS_REQUEST_RANGE_NOT_SATISFIABLE = 416; - const STATUS_EXPECTATION_FAILED = 417; - const STATUS_IM_A_TEAPOT = 418; - const STATUS_UNPROCESSABLE_ENTITY = 422; - const STATUS_LOCKED = 423; - const STATUS_FAILED_DEPENDENCY = 424; - const STATUS_UPGRADE_REQUIRED = 426; - const STATUS_PRECONDITION_REQUIRED = 428; - const STATUS_TOO_MANY_REQUESTS = 429; - const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; - const STATUS_INTERNAL_SERVER_ERROR = 500; - const STATUS_NOT_IMPLEMENTED = 501; - const STATUS_BAD_GATEWAY = 502; - const STATUS_SERVICE_UNAVAILABLE = 503; - const STATUS_GATEWAY_TIMEOUT = 504; - const STATUS_HTTP_VERSION_NOT_SUPPORTED = 505; - const STATUS_VARIANT_ALSO_NEGOTIATES = 506; - const STATUS_INSUFFICIENT_STORAGE = 507; - const STATUS_LOOP_DETECTED = 508; - const STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509; - const STATUS_NOT_EXTENDED = 510; - const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511; -} diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php index 085fdbed2f9..fa7d32596e8 100644 --- a/lib/public/appframework/http/jsonresponse.php +++ b/lib/public/appframework/http/jsonresponse.php @@ -24,6 +24,7 @@ namespace OCP\AppFramework\Http; +use OCP\AppFramework\Http; /** * A renderer for JSON calls diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php index 5ca389b9946..54dc860fec2 100644 --- a/lib/public/appframework/http/response.php +++ b/lib/public/appframework/http/response.php @@ -24,6 +24,7 @@ namespace OCP\AppFramework\Http; +use OCP\AppFramework\Http; /** * Base class for responses. Also used to just send headers. diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php index 9052fe0781a..6cf0da879ff 100644 --- a/tests/lib/appframework/http/DispatcherTest.php +++ b/tests/lib/appframework/http/DispatcherTest.php @@ -26,7 +26,7 @@ namespace OC\AppFramework\Http; use OC\AppFramework\Core\API; use OC\AppFramework\Middleware\MiddlewareDispatcher; - +use OCP\AppFramework\Http; //require_once(__DIR__ . "/../classloader.php"); @@ -53,7 +53,7 @@ class DispatcherTest extends \PHPUnit_Framework_TestCase { ->disableOriginalConstructor() ->getMock(); $this->http = $this->getMockBuilder( - '\OC\AppFramework\Http\Http') + '\OC\AppFramework\Http') ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php index 382d511b116..0bdcee24c99 100644 --- a/tests/lib/appframework/http/HttpTest.php +++ b/tests/lib/appframework/http/HttpTest.php @@ -24,6 +24,7 @@ namespace OC\AppFramework\Http; +use OC\AppFramework\Http; //require_once(__DIR__ . "/../classloader.php"); diff --git a/tests/lib/appframework/http/RedirectResponseTest.php b/tests/lib/appframework/http/RedirectResponseTest.php index 1946655b0fa..f82d0c3a675 100644 --- a/tests/lib/appframework/http/RedirectResponseTest.php +++ b/tests/lib/appframework/http/RedirectResponseTest.php @@ -24,6 +24,7 @@ namespace OC\AppFramework\Http; +use OCP\AppFramework\Http; //require_once(__DIR__ . "/../classloader.php"); diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php index 7e09086f801..1a38c38c1e7 100644 --- a/tests/lib/appframework/http/ResponseTest.php +++ b/tests/lib/appframework/http/ResponseTest.php @@ -25,7 +25,8 @@ namespace OC\AppFramework\Http; -use OCP\AppFramework\Http\Response; +use OCP\AppFramework\Http\Response, + OCP\AppFramework\Http; class ResponseTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php index 4bfd725ffd0..dae6135dc54 100644 --- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php @@ -24,7 +24,7 @@ namespace OC\AppFramework\Middleware\Security; -use OC\AppFramework\Http\Http; +use OC\AppFramework\Http; use OC\AppFramework\Http\Request; use OC\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\JSONResponse; -- cgit v1.2.3