From d496a5e19fbe70d2313cae17be0e788ac6487cd0 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 18 Jun 2012 17:23:54 +0200 Subject: ignore "Shared"-directory when calculating free space --- lib/fileproxy/quota.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index f061d48219b..dab41c5e906 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -55,7 +55,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{ */ private function getFreeSpace(){ $rootInfo=OC_FileCache_Cached::get(''); + $sharedInfo=OC_FileCache_Cached::get('/Shared'); $usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0; + $usedSpace=isset($sharedInfo['size'])?$rootInfo['size']-$sharedInfo['size']:$rootInfo['size']; $totalSpace=$this->getQuota(); if($totalSpace==0){ return 0; -- cgit v1.2.3 From cfb3b633f50decbe0ebd04ba46eaea5f4e5fa226 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Mon, 18 Jun 2012 19:51:46 +0000 Subject: Force sanitize function to use UTF8 (for php lower than 5.4) --- lib/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/template.php b/lib/template.php index a5d10c45d23..77e9332d5b3 100644 --- a/lib/template.php +++ b/lib/template.php @@ -326,7 +326,7 @@ class OC_Template{ * This function is internally used to sanitize HTML. */ private static function sanitizeHTML( &$value ){ - $value = htmlentities( $value ); + $value = htmlentities( $value , ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4 return $value; } -- cgit v1.2.3 From d4044d0283147df678dc0f833abfcc844e0eff75 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Mon, 18 Jun 2012 21:16:51 +0200 Subject: Delay loading of translations until they are used --- lib/l10n.php | 30 +++++++++++++++++++++++------- lib/l10n/string.php | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 lib/l10n/string.php (limited to 'lib') diff --git a/lib/l10n.php b/lib/l10n.php index ba4bf23780e..0f01e927ff9 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -39,6 +39,16 @@ class OC_L10N{ */ protected static $language = ''; + /** + * App of this object + */ + protected $app; + + /** + * Language of this object + */ + protected $lang; + /** * Translations */ @@ -77,10 +87,17 @@ class OC_L10N{ * language. */ public function __construct($app, $lang = null){ - $this->init($app, $lang); + $this->app = $app; + $this->lang = $lang; } - protected function init($app, $lang = null){ + protected function init(){ + if ($this->app === true) { + return; + } + $app = $this->app; + $lang = $this->lang; + $this->app = true; // Find the right language if(is_null($lang)){ $lang = self::findLanguage($app); @@ -127,10 +144,7 @@ class OC_L10N{ * returned. */ public function t($text, $parameters = array()){ - if(array_key_exists($text, $this->translations)){ - return vsprintf($this->translations[$text], $parameters); - } - return vsprintf($text, $parameters); + return new OC_L10N_String($this, $text, $parameters); } /** @@ -144,7 +158,7 @@ class OC_L10N{ public function tA($textArray){ $result = array(); foreach($textArray as $key => $text){ - $result[$key] = $this->t($text); + $result[$key] = (string)$this->t($text); } return $result; } @@ -156,6 +170,7 @@ class OC_L10N{ * Returns an associative array with all translations */ public function getTranslations(){ + $this->init(); return $this->translations; } @@ -182,6 +197,7 @@ class OC_L10N{ * - params: timestamp (int/string) */ public function l($type, $data){ + $this->init(); switch($type){ // If you add something don't forget to add it to $localizations // at the top of the page diff --git a/lib/l10n/string.php b/lib/l10n/string.php new file mode 100644 index 00000000000..4769790a16d --- /dev/null +++ b/lib/l10n/string.php @@ -0,0 +1,25 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class OC_L10N_String{ + protected $l10n; + public function __construct($l10n, $text, $parameters){ + $this->l10n = $l10n; + $this->text = $text; + $this->parameters = $parameters; + + } + + public function __toString(){ + $translations = $this->l10n->getTranslations(); + if(array_key_exists($this->text, $translations)){ + return vsprintf($translations[$this->text], $this->parameters); + } + return vsprintf($this->text, $this->parameters); + } +} -- cgit v1.2.3 From c1df0539a087f2e8964357e96a05c6887b188c7f Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 18 Jun 2012 23:33:02 +0200 Subject: fixes oc-668 --- lib/helper.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/helper.php b/lib/helper.php index 2ded7b13c38..480c3fe930e 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -378,6 +378,12 @@ class OC_Helper { //trim the character set from the end of the response $mimeType=substr($reply,0,strrpos($reply,' ')); + + //trim ; + if (strpos($mimeType, ';') !== false) { + $mimeType = strstr($mimeType, ';', true); + } + } if ($mimeType=='application/octet-stream') { // Fallback solution: (try to guess the type by the file extension -- cgit v1.2.3 From 0469f529fa3c5bb5c643f4c253f886f58ca50ba7 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 19 Jun 2012 09:35:13 +0200 Subject: quota calculation fixed --- lib/fileproxy/quota.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index dab41c5e906..b0c3775b9db 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -57,7 +57,7 @@ class OC_FileProxy_Quota extends OC_FileProxy{ $rootInfo=OC_FileCache_Cached::get(''); $sharedInfo=OC_FileCache_Cached::get('/Shared'); $usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0; - $usedSpace=isset($sharedInfo['size'])?$rootInfo['size']-$sharedInfo['size']:$rootInfo['size']; + $usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace; $totalSpace=$this->getQuota(); if($totalSpace==0){ return 0; -- cgit v1.2.3