diff options
author | Andreas Fischer <bantu@owncloud.com> | 2014-04-09 15:20:18 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2014-04-09 15:20:18 +0200 |
commit | 78ee4c1327313a0d2b8153be01cb77770cf90a81 (patch) | |
tree | 1c363c9f4f3422f0a82db6c72c0bd3081606c27b /lib | |
parent | 86ab1cf476ab03d3c3e64ab9603bc1b6a1f27be5 (diff) | |
parent | d8f56e3c00e9cdba37b1155a4314398c7a124103 (diff) | |
download | nextcloud-server-78ee4c1327313a0d2b8153be01cb77770cf90a81.tar.gz nextcloud-server-78ee4c1327313a0d2b8153be01cb77770cf90a81.zip |
Merge remote-tracking branch 'owncloud/master' into db-convert-tool
* owncloud/master: (137 commits)
add comment to clearify when a skip in the foreach happens
remove obsolete code
Always define sendmail_is_available
[tx-robot] updated from transifex
Make hardcoded exception messages translatable
Disable sharing in trashbin app
class Test_Config is already declared
[tx-robot] updated from transifex
using array_key_exists() instead of isset() - required because in case the value is null isset is returning false
fixing undefined exception classes
unit test testSetAppValueIfSetToNull() added
unit tests for dynamic backend registration
ignore underscore.js in scrutinizer.yml
adding ownCloud globals to jshintrc: OC, t, n
Use git checkout on directory as some files may not be in git resulting in, e.g.:
adding underscore.js
reduce code duplication, fix parse error, prevent page reload on hitting enter while changing the display name - refs #8085
translations for oc-dialogs reside in code
Fix copy conflict dialog translation
[tx-robot] updated from transifex
...
Diffstat (limited to 'lib')
46 files changed, 228 insertions, 121 deletions
diff --git a/lib/base.php b/lib/base.php index 15a3ec8bc8a..6ea77aa7a58 100644 --- a/lib/base.php +++ b/lib/base.php @@ -305,6 +305,7 @@ class OC { OC_Util::addScript("jquery.placeholder"); OC_Util::addScript("jquery-tipsy"); OC_Util::addScript("compatibility"); + OC_Util::addScript("underscore"); OC_Util::addScript("jquery.ocdialog"); OC_Util::addScript("oc-dialogs"); OC_Util::addScript("js"); diff --git a/lib/l10n/ast.php b/lib/l10n/ast.php new file mode 100644 index 00000000000..6b76d8126ee --- /dev/null +++ b/lib/l10n/ast.php @@ -0,0 +1,18 @@ +<?php +$TRANSLATIONS = array( +"Personal" => "Personal", +"Settings" => "Axustes", +"Files" => "Ficheros", +"Text" => "Testu", +"seconds ago" => "fai segundos", +"_%n minute ago_::_%n minutes ago_" => array("","fai %n minutos"), +"_%n hour ago_::_%n hours ago_" => array("","fai %n hores"), +"today" => "güei", +"yesterday" => "ayeri", +"_%n day go_::_%n days ago_" => array("","fai %n díes"), +"last month" => "mes caberu", +"_%n month ago_::_%n months ago_" => array("","fai %n meses"), +"last year" => "añu caberu", +"years ago" => "fai años" +); +$PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/lib/l10n/az.php b/lib/l10n/az.php index e7b09649a24..15f78e0bce6 100644 --- a/lib/l10n/az.php +++ b/lib/l10n/az.php @@ -1,8 +1,8 @@ <?php $TRANSLATIONS = array( -"_%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 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("","") ); -$PLURAL_FORMS = "nplurals=1; plural=0;"; +$PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/lib/l10n/el.php b/lib/l10n/el.php index 148b7fc1fe5..a169ae38649 100644 --- a/lib/l10n/el.php +++ b/lib/l10n/el.php @@ -44,7 +44,9 @@ $TRANSLATIONS = array( "DB Error: \"%s\"" => "Σφάλμα Βάσης Δεδομένων: \"%s\"", "Offending command was: \"%s\"" => "Η εντολη παραβατικοτητας ηταν: \"%s\"", "MySQL/MariaDB user '%s'@'localhost' exists already." => "Υπάρχει ήδη ο χρήστης '%s'@'localhost' της MySQL/MariaDB", +"Drop this user from MySQL/MariaDB" => "Κατάργηση του χρήστη από MySQL/MariaDB", "MySQL/MariaDB user '%s'@'%%' already exists" => "Υπάρχει ήδη ο χρήστης '%s'@'%%' της MySQL/MariaDB", +"Drop this user from MySQL/MariaDB." => "Κατάργηση του χρήστη από MySQL/MariaDB.", "Oracle connection could not be established" => "Αδυναμία σύνδεσης Oracle", "Oracle username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της Oracle", "Offending command was: \"%s\", name: %s, password: %s" => "Η εντολη παραβατικοτητας ηταν: \"%s\", ονομα: %s, κωδικος: %s", diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php index f6435320c6c..7d8cc0f4b49 100644 --- a/lib/l10n/et_EE.php +++ b/lib/l10n/et_EE.php @@ -31,6 +31,7 @@ $TRANSLATIONS = array( "Application is not enabled" => "Rakendus pole sisse lülitatud", "Authentication error" => "Autentimise viga", "Token expired. Please reload page." => "Kontrollkood aegus. Paelun lae leht uuesti.", +"Unknown user" => "Tundmatu kasutaja", "Files" => "Failid", "Text" => "Tekst", "Images" => "Pildid", @@ -39,8 +40,13 @@ $TRANSLATIONS = array( "%s you may not use dots in the database name" => "%s punktide kasutamine andmebaasi nimes pole lubatud", "MS SQL username and/or password not valid: %s" => "MS SQL kasutajatunnus ja/või parool pole õiged: %s", "You need to enter either an existing account or the administrator." => "Sisesta kas juba olemasolev konto või administrator.", +"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB kasutajatunnus ja/või parool pole õiged", "DB Error: \"%s\"" => "Andmebaasi viga: \"%s\"", "Offending command was: \"%s\"" => "Tõrkuv käsk oli: \"%s\"", +"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB kasutaja '%s'@'localhost' on juba olemas.", +"Drop this user from MySQL/MariaDB" => "Kustuta see MySQL/MariaDB kasutaja", +"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB user '%s'@'%%' on juba olemas", +"Drop this user from MySQL/MariaDB." => "Kustuta see MySQL/MariaDB kasutaja.", "Oracle connection could not be established" => "Ei suuda luua ühendust Oracle baasiga", "Oracle username and/or password not valid" => "Oracle kasutajatunnus ja/või parool pole õiged", "Offending command was: \"%s\", name: %s, password: %s" => "Tõrkuv käsk oli: \"%s\", nimi: %s, parool: %s", diff --git a/lib/l10n/jv.php b/lib/l10n/jv.php new file mode 100644 index 00000000000..15f78e0bce6 --- /dev/null +++ b/lib/l10n/jv.php @@ -0,0 +1,8 @@ +<?php +$TRANSLATIONS = array( +"_%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("","") +); +$PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/lib/l10n/pl_PL.php b/lib/l10n/pl_PL.php deleted file mode 100644 index 5494e3dab25..00000000000 --- a/lib/l10n/pl_PL.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php -$TRANSLATIONS = array( -"Settings" => "Ustawienia" -); -$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"; diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php index 546e3017978..424f0f5bd8c 100644 --- a/lib/l10n/sk_SK.php +++ b/lib/l10n/sk_SK.php @@ -31,6 +31,7 @@ $TRANSLATIONS = array( "Application is not enabled" => "Aplikácia nie je zapnutá", "Authentication error" => "Chyba autentifikácie", "Token expired. Please reload page." => "Token vypršal. Obnovte, prosím, stránku.", +"Unknown user" => "Neznámy používateľ", "Files" => "Súbory", "Text" => "Text", "Images" => "Obrázky", diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php index a1f371210ac..7053e09624d 100644 --- a/lib/l10n/sv.php +++ b/lib/l10n/sv.php @@ -31,6 +31,7 @@ $TRANSLATIONS = array( "Application is not enabled" => "Applikationen är inte aktiverad", "Authentication error" => "Fel vid autentisering", "Token expired. Please reload page." => "Ogiltig token. Ladda om sidan.", +"Unknown user" => "Okänd användare", "Files" => "Filer", "Text" => "Text", "Images" => "Bilder", @@ -39,8 +40,13 @@ $TRANSLATIONS = array( "%s you may not use dots in the database name" => "%s du får inte använda punkter i databasnamnet", "MS SQL username and/or password not valid: %s" => "MS SQL-användaren och/eller lösenordet var inte giltigt: %s", "You need to enter either an existing account or the administrator." => "Du måste antingen ange ett befintligt konto eller administratör.", +"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB användarnamn och/eller lösenord är felaktigt", "DB Error: \"%s\"" => "DB error: \"%s\"", "Offending command was: \"%s\"" => "Det felaktiga kommandot var: \"%s\"", +"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB användare '%s'@'localhost' existerar redan.", +"Drop this user from MySQL/MariaDB" => "Radera denna användare från MySQL/MariaDB", +"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB användare '%s'@'%%' existerar redan", +"Drop this user from MySQL/MariaDB." => "Radera denna användare från MySQL/MariaDB.", "Oracle connection could not be established" => "Oracle-anslutning kunde inte etableras", "Oracle username and/or password not valid" => "Oracle-användarnamnet och/eller lösenordet är felaktigt", "Offending command was: \"%s\", name: %s, password: %s" => "Det felande kommandot var: \"%s\", name: %s, password: %s", diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php index 2fce8b87bf4..80f1ade9950 100644 --- a/lib/l10n/tr.php +++ b/lib/l10n/tr.php @@ -53,11 +53,11 @@ $TRANSLATIONS = array( "PostgreSQL username and/or password not valid" => "PostgreSQL adi kullanici ve/veya parola yasal degildir. ", "Set an admin username." => "Bir adi kullanici vermek. ", "Set an admin password." => "Parola yonetici birlemek. ", -"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web sunucunuz dosya transferi için düzgün bir şekilde yapılandırılmamış. WevDAV arabirimini sorunlu gözüküyor.", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web sunucunuz dosya aktarımı için düzgün bir şekilde yapılandırılmamış. WevDAV arayüzü sorunlu görünüyor.", "Please double check the <a href='%s'>installation guides</a>." => "Lütfen <a href='%s'>kurulum kılavuzlarını</a> iki kez kontrol edin.", "%s shared »%s« with you" => "%s sizinle »%s« paylaşımında bulundu", "Could not find category \"%s\"" => "\"%s\" kategorisi bulunamadı", -"seconds ago" => "saniye önce", +"seconds ago" => "saniyeler önce", "_%n minute ago_::_%n minutes ago_" => array("","%n dakika önce"), "_%n hour ago_::_%n hours ago_" => array("","%n saat önce"), "today" => "bugün", diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php index cdaaebb87e5..fed6989a438 100644 --- a/lib/private/appconfig.php +++ b/lib/private/appconfig.php @@ -147,7 +147,7 @@ class AppConfig implements \OCP\IAppConfig { */ public function hasKey($app, $key) { $values = $this->getAppValues($app); - return isset($values[$key]); + return array_key_exists($key, $values); } /** @@ -218,8 +218,8 @@ class AppConfig implements \OCP\IAppConfig { /** * get multiply values, either the app or key can be used as wildcard by setting it to false * - * @param boolean $app - * @param string $key + * @param string|false $app + * @param string|false $key * @return array */ public function getValues($app, $key) { diff --git a/lib/private/cache.php b/lib/private/cache.php index a311f10a00f..961270c334c 100644 --- a/lib/private/cache.php +++ b/lib/private/cache.php @@ -97,7 +97,7 @@ class Cache { /** * creates cache key based on the files given - * @param $files + * @param string[] $files * @return string */ static public function generateCacheKeyFromFiles($files) { diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php index be6805a9a57..2fd77c437fe 100644 --- a/lib/private/cache/file.php +++ b/lib/private/cache/file.php @@ -84,11 +84,6 @@ class File { public function hasKey($key) { $storage = $this->getStorage(); if ($storage && $storage->is_file($key)) { - $mtime = $storage->filemtime($key); - if ($mtime < time()) { - $storage->unlink($key); - return false; - } return true; } return false; diff --git a/lib/private/config.php b/lib/private/config.php index 56f47256134..6701ca0532b 100644 --- a/lib/private/config.php +++ b/lib/private/config.php @@ -172,7 +172,7 @@ class Config { $result = @file_put_contents($this->configFilename, $content); if (!$result) { $defaults = new \OC_Defaults; - $url = \OC_Helper::linkToDocs('admin-dir-permissions'); + $url = \OC_Helper::linkToDocs('admin-dir_permissions'); throw new HintException( "Can't write into config directory!", 'This can usually be fixed by ' diff --git a/lib/private/connector/sabre/quotaplugin.php b/lib/private/connector/sabre/quotaplugin.php index 8099794f670..227e684741c 100644 --- a/lib/private/connector/sabre/quotaplugin.php +++ b/lib/private/connector/sabre/quotaplugin.php @@ -56,8 +56,19 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { $uri='/'.$uri; } list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri); + $req = $this->server->httpRequest; + if ($req->getHeader('OC-Chunked')) { + $info = OC_FileChunking::decodeName($newName); + $chunkHandler = new OC_FileChunking($info); + // substract the already uploaded size to see whether + // there is still enough space for the remaining chunks + $length -= $chunkHandler->getCurrentSize(); + } $freeSpace = $this->getFreeSpace($parentUri); if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) { + if (isset($chunkHandler)) { + $chunkHandler->cleanup(); + } throw new Sabre_DAV_Exception_InsufficientStorage(); } } diff --git a/lib/private/contactsmanager.php b/lib/private/contactsmanager.php index fc6745b4505..1cb3da7098f 100644 --- a/lib/private/contactsmanager.php +++ b/lib/private/contactsmanager.php @@ -47,7 +47,7 @@ namespace OC { * This function can be used to delete the contact identified by the given id * * @param object $id the unique identifier to a contact - * @param $address_book_key + * @param string $address_book_key identifier of the address book in which the contact shall be deleted * @return bool successful or not */ public function delete($id, $address_book_key) { @@ -66,7 +66,7 @@ namespace OC { * Otherwise the contact will be updated by replacing the entire data set. * * @param array $properties this array if key-value-pairs defines a contact - * @param $address_book_key string to identify the address book in which the contact shall be created or updated + * @param string $address_book_key identifier of the address book in which the contact shall be created or updated * @return array representing the contact just created or updated */ public function createOrUpdate($properties, $address_book_key) { diff --git a/lib/private/db.php b/lib/private/db.php index 11532d9fa54..f2654522fff 100644 --- a/lib/private/db.php +++ b/lib/private/db.php @@ -256,9 +256,8 @@ class OC_DB { /** * @brief Insert a row if a matching row doesn't exists. - * @param string $table. The table to insert into in the form '*PREFIX*tableName' - * @param array $input. An array of fieldname/value pairs - * @param string $table + * @param string $table The table to insert into in the form '*PREFIX*tableName' + * @param array $input An array of fieldname/value pairs * @return boolean number of updated rows */ public static function insertIfNotExist($table, $input) { diff --git a/lib/private/defaults.php b/lib/private/defaults.php index 79be211b82f..fca798568c5 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -29,8 +29,8 @@ class OC_Defaults { $this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */ $this->defaultName = "ownCloud"; /* short name, used when referring to the software */ $this->defaultTitle = "ownCloud"; /* can be a longer name, for titles */ - $this->defaultBaseUrl = "http://owncloud.org"; - $this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/"; + $this->defaultBaseUrl = "https://owncloud.org"; + $this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/"; $this->defaultDocBaseUrl = "http://doc.owncloud.org"; $this->defaultSlogan = $this->l->t("web services under your control"); $this->defaultLogoClaim = ""; diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php index be7f4e14a11..1da02fc81e3 100644 --- a/lib/private/filechunking.php +++ b/lib/private/filechunking.php @@ -64,20 +64,46 @@ class OC_FileChunking { return $parts == $this->info['chunkcount']; } + /** + * Assembles the chunks into the file specified by the path. + * Chunks are deleted afterwards. + * + * @param string $f target path + * + * @return assembled file size + * + * @throws \OC\InsufficientStorageException when file could not be fully + * assembled due to lack of free space + */ public function assemble($f) { $cache = $this->getCache(); $prefix = $this->getPrefix(); $count = 0; - for($i=0; $i < $this->info['chunkcount']; $i++) { + for ($i = 0; $i < $this->info['chunkcount']; $i++) { $chunk = $cache->get($prefix.$i); + // remove after reading to directly save space + $cache->remove($prefix.$i); $count += fwrite($f, $chunk); } - $this->cleanup(); return $count; } /** + * Returns the size of the chunks already present + * @return size in bytes + */ + public function getCurrentSize() { + $cache = $this->getCache(); + $prefix = $this->getPrefix(); + $total = 0; + for ($i = 0; $i < $this->info['chunkcount']; $i++) { + $total += $cache->size($prefix.$i); + } + return $total; + } + + /** * Removes all chunks which belong to this transmission */ public function cleanup() { @@ -128,7 +154,15 @@ class OC_FileChunking { } /** - * @param string $path + * Assembles the chunks into the file specified by the path. + * Also triggers the relevant hooks and proxies. + * + * @param string $path target path + * + * @return assembled file size or false if file could not be created + * + * @throws \OC\InsufficientStorageException when file could not be fully + * assembled due to lack of free space */ public function file_assemble($path) { $absolutePath = \OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getView()->getAbsolutePath($path)); diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index abc11e76470..1c9de56f8c5 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -594,7 +594,25 @@ class Cache { } /** + * get the path of a file on this storage by it's id + * + * @param int $id + * @return string | null + */ + public function getPathById($id) { + $sql = 'SELECT `path` FROM `*PREFIX*filecache` WHERE `fileid` = ? AND `storage` = ?'; + $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); + if ($row = $result->fetchRow()) { + return $row['path']; + } else { + return null; + } + } + + /** * get the storage id of the storage for a file and the internal path of the file + * unlike getPathById this does not limit the search to files on this storage and + * instead does a global search in the cache table * * @param int $id * @return array, first element holding the storage id, second the path diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 2b697141515..0ce447a5a48 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -118,17 +118,17 @@ abstract class Common implements \OC\Files\Storage\Storage { if (!$handle) { return false; } - $size = $this->filesize($path); - if ($size == 0) { - return ''; - } - return fread($handle, $size); + $data = stream_get_contents($handle); + fclose($handle); + return $data; } public function file_put_contents($path, $data) { $handle = $this->fopen($path, "w"); $this->removeCachedFile($path); - return fwrite($handle, $data); + $count = fwrite($handle, $data); + fclose($handle); + return $count; } public function rename($path1, $path2) { diff --git a/lib/private/files/view.php b/lib/private/files/view.php index f06c2fcd66c..94be7114865 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -832,6 +832,9 @@ class View { $user = \OC_User::getUser(); if (!$cache->inCache($internalPath)) { + if (!$storage->file_exists($internalPath)) { + return false; + } $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); } else { @@ -1129,15 +1132,22 @@ class View { * @return string */ public function getPath($id) { - list($storage, $internalPath) = Cache\Cache::getById($id); - $mounts = Filesystem::getMountByStorageId($storage); + $manager = Filesystem::getMountManager(); + $mounts = $manager->findIn($this->fakeRoot); + $mounts[] = $manager->find($this->fakeRoot); + // reverse the array so we start with the storage this view is in + // which is the most likely to contain the file we're looking for + $mounts = array_reverse($mounts); foreach ($mounts as $mount) { /** - * @var \OC\Files\Mount $mount + * @var \OC\Files\Mount\Mount $mount */ - $fullPath = $mount->getMountPoint() . $internalPath; - if (!is_null($path = $this->getRelativePath($fullPath))) { - return $path; + $cache = $mount->getStorage()->getCache(); + if ($internalPath = $cache->getPathById($id)) { + $fullPath = $mount->getMountPoint() . $internalPath; + if (!is_null($path = $this->getRelativePath($fullPath))) { + return $path; + } } } return null; diff --git a/lib/private/helper.php b/lib/private/helper.php index d7ac0b5f4fa..da3d3cd1c6e 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -875,12 +875,15 @@ class OC_Helper { * Calculate the disc space for the given path * * @param string $path + * @param \OCP\Files\FileInfo $rootInfo (optional) * @return array */ - public static function getStorageInfo($path) { + public static function getStorageInfo($path, $rootInfo = null) { // return storage info without adding mount points - $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); - $used = $rootInfo['size']; + if (is_null($rootInfo)) { + $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); + } + $used = $rootInfo->getSize(); if ($used < 0) { $used = 0; } diff --git a/lib/private/image.php b/lib/private/image.php index c987ce92c3c..f1b8acc41b7 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -34,7 +34,7 @@ class OC_Image { /** * @brief Get mime type for an image file. - * @param string|null $filepath The path to a local image file. + * @param string|null $filePath The path to a local image file. * @return string The mime type if the it could be determined, otherwise an empty string. */ static public function getMimeTypeForFile($filePath) { diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 197b2d6791b..175360e27a3 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -75,7 +75,7 @@ class OC_L10N implements \OCP\IL10N { * get an L10N instance * @param string $app * @param string|null $lang - * @return OC_L10N + * @return \OC_L10N */ public static function get($app, $lang=null) { if (is_null($lang)) { @@ -89,7 +89,6 @@ class OC_L10N implements \OCP\IL10N { * @brief The constructor * @param string $app app requesting l10n * @param string $lang default: null Language - * @returns OC_L10N-Object * * If language is not set, the constructor tries to find the right * language. @@ -352,7 +351,7 @@ class OC_L10N implements \OCP\IL10N { /** * @brief Localization * @param string $type Type of localization - * @param $params parameters for this localization + * @param array $data parameters for this localization * @returns String or false * * Returns the localized data. diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php index b6c3542a673..cb5cef7e350 100644 --- a/lib/private/legacy/appconfig.php +++ b/lib/private/legacy/appconfig.php @@ -116,8 +116,6 @@ class OC_Appconfig { /** * get multiply values, either the app or key can be used as wildcard by setting it to false * - * @param app - * @param key * @param string|false $app * @param string|false $key * @return array diff --git a/lib/private/legacy/config.php b/lib/private/legacy/config.php index ab67c8d3020..6c2103179ab 100644 --- a/lib/private/legacy/config.php +++ b/lib/private/legacy/config.php @@ -63,8 +63,8 @@ class OC_Config { /** * @brief Gets a value from config.php * @param string $key key - * @param string $default = null default value - * @return string the value or $default + * @param mixed $default = null default value + * @return mixed the value or $default * * This function gets the value from config.php. If it does not exist, * $default will be returned. @@ -76,7 +76,7 @@ class OC_Config { /** * @brief Sets a value * @param string $key key - * @param string $value value + * @param mixed $value value * * This function sets the value and writes the config.php. * diff --git a/lib/private/mail.php b/lib/private/mail.php index 79f51609631..f9083cc4e64 100644 --- a/lib/private/mail.php +++ b/lib/private/mail.php @@ -137,6 +137,9 @@ class OC_Mail { * @return string */ public static function buildAsciiEmail($emailAddress) { + if (!function_exists('idn_to_ascii')) { + return $emailAddress; + } list($name, $domain) = explode('@', $emailAddress, 2); $domain = idn_to_ascii($domain); diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php index 06d6a8eb4b0..c8bb9425f1a 100644 --- a/lib/private/ocs/cloud.php +++ b/lib/private/ocs/cloud.php @@ -99,31 +99,4 @@ class OC_OCS_Cloud { ); return new OC_OCS_Result($data); } - - public static function getUserPublickey($parameters) { - - if(OC_User::userExists($parameters['user'])) { - // calculate the disc space - // TODO - return new OC_OCS_Result(array()); - } else { - return new OC_OCS_Result(null, 300); - } - } - - public static function getUserPrivatekey($parameters) { - $user = OC_User::getUser(); - if(OC_User::isAdminUser($user) or ($user==$parameters['user'])) { - - if(OC_User::userExists($user)) { - // calculate the disc space - $txt = 'this is the private key of '.$parameters['user']; - echo($txt); - } else { - return new OC_OCS_Result(null, 300, 'User does not exist'); - } - } else { - return new OC_OCS_Result('null', 300, 'You don´t have permission to access this ressource.'); - } - } } diff --git a/lib/private/request.php b/lib/private/request.php index 8041c4f0048..7cbbb0676b1 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -166,10 +166,11 @@ class OC_Request { */ public static function scriptName() { $name = $_SERVER['SCRIPT_NAME']; - if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) { + $overwriteWebRoot = OC_Config::getValue('overwritewebroot', ''); + if ($overwriteWebRoot !== '' and self::isOverwriteCondition()) { $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -strlen('lib/private/'))); $suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot))); - $name = OC_Config::getValue('overwritewebroot', '') . $suburi; + $name = '/' . ltrim($overwriteWebRoot . $suburi, '/'); } return $name; } diff --git a/lib/private/server.php b/lib/private/server.php index 5c83f3ef495..3517d7b3548 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -302,7 +302,7 @@ class Server extends SimpleContainer implements IServerContainer { /** * get an L10N instance - * @param $app string appid + * @param string $app appid * @return \OC_L10N */ function getL10N($app) { diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index 45734818731..4799db52330 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -30,7 +30,6 @@ class MailNotifications { /** * - * @param string $recipient user id * @param string $sender user id (if nothing is set we use the currently logged-in user) */ public function __construct($sender = null) { diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 8238797600e..7bab98b00bf 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1523,9 +1523,9 @@ class Share extends \OC\Share\Constants { $select = '*'; if ($format == self::FORMAT_STATUSES) { if ($fileDependent) { - $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `share_with`, `uid_owner`'; + $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `share_with`, `uid_owner` , `file_source`'; } else { - $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`'; + $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`'; } } else { if (isset($uidOwner)) { diff --git a/lib/private/template/base.php b/lib/private/template/base.php index 7aa0cb4a956..3d7c685c1cf 100644 --- a/lib/private/template/base.php +++ b/lib/private/template/base.php @@ -77,7 +77,7 @@ class Base { /** * @brief Appends a variable * @param string $key key - * @param string $value value + * @param mixed $value value * @return boolean|null * * This function assigns a variable in an array context. If the key already diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index 0d238737dde..260eeb15108 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -149,6 +149,11 @@ class URLGenerator implements IURLGenerator { public function getAbsoluteURL($url) { $separator = $url[0] === '/' ? '' : '/'; - return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost(). \OC::$WEBROOT . $separator . $url; + // The ownCloud web root can already be prepended. + $webRoot = substr($url, 0, strlen(\OC::$WEBROOT)) === \OC::$WEBROOT + ? '' + : \OC::$WEBROOT; + + return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost(). $webRoot . $separator . $url; } } diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index 8583a451f2d..a2ad9d17702 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -239,24 +239,25 @@ class Manager extends PublicEmitter { * @return bool | \OC\User\User the created user of false */ public function createUser($uid, $password) { + $l = \OC_L10N::get('lib'); // Check the name for bad characters // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) { - throw new \Exception('Only the following characters are allowed in a username:' - . ' "a-z", "A-Z", "0-9", and "_.@-"'); + throw new \Exception($l->t('Only the following characters are allowed in a username:' + . ' "a-z", "A-Z", "0-9", and "_.@-"')); } // No empty username if (trim($uid) == '') { - throw new \Exception('A valid username must be provided'); + throw new \Exception($l->t('A valid username must be provided')); } // No empty password if (trim($password) == '') { - throw new \Exception('A valid password must be provided'); + throw new \Exception($l->t('A valid password must be provided')); } // Check if user already exists if ($this->userExists($uid)) { - throw new \Exception('The username is already being used'); + throw new \Exception($l->t('The username is already being used')); } $this->emit('\OC\User', 'preCreateUser', array($uid, $password)); diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index 7c2219bd046..758f0a80083 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -38,10 +38,10 @@ use OCP\IRequest; abstract class Controller { /** - * app container for dependency injection - * @var \OCP\AppFramework\IAppContainer + * app name + * @var string */ - protected $app; + protected $appName; /** * current request @@ -51,11 +51,11 @@ abstract class Controller { /** * constructor of the controller - * @param IAppContainer $app interface to the app + * @param string $appName the name of the app * @param IRequest $request an instance of the request */ - public function __construct(IAppContainer $app, IRequest $request){ - $this->app = $app; + public function __construct($appName, IRequest $request){ + $this->appName = $appName; $this->request = $request; } @@ -136,7 +136,7 @@ abstract class Controller { */ public function render($templateName, array $params=array(), $renderAs='user', array $headers=array()){ - $response = new TemplateResponse($this->app->getAppName(), $templateName); + $response = new TemplateResponse($this->appName, $templateName); $response->setParams($params); $response->renderAs($renderAs); diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php index b54b23a34e6..6628c4514d9 100644 --- a/lib/public/appframework/http/jsonresponse.php +++ b/lib/public/appframework/http/jsonresponse.php @@ -66,9 +66,12 @@ class JSONResponse extends Response { * Sets values in the data json array * @param array|object $data an array or object which will be transformed * to JSON + * @return JSONResponse Reference to this object */ public function setData($data){ $this->data = $data; + + return $this; } diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php index d223621d4fd..45402d9b3b3 100644 --- a/lib/public/appframework/http/response.php +++ b/lib/public/appframework/http/response.php @@ -80,6 +80,7 @@ class Response { $this->addHeader('Cache-Control', 'no-cache, must-revalidate'); } + return $this; } @@ -88,6 +89,7 @@ class Response { * function * @param string $name The name of the HTTP header * @param string $value The value, null will delete it + * @return Response Reference to this object */ public function addHeader($name, $value) { if(is_null($value)) { @@ -95,6 +97,8 @@ class Response { } else { $this->headers[$name] = $value; } + + return $this; } @@ -130,9 +134,12 @@ class Response { /** * Set response status * @param int $status a HTTP status code, see also the STATUS constants + * @return Response Reference to this object */ public function setStatus($status) { $this->status = $status; + + return $this; } @@ -165,18 +172,24 @@ class Response { /** * Set the ETag * @param string $ETag + * @return Response Reference to this object */ public function setETag($ETag) { $this->ETag = $ETag; + + return $this; } /** * Set "last modified" date * @param \DateTime $lastModified + * @return Response Reference to this object */ public function setLastModified($lastModified) { $this->lastModified = $lastModified; + + return $this; } diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php index 2200a38beca..f5baf788ada 100644 --- a/lib/public/appframework/http/templateresponse.php +++ b/lib/public/appframework/http/templateresponse.php @@ -74,9 +74,12 @@ class TemplateResponse extends Response { * Sets template parameters * @param array $params an array with key => value structure which sets template * variables + * @return TemplateResponse Reference to this object */ public function setParams(array $params){ $this->params = $params; + + return $this; } @@ -104,9 +107,12 @@ class TemplateResponse extends Response { * settings header and footer, user renders the normal * normal page including footer and header and blank * just renders the plain template + * @return TemplateResponse Reference to this object */ public function renderAs($renderAs){ $this->renderAs = $renderAs; + + return $this; } diff --git a/lib/public/config.php b/lib/public/config.php index bb973939f44..8e3791b449b 100644 --- a/lib/public/config.php +++ b/lib/public/config.php @@ -64,7 +64,7 @@ class Config { public static function setSystemValue( $key, $value ) { try { \OC_Config::setValue( $key, $value ); - } catch (Exception $e) { + } catch (\Exception $e) { return false; } return true; @@ -96,7 +96,7 @@ class Config { public static function setAppValue( $app, $key, $value ) { try { \OC_Appconfig::setValue( $app, $key, $value ); - } catch (Exception $e) { + } catch (\Exception $e) { return false; } return true; @@ -131,7 +131,7 @@ class Config { public static function setUserValue( $user, $app, $key, $value ) { try { \OC_Preferences::setValue( $user, $app, $key, $value ); - } catch (Exception $e) { + } catch (\Exception $e) { return false; } return true; diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php index 5b9d64ecc41..005b71f298b 100644 --- a/lib/public/contacts/imanager.php +++ b/lib/public/contacts/imanager.php @@ -96,7 +96,7 @@ namespace OCP\Contacts { * This function can be used to delete the contact identified by the given id * * @param object $id the unique identifier to a contact - * @param $address_book_key + * @param string $address_book_key identifier of the address book in which the contact shall be deleted * @return bool successful or not */ function delete($id, $address_book_key); @@ -106,7 +106,7 @@ namespace OCP\Contacts { * Otherwise the contact will be updated by replacing the entire data set. * * @param array $properties this array if key-value-pairs defines a contact - * @param $address_book_key string to identify the address book in which the contact shall be created or updated + * @param string $address_book_key identifier of the address book in which the contact shall be created or updated * @return array representing the contact just created or updated */ function createOrUpdate($properties, $address_book_key); diff --git a/lib/public/iappconfig.php b/lib/public/iappconfig.php index 1f31898bf2c..2b014df2e42 100644 --- a/lib/public/iappconfig.php +++ b/lib/public/iappconfig.php @@ -55,9 +55,8 @@ interface IAppConfig { /** * get multiply values, either the app or key can be used as wildcard by setting it to false * - * @param app - * @param key - * @param string $key + * @param string|false $key + * @param string|false $app * @return array */ public function getValues($app, $key); diff --git a/lib/public/il10n.php b/lib/public/il10n.php index 1c025e7824f..1388274c21a 100644 --- a/lib/public/il10n.php +++ b/lib/public/il10n.php @@ -23,7 +23,7 @@ namespace OCP; interface IL10N { /** * Translating - * @param $text String The text we need a translation for + * @param string $text The text we need a translation for * @param array $parameters default:array() Parameters for sprintf * @return \OC_L10N_String Translation or the same text * @@ -34,9 +34,9 @@ interface IL10N { /** * Translating - * @param $text_singular String the string to translate for exactly one object - * @param $text_plural String the string to translate for n objects - * @param $count Integer Number of objects + * @param string $text_singular the string to translate for exactly one object + * @param string $text_plural the string to translate for n objects + * @param integer $count Number of objects * @param array $parameters default:array() Parameters for sprintf * @return \OC_L10N_String Translation or the same text * @@ -51,8 +51,8 @@ interface IL10N { /** * Localization - * @param $type Type of localization - * @param $params parameters for this localization + * @param string $type Type of localization + * @param array $data parameters for this localization * @return String or false * * Returns the localized data. diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index dc3aff663d4..600d81d83af 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -122,7 +122,7 @@ interface IServerContainer { /** * get an L10N instance - * @param $app string appid + * @param string $app appid * @return \OCP\IL10N */ function getL10N($app); diff --git a/lib/public/share.php b/lib/public/share.php index a08134b3837..564839e86b6 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -63,9 +63,9 @@ class Share extends \OC\Share\Constants { /** * Find which users can access a shared item - * @param $path to the file - * @param $user owner of the file - * @param include owner to the list of users with access to the file + * @param string $path to the file + * @param string $user owner of the file + * @param bool $includeOwner include owner to the list of users with access to the file * @return array * @note $path needs to be relative to user data dir, e.g. 'file.txt' * not '/admin/data/file.txt' |