diff options
-rw-r--r-- | .htaccess | 1 | ||||
-rw-r--r-- | apps/files/css/files.css | 2 | ||||
-rw-r--r-- | apps/files/js/files.js | 8 | ||||
-rw-r--r-- | apps/files/templates/appnavigation.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/webdav.php | 24 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 4 | ||||
-rw-r--r-- | apps/files_trashbin/appinfo/database.xml | 26 | ||||
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 9 | ||||
-rw-r--r-- | lib/base.php | 76 | ||||
-rw-r--r-- | lib/private/files/cache/scanner.php | 1 | ||||
-rw-r--r-- | lib/private/files/stream/quota.php | 2 | ||||
-rw-r--r-- | lib/private/route/router.php | 3 | ||||
-rwxr-xr-x | lib/private/util.php | 5 | ||||
-rw-r--r-- | public.php | 5 | ||||
-rw-r--r-- | remote.php | 7 | ||||
-rw-r--r-- | tests/lib/files/utils/scanner.php | 4 |
16 files changed, 71 insertions, 108 deletions
diff --git a/.htaccess b/.htaccess index 714e8af213b..ee4d5af1d85 100644 --- a/.htaccess +++ b/.htaccess @@ -24,7 +24,6 @@ RewriteRule ^\.well-known/carddav /remote.php/carddav/ [R] RewriteRule ^\.well-known/caldav /remote.php/caldav/ [R] RewriteRule ^apps/calendar/caldav\.php remote.php/caldav/ [QSA,L] RewriteRule ^apps/contacts/carddav\.php remote.php/carddav/ [QSA,L] -RewriteRule ^apps/([^/]*)/(.*\.(php))$ index.php?app=$1&getfile=$2 [QSA,L] RewriteRule ^remote/(.*) remote.php [QSA,L] </IfModule> <IfModule mod_mime.c> diff --git a/apps/files/css/files.css b/apps/files/css/files.css index acdeaf17fde..c5c8edd0971 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -225,7 +225,7 @@ table.multiselect thead { z-index: 10; -moz-box-sizing: border-box; box-sizing: border-box; - left: 310px; /* main nav bar + sidebar */ + left: 230px; /* sidebar */ } table.multiselect thead th { diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 4549de57f3f..8d871d6dac6 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -279,13 +279,7 @@ } } - $('#app-settings-header').on('click', function() { - var $settings = $('#app-settings'); - $settings.toggleClass('opened'); - if ($settings.hasClass('opened')) { - $settings.find('input').focus(); - } - }); + $('#webdavurl').on('click', function () { $('#webdavurl').select(); }); diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 86436bbe8c4..3591d0199b0 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -6,7 +6,7 @@ </ul> <div id="app-settings"> <div id="app-settings-header"> - <button class="settings-button"></button> + <button class="settings-button" data-apps-slide-toggle="#app-settings-content"></button> </div> <div id="app-settings-content"> <h2><?php p($l->t('WebDAV'));?></h2> diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 3ea2db0656d..525f41c1276 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -396,5 +396,29 @@ class DAV extends \OC\Files\Storage\Common { return array('curl'); } } + + public function getPermissions($path) { + $this->init(); + $response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions')); + if (isset($response['{http://owncloud.org/ns}permissions'])) { + $permissions = 0; + $permissionsString = $response['{http://owncloud.org/ns}permissions']; + if (strpos($permissionsString, 'R') !== false) { + $permissions |= \OCP\PERMISSION_SHARE; + } + if (strpos($permissionsString, 'D') !== false) { + $permissions |= \OCP\PERMISSION_DELETE; + } + if (strpos($permissionsString, 'W') !== false) { + $permissions |= \OCP\PERMISSION_UPDATE; + } + if (strpos($permissionsString, 'C') !== false) { + $permissions |= \OCP\PERMISSION_CREATE; + } + return $permissions; + } else { + return parent::getPermissions($path); + } + } } diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 27e8d361ff9..a2248405d22 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -10,7 +10,9 @@ /* global FileActions, Files */ /* global dragOptions, folderDropOptions */ -OCA.Sharing = {}; +if (!OCA.Sharing) { + OCA.Sharing = {}; +} if (!OCA.Files) { OCA.Files = {}; } diff --git a/apps/files_trashbin/appinfo/database.xml b/apps/files_trashbin/appinfo/database.xml index db104ee9298..a6ba242c1cf 100644 --- a/apps/files_trashbin/appinfo/database.xml +++ b/apps/files_trashbin/appinfo/database.xml @@ -89,30 +89,4 @@ </table> - <table> - - <name>*dbprefix*files_trashsize</name> - - <declaration> - - <field> - <name>user</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>size</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>50</length> - </field> - - </declaration> - - </table> - </database> diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index a8e66b06bbd..1838c48d95d 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -655,17 +655,12 @@ class Trashbin { /** * deletes used space for trash bin in db if user was deleted * - * @param type $uid id of deleted user + * @param string $uid id of deleted user * @return bool result of db delete operation */ public static function deleteUser($uid) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?'); - $result = $query->execute(array($uid)); - if ($result) { - $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trashsize` WHERE `user`=?'); - return $query->execute(array($uid)); - } - return false; + return $query->execute(array($uid)); } /** diff --git a/lib/base.php b/lib/base.php index 7c58619a556..2ec9c88e9f4 100644 --- a/lib/base.php +++ b/lib/base.php @@ -60,14 +60,11 @@ class OC { public static $configDir; - /* + /** * requested app */ public static $REQUESTEDAPP = ''; - /* - * requested file of app - */ - public static $REQUESTEDFILE = ''; + /** * check if owncloud runs in cli mode */ @@ -574,12 +571,6 @@ class OC { OC_User::useBackend(new OC_User_Database()); OC_Group::useBackend(new OC_Group_Database()); - // Load minimum set of apps - which is filesystem, authentication and logging - if (!self::checkUpgrade(false)) { - OC_App::loadApps(array('authentication')); - OC_App::loadApps(array('filesystem', 'logging')); - } - //setup extra user backends OC_User::setupBackends(); @@ -592,35 +583,6 @@ class OC { //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); - //parse the given parameters - self::$REQUESTEDAPP = (isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app']) ? OC_App::cleanAppId(strip_tags($_GET['app'])) : OC_Config::getValue('defaultapp', 'files')); - if (substr_count(self::$REQUESTEDAPP, '?') != 0) { - $app = substr(self::$REQUESTEDAPP, 0, strpos(self::$REQUESTEDAPP, '?')); - $param = substr($_GET['app'], strpos($_GET['app'], '?') + 1); - parse_str($param, $get); - $_GET = array_merge($_GET, $get); - self::$REQUESTEDAPP = $app; - $_GET['app'] = $app; - } - self::$REQUESTEDFILE = (isset($_GET['getfile']) ? $_GET['getfile'] : null); - if (substr_count(self::$REQUESTEDFILE, '?') != 0) { - $file = substr(self::$REQUESTEDFILE, 0, strpos(self::$REQUESTEDFILE, '?')); - $param = substr(self::$REQUESTEDFILE, strpos(self::$REQUESTEDFILE, '?') + 1); - parse_str($param, $get); - $_GET = array_merge($_GET, $get); - self::$REQUESTEDFILE = $file; - $_GET['getfile'] = $file; - } - if (!is_null(self::$REQUESTEDFILE)) { - $subdir = OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . self::$REQUESTEDFILE; - $parent = OC_App::getAppPath(OC::$REQUESTEDAPP); - if (!OC_Helper::isSubDirectory($subdir, $parent)) { - self::$REQUESTEDFILE = null; - header('HTTP/1.0 404 Not Found'); - exit; - } - } - if (OC_Config::getValue('installed', false) && !self::checkUpgrade(false)) { if (OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { OC_Util::addScript('backgroundjobs'); @@ -729,6 +691,7 @@ class OC { OC::tryBasicAuthLogin(); } + if (!self::$CLI and (!isset($_GET["logout"]) or ($_GET["logout"] !== 'true'))) { try { if (!OC_Config::getValue('maintenance', false) && !self::needUpgrade()) { @@ -745,9 +708,17 @@ class OC { } } - $app = OC::$REQUESTEDAPP; - $file = OC::$REQUESTEDFILE; - $param = array('app' => $app, 'file' => $file); + // Load minimum set of apps + if (!self::checkUpgrade(false)) { + // For logged-in users: Load everything + if(OC_User::isLoggedIn()) { + OC_App::loadApps(); + } else { + // For guests: Load only authentication, filesystem and logging + OC_App::loadApps(array('authentication')); + OC_App::loadApps(array('filesystem', 'logging')); + } + } // Handle redirect URL for logged in users if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) { @@ -778,7 +749,7 @@ class OC { return; } - // Someone is logged in : + // Someone is logged in if (OC_User::isLoggedIn()) { OC_App::loadApps(); OC_User::setupBackends(); @@ -800,20 +771,13 @@ class OC { // redirect to webroot and add slash if webroot is empty header("Location: " . OC::$WEBROOT.(empty(OC::$WEBROOT) ? '/' : '')); } else { - if (is_null($file)) { - $param['file'] = 'index.php'; - } - $file_ext = substr($param['file'], -3); - if ($file_ext != 'php' - || !self::loadAppScriptFile($param) - ) { - header('HTTP/1.0 404 Not Found'); - } + // Redirect to default application + OC_Util::redirectToDefaultPage(); } - return; + } else { + // Not handled and not logged in + self::handleLogin(); } - // Not handled and not logged in - self::handleLogin(); } /** diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 0c59e57d839..965013c5c98 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -121,6 +121,7 @@ class Scanner extends BasicEmitter { } // only reuse data if the file hasn't explicitly changed if (isset($data['storage_mtime']) && isset($cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) { + $data['mtime'] = $cacheData['mtime']; if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) { $data['size'] = $cacheData['size']; } diff --git a/lib/private/files/stream/quota.php b/lib/private/files/stream/quota.php index 60e60da8e67..bb4623b1a7b 100644 --- a/lib/private/files/stream/quota.php +++ b/lib/private/files/stream/quota.php @@ -123,7 +123,7 @@ class Quota { } public function stream_lock($mode) { - flock($this->source, $mode); + return flock($this->source, $mode); } public function stream_flush() { diff --git a/lib/private/route/router.php b/lib/private/route/router.php index a72ac2bb3f1..e7c8ad9ebdd 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -188,8 +188,11 @@ class Router implements IRouter { if (substr($url, 0, 6) === '/apps/') { // empty string / 'apps' / $app / rest of the route list(, , $app,) = explode('/', $url, 4); + \OC::$REQUESTEDAPP = $app; $this->loadRoutes($app); } else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 10) === '/settings/') { + \OC::$REQUESTEDAPP = $url; + \OC_App::loadApps(); $this->loadRoutes('core'); } else { $this->loadRoutes(); diff --git a/lib/private/util.php b/lib/private/util.php index 0daef78ce7f..dfdddd0e3ab 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -767,15 +767,12 @@ class OC_Util { $urlGenerator = \OC::$server->getURLGenerator(); if(isset($_REQUEST['redirect_url'])) { $location = urldecode($_REQUEST['redirect_url']); - } - else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) { - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.OC::$REQUESTEDAPP.'/index.php'); } else { $defaultPage = OC_Appconfig::getValue('core', 'defaultpage'); if ($defaultPage) { $location = $urlGenerator->getAbsoluteURL($defaultPage); } else { - $location = $urlGenerator->getAbsoluteURL('/index.php/files/index.php'); + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/files'); } } OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG); diff --git a/public.php b/public.php index dfdd4c52af9..eed63948112 100644 --- a/public.php +++ b/public.php @@ -24,6 +24,11 @@ try { $parts = explode('/', $file, 2); $app = $parts[0]; + // Load all required applications + \OC::$REQUESTEDAPP = $app; + OC_App::loadApps(array('authentication')); + OC_App::loadApps(array('filesystem', 'logging')); + OC_Util::checkAppEnabled($app); OC_App::loadApp($app); OC_User::setIncognitoMode(true); diff --git a/remote.php b/remote.php index 15dfa8256ff..232e47ee402 100644 --- a/remote.php +++ b/remote.php @@ -1,7 +1,6 @@ <?php try { - require_once 'lib/base.php'; $path_info = OC_Request::getPathInfo(); if ($path_info === false || $path_info === '') { @@ -24,6 +23,12 @@ try { $parts=explode('/', $file, 2); $app=$parts[0]; + + // Load all required applications + \OC::$REQUESTEDAPP = $app; + OC_App::loadApps(array('authentication')); + OC_App::loadApps(array('filesystem', 'logging')); + switch ($app) { case 'core': $file = OC::$SERVERROOT .'/'. $file; diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/files/utils/scanner.php index 159a2a48677..5e5cc6ac128 100644 --- a/tests/lib/files/utils/scanner.php +++ b/tests/lib/files/utils/scanner.php @@ -112,7 +112,7 @@ class Scanner extends \PHPUnit_Framework_TestCase { $this->assertEquals(array('/foo', '/foo/folder', '/foo/folder/bar.txt', '/foo/foo.txt'), $changes); $this->assertEquals(array('/', '/foo', '/foo/folder'), $parents); - $cache->put('foo.txt', array('mtime' => time() - 50)); + $cache->put('foo.txt', array('storage_mtime' => time() - 50)); $propagator = $this->getMock('\OC\Files\Cache\ChangePropagator', array('propagateChanges'), array(), '', false); $scanner->setPropagator($propagator); @@ -128,7 +128,7 @@ class Scanner extends \PHPUnit_Framework_TestCase { $scanner->setPropagator($originalPropagator); $oldInfo = $cache->get(''); - $cache->put('foo.txt', array('mtime' => time() - 70)); + $cache->put('foo.txt', array('storage_mtime' => time() - 70)); $storage->file_put_contents('foo.txt', 'asdasd'); $scanner->scan(''); |