From 81a45cfcf1c7064615429bb3f9759e9455868614 Mon Sep 17 00:00:00 2001 From: Stephane Martin Date: Mon, 26 Aug 2013 15:16:41 +0200 Subject: [PATCH 01/15] fixes #4574 --- lib/base.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/base.php b/lib/base.php index 2613e88d05..c73eb9413d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -795,11 +795,16 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); - if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { - //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); - OC_User::unsetMagicInCookie(); - $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); + // don't redo authentication if user is already logged in + // otherwise session would be invalidated in OC_User::login with + // session_regenerate_id at every page load + if (!OC_User::isLoggedIn()) { + OC_App::loadApps(array('authentication')); + if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { + //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); + OC_User::unsetMagicInCookie(); + $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); + } } return true; } From 6e8bc13aa3befba15e3df17cb32ef54d447fbfec Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 27 Aug 2013 10:58:17 +0200 Subject: [PATCH 02/15] fix weird logical behaviour --- lib/helper.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index dd2476eda5..cfb29028ee 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -858,10 +858,8 @@ class OC_Helper { } else { $total = $free; //either unknown or unlimited } - if ($total == 0) { - $total = 1; // prevent division by zero - } - if ($total >= 0) { + if ($total > 0) { + // prevent division by zero or error codes (negative values) $relative = round(($used / $total) * 10000) / 100; } else { $relative = 0; From 301cce54ccdc1dcd1bd63bf4285e870e300979b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 29 Aug 2013 10:49:50 +0200 Subject: [PATCH 03/15] webdav quota information contains the values for used and free - not total --- lib/connector/sabre/directory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index 66cd2fcd4e..3181a4b310 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -236,7 +236,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa $storageInfo = OC_Helper::getStorageInfo($this->path); return array( $storageInfo['used'], - $storageInfo['total'] + $storageInfo['free'] ); } From 98a04d7c73f2969d6b08f4d925f53fb8e9f34c7e Mon Sep 17 00:00:00 2001 From: Masaki Kawabata Neto Date: Thu, 29 Aug 2013 10:00:30 -0300 Subject: [PATCH 04/15] added help and status commands switch structure enables many commands seamlessy. also added some help and status command. --- console.php | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/console.php b/console.php index 4aec5bdc24..a2d4ab3562 100644 --- a/console.php +++ b/console.php @@ -20,17 +20,32 @@ if (!OC::$CLI) { exit(0); } +$self = basename($argv[0]); if ($argc <= 1) { - echo "Usage:" . PHP_EOL; - echo " " . basename($argv[0]) . " " . PHP_EOL; - exit(0); + $argv[1] = "help"; } $command = $argv[1]; array_shift($argv); -if ($command === 'files:scan') { - require_once 'apps/files/console/scan.php'; -} else { - echo "Unknown command '$command'" . PHP_EOL; +switch ($command) { + case 'files:scan': + require_once 'apps/files/console/scan.php'; + break; + case 'status': + require_once 'status.php'; + break; + case 'help': + echo "Usage:" . PHP_EOL; + echo " " . $self . " " . PHP_EOL; + echo PHP_EOL; + echo "Available commands:" . PHP_EOL; + echo " files:scan -> rescan filesystem" .PHP_EOL; + echo " status -> show some status information" .PHP_EOL; + echo " help -> show this help screen" .PHP_EOL; + break; + default: + echo "Unknown command '$command'" . PHP_EOL; + echo "For available commands type ". $self . " help" . PHP_EOL; + break; } From 1dd18980ae171d9cd16ab95bdfb289b54ef6c34d Mon Sep 17 00:00:00 2001 From: Masaki Kawabata Neto Date: Thu, 29 Aug 2013 10:03:58 -0300 Subject: [PATCH 06/15] enable usage with CLI interface Added option to use the status.php with console.php via CLI --- status.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/status.php b/status.php index 179fe3f49f..88805ad6b1 100644 --- a/status.php +++ b/status.php @@ -33,8 +33,11 @@ try { 'version'=>implode('.', OC_Util::getVersion()), 'versionstring'=>OC_Util::getVersionString(), 'edition'=>OC_Util::getEditionString()); - - echo(json_encode($values)); + if (OC::$CLI) { + print_r($values); + } else { + echo(json_encode($values)); + } } catch (Exception $ex) { OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); From 1fa29b4c118b848fb3e0e6cdb6aa7bb88cb9d62e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 29 Aug 2013 15:31:03 +0200 Subject: [PATCH 07/15] also emmit create hook when creating new files using touch() --- lib/files/view.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/files/view.php b/lib/files/view.php index bb737f19ef..8aee12bf6f 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -249,6 +249,7 @@ class View { $hooks = array('touch'); if (!$this->file_exists($path)) { + $hooks[] = 'create'; $hooks[] = 'write'; } $result = $this->basicOperation('touch', $path, $hooks, $mtime); From 04b9e77478a36b9ef9ed48a8181ed9195d47ec8a Mon Sep 17 00:00:00 2001 From: Masaki Date: Thu, 29 Aug 2013 15:03:16 -0300 Subject: [PATCH 08/15] replace ident spaces with tabs --- console.php | 41 +++++++++++++++++++++-------------------- status.php | 4 ++-- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/console.php b/console.php index a2d4ab3562..fbe09d9bb6 100644 --- a/console.php +++ b/console.php @@ -1,3 +1,4 @@ + @@ -22,30 +23,30 @@ if (!OC::$CLI) { $self = basename($argv[0]); if ($argc <= 1) { - $argv[1] = "help"; + $argv[1] = "help"; } $command = $argv[1]; array_shift($argv); switch ($command) { - case 'files:scan': - require_once 'apps/files/console/scan.php'; - break; - case 'status': - require_once 'status.php'; - break; - case 'help': - echo "Usage:" . PHP_EOL; - echo " " . $self . " " . PHP_EOL; - echo PHP_EOL; - echo "Available commands:" . PHP_EOL; - echo " files:scan -> rescan filesystem" .PHP_EOL; - echo " status -> show some status information" .PHP_EOL; - echo " help -> show this help screen" .PHP_EOL; - break; - default: - echo "Unknown command '$command'" . PHP_EOL; - echo "For available commands type ". $self . " help" . PHP_EOL; - break; + case 'files:scan': + require_once 'apps/files/console/scan.php'; + break; + case 'status': + require_once 'status.php'; + break; + case 'help': + echo "Usage:" . PHP_EOL; + echo " " . $self . " " . PHP_EOL; + echo PHP_EOL; + echo "Available commands:" . PHP_EOL; + echo " files:scan -> rescan filesystem" .PHP_EOL; + echo " status -> show some status information" .PHP_EOL; + echo " help -> show this help screen" .PHP_EOL; + break; + default: + echo "Unknown command '$command'" . PHP_EOL; + echo "For available commands type ". $self . " help" . PHP_EOL; + break; } diff --git a/status.php b/status.php index 88805ad6b1..88422100f1 100644 --- a/status.php +++ b/status.php @@ -34,9 +34,9 @@ try { 'versionstring'=>OC_Util::getVersionString(), 'edition'=>OC_Util::getEditionString()); if (OC::$CLI) { - print_r($values); + print_r($values); } else { - echo(json_encode($values)); + echo(json_encode($values)); } } catch (Exception $ex) { From c9c4ab22a489c373cf994da490353e2f3e1cadd1 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Fri, 30 Aug 2013 11:17:31 +0200 Subject: [PATCH 09/15] Apps management as sticky footer and rename to 'Apps', fix #4622 --- core/css/styles.css | 18 ++++++++++++++++++ core/templates/layout.user.php | 9 +++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index ce0d5abfc7..ad9fcb4346 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -501,6 +501,9 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } #navigation:hover { overflow-y: auto; /* show scrollbar only on hover */ } +#apps { + height: 100%; +} #navigation a span { display: block; text-decoration: none; @@ -545,9 +548,24 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } padding-top: 20px; } +/* Apps management as sticky footer, less obtrusive in the list */ +#navigation .wrapper { + min-height: 100%; + margin: 0 auto -72px; +} +#apps-management, #navigation .push { + height: 70px; +} #apps-management { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; + filter: alpha(opacity=60); opacity: .6; } +#apps-management .icon { + padding-bottom: 0; +} + + /* USER MENU */ diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 3c1114492c..1e0f4a75c3 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -78,6 +78,7 @@