From ea2a45f19df8bcdff56752904d07c2af2fb5b8d7 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:16:49 +0200 Subject: [PATCH 1/9] Remove loadAppScriptFile --- lib/base.php | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/lib/base.php b/lib/base.php index 1f3c616fb18..196ca74f52f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -789,32 +789,6 @@ class OC { } } - /** - * Load a PHP file belonging to the specified application - * @param array $param The application and file to load - * @return bool Whether the file has been found (will return 404 and false if not) - * @deprecated This function will be removed in ownCloud 8 - use proper routing instead - * @param $param - * @return bool Whether the file has been found (will return 404 and false if not) - */ - public static function loadAppScriptFile($param) { - OC_App::loadApps(); - $app = $param['app']; - $file = $param['file']; - $app_path = OC_App::getAppPath($app); - $file = $app_path . '/' . $file; - - if (OC_App::isEnabled($app) && $app_path !== false && OC_Helper::issubdirectory($file, $app_path)) { - unset($app, $app_path); - if (file_exists($file)) { - require_once $file; - return true; - } - } - header('HTTP/1.0 404 Not Found'); - return false; - } - protected static function handleAuthHeaders() { //copy http auth headers for apache+php-fcgid work around if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) { From f9881abf25893df6b5387ff4467cb8465793763b Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:19:18 +0200 Subject: [PATCH 2/9] Use proper routes for files --- apps/files/appinfo/routes.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php index f3d8e9a4f4d..4d77065a347 100644 --- a/apps/files/appinfo/routes.php +++ b/apps/files/appinfo/routes.php @@ -6,6 +6,33 @@ * See the COPYING-README file. */ +/** @var $this OC\Route\Router */ + +$this->create('files_index', '/') + ->actionInclude('files/index.php'); +$this->create('files_ajax_delete', 'ajax/delete.php') + ->actionInclude('files/ajax/delete.php'); +$this->create('files_ajax_download', 'ajax/download.php') + ->actionInclude('files/ajax/download.php'); +$this->create('files_ajax_getstoragestats', 'ajax/getstoragestats.php') + ->actionInclude('files/ajax/getstoragestats.php'); +$this->create('files_ajax_list', 'ajax/list.php') + ->actionInclude('files/ajax/list.php'); +$this->create('files_ajax_mimeicon', 'ajax/mimeicon.php') + ->actionInclude('files/ajax/mimeicon.php'); +$this->create('files_ajax_move', 'ajax/move.php') + ->actionInclude('files/ajax/move.php'); +$this->create('files_ajax_newfile', 'ajax/newfile.php') + ->actionInclude('files/ajax/newfile.php'); +$this->create('files_ajax_newfolder', 'ajax/newfolder.php') + ->actionInclude('files/ajax/newfolder.php'); +$this->create('files_ajax_rename', 'ajax/rename.php') + ->actionInclude('files/ajax/rename.php'); +$this->create('files_ajax_scan', 'ajax/scan.php') + ->actionInclude('files/ajax/scan.php'); +$this->create('files_ajax_upload', 'ajax/upload.php') + ->actionInclude('files/ajax/upload.php'); + $this->create('download', 'download{file}') ->requirements(array('file' => '.*')) ->actionInclude('files/download.php'); From ad202250a8f30486b0694f9d2660d33b2453521c Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:22:54 +0200 Subject: [PATCH 3/9] Add routing to files_sharing --- apps/files_sharing/appinfo/routes.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php index e68b953fc05..d5a48025d4a 100644 --- a/apps/files_sharing/appinfo/routes.php +++ b/apps/files_sharing/appinfo/routes.php @@ -5,10 +5,14 @@ $this->create('core_ajax_public_preview', '/publicpreview')->action( require_once __DIR__ . '/../ajax/publicpreview.php'; }); -$this->create('sharing_external_shareinfo', '/shareinfo')->actionInclude('files_sharing/ajax/shareinfo.php'); -$this->create('sharing_external_add', '/external')->actionInclude('files_sharing/ajax/external.php'); -$this->create('sharing_external_test_remote', '/testremote')->actionInclude('files_sharing/ajax/testremote.php'); - +$this->create('files_sharing_ajax_list', 'ajax/list.php') + ->actionInclude('files_sharing/ajax/list.php'); +$this->create('sharing_external_shareinfo', '/shareinfo') + ->actionInclude('files_sharing/ajax/shareinfo.php'); +$this->create('sharing_external_add', '/external') + ->actionInclude('files_sharing/ajax/external.php'); +$this->create('sharing_external_test_remote', '/testremote') + ->actionInclude('files_sharing/ajax/testremote.php'); // OCS API //TODO: SET: mail notification, waiting for PR #4689 to be accepted From 520ee969f2b8e0e1a17d6a985106f568459421c9 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:23:45 +0200 Subject: [PATCH 4/9] Add routing to files_encryption --- apps/files_encryption/appinfo/routes.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/files_encryption/appinfo/routes.php b/apps/files_encryption/appinfo/routes.php index 07ff920a60d..97635ae1236 100644 --- a/apps/files_encryption/appinfo/routes.php +++ b/apps/files_encryption/appinfo/routes.php @@ -5,5 +5,18 @@ * See the COPYING-README file. */ +/** @var $this \OCP\Route\IRouter */ + +$this->create('files_encryption_ajax_adminrecovery', 'ajax/adminrecovery.php') + ->actionInclude('files_encryption/ajax/adminrecovery.php'); +$this->create('files_encryption_ajax_changeRecoveryPassword', 'ajax/changeRecoveryPassword.php') + ->actionInclude('files_encryption/ajax/changeRecoveryPassword.php'); +$this->create('files_encryption_ajax_getMigrationStatus', 'ajax/getMigrationStatus.php') + ->actionInclude('files_encryption/ajax/getMigrationStatus.php'); +$this->create('files_encryption_ajax_updatePrivateKeyPassword', 'ajax/updatePrivateKeyPassword.php') + ->actionInclude('files_encryption/ajax/updatePrivateKeyPassword.php'); +$this->create('files_encryption_ajax_userrecovery', 'ajax/userrecovery.php') + ->actionInclude('files_encryption/ajax/userrecovery.php'); + // Register with the capabilities API OC_API::register('get', '/cloud/capabilities', array('OCA\Encryption\Capabilities', 'getCapabilities'), 'files_encryption', OC_API::USER_AUTH); From 8524e61fccbeb3f56fb3f444521ff6ba4255df94 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:24:47 +0200 Subject: [PATCH 5/9] Add routing to files_trashbin --- apps/files_trashbin/appinfo/routes.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/files_trashbin/appinfo/routes.php b/apps/files_trashbin/appinfo/routes.php index 42398a06c8b..da268f4fdfd 100644 --- a/apps/files_trashbin/appinfo/routes.php +++ b/apps/files_trashbin/appinfo/routes.php @@ -4,3 +4,12 @@ $this->create('core_ajax_trashbin_preview', '/preview')->action( function() { require_once __DIR__ . '/../ajax/preview.php'; }); + +$this->create('files_trashbin_ajax_delete', 'ajax/delete.php') + ->actionInclude('files_trashbin/ajax/delete.php'); +$this->create('files_trashbin_ajax_isEmpty', 'ajax/isEmpty.php') + ->actionInclude('files_trashbin/ajax/isEmpty.php'); +$this->create('files_trashbin_ajax_list', 'ajax/list.php') + ->actionInclude('files_trashbin/ajax/list.php'); +$this->create('files_trashbin_ajax_undelete', 'ajax/undelete.php') + ->actionInclude('files_trashbin/ajax/undelete.php'); From b12af9ea7f10454106d77e233b4e2da003754796 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:25:16 +0200 Subject: [PATCH 6/9] Add routing to files_versions --- apps/files_versions/appinfo/routes.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_versions/appinfo/routes.php b/apps/files_versions/appinfo/routes.php index b9bb00dae55..057834213e4 100644 --- a/apps/files_versions/appinfo/routes.php +++ b/apps/files_versions/appinfo/routes.php @@ -11,5 +11,10 @@ function() { require_once __DIR__ . '/../ajax/preview.php'; }); +$this->create('files_versions_ajax_getVersions', 'ajax/getVersions.php') + ->actionInclude('files_versions/ajax/getVersions.php'); +$this->create('files_versions_ajax_rollbackVersion', 'ajax/rollbackVersion.php') + ->actionInclude('files_versions/ajax/rollbackVersion.php'); + // Register with the capabilities API OC_API::register('get', '/cloud/capabilities', array('OCA\Files_Versions\Capabilities', 'getCapabilities'), 'files_versions', OC_API::USER_AUTH); From 381340c9b267ee16c2ba4bd461af519ed6c9253c Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:26:15 +0200 Subject: [PATCH 7/9] Add routing to user_ldap --- apps/user_ldap/appinfo/routes.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 apps/user_ldap/appinfo/routes.php diff --git a/apps/user_ldap/appinfo/routes.php b/apps/user_ldap/appinfo/routes.php new file mode 100644 index 00000000000..92c8ad1809a --- /dev/null +++ b/apps/user_ldap/appinfo/routes.php @@ -0,0 +1,22 @@ + + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + +/** @var $this \OCP\Route\IRouter */ +$this->create('user_ldap_ajax_clearMappings', 'ajax/clearMappings.php') + ->actionInclude('user_ldap/ajax/clearMappings.php'); +$this->create('user_ldap_ajax_deleteConfiguration', 'ajax/deleteConfiguration.php') + ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); +$this->create('user_ldap_ajax_getConfiguration', 'ajax/getConfiguration.php') + ->actionInclude('user_ldap/ajax/getConfiguration.php'); +$this->create('user_ldap_ajax_getNewServerConfigPrefix', 'ajax/getNewServerConfigPrefix.php') + ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); +$this->create('user_ldap_ajax_setConfiguration', 'ajax/setConfiguration.php') + ->actionInclude('user_ldap/ajax/setConfiguration.php'); +$this->create('user_ldap_ajax_testConfiguration', 'ajax/testConfiguration.php') + ->actionInclude('user_ldap/ajax/testConfiguration.php'); +$this->create('user_ldap_ajax_wizard', 'ajax/wizard.php') + ->actionInclude('user_ldap/ajax/wizard.php'); From 29ae7f55ef49e02cd9a823ead1882342bddaaef4 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:37:00 +0200 Subject: [PATCH 8/9] Remove loadAppScriptFile from the default routes --- core/routes.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/core/routes.php b/core/routes.php index d08bd105a14..cf74521a746 100644 --- a/core/routes.php +++ b/core/routes.php @@ -98,16 +98,6 @@ $this->create('core_avatar_post_cropped', '/avatar/cropped') ->post() ->action('OC\Core\Avatar\Controller', 'postCroppedAvatar'); -// Not specifically routed -$this->create('app_index_script', '/apps/{app}/') - ->defaults(array('file' => 'index.php')) - //->requirements(array('file' => '.*.php')) - ->action('OC', 'loadAppScriptFile'); -$this->create('app_script', '/apps/{app}/{file}') - ->defaults(array('file' => 'index.php')) - ->requirements(array('file' => '.*.php')) - ->action('OC', 'loadAppScriptFile'); - // used for heartbeat $this->create('heartbeat', '/heartbeat')->action(function(){ // do nothing From ab12bd292d1ac44db427332c265fa58bcf4c3cb4 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 19 Aug 2014 15:40:08 +0200 Subject: [PATCH 9/9] Add update route to core --- core/ajax/update.php | 1 - core/routes.php | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/ajax/update.php b/core/ajax/update.php index 698614c975f..70696e98eef 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -1,6 +1,5 @@ create('core_ajax_preview', '/core/preview') ->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_preview', '/core/preview.png') ->actionInclude('core/ajax/preview.php'); - +$this->create('core_ajax_update', '/core/ajax/update.php') + ->actionInclude('core/ajax/update.php'); // Avatar routes $this->create('core_avatar_get_tmp', '/avatar/tmp') ->get()