diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-08-31 15:21:09 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-08-31 15:21:09 +0200 |
commit | ae3425d2dadbac69e7dcb0ba577db20e63e7d91f (patch) | |
tree | f483759739cd951c33ef1c61ade8694f9e1c95e3 /lib | |
parent | 3329e0f2b22207a24ddb4953bbf11964b23682d9 (diff) | |
parent | 73685892ed6f255a916512863cd5549914d071e1 (diff) | |
download | nextcloud-server-ae3425d2dadbac69e7dcb0ba577db20e63e7d91f.tar.gz nextcloud-server-ae3425d2dadbac69e7dcb0ba577db20e63e7d91f.zip |
Merge branch 'master' into securityutils
Conflicts:
lib/private/util.php
Diffstat (limited to 'lib')
41 files changed, 385 insertions, 170 deletions
diff --git a/lib/base.php b/lib/base.php index 499ef29f304..176f799f94d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -71,6 +71,7 @@ class OC { public static $CLI = false; /** + * @deprecated use \OC::$server->getSession() instead * @var \OC\Session\Session */ public static $session = null; @@ -192,7 +193,7 @@ class OC { } public static function checkConfig() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (file_exists(self::$configDir . "/config.php") and !is_writable(self::$configDir . "/config.php") ) { @@ -344,6 +345,7 @@ class OC { OC_Util::addScript("oc-requesttoken"); OC_Util::addScript("apps"); OC_Util::addScript("snap"); + OC_Util::addScript("moment"); // avatars if (\OC_Config::getValue('enable_avatars', true) === true) { @@ -374,19 +376,20 @@ class OC { $cookie_path = OC::$WEBROOT ? : '/'; ini_set('session.cookie_path', $cookie_path); - //set the session object to a dummy session so code relying on the session existing still works - self::$session = new \OC\Session\Memory(''); - // Let the session name be changed in the initSession Hook $sessionName = OC_Util::getInstanceId(); try { // Allow session apps to create a custom session object $useCustomSession = false; - OC_Hook::emit('OC', 'initSession', array('session' => &self::$session, 'sessionName' => &$sessionName, 'useCustomSession' => &$useCustomSession)); - if(!$useCustomSession) { + $session = self::$server->getSession(); + OC_Hook::emit('OC', 'initSession', array('session' => &$session, 'sessionName' => &$sessionName, 'useCustomSession' => &$useCustomSession)); + if($useCustomSession) { + // use the session reference as the new Session + self::$server->setSession($session); + } else { // set the session name to the instance id - which is unique - self::$session = new \OC\Session\Internal($sessionName); + self::$server->setSession(new \OC\Session\Internal($sessionName)); } // if session cant be started break with http 500 error } catch (Exception $e) { @@ -397,15 +400,19 @@ class OC { $sessionLifeTime = self::getSessionLifeTime(); // regenerate session id periodically to avoid session fixation - if (!self::$session->exists('SID_CREATED')) { - self::$session->set('SID_CREATED', time()); - } else if (time() - self::$session->get('SID_CREATED') > $sessionLifeTime / 2) { + /** + * @var \OCP\ISession $session + */ + $session = self::$server->getSession(); + if (!$session->exists('SID_CREATED')) { + $session->set('SID_CREATED', time()); + } else if (time() - $session->get('SID_CREATED') > $sessionLifeTime / 2) { session_regenerate_id(true); - self::$session->set('SID_CREATED', time()); + $session->set('SID_CREATED', time()); } // session timeout - if (self::$session->exists('LAST_ACTIVITY') && (time() - self::$session->get('LAST_ACTIVITY') > $sessionLifeTime)) { + if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time() - 42000, $cookie_path); } @@ -414,7 +421,7 @@ class OC { session_start(); } - self::$session->set('LAST_ACTIVITY', time()); + $session->set('LAST_ACTIVITY', time()); } /** @@ -446,9 +453,6 @@ class OC { self::$loader->registerPrefix('Pimple', '3rdparty/Pimple'); spl_autoload_register(array(self::$loader, 'load')); - // make a dummy session available as early as possible since error pages need it - self::$session = new \OC\Session\Memory(''); - // set some stuff //ob_start(); error_reporting(E_ALL | E_STRICT); @@ -543,7 +547,7 @@ class OC { // User and Groups if (!OC_Config::getValue("installed", false)) { - self::$session->set('user_id', ''); + self::$server->getSession()->set('user_id', ''); } OC_User::useBackend(new OC_User_Database()); @@ -570,7 +574,7 @@ class OC { // Check whether the sample configuration has been copied if(OC_Config::getValue('copied_sample_config', false)) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); OC_Template::printErrorPage( @@ -668,7 +672,6 @@ class OC { * Handle the request */ public static function handleRequest() { - $l = \OC_L10N::get('lib'); // load all the classpaths from the enabled apps so they are available // in the routing files of each app OC::loadAppClassPaths(); @@ -782,7 +785,7 @@ class OC { if (isset($_COOKIE['oc_ignore_php_auth_user'])) { // Ignore HTTP Authentication for 5 more mintues. setcookie('oc_ignore_php_auth_user', $_SERVER['PHP_AUTH_USER'], time() + 300, OC::$WEBROOT.(empty(OC::$WEBROOT) ? '/' : '')); - } elseif ($_SERVER['PHP_AUTH_USER'] === self::$session->get('loginname')) { + } elseif ($_SERVER['PHP_AUTH_USER'] === self::$server->getSession()->get('loginname')) { // Ignore HTTP Authentication to allow a different user to log in. setcookie('oc_ignore_php_auth_user', $_SERVER['PHP_AUTH_USER'], 0, OC::$WEBROOT.(empty(OC::$WEBROOT) ? '/' : '')); } @@ -929,7 +932,7 @@ class OC { if (OC_User::login($_POST["user"], $_POST["password"])) { // setting up the time zone if (isset($_POST['timezone-offset'])) { - self::$session->set('timezone', $_POST['timezone-offset']); + self::$server->getSession()->set('timezone', $_POST['timezone-offset']); } $userid = OC_User::getUser(); diff --git a/lib/l10n/az.php b/lib/l10n/az.php index ae7bd786010..a527b8edf5d 100644 --- a/lib/l10n/az.php +++ b/lib/l10n/az.php @@ -3,16 +3,42 @@ $TRANSLATIONS = array( "Cannot write into \"config\" directory!" => "\"configurasiya\" direktoriyasının daxilində yazmaq mümkün deyil", "This can usually be fixed by giving the webserver write access to the config directory" => "Adətən tez həll etmək üçün WEB serverdə yazma yetkisi verilir", "See %s" => "Bax %s", +"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Bu adətən %s config qovluğuna web server üçün yazma yetkisi verdikdə, %s tərəfindən fix edilə bilir. ", +"Sample configuration detected" => "Konfiqurasiya nüsxəsi təyin edildi", +"Help" => "Kömək", +"Personal" => "Şəxsi", "Settings" => "Quraşdırmalar", "Users" => "İstifadəçilər", "Admin" => "İnzibatçı", "No app name specified" => "Proqram adı təyin edilməyib", "Unknown filetype" => "Fayl tipi bəlli deyil.", "Invalid image" => "Yalnış şəkil", +"App directory already exists" => "Proqram təminatı qovluğu artıq mövcuddur.", +"Can't create app folder. Please fix permissions. %s" => "Proqram təminatı qovluğunu yaratmaq mümkün olmadı. Xahiş edilir yetkiləri düzgün təyin edəsiniz. %s", +"Application is not enabled" => "Proqram təminatı aktiv edilməyib", "Authentication error" => "Təyinat metodikası", +"Token expired. Please reload page." => "Token vaxtı bitib. Xahiş olunur səhifəni yenidən yükləyəsiniz.", +"Unknown user" => "Istifadəçi tanınmır ", +"%s enter the database username." => "Verilənlər bazası istifadəçi adını %s daxil et.", +"%s enter the database name." => "Verilənlər bazası adını %s daxil et.", +"MS SQL username and/or password not valid: %s" => "MS SQL istifadəçi adı və/ya şifrəsi düzgün deyil : %s", +"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB istifadəçi adı və/ya şifrəsi düzgün deyil :", +"DB Error: \"%s\"" => "DB səhvi: \"%s\"", +"Drop this user from MySQL/MariaDB" => "Bu istifadəçini MySQL/MariaDB-dən sil", +"Drop this user from MySQL/MariaDB." => "Bu istifadəçini MySQL/MariaDB-dən sil.", +"Oracle connection could not be established" => "Oracle qoşulması alınmır", +"Oracle username and/or password not valid" => "Oracle istifadəçi adı və/ya şifrəsi düzgün deyil", +"Set an admin username." => "İnzibatçı istifadəçi adını təyin et.", +"Set an admin password." => "İnzibatçı şifrəsini təyin et.", +"%s shared »%s« with you" => "%s yayımlandı »%s« sizinlə", +"Sharing %s failed, because the file does not exist" => "%s yayımlanmasında səhv baş verdi ona görə ki, fayl mövcud deyil.", +"You are not allowed to share %s" => "%s-in yayimlanmasına sizə izin verilmir", +"Share type %s is not valid for %s" => "Yayımlanma tipi %s etibarlı deyil %s üçün", "_%n minute ago_::_%n minutes ago_" => array("",""), "_%n hour ago_::_%n hours ago_" => array("",""), "_%n day go_::_%n days ago_" => array("",""), -"_%n month ago_::_%n months ago_" => array("","") +"_%n month ago_::_%n months ago_" => array("",""), +"A valid username must be provided" => "Düzgün istifadəçi adı daxil edilməlidir", +"A valid password must be provided" => "Düzgün şifrə daxil edilməlidir" ); $PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/lib/l10n/bn_BD.php b/lib/l10n/bn_BD.php index 82a7fccf47f..c28f399610e 100644 --- a/lib/l10n/bn_BD.php +++ b/lib/l10n/bn_BD.php @@ -1,11 +1,21 @@ <?php $TRANSLATIONS = array( +"Cannot write into \"config\" directory!" => "\"config\" ডিরেক্টরিতে লেখা যায়না!", +"This can usually be fixed by giving the webserver write access to the config directory" => "সাধারণতঃ ওয়বসার্ভারকে কনফিগ ডিরেক্টরিতে লেখার অধিকার দিয়ে এই সমস্যা সমাধান করা যায়", +"See %s" => "%s দেখ", +"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "সাধারণতঃ ওয়বসার্ভারকে কনফিগ ডিরেক্টরি%sতে লেখার অধিকার দিয়ে%s এই সমস্যা সমাধান করা যায়", +"Sample configuration detected" => "নমুনা কনফিগারেশন পাওয়া গেছে", "Help" => "সহায়িকা", "Personal" => "ব্যক্তিগত", "Settings" => "নিয়ামকসমূহ", "Users" => "ব্যবহারকারী", "Admin" => "প্রশাসন", +"No app name specified" => "কোন অ্যাপ নাম সুনির্দিষ্ট নয়", +"Unknown filetype" => "অজানা প্রকৃতির ফাইল", +"Invalid image" => "অবৈধ চিত্র", "web services under your control" => "ওয়েব সার্ভিস আপনার হাতের মুঠোয়", +"App directory already exists" => "এই অ্যাপ ডিরেক্টরিটি পূর্ব থেকেই বিদ্যমান", +"Can't create app folder. Please fix permissions. %s" => "অ্যাপ ফোল্ডার বানানো হেলনা। অনুমতি নির্ধারণ করুন। %s", "Application is not enabled" => "অ্যাপ্লিকেসনটি সক্রিয় নয়", "Authentication error" => "অনুমোদন ঘটিত সমস্যা", "Token expired. Please reload page." => "টোকেন মেয়াদোত্তীর্ণ। দয়া করে পৃষ্ঠাটি পূনরায় লোড করুন।", diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php index a34690c365f..c5c10a77bf2 100644 --- a/lib/l10n/cs_CZ.php +++ b/lib/l10n/cs_CZ.php @@ -1,9 +1,9 @@ <?php $TRANSLATIONS = array( "Cannot write into \"config\" directory!" => "Nelze zapisovat do adresáře \"config\"!", -"This can usually be fixed by giving the webserver write access to the config directory" => "To bývá obyčejně vyřešeno povolením webovému serveru zapisovat do konfiguračního adresáře.", +"This can usually be fixed by giving the webserver write access to the config directory" => "To lze obvykle vyřešit povolením zápisu webovému serveru do konfiguračního adresáře", "See %s" => "Viz %s", -"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "To bývá obyčeně vyřešeno, když %s povolí webovému serveru zápis do konfiguračního adresáře %s.", +"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "To lze obvykle vyřešit %spovolením zápisu webovému serveru do konfiguračního adresáře%s.", "Sample configuration detected" => "Byla detekována vzorová konfigurace", "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" => "Pravděpodobně byla zkopírována konfigurační nastavení ze vzorových souborů. Toto není podporováno a může poškodit vaši instalaci. Nahlédněte prosím do dokumentace před prováděním změn v souboru config.php", "Help" => "Nápověda", @@ -66,16 +66,16 @@ $TRANSLATIONS = array( "Share type %s is not valid for %s" => "Sdílení typu %s není korektní pro %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Nastavení oprávnění pro %s selhalo, protože jsou k tomu nutná vyšší oprávnění, než jaká byla povolena pro %s", "Setting permissions for %s failed, because the item was not found" => "Nastavení práv pro %s selhalo, protože položka nebyla nalezena", -"Cannot set expiration date. Shares cannot expire later than %s after they have been shared" => "Nelze nastavit datum vypršení platnosti. Sdílení nemůže vypršet později než za %s po zveřejnění.", -"Cannot set expiration date. Expiration date is in the past" => "Nelze nastavit datum vypršení platnosti. Datum vypršení je v minulosti.", -"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Podpůrná vrstva pro sdílení %s musí obsahovat rozhraní OCP\\Share_Backend", -"Sharing backend %s not found" => "Podpůrná vrstva sdílení %s nenalezena", -"Sharing backend for %s not found" => "Podpůrná vrstva sdílení pro %s nenalezena", -"Sharing %s failed, because the user %s is the original sharer" => "Sdílení položky %s selhalo, protože byla sdílena uživatelem %s jako první.", +"Cannot set expiration date. Shares cannot expire later than %s after they have been shared" => "Nelze nastavit datum vypršení platnosti. Sdílení nemůže vypršet později než za %s po zveřejnění", +"Cannot set expiration date. Expiration date is in the past" => "Nelze nastavit datum vypršení platnosti. Datum vypršení je v minulosti", +"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Úložiště pro sdílení %s musí implementovat rozhraní OCP\\Share_Backend", +"Sharing backend %s not found" => "Úložiště sdílení %s nenalezeno", +"Sharing backend for %s not found" => "Úložiště sdílení pro %s nenalezeno", +"Sharing %s failed, because the user %s is the original sharer" => "Sdílení položky %s selhalo, protože byla sdílena uživatelem %s jako první", "Sharing %s failed, because the permissions exceed permissions granted to %s" => "Sdílení položky %s selhalo, protože jsou k tomu nutná vyšší oprávnění, než jaká byla %s povolena.", -"Sharing %s failed, because resharing is not allowed" => "Sdílení položky %s selhalo, protože sdílení dále není povoleno", -"Sharing %s failed, because the sharing backend for %s could not find its source" => "Sdílení položky %s selhalo, protože podpůrná vrstva sdílení nenalezla zdrojový %s", -"Sharing %s failed, because the file could not be found in the file cache" => "Sdílení položky %s selhalo, protože soubor nebyl nalezen v dočasném úložišti", +"Sharing %s failed, because resharing is not allowed" => "Sdílení položky %s selhalo, protože znovu-sdílení není povoleno", +"Sharing %s failed, because the sharing backend for %s could not find its source" => "Sdílení položky %s selhalo, protože úložiště sdílení %s nenalezla zdroj", +"Sharing %s failed, because the file could not be found in the file cache" => "Sdílení položky %s selhalo, protože soubor nebyl nalezen ve vyrovnávací paměti", "Could not find category \"%s\"" => "Nelze nalézt kategorii \"%s\"", "seconds ago" => "před pár sekundami", "_%n minute ago_::_%n minutes ago_" => array("před %n minutou","před %n minutami","před %n minutami"), @@ -92,32 +92,32 @@ $TRANSLATIONS = array( "A valid password must be provided" => "Musíte zadat platné heslo", "The username is already being used" => "Uživatelské jméno je již využíváno", "No database drivers (sqlite, mysql, or postgresql) installed." => "Nejsou instalovány ovladače databází (sqlite, mysql nebo postresql).", -"Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "Oprávnění bývají obvykle napravena, když %s povolí webovému serveru zápis do kořenového adresáře %s.", +"Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "Oprávnění lze obvykle napravit %spovolením zápisu webovému serveru do kořenového adresáře%s.", "Cannot write into \"config\" directory" => "Nelze zapisovat do adresáře \"config\"", "Cannot write into \"apps\" directory" => "Nelze zapisovat do adresáře \"apps\"", -"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "To bývá obyčeně vyřešeno, když %s povolí webovému serveru zápis do apps adresáře%s nebo vypnutím položky appstore v konfiguračním souboru.", -"Cannot create \"data\" directory (%s)" => "Nelze vytvořit \"data\" adresář (%s)", -"This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "To bývá obvykle vyřešeno, když <a href=\"%s\" target=\"_blank\"> povolí webovému serveru zápis do kořenového adresáře</a>.", +"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "To lze obvykle vyřešit %spovolením zápisu webovému serveru do adresáře apps%s nebo zakázáním appstore v konfiguračním souboru.", +"Cannot create \"data\" directory (%s)" => "Nelze vytvořit adresář \"data\" (%s)", +"This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "To lze obvykle vyřešit <a href=\"%s\" target=\"_blank\">povolením zápisu webovému serveru do kořenového adresáře</a>.", "Setting locale to %s failed" => "Nastavení jazyka na %s selhalo", "Please install one of these locales on your system and restart your webserver." => "Prosím nainstalujte alespoň jeden z těchto jazyků do svého systému a restartujte webový server.", -"Please ask your server administrator to install the module." => "Požádejte svého administrátora, ať nainstaluje příslušný modul.", +"Please ask your server administrator to install the module." => "Požádejte svého administrátora o instalaci tohoto modulu.", "PHP module %s not installed." => "PHP modul %s není nainstalován.", "PHP %s or higher is required." => "Je vyžadováno PHP %s nebo vyšší.", -"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." => "Požádejte svého administrátora, aby provedl aktualizaci PHP na nejvyšší verzi. Vaše verze PHP již není podporována komunitami ownCloud a PHP.", +"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." => "Požádejte svého administrátora o aktualizaci PHP na nejnovější verzi. Vaše verze PHP již není podporována komunitami ownCloud a PHP.", "PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly." => "Je zapnut PHP Safe Mode. Pro správnou funkčnost ownCloud je třeba toto vypnout.", -"PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "PHP Safe Mode je zastaralé a víceméně zbytečné nastavení, které je třeba vypnout. Požádejte prosím svého administrátora, ať toto provede v php.ini nebo v nastavení konfigurace webového serveru.", +"PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "PHP Safe Mode je zastaralé a většinou zbytečné nastavení, které je třeba vypnout. Požádejte prosím svého administrátora o zakázání v php.ini nebo v konfiguraci webového serveru.", "Magic Quotes is enabled. ownCloud requires that it is disabled to work properly." => "Je povoleno nastavení Magic Quotes. Pro správnou funkčnost ownCloud je třeba toto vypnout.", -"Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "Magic Quotes je zastaralé a víceméně zbytečné nastavení, které je třeba vypnout. Požádejte prosím svého administrátora, ať toto provede v php.ini nebo v nastavení konfigurace webového serveru.", -"PHP modules have been installed, but they are still listed as missing?" => "PHP moduly jsou nainstalovány, ale stále vykázány jako chybějící?", -"Please ask your server administrator to restart the web server." => "Požádejte svého administrátora, ať restartuje webový server.", -"PostgreSQL >= 9 required" => "Je třeba PostgreSQL >= 9", +"Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "Magic Quotes je zastaralé a většinou zbytečné nastavení, které je třeba vypnout. Požádejte prosím svého administrátora o zakázání v php.ini nebo v konfiguraci webového serveru.", +"PHP modules have been installed, but they are still listed as missing?" => "PHP moduly jsou nainstalovány, ale stále se tváří jako chybějící?", +"Please ask your server administrator to restart the web server." => "Požádejte svého administrátora o restart webového serveru.", +"PostgreSQL >= 9 required" => "Je vyžadováno PostgreSQL >= 9", "Please upgrade your database version" => "Aktualizujte prosím verzi své databáze", "Error occurred while checking PostgreSQL version" => "Při zjišťování verze PostgreSQL došlo k chybě", -"Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" => "Zajistěte prosím PostgreSQL >=9 nebo zkontrolujte logy pro více informací o chybě.", -"Please change the permissions to 0770 so that the directory cannot be listed by other users." => "Změntě prosím práva na 0770, aby adresář nemohl být otevřen ostatními uživateli.", -"Data directory (%s) is readable by other users" => "Data adresář (%s) je čitelný i ostatními uživateli", -"Data directory (%s) is invalid" => "Data adresář (%s) je neplatný", +"Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" => "Ujistěte se, že máte PostgreSQL >= 9, a zkontrolujte logy pro více informací o chybě.", +"Please change the permissions to 0770 so that the directory cannot be listed by other users." => "Změňte prosím práva na 0770, aby adresář nemohl být otevřen ostatními uživateli.", +"Data directory (%s) is readable by other users" => "Datový adresář (%s) je čitelný i ostatními uživateli", +"Data directory (%s) is invalid" => "Datový adresář (%s) je neplatný", "Please check that the data directory contains a file \".ocdata\" in its root." => "Ověřte prosím, že kořenový adresář s daty obsahuje soubor \".ocdata\".", -"Could not obtain lock type %d on \"%s\"." => "Nelze zjistit typ zámku %d na \"%s\"." +"Could not obtain lock type %d on \"%s\"." => "Nelze získat zámek typu %d na \"%s\"." ); $PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"; diff --git a/lib/l10n/da.php b/lib/l10n/da.php index dd5347c6714..e23abf05943 100644 --- a/lib/l10n/da.php +++ b/lib/l10n/da.php @@ -4,6 +4,8 @@ $TRANSLATIONS = array( "This can usually be fixed by giving the webserver write access to the config directory" => "Dette kan normalvis ordnes ved at give webserveren skrive adgang til config mappen", "See %s" => "Se %s", "This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Dette kan som regel rettes ved at %sgive webserveren skriveadgang til config-mappen%s.", +"Sample configuration detected" => "Eksempel for konfiguration registreret", +"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" => "Der er registreret at eksempel for konfiguration er blevet kopieret. Dette kan ødelægge din installation og understøttes ikke. Læs venligst dokumentationen før der foretages ændringer i config.php", "Help" => "Hjælp", "Personal" => "Personligt", "Settings" => "Indstillinger", @@ -64,6 +66,8 @@ $TRANSLATIONS = array( "Share type %s is not valid for %s" => "Delingstypen %s er ikke gyldig for %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Angivelse af tilladelser for %s mislykkedes, fordi tilladelserne overskred de som var tildelt %s", "Setting permissions for %s failed, because the item was not found" => "Angivelse af tilladelser for %s mislykkedes, fordi artiklen ikke blev fundet", +"Cannot set expiration date. Shares cannot expire later than %s after they have been shared" => "Kan ikke angive udløbsdato. Delinger kan ikke udløbe senere end %s efter at de er blevet delt", +"Cannot set expiration date. Expiration date is in the past" => "Kan ikke angive udløbsdato. Udløbsdato er allerede passeret", "Sharing backend %s must implement the interface OCP\\Share_Backend" => "Delingsbackend'en %s skal implementere grænsefladen OCP\\Share_Backend", "Sharing backend %s not found" => "Delingsbackend'en %s blev ikke fundet", "Sharing backend for %s not found" => "Delingsbackend'en for %s blev ikke fundet", @@ -91,9 +95,11 @@ $TRANSLATIONS = array( "Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "Rettigheder kan som regel rettes ved %sat give webserveren skriveadgang til rodmappen%s.", "Cannot write into \"config\" directory" => "Kan ikke skrive til mappen \"config\"", "Cannot write into \"apps\" directory" => "Kan ikke skrive til mappen \"apps\"", +"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "Dette kan som regel rettes ved at %sgive webserveren skriveadgang til apps-mappen%s eller slå appstore fra i config-filen.", "Cannot create \"data\" directory (%s)" => "Kan ikke oprette mappen \"data\" (%s)", "This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "Dette kan som regel rettes ved <a href=\"%s\" target=\"_blank\">give webserveren skriveadgang til rodmappen</a>.", "Setting locale to %s failed" => "Angivelse af %s for lokalitet mislykkedes", +"Please install one of these locales on your system and restart your webserver." => "Installér venligst én af disse lokaliteter på dit system, og genstart din webserver.", "Please ask your server administrator to install the module." => "Du bedes anmode din serveradministrator om at installere modulet.", "PHP module %s not installed." => "PHP-modulet %s er ikke installeret.", "PHP %s or higher is required." => "Der kræves PHP %s eller nyere.", diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php index a07ef8f249c..365c2e1f96a 100644 --- a/lib/l10n/et_EE.php +++ b/lib/l10n/et_EE.php @@ -4,6 +4,7 @@ $TRANSLATIONS = array( "This can usually be fixed by giving the webserver write access to the config directory" => "Tavaliselt saab selle lahendada andes veebiserverile seatete kataloogile \"config\" kirjutusõigused", "See %s" => "Vaata %s", "This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Tavaliselt saab selle lahendada %s andes veebiserverile seadete kataloogile \"config\" kirjutusõigused %s", +"Sample configuration detected" => "Tuvastati näidisseaded", "Help" => "Abiinfo", "Personal" => "Isiklik", "Settings" => "Seaded", @@ -64,6 +65,7 @@ $TRANSLATIONS = array( "Share type %s is not valid for %s" => "Jagamise tüüp %s ei ole õige %s jaoks", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Lubade seadistus %s jaoks ebaõnnestus, kuna antud õigused ületavad %s jaoks määratud õigusi", "Setting permissions for %s failed, because the item was not found" => "Lubade seadistus %s jaoks ebaõnnestus, kuna üksust ei leitud", +"Cannot set expiration date. Expiration date is in the past" => "Aegumiskuupäeva ei saa määrata. Aegumise kuupäev on minevikus", "Sharing backend %s must implement the interface OCP\\Share_Backend" => "Jagamise tagarakend %s peab kasutusele võtma OCP\\Share_Backend liidese", "Sharing backend %s not found" => "Jagamise tagarakendit %s ei leitud", "Sharing backend for %s not found" => "Jagamise tagarakendit %s jaoks ei leitud", diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php index 49fdee6e741..35200643d4b 100644 --- a/lib/l10n/hu_HU.php +++ b/lib/l10n/hu_HU.php @@ -1,17 +1,23 @@ <?php $TRANSLATIONS = array( "Cannot write into \"config\" directory!" => "Nem írható a \"config\" könyvtár!", +"This can usually be fixed by giving the webserver write access to the config directory" => "Ez rendszerint úgy oldható meg, hogy írási jogot adunk a webszervernek a config könyvtárra.", +"See %s" => "Lásd %s", +"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Ez rendszerint úgy oldható meg, hogy %sírási jogot adunk a webszervernek a config könyvtárra%s.", +"Sample configuration detected" => "A példabeállítások vannak beállítva", +"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" => "Úgy tűnik a példakonfigurációt próbálja ténylegesen használni. Ez nem támogatott, és működésképtelenné teheti a telepítést. Kérjük olvassa el a dokumentációt és azt követően változtasson a config.php-n!", "Help" => "Súgó", "Personal" => "Személyes", "Settings" => "Beállítások", "Users" => "Felhasználók", "Admin" => "Adminsztráció", +"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." => " \\\"%s\\\" alkalmazás nem telepíthető, mert nem kompatibilis az ownCloud jelen változatával.", "No app name specified" => "Nincs az alkalmazás név megadva.", "Unknown filetype" => "Ismeretlen file tipús", "Invalid image" => "Hibás kép", "web services under your control" => "webszolgáltatások saját kézben", "App directory already exists" => "Az alkalmazás mappája már létezik", -"Can't create app folder. Please fix permissions. %s" => "Nem lehetett létrehozni az alkalmzás mappáját. Kérlek ellenőrizd a jogosultásgokat. %s", +"Can't create app folder. Please fix permissions. %s" => "Nem lehetett létrehozni az alkalmazás mappáját. Kérem ellenőrizze a jogosultságokat. %s", "No source specified when installing app" => "Az alkalmazás telepítéséhez nincs forrás megadva", "No href specified when installing app from http" => "Az alkalmazás http-n keresztül történő telepítéséhez nincs href hivetkozás megadva", "No path specified when installing app from local file" => "Az alkalmazás helyi telepítéséhez nincs útvonal (mappa) megadva", @@ -19,9 +25,9 @@ $TRANSLATIONS = array( "Failed to open archive when installing app" => "Nem sikerült megnyitni a tömörített állományt a telepítés során", "App does not provide an info.xml file" => "Az alkalmazás nem szolgáltatott info.xml file-t", "App can't be installed because of not allowed code in the App" => "Az alkalmazást nem lehet telepíteni, mert abban nem engedélyezett programkód szerepel", -"App can't be installed because it is not compatible with this version of ownCloud" => "Az alalmazás nem telepíthető, mert nem kompatibilis az ownClod ezzel a verziójával.", +"App can't be installed because it is not compatible with this version of ownCloud" => "Az alkalmazás nem telepíthető, mert nem kompatibilis az ownCloud jelen verziójával.", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Az alkalmazást nem lehet telepíteni, mert tartalmazza a \n<shipped>\ntrue\n</shipped>\ncímkét, ami a nem szállított alkalmazások esetén nem engedélyezett", -"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Az alkalmazást nem lehet telepíteni, mert az info.xml/version-ben megadott verzió nem egyezik az alkalmazás-áruházban feltüntetett verzióval.", +"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Az alkalmazást nem lehet telepíteni, mert az info.xml/version-ben megadott verzió nem egyezik az alkalmazás-kiszolgálón feltüntetett verzióval.", "Application is not enabled" => "Az alkalmazás nincs engedélyezve", "Authentication error" => "Azonosítási hiba", "Token expired. Please reload page." => "A token lejárt. Frissítse az oldalt.", @@ -31,8 +37,13 @@ $TRANSLATIONS = array( "%s you may not use dots in the database name" => "%s az adatbázis neve nem tartalmazhat pontot", "MS SQL username and/or password not valid: %s" => "Az MS SQL felhasználónév és/vagy jelszó érvénytelen: %s", "You need to enter either an existing account or the administrator." => "Vagy egy létező felhasználó vagy az adminisztrátor bejelentkezési nevét kell megadnia", +"MySQL/MariaDB username and/or password not valid" => "A MySQL/MariaDB felhasználónév és/vagy jelszó nem megfelelő", "DB Error: \"%s\"" => "Adatbázis hiba: \"%s\"", "Offending command was: \"%s\"" => "A hibát ez a parancs okozta: \"%s\"", +"MySQL/MariaDB user '%s'@'localhost' exists already." => "A MySQL/MariaDB felhasználó '%s'@'localhost' már létezik.", +"Drop this user from MySQL/MariaDB" => "Töröljük ez a felhasználót a MySQL/MariaDB-rendszerből", +"MySQL/MariaDB user '%s'@'%%' already exists" => "A MySQL/MariaDB felhasználó '%s'@'%%' már létezik.", +"Drop this user from MySQL/MariaDB." => "Töröljük ez a felhasználót a MySQL/MariaDB-rendszerből.", "Oracle connection could not be established" => "Az Oracle kapcsolat nem hozható létre", "Oracle username and/or password not valid" => "Az Oracle felhasználói név és/vagy jelszó érvénytelen", "Offending command was: \"%s\", name: %s, password: %s" => "A hibát okozó parancs ez volt: \"%s\", login név: %s, jelszó: %s", @@ -43,7 +54,28 @@ $TRANSLATIONS = array( "Please double check the <a href='%s'>installation guides</a>." => "Kérjük tüzetesen tanulmányozza át a <a href='%s'>telepítési útmutatót</a>.", "%s shared »%s« with you" => "%s megosztotta Önnel ezt: »%s«", "Sharing %s failed, because the file does not exist" => "%s megosztása sikertelen, mert a fájl nem létezik", -"Cannot set expiration date. Expiration date is in the past" => "Nem lehet beállítani a lejárati időt mivel már elmúlt.", +"You are not allowed to share %s" => "Önnek nincs jogosultsága %s megosztására", +"Sharing %s failed, because the user %s is the item owner" => "%s megosztása nem sikerült, mert %s felhasználó az állomány tulajdonosa", +"Sharing %s failed, because the user %s does not exist" => "%s megosztása nem sikerült, mert %s felhasználó nem létezik", +"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "%s megosztása nem sikerült, mert %s felhasználó nem tagja egyik olyan csoportnak sem, aminek %s tagja", +"Sharing %s failed, because this item is already shared with %s" => "%s megosztása nem sikerült, mert ez már meg van osztva %s-vel", +"Sharing %s failed, because the group %s does not exist" => "%s megosztása nem sikerült, mert %s csoport nem létezik", +"Sharing %s failed, because %s is not a member of the group %s" => "%s megosztása nem sikerült, mert %s felhasználó nem tagja a %s csoportnak", +"You need to provide a password to create a public link, only protected links are allowed" => "Meg kell adnia egy jelszót is, mert a nyilvános linkek csak jelszóval védetten használhatók", +"Sharing %s failed, because sharing with links is not allowed" => "%s megosztása nem sikerült, mert a linkekkel történő megosztás nincs engedélyezve", +"Share type %s is not valid for %s" => "A %s megosztási típus nem érvényes %s-re", +"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Nem sikerült %s-re beállítani az elérési jogosultságokat, mert a megadottak túllépik a %s-re érvényes jogosultságokat", +"Setting permissions for %s failed, because the item was not found" => "Nem sikerült %s-re beállítani az elérési jogosultságokat, mert a kérdéses állomány nem található", +"Cannot set expiration date. Shares cannot expire later than %s after they have been shared" => "Nem lehet beállítani a lejárati időt. A megosztások legfeljebb ennyi idővel járhatnak le a létrehozásukat követően: %s", +"Cannot set expiration date. Expiration date is in the past" => "Nem lehet beállítani a lejárati időt, mivel a megadott lejárati időpont már elmúlt.", +"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Az %s megosztási alrendszernek támogatnia kell az OCP\\Share_Backend interface-t", +"Sharing backend %s not found" => "A %s megosztási alrendszer nem található", +"Sharing backend for %s not found" => "%s megosztási alrendszere nem található", +"Sharing %s failed, because the user %s is the original sharer" => "%s megosztása nem sikerült, mert %s felhasználó az eredeti megosztó", +"Sharing %s failed, because the permissions exceed permissions granted to %s" => "%s megosztása nem sikerült, mert a jogosultságok túllépik azt, ami %s rendelkezésére áll", +"Sharing %s failed, because resharing is not allowed" => "%s megosztása nem sikerült, mert a megosztás továbbadása nincs engedélyezve", +"Sharing %s failed, because the sharing backend for %s could not find its source" => "%s megosztása nem sikerült, mert %s megosztási alrendszere nem találja", +"Sharing %s failed, because the file could not be found in the file cache" => "%s megosztása nem sikerült, mert a fájl nem található a gyorsítótárban", "Could not find category \"%s\"" => "Ez a kategória nem található: \"%s\"", "seconds ago" => "pár másodperce", "_%n minute ago_::_%n minutes ago_" => array("","%n perccel ezelőtt"), @@ -55,10 +87,37 @@ $TRANSLATIONS = array( "_%n month ago_::_%n months ago_" => array("%n hónappal ezelőtt","%n hónappal ezelőtt"), "last year" => "tavaly", "years ago" => "több éve", +"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "A felhasználónévben csak a következő karakterek fordulhatnak elő: \"a-z\", \"A-Z\", \"0-9\", és \"_.@-\"", "A valid username must be provided" => "Érvényes felhasználónevet kell megadnia", "A valid password must be provided" => "Érvényes jelszót kell megadnia", "The username is already being used" => "Ez a bejelentkezési név már foglalt", +"No database drivers (sqlite, mysql, or postgresql) installed." => "Nincs telepítve adatbázis-meghajtóprogram (sqlite, mysql vagy postgresql).", +"Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "Az elérési problémák rendszerint megoldhatók azzal, ha a %swebszervernek írásjogot adunk a gyökérkönyvtárra%s.", "Cannot write into \"config\" directory" => "Nem írható a \"config\" könyvtár", -"Please upgrade your database version" => "Kérlek frissítsd az adatbázisodat" +"Cannot write into \"apps\" directory" => "Nem írható az \"apps\" könyvtár", +"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "Ez rendszerint úgy oldható meg, hogy %sírási jogot adunk a webszervernek az app könyvtárra%s, vagy letiltjuk a config fájlban az appstore használatát.", +"Cannot create \"data\" directory (%s)" => "Nem sikerült létrehozni a \"data\" könyvtárt (%s)", +"This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "Ez rendszerint úgy oldható meg, hogy <a href=\"%s\" target=\"_blank\">írásjogot adunk a webszervernek a gyökérkönyvtárra</a>.", +"Setting locale to %s failed" => "A lokalizáció %s-re való állítása nem sikerült", +"Please install one of these locales on your system and restart your webserver." => "Kérjük állítsa be a következő lokalizációk valamelyikét a rendszeren és indítsa újra a webszervert!", +"Please ask your server administrator to install the module." => "Kérje meg a rendszergazdát, hogy telepítse a modult!", +"PHP module %s not installed." => "A %s PHP modul nincs telepítve.", +"PHP %s or higher is required." => "PHP %s vagy ennél újabb szükséges.", +"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." => "Kérje meg a rendszergazdát, hogy frissítse a PHP-t újabb változatra! Ezt a PHP változatot már nem támogatja az ownCloud és a PHP fejlesztői közösség.", +"PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly." => "Be van állítva a PHP Safe Mode. Az ownCloud megfelelő működéséhez szükséges, hogy ez ki legyen kapcsolva.", +"PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "A PHP Safe Mode egy régi, már nem támogatott és haszontalan üzemmód, amit érdemes letiltani. Kérje meg a rendszergazdát, hogy tiltsa le vagy a php.ini-ben, vagy a webszerver beállításokban!", +"Magic Quotes is enabled. ownCloud requires that it is disabled to work properly." => "Be van álltva a Magic Quotes. Az ownCloud megfelelő működéséhez szükséges, hogy ez le legyen tiltva.", +"Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "A Magic Quotes egy régi, már nem támogatott és haszontalan üzemmód, amit érdemes letiltani. Kérje meg a rendszergazdát, hogy tiltsa le vagy a php.ini-ben, vagy a webszerver beállításokban!", +"PHP modules have been installed, but they are still listed as missing?" => "A PHP modulok telepítve vannak, de a listában mégsincsenek felsorolva?", +"Please ask your server administrator to restart the web server." => "Kérje meg a rendszergazdát, hogy indítsa újra a webszervert!", +"PostgreSQL >= 9 required" => "PostgreSQL >= 9 szükséges", +"Please upgrade your database version" => "Kérem frissítse az adatbázis-szoftvert!", +"Error occurred while checking PostgreSQL version" => "Hiba történt a PostgreSQL verziójának ellenőrzése közben", +"Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" => "Kérjük gondoskodjon róla, hogy a PostgreSQL legalább 9-es verziójú legyen, vagy ellenőrizze a naplófájlokat, hogy mi okozta a hibát!", +"Please change the permissions to 0770 so that the directory cannot be listed by other users." => "Kérjük módosítsa a könyvtár elérhetőségi engedélybeállítását 0770-re, hogy a tartalmát más felhasználó ne listázhassa!", +"Data directory (%s) is readable by other users" => "Az adatkönyvtár (%s) más felhasználók számára is olvasható ", +"Data directory (%s) is invalid" => "Érvénytelen a megadott adatkönyvtár (%s) ", +"Please check that the data directory contains a file \".ocdata\" in its root." => "Kérjük ellenőrizze, hogy az adatkönyvtár tartalmaz a gyökerében egy \".ocdata\" nevű állományt!", +"Could not obtain lock type %d on \"%s\"." => "Nem sikerült %d típusú zárolást elérni itt: \"%s\"." ); $PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php index 3e89a4d7a42..a142255ce79 100644 --- a/lib/l10n/pt_PT.php +++ b/lib/l10n/pt_PT.php @@ -4,6 +4,8 @@ $TRANSLATIONS = array( "This can usually be fixed by giving the webserver write access to the config directory" => "Isto pode ser resolvido normalmente dando ao servidor web direitos de escrita ao directório de configuração", "See %s" => "Ver %s", "This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Isto pode ser resolvido normalmente %sdando ao servidor web direitos de escrita no directório de configuração%s.", +"Sample configuration detected" => "Exemplo de configuração detectada", +"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" => "Foi detectado que a configuração de amostra foi copiada. Isso pode danificar a sua instalação e não é suportado. Por favor, leia a documentação antes de realizar mudanças no config.php", "Help" => "Ajuda", "Personal" => "Pessoal", "Settings" => "Configurações", @@ -97,6 +99,7 @@ $TRANSLATIONS = array( "Cannot create \"data\" directory (%s)" => "Não é possivel criar a directoria \"data\" (%s)", "This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "Isto pode ser normalmente resolvido <a href=\"%s\" target=\"_blank\">dando ao servidor web direito de escrita para o directório do root</a>.", "Setting locale to %s failed" => "Definindo local para %s falhado", +"Please install one of these locales on your system and restart your webserver." => "Por favor instale um destes locais no seu sistema e reinicie o seu servidor web.", "Please ask your server administrator to install the module." => "Por favor pergunte ao seu administrador do servidor para instalar o modulo.", "PHP module %s not installed." => "O modulo %s PHP não está instalado.", "PHP %s or higher is required." => "Necessário PHP %s ou maior.", diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php index 301df298b98..bb5ad02c8c9 100644 --- a/lib/l10n/zh_TW.php +++ b/lib/l10n/zh_TW.php @@ -1,5 +1,6 @@ <?php $TRANSLATIONS = array( +"Cannot write into \"config\" directory!" => "無法寫入 config 目錄!", "Help" => "說明", "Personal" => "個人", "Settings" => "設定", diff --git a/lib/private/allconfig.php b/lib/private/allconfig.php index eb114546010..ef8673af231 100644 --- a/lib/private/allconfig.php +++ b/lib/private/allconfig.php @@ -28,7 +28,7 @@ class AllConfig implements \OCP\IConfig { * * @param string $key the key of the value, under which it was saved * @param mixed $default the default value to be returned if the value isn't set - * @return string the saved value + * @return mixed the value or $default */ public function getSystemValue($key, $default = '') { return \OCP\Config::getSystemValue($key, $default); diff --git a/lib/private/app.php b/lib/private/app.php index 70f8980d2c1..d10d352b432 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -359,7 +359,7 @@ class OC_App { * entries are sorted by the key 'order' ascending. */ public static function getSettingsNavigation() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $settings = array(); // by default, settings only contain the help menu @@ -1094,7 +1094,7 @@ class OC_App { * @throws Exception if no app-name was specified */ public static function installApp($app) { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); $appData=OC_OCSClient::getApplication($app); // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index 61a2333ecee..e7efa3fa219 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -191,7 +191,7 @@ class DIContainer extends SimpleContainer implements IAppContainer{ } private function getUserId() { - return \OC::$session->get('user_id'); + return \OC::$server->getSession()->get('user_id'); } /** diff --git a/lib/private/avatar.php b/lib/private/avatar.php index 2286b896878..a9d9346d50a 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -62,12 +62,12 @@ class OC_Avatar implements \OCP\IAvatar { $type = 'jpg'; } if ($type !== 'jpg' && $type !== 'png') { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); throw new \Exception($l->t("Unknown filetype")); } if (!$img->valid()) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); throw new \Exception($l->t("Invalid image")); } diff --git a/lib/private/connector/sabre/auth.php b/lib/private/connector/sabre/auth.php index b1ef698583d..6e1baca9332 100644 --- a/lib/private/connector/sabre/auth.php +++ b/lib/private/connector/sabre/auth.php @@ -78,7 +78,7 @@ class OC_Connector_Sabre_Auth extends \Sabre\DAV\Auth\Backend\AbstractBasic { $result = $this->auth($server, $realm); // close the session - right after authentication there is not need to write to the session any more - \OC::$session->close(); + \OC::$server->getSession()->close(); return $result; } diff --git a/lib/private/defaults.php b/lib/private/defaults.php index dfd114cd2fe..3996cc081ed 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -27,7 +27,7 @@ class OC_Defaults { private $defaultMailHeaderColor; function __construct() { - $this->l = OC_L10N::get('lib'); + $this->l = \OC::$server->getL10N('lib'); $version = OC_Util::getVersion(); $this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */ diff --git a/lib/private/group/database.php b/lib/private/group/database.php index 8d6ea1f50a5..e6a5565b20e 100644 --- a/lib/private/group/database.php +++ b/lib/private/group/database.php @@ -168,7 +168,7 @@ class OC_Group_Database extends OC_Group_Backend { * Returns a list with all groups */ public function getGroups($search = '', $limit = null, $offset = null) { - $stmt = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` LIKE ?', $limit, $offset); + $stmt = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` LIKE ? ORDER BY `gid` ASC', $limit, $offset); $result = $stmt->execute(array('%' . $search . '%')); $groups = array(); while ($row = $result->fetchRow()) { @@ -200,7 +200,7 @@ class OC_Group_Database extends OC_Group_Backend { * @return array an array of user ids */ public function usersInGroup($gid, $search = '', $limit = null, $offset = null) { - $stmt = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?', + $stmt = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ? ORDER BY `uid` ASC', $limit, $offset); $result = $stmt->execute(array($gid, '%'.$search.'%')); diff --git a/lib/private/installer.php b/lib/private/installer.php index dc9a3558b75..02e2190aaf2 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -62,7 +62,7 @@ class OC_Installer{ * @return integer */ public static function installApp( $data = array()) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); list($extractDir, $path) = self::downloadApp($data); $info = self::checkAppsIntegrity($data, $extractDir, $path); @@ -229,7 +229,7 @@ class OC_Installer{ * @throws Exception */ public static function downloadApp($data = array()) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if(!isset($data['source'])) { throw new \Exception($l->t("No source specified when installing app")); @@ -285,7 +285,7 @@ class OC_Installer{ * @throws \Exception */ public static function checkAppsIntegrity($data = array(), $extractDir, $path, $isShipped=false) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')) { //try to find it in a subdir diff --git a/lib/private/json.php b/lib/private/json.php index da38654997f..f2719dd2bc7 100644 --- a/lib/private/json.php +++ b/lib/private/json.php @@ -25,7 +25,7 @@ class OC_JSON{ */ public static function checkAppEnabled($app) { if( !OC_App::isEnabled($app)) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ))); exit(); } @@ -36,7 +36,7 @@ class OC_JSON{ */ public static function checkLoggedIn() { if( !OC_User::isLoggedIn()) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); exit(); } @@ -47,7 +47,7 @@ class OC_JSON{ */ public static function callCheck() { if( !OC_Util::isCallRegistered()) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ))); exit(); } @@ -58,7 +58,7 @@ class OC_JSON{ */ public static function checkAdminUser() { if( !OC_User::isAdminUser(OC_User::getUser())) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); exit(); } @@ -70,7 +70,7 @@ class OC_JSON{ */ public static function checkUserExists($user) { if (!OCP\User::userExists($user)) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' ))); exit; } @@ -83,7 +83,7 @@ class OC_JSON{ */ public static function checkSubAdminUser() { if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); exit(); } diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index d0c3799b9c2..fcc3f3e3394 100644 --- a/lib/private/l10n/factory.php +++ b/lib/private/l10n/factory.php @@ -20,12 +20,15 @@ class Factory { /** * get an L10N instance + * * @param string $app * @param string|null $lang * @return \OC_L10N */ - public function get($app) { - if (!isset($this->instances[$app])) { + public function get($app, $lang = null) { + if (!is_null($lang)) { + return new \OC_L10N($app, $lang); + } else if (!isset($this->instances[$app])) { $this->instances[$app] = new \OC_L10N($app); } return $this->instances[$app]; diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index e4cce6b2260..dc147dea0c9 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -29,6 +29,18 @@ class OC_OCSClient{ /** + * Returns whether the AppStore is enabled (i.e. because the AppStore is disabled for EE) + * @return bool + */ + protected static function isAppstoreEnabled() { + if(OC::$server->getConfig()->getSystemValue('appstoreenabled', true) === false OR OC_Util::getEditionString() !== '') { + return false; + } + + return true; + } + + /** * Get the url of the OCS AppStore server. * @return string of the AppStore server * @@ -36,16 +48,9 @@ class OC_OCSClient{ * to set it in the config file or it will fallback to the default */ private static function getAppStoreURL() { - if(OC_Util::getEditionString()===''){ - $default='https://api.owncloud.com/v1'; - }else{ - $default=''; - } - $url = OC_Config::getValue('appstoreurl', $default); - return($url); + return OC::$server->getConfig()->getSystemValue('appstoreurl', 'https://api.owncloud.com/v1'); } - /** * Get the content of an OCS url call. * @return string of the response @@ -64,7 +69,7 @@ class OC_OCSClient{ * This function returns a list of all the application categories on the OCS server */ public static function getCategories() { - if(OC_Config::getValue('appstoreenabled', true)==false) { + if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; @@ -100,7 +105,7 @@ class OC_OCSClient{ * @param string $filter */ public static function getApplications($categories, $page, $filter) { - if(OC_Config::getValue('appstoreenabled', true)==false) { + if(!self::isAppstoreEnabled()) { return(array()); } @@ -155,7 +160,7 @@ class OC_OCSClient{ * This function returns an applications from the OCS server */ public static function getApplication($id) { - if(OC_Config::getValue('appstoreenabled', true)==false) { + if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); @@ -203,7 +208,7 @@ class OC_OCSClient{ * @param integer $item */ public static function getApplicationDownload($id, $item) { - if(OC_Config::getValue('appstoreenabled', true)==false) { + if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item); diff --git a/lib/private/request.php b/lib/private/request.php index 5fd5b3a7197..b063c1f5967 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -16,6 +16,34 @@ class OC_Request { const REGEX_LOCALHOST = '/^(127\.0\.0\.1|localhost)(:[0-9]+|)$/'; /** + * Returns the remote address, if the connection came from a trusted proxy and `forwarded_for_headers` has been configured + * then the IP address specified in this header will be returned instead. + * Do always use this instead of $_SERVER['REMOTE_ADDR'] + * @return string IP address + */ + public static function getRemoteAddress() { + $remoteAddress = $_SERVER['REMOTE_ADDR']; + $trustedProxies = \OC::$server->getConfig()->getSystemValue('trusted_proxies', array()); + + if(is_array($trustedProxies) && in_array($remoteAddress, $trustedProxies)) { + $forwardedForHeaders = \OC::$server->getConfig()->getSystemValue('forwarded_for_headers', array()); + + foreach($forwardedForHeaders as $header) { + if (array_key_exists($header, $_SERVER) === true) { + foreach (explode(',', $_SERVER[$header]) as $IP) { + $IP = trim($IP); + if (filter_var($IP, FILTER_VALIDATE_IP) !== false) { + return $IP; + } + } + } + } + } + + return $remoteAddress; + } + + /** * Check overwrite condition * @param string $type * @return bool diff --git a/lib/private/server.php b/lib/private/server.php index d67517f13e2..f533d270a95 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -12,6 +12,7 @@ use OC\Files\View; use OC\Security\Crypto; use OC\Security\SecureRandom; use OCP\IServerContainer; +use OCP\ISession; /** * Class Server @@ -33,8 +34,8 @@ class Server extends SimpleContainer implements IServerContainer { $urlParams = array(); } - if (\OC::$session->exists('requesttoken')) { - $requestToken = \OC::$session->get('requesttoken'); + if (\OC::$server->getSession()->exists('requesttoken')) { + $requestToken = \OC::$server->getSession()->get('requesttoken'); } else { $requestToken = false; } @@ -102,7 +103,7 @@ class Server extends SimpleContainer implements IServerContainer { * @var \OC\User\Manager $manager */ $manager = $c->query('UserManager'); - $userSession = new \OC\User\Session($manager, \OC::$session); + $userSession = new \OC\User\Session($manager, new \OC\Session\Memory('')); $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); }); @@ -270,14 +271,18 @@ class Server extends SimpleContainer implements IServerContainer { /** * Returns a view to ownCloud's files folder * + * @param string $userId user ID * @return \OCP\Files\Folder */ - function getUserFolder() { - $user = $this->getUserSession()->getUser(); - if (!$user) { - return null; + function getUserFolder($userId = null) { + if($userId === null) { + $user = $this->getUserSession()->getUser(); + if (!$user) { + return null; + } + $userId = $user->getUID(); } - $dir = '/' . $user->getUID(); + $dir = '/' . $userId; $root = $this->getRootFolder(); $folder = null; @@ -336,6 +341,20 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * @return \OCP\ISession + */ + function getSession() { + return $this->query('UserSession')->getSession(); + } + + /** + * @param \OCP\ISession $session + */ + function setSession(\OCP\ISession $session) { + return $this->query('UserSession')->setSession($session); + } + + /** * @return \OC\NavigationManager */ function getNavigationManager() { @@ -362,10 +381,11 @@ class Server extends SimpleContainer implements IServerContainer { * get an L10N instance * * @param string $app appid + * @param string $lang * @return \OC_L10N */ - function getL10N($app) { - return $this->query('L10NFactory')->get($app); + function getL10N($app, $lang = null) { + return $this->query('L10NFactory')->get($app, $lang); } /** @@ -403,15 +423,6 @@ class Server extends SimpleContainer implements IServerContainer { /** * Returns the current session * - * @return \OCP\ISession - */ - function getSession() { - return \OC::$session; - } - - /** - * Returns the current session - * * @return \OCP\IDBConnection */ function getDatabaseConnection() { diff --git a/lib/private/setup.php b/lib/private/setup.php index 9ea1690b6d9..7ea4c1bcd26 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -15,7 +15,7 @@ class OC_Setup { ); public static function getTrans(){ - return OC_L10N::get('lib'); + return \OC::$server->getL10N('lib'); } public static function install($options) { diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php index 24863b9e38a..23b5232438a 100644 --- a/lib/private/setup/oci.php +++ b/lib/private/setup/oci.php @@ -14,9 +14,23 @@ class OCI extends AbstractDatabase { } else { $this->dbtablespace = 'USERS'; } + // allow empty hostname for oracle + $this->dbhost = $config['dbhost']; + \OC_Config::setValue('dbhost', $this->dbhost); \OC_Config::setValue('dbtablespace', $this->dbtablespace); } + public function validate($config) { + $errors = array(); + if(empty($config['dbuser'])) { + $errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname)); + } + if(empty($config['dbname'])) { + $errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname)); + } + return $errors; + } + public function setupDatabase($username) { $e_host = addslashes($this->dbhost); $e_dbname = addslashes($this->dbname); diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index 1f4645eed9f..4a92503bdd3 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -52,7 +52,7 @@ class MailNotifications { * @param string $sender user id (if nothing is set we use the currently logged-in user) */ public function __construct($sender = null) { - $this->l = \OC_L10N::get('core'); + $this->l = \OC::$server->getL10N('core'); $this->senderId = $sender; diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 4bf6622c561..e2e9b94125e 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -479,7 +479,7 @@ class Share extends \OC\Share\Constants { public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) { $uidOwner = \OC_User::getUser(); $shareWithinGroupOnly = self::shareWithGroupMembersOnly(); - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (is_null($itemSourceName)) { $itemSourceName = $itemSource; @@ -719,23 +719,24 @@ class Share extends \OC\Share\Constants { /** * Unshare an item shared with the current user * @param string $itemType - * @param string $itemTarget + * @param string $itemOrigin Item target or source + * @param boolean $originIsSource true if $itemOrigin is the source, false if $itemOrigin is the target (optional) * @return boolean true on success or false on failure * * Unsharing from self is not allowed for items inside collections */ - public static function unshareFromSelf($itemType, $itemTarget) { - + public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) { + $originType = ($originIsSource) ? 'source' : 'target'; $uid = \OCP\User::getUser(); if ($itemType === 'file' || $itemType === 'folder') { - $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_target` = ?'; + $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_' . $originType . '` = ?'; } else { - $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `item_target` = ?'; + $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `item_' . $originType . '` = ?'; } $query = \OCP\DB::prepare($statement); - $result = $query->execute(array($itemType, $itemTarget)); + $result = $query->execute(array($itemType, $itemOrigin)); $shares = $result->fetchAll(); @@ -848,7 +849,7 @@ class Share extends \OC\Share\Constants { * @return boolean true on success or false on failure */ public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) { // Check if this item is a reshare and verify that the permissions @@ -937,7 +938,7 @@ class Share extends \OC\Share\Constants { * @throws \Exception */ private static function validateExpireDate($expireDate, $shareTime, $itemType, $itemSource) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $date = new \DateTime($expireDate); $today = new \DateTime('now'); @@ -1082,7 +1083,7 @@ class Share extends \OC\Share\Constants { * @return \OCP\Share_Backend */ public static function getBackend($itemType) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (isset(self::$backends[$itemType])) { return self::$backends[$itemType]; } else if (isset(self::$backendTypes[$itemType]['class'])) { @@ -1515,7 +1516,7 @@ class Share extends \OC\Share\Constants { private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $parentFolder = null, $token = null, $itemSourceName = null, \DateTime $expirationDate = null) { $backend = self::getBackend($itemType); - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); // Check if this is a reshare if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) { @@ -1854,8 +1855,8 @@ class Share extends \OC\Share\Constants { return true; } - if ( \OC::$session->exists('public_link_authenticated') - && \OC::$session->get('public_link_authenticated') === $linkItem['id'] ) { + if ( \OC::$server->getSession()->exists('public_link_authenticated') + && \OC::$server->getSession()->get('public_link_authenticated') === $linkItem['id'] ) { return true; } diff --git a/lib/private/tags.php b/lib/private/tags.php index 0b62caf2dd8..0e58789ecd5 100644 --- a/lib/private/tags.php +++ b/lib/private/tags.php @@ -178,7 +178,7 @@ class Tags implements \OCP\ITags { } if($tagId === false) { - $l10n = \OC_L10N::get('core'); + $l10n = \OC::$server->getL10N('core'); throw new \Exception( $l10n->t('Could not find category "%s"', $tag) ); diff --git a/lib/private/template.php b/lib/private/template.php index eaa58b769d7..d95943a714c 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -29,7 +29,7 @@ require_once __DIR__.'/template/functions.php'; class OC_Template extends \OC\Template\Base { private $renderas; // Create a full page? private $path; // The path to the template - private $headers=array(); //custom headers + private $headers = array(); //custom headers protected $app; // app id /** @@ -37,6 +37,7 @@ class OC_Template extends \OC\Template\Base { * @param string $app app providing the template * @param string $name of the template file (without suffix) * @param string $renderas = ""; produce a full page + * @param bool $registerCall = true * @return OC_Template object * * This function creates an OC_Template object. @@ -45,17 +46,17 @@ class OC_Template extends \OC\Template\Base { * according layout. For now, renderas can be set to "guest", "user" or * "admin". */ - public function __construct( $app, $name, $renderas = "" ) { + public function __construct( $app, $name, $renderas = "", $registerCall = true ) { // Read the selected theme from the config file $theme = OC_Util::getTheme(); // Read the detected formfactor and use the right file name. $fext = self::getFormFactorExtension(); - $requesttoken = OC::$session ? OC_Util::callRegister() : ''; + $requesttoken = (OC::$server->getSession() and $registerCall) ? OC_Util::callRegister() : ''; $parts = explode('/', $app); // fix translation when app is something like core/lostpassword - $l10n = OC_L10N::get($parts[0]); + $l10n = \OC::$server->getL10N($parts[0]); $themeDefaults = new OC_Defaults(); list($path, $template) = $this->findTemplate($theme, $app, $name, $fext); @@ -101,20 +102,20 @@ class OC_Template extends \OC\Template\Base { */ static public function getFormFactorExtension() { - if (!\OC::$session) { + if (!\OC::$server->getSession()) { return ''; } // if the formfactor is not yet autodetected do the // autodetection now. For possible formfactors check the // detectFormfactor documentation - if (!\OC::$session->exists('formfactor')) { - \OC::$session->set('formfactor', self::detectFormfactor()); + if (!\OC::$server->getSession()->exists('formfactor')) { + \OC::$server->getSession()->set('formfactor', self::detectFormfactor()); } // allow manual override via GET parameter if(isset($_GET['formfactor'])) { - \OC::$session->set('formfactor', $_GET['formfactor']); + \OC::$server->getSession()->set('formfactor', $_GET['formfactor']); } - $formfactor = \OC::$session->get('formfactor'); + $formfactor = \OC::$server->getSession()->get('formfactor'); if($formfactor==='default') { $fext=''; }elseif($formfactor==='mobile') { @@ -253,7 +254,7 @@ class OC_Template extends \OC\Template\Base { * Warning: All data passed to $hint needs to get sanitized using OC_Util::sanitizeHTML */ public static function printErrorPage( $error_msg, $hint = '' ) { - $content = new OC_Template( '', 'error', 'error' ); + $content = new \OC_Template( '', 'error', 'error', false ); $errors = array(array('error' => $error_msg, 'hint' => $hint)); $content->assign( 'errors', $errors ); $content->printPage(); @@ -272,19 +273,19 @@ class OC_Template extends \OC\Template\Base { if (defined('DEBUG') and DEBUG) { $hint = $exception->getTraceAsString(); if (!empty($hint)) { - $hint = '<pre>'.$hint.'</pre>'; + $hint = '<pre>'.OC_Util::sanitizeHTML($hint).'</pre>'; } while (method_exists($exception, 'previous') && $exception = $exception->previous()) { $error_msg .= '<br/>Caused by:' . ' '; if ($exception->getCode()) { - $error_msg .= '['.$exception->getCode().'] '; + $error_msg .= '['.OC_Util::sanitizeHTML($exception->getCode()).'] '; } - $error_msg .= $exception->getMessage(); + $error_msg .= OC_Util::sanitizeHTML($exception->getMessage()); }; } else { $hint = ''; if ($exception instanceof \OC\HintException) { - $hint = $exception->getHint(); + $hint = OC_Util::sanitizeHTML($exception->getHint()); } } self::printErrorPage($error_msg, $hint); diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php index 46e48274001..3cbf0d9748f 100644 --- a/lib/private/template/functions.php +++ b/lib/private/template/functions.php @@ -117,7 +117,7 @@ function strip_time($timestamp){ * @return OC_L10N_String timestamp */ function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) { - $l=OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (!isset($fromTime) || $fromTime === null){ $fromTime = time(); } diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php index a5dd9a0c614..b9a97186945 100644 --- a/lib/private/templatelayout.php +++ b/lib/private/templatelayout.php @@ -59,7 +59,9 @@ class OC_TemplateLayout extends OC_Template { $this->assign( 'user_uid', OC_User::getUser() ); $this->assign( 'appsmanagement_active', strpos(OC_Request::requestUri(), OC_Helper::linkToRoute('settings_apps')) === 0 ); $this->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true)); - } else if ($renderas == 'guest' || $renderas == 'error') { + } else if ($renderas == 'error') { + parent::__construct('core', 'layout.guest', '', false); + } else if ($renderas == 'guest') { parent::__construct('core', 'layout.guest'); } else { parent::__construct('core', 'layout.base'); diff --git a/lib/private/user.php b/lib/private/user.php index cdef4d8fe65..c9b1522f85a 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -300,7 +300,7 @@ class OC_User { * Sets user id for session and triggers emit */ public static function setUserId($uid) { - OC::$session->set('user_id', $uid); + \OC::$server->getSession()->set('user_id', $uid); } /** @@ -337,8 +337,8 @@ class OC_User { * Checks if the user is logged in */ public static function isLoggedIn() { - if (\OC::$session->get('user_id') !== null && self::$incognitoMode === false) { - return self::userExists(\OC::$session->get('user_id')); + if (\OC::$server->getSession()->get('user_id') !== null && self::$incognitoMode === false) { + return self::userExists(\OC::$server->getSession()->get('user_id')); } return false; } @@ -386,7 +386,7 @@ class OC_User { * @return string uid or false */ public static function getUser() { - $uid = OC::$session ? OC::$session->get('user_id') : null; + $uid = \OC::$server->getSession() ? \OC::$server->getSession()->get('user_id') : null; if (!is_null($uid) && self::$incognitoMode === false) { return $uid; } else { diff --git a/lib/private/user/database.php b/lib/private/user/database.php index e9844f0f79c..3a76adbe763 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -157,7 +157,7 @@ class OC_User_Database extends OC_User_Backend { $displayNames = array(); $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`' . ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR ' - . 'LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); + . 'LOWER(`uid`) LIKE LOWER(?) ORDER BY `uid` ASC', $limit, $offset); $result = $query->execute(array('%' . $search . '%', '%' . $search . '%')); $users = array(); while ($row = $result->fetchRow()) { @@ -231,7 +231,7 @@ class OC_User_Database extends OC_User_Backend { * Get a list of all users. */ public function getUsers($search = '', $limit = null, $offset = null) { - $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); + $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?) ORDER BY `uid` ASC', $limit, $offset); $result = $query->execute(array('%' . $search . '%')); $users = array(); while ($row = $result->fetchRow()) { diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index a54755e71c5..5c155c27aba 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -237,7 +237,7 @@ class Manager extends PublicEmitter implements IUserManager { * @return bool|\OC\User\User the created user of false */ public function createUser($uid, $password) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); // Check the name for bad characters // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) { diff --git a/lib/private/user/session.php b/lib/private/user/session.php index 6abf8fb80d2..11938db5076 100644 --- a/lib/private/user/session.php +++ b/lib/private/user/session.php @@ -47,10 +47,10 @@ class Session implements IUserSession, Emitter { protected $activeUser; /** - * @param \OC\User\Manager $manager - * @param \OC\Session\Session $session + * @param \OCP\IUserManager $manager + * @param \OCP\ISession $session */ - public function __construct($manager, $session) { + public function __construct(\OCP\IUserManager $manager, \OCP\ISession $session) { $this->manager = $manager; $this->session = $session; } @@ -83,6 +83,44 @@ class Session implements IUserSession, Emitter { } /** + * get the session object + * + * @return \OCP\ISession + */ + public function getSession() { + // fetch the deprecated \OC::$session if it changed for backwards compatibility + if (isset(\OC::$session) && \OC::$session !== $this->session) { + \OC::$server->getLogger()->warning( + 'One of your installed apps still seems to use the deprecated '. + '\OC::$session and has replaced it with a new instance. Please file a bug against it.'. + 'Closing and replacing session in UserSession instance.' + ); + $this->setSession(\OC::$session); + } + return $this->session; + } + + /** + * set the session object + * + * @param \OCP\ISession $session + */ + public function setSession(\OCP\ISession $session) { + if ($this->session instanceof \OCP\ISession) { + $this->session->close(); + } + $this->session = $session; + + // maintain deprecated \OC::$session + if (\OC::$session !== $this->session) { + if (\OC::$session instanceof \OCP\ISession) { + \OC::$session->close(); + } + \OC::$session = $session; + } + } + + /** * set the currently active user * * @param \OC\User\User|null $user diff --git a/lib/private/util.php b/lib/private/util.php index b2a9aecb5d0..8fae5189ca2 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -384,15 +384,15 @@ class OC_Util { * @return string timestamp * @description adjust to clients timezone if we know it */ - public static function formatDate($timestamp, $dateOnly = false) { - if (\OC::$session->exists('timezone')) { + public static function formatDate( $timestamp, $dateOnly = false) { + if(\OC::$server->getSession()->exists('timezone')) { $systemTimeZone = intval(date('O')); $systemTimeZone = (round($systemTimeZone / 100, 0) * 60) + ($systemTimeZone % 100); - $clientTimeZone = \OC::$session->get('timezone') * 60; + $clientTimeZone = \OC::$server->getSession()->get('timezone') * 60; $offset = $clientTimeZone - $systemTimeZone; $timestamp = $timestamp + $offset * 60; } - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); return $l->l($dateOnly ? 'date' : 'datetime', $timestamp); } @@ -402,7 +402,7 @@ class OC_Util { * @return array arrays with error messages and hints */ public static function checkServer() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data'); @@ -412,7 +412,7 @@ class OC_Util { } // Assume that if checkServer() succeeded before in this session, then all is fine. - if (\OC::$session->exists('checkServer_succeeded') && \OC::$session->get('checkServer_succeeded')) { + if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) { return $errors; } @@ -615,7 +615,7 @@ class OC_Util { $errors = array_merge($errors, self::checkDatabaseVersion()); // Cache the result of this function - \OC::$session->set('checkServer_succeeded', count($errors) == 0); + \OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0); return $errors; } @@ -626,7 +626,7 @@ class OC_Util { * @return array errors array */ public static function checkDatabaseVersion() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); $dbType = \OC_Config::getValue('dbtype', 'sqlite'); if ($dbType === 'pgsql') { @@ -707,7 +707,7 @@ class OC_Util { * @return array arrays with error messages and hints */ public static function checkDataDirectoryPermissions($dataDirectory) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); if (self::runningOnWindows()) { //TODO: permissions checks for windows hosts @@ -738,7 +738,7 @@ class OC_Util { * @return bool true if the data directory is valid, false otherwise */ public static function checkDataDirectoryValidity($dataDirectory) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); if (!file_exists($dataDirectory . '/.ocdata')) { $errors[] = array( @@ -938,13 +938,13 @@ class OC_Util { */ public static function callRegister() { // Check if a token exists - if (!\OC::$session->exists('requesttoken')) { + if (!\OC::$server->getSession()->exists('requesttoken')) { // No valid token found, generate a new one. $requestToken = self::generateRandomBytes(20); - \OC::$session->set('requesttoken', $requestToken); + \OC::$server->getSession()->set('requesttoken', $requestToken); } else { // Valid token already exists, send it - $requestToken = \OC::$session->get('requesttoken'); + $requestToken = \OC::$server->getSession()->get('requesttoken'); } return ($requestToken); } diff --git a/lib/public/config.php b/lib/public/config.php index ea3e0c1372a..65dde39cdce 100644 --- a/lib/public/config.php +++ b/lib/public/config.php @@ -43,7 +43,7 @@ class Config { * Gets a value from config.php * @param string $key key * @param mixed $default = null default value - * @return string the value or $default + * @return mixed the value or $default * * This function gets the value from config.php. If it does not exist, * $default will be returned. diff --git a/lib/public/files/locknotacquiredexception.php b/lib/public/files/locknotacquiredexception.php index 9fb70e7cbe2..647b07bf878 100644 --- a/lib/public/files/locknotacquiredexception.php +++ b/lib/public/files/locknotacquiredexception.php @@ -36,7 +36,7 @@ class LockNotAcquiredException extends \Exception { public $lockType; public function __construct($path, $lockType, $code = 0, \Exception $previous = null) { - $message = \OC_L10N::get('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path)); + $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path)); parent::__construct($message, $code, $previous); } @@ -44,4 +44,4 @@ class LockNotAcquiredException extends \Exception { public function __toString() { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; } -}
\ No newline at end of file +} diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php index d4a8cdc7381..4865f8bc85b 100644 --- a/lib/public/iconfig.php +++ b/lib/public/iconfig.php @@ -47,7 +47,7 @@ interface IConfig { * * @param string $key the key of the value, under which it was saved * @param string $default the default value to be returned if the value isn't set - * @return string the saved value + * @return mixed the value or $default */ public function getSystemValue($key, $default = ''); diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 9c39ac7ae73..64f5f350b1e 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -81,9 +81,10 @@ interface IServerContainer { /** * Returns a view to ownCloud's files folder * + * @param string $userId user ID * @return \OCP\Files\Folder */ - function getUserFolder(); + function getUserFolder($userId = null); /** * Returns an app-specific view in ownClouds data directory @@ -145,9 +146,10 @@ interface IServerContainer { /** * get an L10N instance * @param string $app appid + * @param string $lang * @return \OCP\IL10N */ - function getL10N($app); + function getL10N($app, $lang = null); /** * Returns the URL generator diff --git a/lib/public/share.php b/lib/public/share.php index bb9c6ec5886..c8b64cc187c 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -265,8 +265,8 @@ class Share extends \OC\Share\Constants { * * Unsharing from self is not allowed for items inside collections */ - public static function unshareFromSelf($itemType, $itemTarget) { - return \OC\Share\Share::unshareFromSelf($itemType, $itemTarget); + public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) { + return \OC\Share\Share::unshareFromSelf($itemType, $itemOrigin, $originIsSource); } /** diff --git a/lib/public/util.php b/lib/public/util.php index 83a6155685b..2f657facfe8 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -132,7 +132,7 @@ class Util { * @return \OC_L10N */ public static function getL10N($application, $language = null) { - return \OC_L10N::get($application, $language); + return \OC::$server->getL10N($application, $language); } /** |