diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-03-05 21:54:32 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-03-05 21:54:32 -0500 |
commit | 4dcbaa1d7bf3c94a92ac8a848305913e57a17ec5 (patch) | |
tree | 59113a180157e2037f3c127489e735bba173ccd6 /lib | |
parent | ee0c38bb5112af4aa491b526ca390de52dd3ab7e (diff) | |
parent | c1a32b50735b0a8558823d111e546865ddcba790 (diff) | |
download | nextcloud-server-4dcbaa1d7bf3c94a92ac8a848305913e57a17ec5.tar.gz nextcloud-server-4dcbaa1d7bf3c94a92ac8a848305913e57a17ec5.zip |
Merge branch 'master' into shared-folder-etags
Conflicts:
apps/files_sharing/appinfo/app.php
Diffstat (limited to 'lib')
36 files changed, 150 insertions, 61 deletions
diff --git a/lib/base.php b/lib/base.php index f70496912df..bffae36261e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -539,7 +539,7 @@ class OC { 'setting locale to en_US.UTF-8/en_US.UTF8 failed. Support is probably not installed on your system', OC_Log::ERROR); } - if (OC_Config::getValue('installed', false)) { + if (OC_Config::getValue('installed', false) && !self::checkUpgrade(false)) { if (OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { OC_Util::addScript('backgroundjobs'); } @@ -596,7 +596,9 @@ class OC { if (!self::$CLI) { try { - OC_App::loadApps(); + if (!OC_Config::getValue('maintenance', false)) { + OC_App::loadApps(); + } OC::getRouter()->match(OC_Request::getRawPathInfo()); return; } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) { diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index 01e6e788263..f288919df74 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -313,6 +313,9 @@ class Cache { } $query = \OC_DB::prepare('DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'); $query->execute(array($entry['fileid'])); + + $permissionsCache = new Permissions($this->storageId); + $permissionsCache->remove($entry['fileid']); } /** diff --git a/lib/files/cache/permissions.php b/lib/files/cache/permissions.php index e1735831b94..a5c9c144054 100644 --- a/lib/files/cache/permissions.php +++ b/lib/files/cache/permissions.php @@ -17,10 +17,10 @@ class Permissions { /** * @param \OC\Files\Storage\Storage|string $storage */ - public function __construct($storage){ - if($storage instanceof \OC\Files\Storage\Storage) { + public function __construct($storage) { + if ($storage instanceof \OC\Files\Storage\Storage) { $this->storageId = $storage->getId(); - }else{ + } else { $this->storageId = $storage; } } @@ -52,10 +52,10 @@ class Permissions { public function set($fileId, $user, $permissions) { if (self::get($fileId, $user) !== -1) { $query = \OC_DB::prepare('UPDATE `*PREFIX*permissions` SET `permissions` = ?' - .' WHERE `user` = ? AND `fileid` = ?'); + . ' WHERE `user` = ? AND `fileid` = ?'); } else { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*permissions`(`permissions`, `user`, `fileid`)' - .' VALUES(?, ?,? )'); + . ' VALUES(?, ?,? )'); } $query->execute(array($permissions, $user, $fileId)); } @@ -76,7 +76,7 @@ class Permissions { $inPart = implode(', ', array_fill(0, count($fileIds), '?')); $query = \OC_DB::prepare('SELECT `fileid`, `permissions` FROM `*PREFIX*permissions`' - .' WHERE `fileid` IN (' . $inPart . ') AND `user` = ?'); + . ' WHERE `fileid` IN (' . $inPart . ') AND `user` = ?'); $result = $query->execute($params); $filePermissions = array(); while ($row = $result->fetchRow()) { @@ -91,14 +91,19 @@ class Permissions { * @param int $fileId * @param string $user */ - public function remove($fileId, $user) { - $query = \OC_DB::prepare('DELETE FROM `*PREFIX*permissions` WHERE `fileid` = ? AND `user` = ?'); - $query->execute(array($fileId, $user)); + public function remove($fileId, $user = null) { + if (is_null($user)) { + $query = \OC_DB::prepare('DELETE FROM `*PREFIX*permissions` WHERE `fileid` = ?'); + $query->execute(array($fileId)); + } else { + $query = \OC_DB::prepare('DELETE FROM `*PREFIX*permissions` WHERE `fileid` = ? AND `user` = ?'); + $query->execute(array($fileId, $user)); + } } public function removeMultiple($fileIds, $user) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*permissions` WHERE `fileid` = ? AND `user` = ?'); - foreach($fileIds as $fileId){ + foreach ($fileIds as $fileId) { $query->execute(array($fileId, $user)); } } diff --git a/lib/files/cache/upgrade.php b/lib/files/cache/upgrade.php index 1fe4c584686..811d82d7437 100644 --- a/lib/files/cache/upgrade.php +++ b/lib/files/cache/upgrade.php @@ -64,7 +64,7 @@ class Upgrade { * @param array $data the data for the new cache */ function insert($data) { - if (!$this->inCache($data['storage'], $data['path_hash'])) { + if (!$this->inCache($data['storage'], $data['path_hash'], $data['id'])) { $insertQuery = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` ( `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted` ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); @@ -78,11 +78,12 @@ class Upgrade { /** * @param string $storage * @param string $pathHash + * @param string $id * @return bool */ - function inCache($storage, $pathHash) { - $query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?'); - $result = $query->execute(array($storage, $pathHash)); + function inCache($storage, $pathHash, $id) { + $query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE (`storage` = ? AND `path_hash` = ?) OR `fileid` = ?'); + $result = $query->execute(array($storage, $pathHash, $id)); return (bool)$result->fetchRow(); } diff --git a/lib/files/view.php b/lib/files/view.php index f48d0c8b225..3e2cb080e1d 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -199,7 +199,7 @@ class View { @ob_end_clean(); $handle = $this->fopen($path, 'rb'); if ($handle) { - $chunkSize = 8192; // 8 MB chunks + $chunkSize = 8192; // 8 kB chunks while (!feof($handle)) { echo fread($handle, $chunkSize); flush(); diff --git a/lib/group/backend.php b/lib/group/backend.php index e7b7b21d957..26a784efb28 100644 --- a/lib/group/backend.php +++ b/lib/group/backend.php @@ -142,14 +142,14 @@ abstract class OC_Group_Backend implements OC_Group_Interface { * @param int $offset * @return array with display names (value) and user ids (key) */ - public function DisplayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { - $displayNames = ''; + public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { + $displayNames = array(); $users = $this->usersInGroup($gid, $search, $limit, $offset); - foreach ( $users as $user ) { - $DisplayNames[$user] = $user; + foreach ($users as $user) { + $displayNames[$user] = $user; } - return $DisplayNames; + return $displayNames; } } diff --git a/lib/group/database.php b/lib/group/database.php index 40e9b0d4147..d0974685ff6 100644 --- a/lib/group/database.php +++ b/lib/group/database.php @@ -219,8 +219,8 @@ class OC_Group_Database extends OC_Group_Backend { * @param int $offset * @return array with display names (value) and user ids (key) */ - public function DisplayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { - $displayNames = ''; + public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { + $displayNames = array(); $stmt = OC_DB::prepare('SELECT `*PREFIX*users`.`uid`, `*PREFIX*users`.`displayname`' .' FROM `*PREFIX*users`' diff --git a/lib/image.php b/lib/image.php index 97b0231047b..c1b187608a6 100644 --- a/lib/image.php +++ b/lib/image.php @@ -35,7 +35,13 @@ class OC_Image { * @returns string The mime type if the it could be determined, otherwise an empty string. */ static public function getMimeTypeForFile($filepath) { - $imagetype = exif_imagetype($filepath); + // exif_imagetype throws "read error!" if file is less than 12 byte + if (filesize($filepath) > 11) { + $imagetype = exif_imagetype($filepath); + } + else { + $imagetype = false; + } return $imagetype ? image_type_to_mime_type($imagetype) : ''; } @@ -385,7 +391,8 @@ class OC_Image { * @returns An image resource or false on error */ public function loadFromFile($imagepath=false) { - if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) { + // exif_imagetype throws "read error!" if file is less than 12 byte + if(!is_file($imagepath) || !file_exists($imagepath) || filesize($imagepath) < 12 || !is_readable($imagepath)) { // Debug output disabled because this method is tried before loadFromBase64? OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagepath, OC_Log::DEBUG); return false; diff --git a/lib/l10n/bg_BG.php b/lib/l10n/bg_BG.php index d80e03608a2..d32e2aadfc5 100644 --- a/lib/l10n/bg_BG.php +++ b/lib/l10n/bg_BG.php @@ -21,6 +21,18 @@ "Specify a data folder." => "Укажете папка за данни", "%s enter the database username." => "%s въведете потребителско име за базата с данни.", "%s enter the database name." => "%s въведете име на базата с данни.", +"%s you may not use dots in the database name" => "%s, не можете да ползвате точки в името на базата от данни", +"PostgreSQL username and/or password not valid" => "Невалидно PostgreSQL потребителско име и/или парола", +"You need to enter either an existing account or the administrator." => "Необходимо е да влезете в всъществуващ акаунт или като администратора", +"Oracle username and/or password not valid" => "Невалидно Oracle потребителско име и/или парола", +"MySQL username and/or password not valid" => "Невалидно MySQL потребителско име и/или парола", +"DB Error: \"%s\"" => "Грешка в базата от данни: \"%s\"", +"MySQL user '%s'@'localhost' exists already." => "MySQL потребителят '%s'@'localhost' вече съществува", +"Drop this user from MySQL" => "Изтриване на потребителя от MySQL", +"MySQL user '%s'@'%%' already exists" => "MySQL потребителят '%s'@'%%' вече съществува.", +"Drop this user from MySQL." => "Изтриване на потребителя от MySQL.", +"MS SQL username and/or password not valid: %s" => "Невалидно MS SQL потребителско име и/или парола: %s", +"Please double check the <a href='%s'>installation guides</a>." => "Моля направете повторна справка с <a href='%s'>ръководството за инсталиране</a>.", "seconds ago" => "преди секунди", "1 minute ago" => "преди 1 минута", "%d minutes ago" => "преди %d минути", diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php index 3e3938aa6cb..108bb5c09be 100644 --- a/lib/l10n/ca.php +++ b/lib/l10n/ca.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "L'usuari MySQL '%s'@'%%' ja existeix", "Drop this user from MySQL." => "Elimina aquest usuari de MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "L'ordre en conflicte és: \"%s\", nom: %s, contrasenya: %s", +"MS SQL username and/or password not valid: %s" => "Nom d'usuari i/o contrasenya MS SQL no vàlids: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "El servidor web no està configurat correctament per permetre la sincronització de fitxers perquè la interfície WebDAV sembla no funcionar correctament.", "Please double check the <a href='%s'>installation guides</a>." => "Comproveu les <a href='%s'>guies d'instal·lació</a>.", "seconds ago" => "segons enrere", diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php index d99f259cb0f..d9ec3d82cf7 100644 --- a/lib/l10n/cs_CZ.php +++ b/lib/l10n/cs_CZ.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Uživatel '%s'@'%%' již v MySQL existuje", "Drop this user from MySQL." => "Zahodit uživatele z MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Podezřelý příkaz byl: \"%s\", jméno: %s, heslo: %s", +"MS SQL username and/or password not valid: %s" => "Uživatelské jméno, či heslo MSSQL není platné: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server není správně nastaven pro umožnění synchronizace, protože rozhraní WebDAV je rozbité.", "Please double check the <a href='%s'>installation guides</a>." => "Zkonzultujte, prosím, <a href='%s'>průvodce instalací</a>.", "seconds ago" => "před vteřinami", diff --git a/lib/l10n/da.php b/lib/l10n/da.php index e61fba30ff3..38ccbbe8e21 100644 --- a/lib/l10n/da.php +++ b/lib/l10n/da.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQL brugeren '%s'@'%%' eksisterer allerede.", "Drop this user from MySQL." => "Slet denne bruger fra MySQL", "Offending command was: \"%s\", name: %s, password: %s" => "Fejlende kommando var: \"%s\", navn: %s, password: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL brugernavn og/eller adgangskode ikke er gyldigt: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Din webserver er endnu ikke sat op til at tillade fil synkronisering fordi WebDAV grænsefladen virker ødelagt.", "Please double check the <a href='%s'>installation guides</a>." => "Dobbelttjek venligst <a href='%s'>installations vejledningerne</a>.", "seconds ago" => "sekunder siden", diff --git a/lib/l10n/de.php b/lib/l10n/de.php index 87b0b29469c..3c2069d4637 100644 --- a/lib/l10n/de.php +++ b/lib/l10n/de.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQL Benutzer '%s'@'%%' existiert bereits", "Drop this user from MySQL." => "Lösche diesen Benutzer aus MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Fehlerhafter Befehl war: \"%s\", Name: %s, Passwort: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL Benutzername und/oder Password ungültig: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Dein Web-Server ist noch nicht für Datei-Synchronisation bereit, weil die WebDAV-Schnittstelle vermutlich defekt ist.", "Please double check the <a href='%s'>installation guides</a>." => "Bitte prüfe die <a href='%s'>Instalationsanleitungen</a>.", "seconds ago" => "Gerade eben", diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php index d04c691f7ec..9978cdf8b31 100644 --- a/lib/l10n/de_DE.php +++ b/lib/l10n/de_DE.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQL Benutzer '%s'@'%%' existiert bereits", "Drop this user from MySQL." => "Lösche diesen Benutzer aus MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Fehlerhafter Befehl war: \"%s\", Name: %s, Passwort: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL Benutzername und/oder Passwort ungültig: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ihr Web-Server ist noch nicht für Datei-Synchronisation bereit, weil die WebDAV-Schnittstelle vermutlich defekt ist.", "Please double check the <a href='%s'>installation guides</a>." => "Bitte prüfen Sie die <a href='%s'>Instalationsanleitungen</a>.", "seconds ago" => "Gerade eben", diff --git a/lib/l10n/es.php b/lib/l10n/es.php index 3ee3ce2811b..37b15a375c4 100644 --- a/lib/l10n/es.php +++ b/lib/l10n/es.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Usuario MySQL '%s'@'%%' ya existe", "Drop this user from MySQL." => "Eliminar este usuario de MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Comando infractor: \"%s\", nombre: %s, contraseña: %s", +"MS SQL username and/or password not valid: %s" => "Usuario y/o contraseña de MS SQL no válidos: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Su servidor web aún no está configurado adecuadamente para permitir sincronización de archivos ya que la interfaz WebDAV parece no estar funcionando.", "Please double check the <a href='%s'>installation guides</a>." => "Por favor, vuelva a comprobar las <a href='%s'>guías de instalación</a>.", "seconds ago" => "hace segundos", diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php index 97eb6511198..36eb397e425 100644 --- a/lib/l10n/eu.php +++ b/lib/l10n/eu.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQL '%s'@'%%' erabiltzailea dagoeneko existitzen da", "Drop this user from MySQL." => "Ezabatu erabiltzaile hau MySQLtik.", "Offending command was: \"%s\", name: %s, password: %s" => "Errorea komando honek sortu du: \"%s\", izena: %s, pasahitza: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL erabiltzaile izena edota pasahitza ez dira egokiak: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Zure web zerbitzaria ez dago oraindik ongi konfiguratuta fitxategien sinkronizazioa egiteko, WebDAV interfazea ongi ez dagoela dirudi.", "Please double check the <a href='%s'>installation guides</a>." => "Mesedez begiratu <a href='%s'>instalazio gidak</a>.", "seconds ago" => "orain dela segundu batzuk", diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php index c3ff3e9a2bf..89a584d389d 100644 --- a/lib/l10n/fi_FI.php +++ b/lib/l10n/fi_FI.php @@ -19,12 +19,16 @@ "Set an admin username." => "Aseta ylläpitäjän käyttäjätunnus.", "Set an admin password." => "Aseta ylläpitäjän salasana.", "Specify a data folder." => "Määritä datakansio.", +"%s enter the database username." => "%s anna tietokannan käyttäjätunnus.", +"%s enter the database name." => "%s anna tietokannan nimi.", +"%s you may not use dots in the database name" => "%s et voi käyttää pisteitä tietokannan nimessä", "PostgreSQL username and/or password not valid" => "PostgreSQL:n käyttäjätunnus ja/tai salasana on väärin", "Oracle username and/or password not valid" => "Oraclen käyttäjätunnus ja/tai salasana on väärin", "MySQL username and/or password not valid" => "MySQL:n käyttäjätunnus ja/tai salasana on väärin", "DB Error: \"%s\"" => "Tietokantavirhe: \"%s\"", "MySQL user '%s'@'localhost' exists already." => "MySQL-käyttäjä '%s'@'localhost' on jo olemassa.", "MySQL user '%s'@'%%' already exists" => "MySQL-käyttäjä '%s'@'%%' on jo olemassa", +"MS SQL username and/or password not valid: %s" => "MS SQL -käyttäjätunnus ja/tai -salasana on väärin: %s", "Please double check the <a href='%s'>installation guides</a>." => "Lue tarkasti <a href='%s'>asennusohjeet</a>.", "seconds ago" => "sekuntia sitten", "1 minute ago" => "1 minuutti sitten", diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php index 9673bb65fc1..a11724fef43 100644 --- a/lib/l10n/gl.php +++ b/lib/l10n/gl.php @@ -23,10 +23,10 @@ "%s enter the database name." => "%s introduza o nome da base de datos", "%s you may not use dots in the database name" => "%s non se poden empregar puntos na base de datos", "%s set the database host." => "%s estabeleza o servidor da base de datos", -"PostgreSQL username and/or password not valid" => "Nome de usuario e/ou contrasinal PostgreSQL incorrecto", +"PostgreSQL username and/or password not valid" => "Nome de usuario e/ou contrasinal de PostgreSQL incorrecto", "You need to enter either an existing account or the administrator." => "Deberá introducir unha conta existente ou o administrador.", -"Oracle username and/or password not valid" => "Nome de usuario e/ou contrasinal Oracle incorrecto", -"MySQL username and/or password not valid" => "Nome de usuario e/ou contrasinal MySQL incorrecto", +"Oracle username and/or password not valid" => "Nome de usuario e/ou contrasinal de Oracle incorrecto", +"MySQL username and/or password not valid" => "Nome de usuario e/ou contrasinal de MySQL incorrecto", "DB Error: \"%s\"" => "Produciuse un erro na base de datos: «%s»", "Offending command was: \"%s\"" => "A orde ofensiva foi: «%s»", "MySQL user '%s'@'localhost' exists already." => "O usuario MySQL '%s'@'localhost' xa existe.", @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "O usuario MySQL «%s»@«%%» xa existe.", "Drop this user from MySQL." => "Omitir este usuario de MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "A orde ofensiva foi: «%s», nome: %s, contrasinal: %s", +"MS SQL username and/or password not valid: %s" => "Nome de usuario e/ou contrasinal de MS SQL incorrecto: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web non está aínda configurado adecuadamente para permitir a sincronización de ficheiros xa que semella que a interface WebDAV non está a funcionar.", "Please double check the <a href='%s'>installation guides</a>." => "Volva comprobar as <a href='%s'>guías de instalación</a>", "seconds ago" => "segundos atrás", diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php index d1aeb621e23..537066c6fea 100644 --- a/lib/l10n/hu_HU.php +++ b/lib/l10n/hu_HU.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "A '%s'@'%%' MySQL felhasználó már létezik", "Drop this user from MySQL." => "Törölje ezt a felhasználót a MySQL-ből.", "Offending command was: \"%s\", name: %s, password: %s" => "A hibát okozó parancs ez volt: \"%s\", login név: %s, jelszó: %s", +"MS SQL username and/or password not valid: %s" => "Az MS SQL felhasználónév és/vagy jelszó érvénytelen: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Az Ön webkiszolgálója nincs megfelelően beállítva az állományok szinkronizálásához, mert a WebDAV-elérés úgy tűnik, nem működik.", "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>.", "seconds ago" => "másodperce", diff --git a/lib/l10n/ja_JP.php b/lib/l10n/ja_JP.php index 51b5b40940a..529eec3ac52 100644 --- a/lib/l10n/ja_JP.php +++ b/lib/l10n/ja_JP.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQLのユーザ '%s'@'%%' はすでに存在します。", "Drop this user from MySQL." => "MySQLからこのユーザを削除する。", "Offending command was: \"%s\", name: %s, password: %s" => "違反コマンド: \"%s\"、名前: %s、パスワード: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL サーバーのユーザー名/パスワードが正しくありません: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "WebDAVインタフェースが動作していないと考えられるため、あなたのWEBサーバはまだファイルの同期を許可するように適切な設定がされていません。", "Please double check the <a href='%s'>installation guides</a>." => "<a href='%s'>インストールガイド</a>をよく確認してください。", "seconds ago" => "秒前", diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php index 5ec9ddd9693..c73d306ca0a 100644 --- a/lib/l10n/lv.php +++ b/lib/l10n/lv.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQL lietotājs '%s'@'%%' jau eksistē", "Drop this user from MySQL." => "Izmest šo lietotāju no MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Vainīgā komanda bija \"%s\", vārds: %s, parole: %s", +"MS SQL username and/or password not valid: %s" => "Nav derīga MySQL parole un/vai lietotājvārds — %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Jūsu serveris vēl nav pareizi iestatīts, lai ļautu sinhronizēt datnes, jo izskatās, ka WebDAV saskarne ir salauzta.", "Please double check the <a href='%s'>installation guides</a>." => "Lūdzu, vēlreiz pārbaudiet <a href='%s'>instalēšanas palīdzību</a>.", "seconds ago" => "sekundes atpakaļ", diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php index 4a357889fdc..e26a663e9cc 100644 --- a/lib/l10n/nl.php +++ b/lib/l10n/nl.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "MySQL gebruiker '%s'@'%%' bestaat al", "Drop this user from MySQL." => "Verwijder deze gebruiker uit MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Onjuiste commando was: \"%s\", naam: %s, wachtwoord: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL gebruikersnaam en/of wachtwoord niet geldig: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Uw webserver is nog niet goed ingesteld voor bestandssynchronisatie omdat de WebDAV interface verbroken lijkt.", "Please double check the <a href='%s'>installation guides</a>." => "Conntroleer de <a href='%s'>installatie handleiding</a> goed.", "seconds ago" => "seconden geleden", diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php index da924cf4d12..9a1a5e836c9 100644 --- a/lib/l10n/pl.php +++ b/lib/l10n/pl.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Użytkownik MySQL '%s'@'%%t' już istnieje", "Drop this user from MySQL." => "Usuń tego użytkownika z MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Niepoprawne polecania: \"%s\", nazwa: %s, hasło: %s", +"MS SQL username and/or password not valid: %s" => "Nazwa i/lub hasło serwera MS SQL jest niepoprawne: %s.", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serwer www nie jest jeszcze poprawnie ustawiony, aby umożliwić synchronizację plików, ponieważ interfejs WebDAV wydaje się być uszkodzony. Sprawdź ustawienia serwera.", "Please double check the <a href='%s'>installation guides</a>." => "Proszę sprawdź ponownie <a href='%s'>przewodnik instalacji</a>.", "seconds ago" => "sekund temu", diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php index 25645b1dcd9..d4f410d8885 100644 --- a/lib/l10n/pt_BR.php +++ b/lib/l10n/pt_BR.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Usuário MySQL '%s'@'%%' já existe", "Drop this user from MySQL." => "Derrube este usuário do MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Comando ofensivo era: \"%s\", nome: %s, senha: %s", +"MS SQL username and/or password not valid: %s" => "Nome de usuário e/ou senha MS SQL inválido(s): %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Seu servidor web não está configurado corretamente para permitir sincronização de arquivos porque a interface WebDAV parece estar quebrada.", "Please double check the <a href='%s'>installation guides</a>." => "Por favor, confira os <a href='%s'>guias de instalação</a>.", "seconds ago" => "segundos atrás", diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php index 9bdcfcc9ced..2c813f5b07c 100644 --- a/lib/l10n/pt_PT.php +++ b/lib/l10n/pt_PT.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "O utilizador '%s'@'%%' do MySQL já existe", "Drop this user from MySQL." => "Eliminar este utilizador do MySQL", "Offending command was: \"%s\", name: %s, password: %s" => "O comando gerador de erro foi: \"%s\", nome: %s, password: %s", +"MS SQL username and/or password not valid: %s" => "Nome de utilizador/password do MySQL é inválido: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web não está configurado correctamente para autorizar sincronização de ficheiros, pois o interface WebDAV parece estar com problemas.", "Please double check the <a href='%s'>installation guides</a>." => "Por favor verifique <a href='%s'>installation guides</a>.", "seconds ago" => "há alguns segundos", diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php index 7f1111376ef..25a88d5efc2 100644 --- a/lib/l10n/ru.php +++ b/lib/l10n/ru.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Пользователь MySQL '%s'@'%%' уже существует", "Drop this user from MySQL." => "Удалить этого пользователя из MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Вызываемая команда была: \"%s\", имя: %s, пароль: %s", +"MS SQL username and/or password not valid: %s" => "Имя пользователя и/или пароль MS SQL не подходит: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ваш веб сервер до сих пор не настроен правильно для возможности синхронизации файлов, похоже что проблема в неисправности интерфейса WebDAV.", "Please double check the <a href='%s'>installation guides</a>." => "Пожалуйста, дважды просмотрите <a href='%s'>инструкции по установке</a>.", "seconds ago" => "менее минуты", diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php index 97a4999407f..8c9ce61622c 100644 --- a/lib/l10n/sk_SK.php +++ b/lib/l10n/sk_SK.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Používateľ '%s'@'%%' už v MySQL existuje", "Drop this user from MySQL." => "Zahodiť používateľa z MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Podozrivý príkaz bol: \"%s\", meno: %s, heslo: %s", +"MS SQL username and/or password not valid: %s" => "Používateľské meno, alebo heslo MS SQL nie je platné: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server nie je správne nastavený na synchronizáciu, pretože rozhranie WebDAV je poškodené.", "Please double check the <a href='%s'>installation guides</a>." => "Prosím skontrolujte <a href='%s'>inštalačnú príručku</a>.", "seconds ago" => "pred sekundami", diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php index 415c0a80c27..68f7151d15e 100644 --- a/lib/l10n/uk.php +++ b/lib/l10n/uk.php @@ -34,6 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Користувач MySQL '%s'@'%%' вже існує", "Drop this user from MySQL." => "Видалити цього користувача з MySQL.", "Offending command was: \"%s\", name: %s, password: %s" => "Команда, що викликала проблему: \"%s\", ім'я: %s, пароль: %s", +"MS SQL username and/or password not valid: %s" => "MS SQL ім'я користувача та/або пароль не дійсні: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ваш Web-сервер ще не налаштований належним чином для того, щоб дозволити синхронізацію файлів, через те що інтерфейс WebDAV, здається, зламаний.", "Please double check the <a href='%s'>installation guides</a>." => "Будь ласка, перевірте <a href='%s'>інструкції по встановленню</a>.", "seconds ago" => "секунди тому", diff --git a/lib/mail.php b/lib/mail.php index 22194045a76..61634632efc 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -119,4 +119,12 @@ class OC_Mail { return($txt); } + + /** + * @param string $emailAddress a given email address to be validated + * @return bool + */ + public static function ValidateAddress($emailAddress) { + return PHPMailer::ValidateAddress($emailAddress); + } } diff --git a/lib/public/share.php b/lib/public/share.php index eadf24b14eb..57fcd936ac6 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -61,6 +61,7 @@ class Share { private static $shareTypeGroupUserUnique = 2; private static $backends = array(); private static $backendTypes = array(); + private static $isResharingAllowed; /** * @brief Register a sharing backend class that implements OCP\Share_Backend for an item type @@ -591,6 +592,24 @@ class Share { } /** + * @brief Check if resharing is allowed + * @return Returns true if allowed or false + * + * Resharing is allowed by default if not configured + * + */ + private static function isResharingAllowed() { + if (!isset(self::$isResharingAllowed)) { + if (\OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') { + self::$isResharingAllowed = true; + } else { + self::$isResharingAllowed = false; + } + } + return self::$isResharingAllowed; + } + + /** * @brief Get a list of collection item types for the specified item type * @param string Item type * @return array @@ -863,7 +882,10 @@ class Share { continue; } } - + // Check if resharing is allowed, if not remove share permission + if (isset($row['permissions']) && !self::isResharingAllowed()) { + $row['permissions'] &= ~PERMISSION_SHARE; + } // Add display names to result if ( isset($row['share_with']) && $row['share_with'] != '') { $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']); @@ -1001,7 +1023,7 @@ class Share { throw new \Exception($message); } // Check if share permissions is granted - if ((int)$checkReshare['permissions'] & PERMISSION_SHARE) { + if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & PERMISSION_SHARE) { if (~(int)$checkReshare['permissions'] & $permissions) { $message = 'Sharing '.$itemSource .' failed, because the permissions exceed permissions granted to '.$uidOwner; diff --git a/lib/public/util.php b/lib/public/util.php index 13498b260ef..db07cbcfff3 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -217,11 +217,14 @@ class Util { */ public static function getDefaultEmailAddress($user_part) { $host_name = self::getServerHostName(); - // handle localhost installations - if ($host_name === 'localhost') { - $host_name = "example.com"; + $defaultEmailAddress = $user_part.'@'.$host_name; + + if (\OC_Mail::ValidateAddress($defaultEmailAddress)) { + return $defaultEmailAddress; } - return $user_part.'@'.$host_name; + + // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain' + return $user_part.'@localhost.localdomain'; } /** diff --git a/lib/setup.php b/lib/setup.php index 8f772e663e2..8814447f52f 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -851,7 +851,7 @@ class OC_Setup { 'http://doc.owncloud.org/server/5.0/admin_manual/installation.html'); $tmpl = new OC_Template('', 'error', 'guest'); - $tmpl->assign('errors', array(1 => array('error' => $error, 'hint' => $hint)), false); + $tmpl->assign('errors', array(1 => array('error' => $error, 'hint' => $hint))); $tmpl->printPage(); exit(); } diff --git a/lib/template.php b/lib/template.php index ce55e58d28d..398f9de0655 100644 --- a/lib/template.php +++ b/lib/template.php @@ -147,7 +147,7 @@ function html_select_options($options, $selected, $params=array()) { $label = $label[$label_name]; } $select = in_array($value, $selected) ? ' selected="selected"' : ''; - $html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>'."\n"; + $html .= '<option value="' . OC_Util::sanitizeHTML($value) . '"' . $select . '>' . OC_Util::sanitizeHTML($label) . '</option>'."\n"; } return $html; } @@ -200,7 +200,6 @@ class OC_Template{ .'img-src *; ' .'font-src \'self\' data:'); header('Content-Security-Policy:'.$policy); // Standard - header('X-WebKit-CSP:'.$policy); // Older webkit browsers $this->findTemplate($name); } @@ -341,7 +340,6 @@ class OC_Template{ * @brief Assign variables * @param string $key key * @param string $value value - * @param bool $sanitizeHTML false, if data shouldn't get passed through htmlentities * @return bool * * This function assigns a variable. It can be accessed via $_[$key] in @@ -349,8 +347,7 @@ class OC_Template{ * * If the key existed before, it will be overwritten */ - public function assign( $key, $value, $sanitizeHTML=true ) { - if($sanitizeHTML == true) $value=OC_Util::sanitizeHTML($value); + public function assign( $key, $value) { $this->vars[$key] = $value; return true; } @@ -484,7 +481,7 @@ class OC_Template{ public static function printUserPage( $application, $name, $parameters = array() ) { $content = new OC_Template( $application, $name, "user" ); foreach( $parameters as $key => $value ) { - $content->assign( $key, $value, false ); + $content->assign( $key, $value ); } print $content->printPage(); } @@ -499,7 +496,7 @@ class OC_Template{ public static function printAdminPage( $application, $name, $parameters = array() ) { $content = new OC_Template( $application, $name, "admin" ); foreach( $parameters as $key => $value ) { - $content->assign( $key, $value, false ); + $content->assign( $key, $value ); } return $content->printPage(); } @@ -514,7 +511,7 @@ class OC_Template{ public static function printGuestPage( $application, $name, $parameters = array() ) { $content = new OC_Template( $application, $name, "guest" ); foreach( $parameters as $key => $value ) { - $content->assign( $key, $value, false ); + $content->assign( $key, $value ); } return $content->printPage(); } diff --git a/lib/templatelayout.php b/lib/templatelayout.php index afa875b0a6d..29f120a6041 100644 --- a/lib/templatelayout.php +++ b/lib/templatelayout.php @@ -13,24 +13,25 @@ class OC_TemplateLayout extends OC_Template { if( $renderas == 'user' ) { parent::__construct( 'core', 'layout.user' ); if(in_array(OC_APP::getCurrentApp(), array('settings','admin', 'help'))!==false) { - $this->assign('bodyid', 'body-settings', false); + $this->assign('bodyid', 'body-settings'); }else{ - $this->assign('bodyid', 'body-user', false); + $this->assign('bodyid', 'body-user'); } // Add navigation entry $this->assign( 'application', '', false ); $navigation = OC_App::getNavigation(); - $this->assign( 'navigation', $navigation, false); - $this->assign( 'settingsnavigation', OC_App::getSettingsNavigation(), false); + $this->assign( 'navigation', $navigation); + $this->assign( 'settingsnavigation', OC_App::getSettingsNavigation()); foreach($navigation as $entry) { if ($entry['active']) { - $this->assign( 'application', $entry['name'], false ); + $this->assign( 'application', $entry['name'] ); break; } } $user_displayname = OC_User::getDisplayName(); $this->assign( 'user_displayname', $user_displayname ); + $this->assign( 'user_uid', OC_User::getUser() ); } else if ($renderas == 'guest' || $renderas == 'error') { parent::__construct('core', 'layout.guest'); } else { diff --git a/lib/util.php b/lib/util.php index 2e32ee2e3c2..c7916b9e774 100755 --- a/lib/util.php +++ b/lib/util.php @@ -75,7 +75,7 @@ class OC_Util { public static function getVersion() { // hint: We only can count up. Reset minor/patchlevel when // updating major/minor version number. - return array(4, 94, 10); + return array(4, 96, 10); } /** @@ -83,7 +83,7 @@ class OC_Util { * @return string */ public static function getVersionString() { - return '5.0 beta 2'; + return '5.0 RC 2'; } /** @@ -323,14 +323,14 @@ class OC_Util { $parameters[$value] = true; } if (!empty($_POST['user'])) { - $parameters["username"] = OC_Util::sanitizeHTML($_POST['user']).'"'; + $parameters["username"] = $_POST['user']; $parameters['user_autofocus'] = false; } else { $parameters["username"] = ''; $parameters['user_autofocus'] = true; } if (isset($_REQUEST['redirect_url'])) { - $redirect_url = OC_Util::sanitizeHTML($_REQUEST['redirect_url']); + $redirect_url = $_REQUEST['redirect_url']; $parameters['redirect_url'] = urlencode($redirect_url); } @@ -464,13 +464,17 @@ class OC_Util { * @see OC_Util::callRegister() */ public static function isCallRegistered() { + if(!isset($_SESSION['requesttoken'])) { + return false; + } + if(isset($_GET['requesttoken'])) { $token=$_GET['requesttoken']; - }elseif(isset($_POST['requesttoken'])) { + } elseif(isset($_POST['requesttoken'])) { $token=$_POST['requesttoken']; - }elseif(isset($_SERVER['HTTP_REQUESTTOKEN'])) { + } elseif(isset($_SERVER['HTTP_REQUESTTOKEN'])) { $token=$_SERVER['HTTP_REQUESTTOKEN']; - }else{ + } else { //no token found. return false; } @@ -577,6 +581,9 @@ class OC_Util { $client = new \Sabre_DAV_Client($settings); + // for this self test we don't care if the ssl certificate is self signed and the peer cannot be verified. + $client->setVerifyPeer(false); + $return = true; try { // test PROPFIND diff --git a/lib/vcategories.php b/lib/vcategories.php index f94a0a55d3b..2f990c5d2d2 100644 --- a/lib/vcategories.php +++ b/lib/vcategories.php @@ -348,12 +348,11 @@ class OC_VCategories { self::$relations[] = array('objid' => $id, 'category' => $name); } } - if(count($newones) > 0) { - $this->categories = array_merge($this->categories, $newones); - if($sync === true) { - $this->save(); - } + $this->categories = array_merge($this->categories, $newones); + if($sync === true) { + $this->save(); } + return true; } |