summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2014-04-09 15:20:18 +0200
committerAndreas Fischer <bantu@owncloud.com>2014-04-09 15:20:18 +0200
commit78ee4c1327313a0d2b8153be01cb77770cf90a81 (patch)
tree1c363c9f4f3422f0a82db6c72c0bd3081606c27b /lib/private
parent86ab1cf476ab03d3c3e64ab9603bc1b6a1f27be5 (diff)
parentd8f56e3c00e9cdba37b1155a4314398c7a124103 (diff)
downloadnextcloud-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/private')
-rw-r--r--lib/private/appconfig.php6
-rw-r--r--lib/private/cache.php2
-rw-r--r--lib/private/cache/file.php5
-rw-r--r--lib/private/config.php2
-rw-r--r--lib/private/connector/sabre/quotaplugin.php11
-rw-r--r--lib/private/contactsmanager.php4
-rw-r--r--lib/private/db.php5
-rw-r--r--lib/private/defaults.php4
-rw-r--r--lib/private/filechunking.php40
-rw-r--r--lib/private/files/cache/cache.php18
-rw-r--r--lib/private/files/storage/common.php12
-rw-r--r--lib/private/files/view.php22
-rw-r--r--lib/private/helper.php9
-rw-r--r--lib/private/image.php2
-rw-r--r--lib/private/l10n.php5
-rw-r--r--lib/private/legacy/appconfig.php2
-rw-r--r--lib/private/legacy/config.php6
-rw-r--r--lib/private/mail.php3
-rw-r--r--lib/private/ocs/cloud.php27
-rwxr-xr-xlib/private/request.php5
-rw-r--r--lib/private/server.php2
-rw-r--r--lib/private/share/mailnotifications.php1
-rw-r--r--lib/private/share/share.php4
-rw-r--r--lib/private/template/base.php2
-rw-r--r--lib/private/urlgenerator.php7
-rw-r--r--lib/private/user/manager.php11
26 files changed, 133 insertions, 84 deletions
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));