diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 16 | ||||
-rw-r--r-- | lib/l10n/fr.php | 4 | ||||
-rw-r--r-- | lib/l10n/ia.php | 4 | ||||
-rw-r--r-- | lib/l10n/pl.php | 29 | ||||
-rw-r--r-- | lib/l10n/pt_PT.php | 36 | ||||
-rw-r--r-- | lib/l10n/ta_IN.php | 1 | ||||
-rw-r--r-- | lib/l10n/zh_HK.php | 11 | ||||
-rw-r--r-- | lib/private/backgroundjob/joblist.php | 5 | ||||
-rw-r--r-- | lib/private/group.php | 29 | ||||
-rw-r--r-- | lib/private/group/group.php | 4 | ||||
-rw-r--r-- | lib/private/group/manager.php | 3 | ||||
-rw-r--r-- | lib/private/server.php | 82 | ||||
-rw-r--r-- | lib/private/user/user.php | 2 | ||||
-rwxr-xr-x | lib/private/util.php | 5 | ||||
-rw-r--r-- | lib/public/igroup.php | 81 | ||||
-rw-r--r-- | lib/public/igroupmanager.php | 83 | ||||
-rw-r--r-- | lib/public/iservercontainer.php | 7 | ||||
-rw-r--r-- | lib/public/iuser.php | 6 |
18 files changed, 339 insertions, 69 deletions
diff --git a/lib/base.php b/lib/base.php index 730cee5231d..d43ff0a9ce3 100644 --- a/lib/base.php +++ b/lib/base.php @@ -211,9 +211,11 @@ class OC { public static function checkInstalled() { // Redirect to installer if not installed if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') { - if (!OC::$CLI) { + if (OC::$CLI) { + throw new Exception('Not installed'); + } else { $url = 'http://' . $_SERVER['SERVER_NAME'] . OC::$WEBROOT . '/index.php'; - header("Location: $url"); + header('Location: ' . $url); } exit(); } @@ -520,10 +522,10 @@ class OC { self::initTemplateEngine(); OC_App::loadApps(array('session')); - if (!self::$CLI) { - self::initSession(); - } else { + if (self::$CLI) { self::$session = new \OC\Session\Memory(''); + } else { + self::initSession(); } self::checkConfig(); self::checkInstalled(); @@ -654,8 +656,8 @@ class OC { if (!OC::$CLI // overwritehost is always trusted && OC_Request::getOverwriteHost() === null - && !OC_Request::isTrustedDomain($host)) { - + && !OC_Request::isTrustedDomain($host) + ) { header('HTTP/1.1 400 Bad Request'); header('Status: 400 Bad Request'); OC_Template::printErrorPage( diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php index 567e9ff0c0e..b20f89a9ad7 100644 --- a/lib/l10n/fr.php +++ b/lib/l10n/fr.php @@ -12,7 +12,7 @@ $TRANSLATIONS = array( "Users" => "Utilisateurs", "Admin" => "Administration", "Failed to upgrade \"%s\"." => "Echec de la mise à niveau \"%s\".", -"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." => "L'application \\\"%s\\\" ne peut être installée car elle n'est pas compatible avec cette version de ownCloud.", +"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." => "L'application \\\"%s\\\" ne peut pas être installée car elle n'est pas compatible avec cette version de ownCloud.", "No app name specified" => "Aucun nom d'application spécifié", "Unknown filetype" => "Type de fichier inconnu", "Invalid image" => "Image invalide", @@ -89,7 +89,7 @@ $TRANSLATIONS = array( "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Seuls les caractères suivants sont autorisés dans un nom d'utilisateur : \"a-z\", \"A-Z\", \"0-9\", et \"_.@-\"", "A valid username must be provided" => "Un nom d'utilisateur valide doit être saisi", "A valid password must be provided" => "Un mot de passe valide doit être saisi", -"The username is already being used" => "Le nom d'utilisateur est déjà utilisé", +"The username is already being used" => "Ce nom d'utilisateur est déjà utilisé", "No database drivers (sqlite, mysql, or postgresql) installed." => "Aucun pilote de base de données (sqlite, mysql, ou postgresql) n’est installé.", "Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "Les permissions peuvent, généralement, être résolues %sen donnant au serveur web un accès en écriture au répertoire racine%s", "Cannot write into \"config\" directory" => "Impossible d’écrire dans le répertoire \"config\"", diff --git a/lib/l10n/ia.php b/lib/l10n/ia.php index 51dc365ed6b..03fbad47682 100644 --- a/lib/l10n/ia.php +++ b/lib/l10n/ia.php @@ -13,9 +13,9 @@ $TRANSLATIONS = array( "_%n hour ago_::_%n hours ago_" => array("","%n horas passate"), "today" => "hodie", "yesterday" => "heri", -"_%n day go_::_%n days ago_" => array("",""), +"_%n day go_::_%n days ago_" => array("","%n dies ante"), "last month" => "ultime mense", -"_%n month ago_::_%n months ago_" => array("",""), +"_%n month ago_::_%n months ago_" => array("","%n menses ante"), "last year" => "ultime anno", "years ago" => "annos passate" ); diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php index f024682adff..877c3fcdbe8 100644 --- a/lib/l10n/pl.php +++ b/lib/l10n/pl.php @@ -1,6 +1,9 @@ <?php $TRANSLATIONS = array( +"Cannot write into \"config\" directory!" => "Nie można zapisać do katalogu \"config\"!", +"This can usually be fixed by giving the webserver write access to the config directory" => "Można to zwykle rozwiązać przez dodanie serwerowi www uprawnień zapisu do katalogu config.", "See %s" => "Zobacz %s", +"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Można to zwykle rozwiązać przez %sdodanie serwerowi www uprawnień zapisu do katalogu config%s.", "You are accessing the server from an untrusted domain." => "Dostajesz się do serwera z niezaufanej domeny.", "Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domain\" setting in config/config.php. An example configuration is provided in config/config.sample.php." => "Proszę skontaktuj się z administratorem. Jeśli jesteś administratorem tej instancji, skonfiguruj parametr \"trusted_domain\" w pliku config/config.php. Przykładowa konfiguracja jest dostępna w pliku config/config.sample.php.", "Help" => "Pomoc", @@ -87,7 +90,33 @@ $TRANSLATIONS = array( "A valid username must be provided" => "Należy podać prawidłową nazwę użytkownika", "A valid password must be provided" => "Należy podać prawidłowe hasło", "The username is already being used" => "Ta nazwa użytkownika jest już używana", +"No database drivers (sqlite, mysql, or postgresql) installed." => "Brak sterowników bazy danych (sqlite, mysql or postgresql).", +"Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "Problemy z uprawnieniami można zwykle naprawić przez %sdodanie serwerowi www uprawnień zapisu do katalogu głównego%s.", +"Cannot write into \"config\" directory" => "Nie można zapisać do katalogu \"config\"", +"Cannot write into \"apps\" directory" => "Nie można zapisać do katalogu \"apps\"", +"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "Można to zwykle rozwiązać przez %sdodanie serwerowi www uprawnień zapisu do katalogu apps%s lub wyłączenie appstore w pliku konfiguracyjnym.", +"Cannot create \"data\" directory (%s)" => "Nie można utworzyć katalogu \"data\" (%s)", +"This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "Można to zwykle rozwiązać przez <a href=\"%s\" target=\"_blank\">dodanie serwerowi www uprawnień zapisu do katalogu głównego</a>.", +"Setting locale to %s failed" => "Nie udało się zmienić języka na %s", +"Please install one of theses locales on your system and restart your webserver." => "Proszę zainstalować jeden z tych języków w twoim systemie i zrestartować serwer www.", +"Please ask your server administrator to install the module." => "Proszę poproś administratora serwera aby zainstalował ten moduł.", +"PHP module %s not installed." => "Moduł PHP %s nie jest zainstalowany.", +"PHP %s or higher is required." => "PHP %s lub wyższe jest wymagane.", +"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." => "Proszę poproś administratora serwera aby zaktualizował PHP do najnowszej wersji. Twoja wersja PHP nie jest już dłużej wspierana przez ownCloud i społeczność PHP.", +"PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly." => "Bezpieczny tryb PHP jest aktywny. ownCloud do poprawnej pracy wymaga aby był on wyłączony.", +"PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "Bezpieczny tryb PHP jest przestarzały i w większości bezużyteczny i powinien być wyłączony. Proszę poproś administratora serwera aby wyłączył go w php.ini lub w pliku konfiguracyjnym serwera www.", +"Magic Quotes is enabled. ownCloud requires that it is disabled to work properly." => "Magic Quotes są włączone. Do poprawnego działania ownCloud wymagane jest ich wyłączenie.", +"Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "Magic Quotes to przestarzałe i zasadniczo bezużyteczne ustawienie, które powinno być wyłączone. Poproś administratora serwera, by wyłączył je w php.ini albo w konfiguracji serwera www.", +"PHP modules have been installed, but they are still listed as missing?" => "Moduły PHP zostały zainstalowane, ale nadal brakuje ich na liście?", +"Please ask your server administrator to restart the web server." => "Poproś administratora serwera o restart serwera www.", "PostgreSQL >= 9 required" => "Wymagany PostgreSQL >= 9", +"Please upgrade your database version" => "Uaktualnij wersję bazy danych", +"Error occurred while checking PostgreSQL version" => "Wystąpił błąd podczas sprawdzania wersji PostgreSQL", +"Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" => "Upewnij się, że PostgreSQL jest w wersji co najmniej 9 lub sprawdź log by uzyskać więcej informacji na temat błędu", +"Please change the permissions to 0770 so that the directory cannot be listed by other users." => "Zmień uprawnienia na 0770, żeby ukryć zawartość katalogu przed innymi użytkownikami.", +"Data directory (%s) is readable by other users" => "Katalog danych (%s) jest możliwy do odczytania przez innych użytkowników", +"Data directory (%s) is invalid" => "Katalog danych (%s) jest nieprawidłowy", +"Please check that the data directory contains a file \".ocdata\" in its root." => "Sprawdź, czy katalog danych zawiera plik \".ocdata\".", "Could not obtain lock type %d on \"%s\"." => "Nie można uzyskać blokady typu %d na \"%s\"." ); $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/pt_PT.php b/lib/l10n/pt_PT.php index 0774e6ea36d..9629d47a023 100644 --- a/lib/l10n/pt_PT.php +++ b/lib/l10n/pt_PT.php @@ -1,12 +1,18 @@ <?php $TRANSLATIONS = array( +"Cannot write into \"config\" directory!" => "Não é possível gravar na directoria \"configurar\"!", +"This can usually be fixed by giving the webserver write access to the config directory" => "Isto pode ser resolvido normalmente dando ao servidor web direitos de escrita ao directório de configuração", +"See %s" => "Ver %s", +"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Isto pode ser resolvido normalmente %sdando ao servidor web direitos de escrita no directório de configuração%s.", "You are accessing the server from an untrusted domain." => "Está a aceder ao servidor a partir de um domínio que não é de confiança.", +"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domain\" setting in config/config.php. An example configuration is provided in config/config.sample.php." => "Por favor contacte o seu administrador. Se é um administrador desta instância, configure as definições \"trusted_domain\" em config/config.php. Um exemplo de configuração é fornecido em config/config.sample.php.", "Help" => "Ajuda", "Personal" => "Pessoal", "Settings" => "Configurações", "Users" => "Utilizadores", "Admin" => "Admin", "Failed to upgrade \"%s\"." => "A actualização \"%s\" falhou.", +"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." => "A Aplicação \\\"%s\\\" não pode ser instalada porque não é compatível com esta versão do owncloud.", "No app name specified" => "O nome da aplicação não foi especificado", "Unknown filetype" => "Ficheiro desconhecido", "Invalid image" => "Imagem inválida", @@ -56,6 +62,7 @@ $TRANSLATIONS = array( "Sharing %s failed, because this item is already shared with %s" => "A partilha %s falhou, porque o item já está a ser partilhado com %s", "Sharing %s failed, because the group %s does not exist" => "A partilha %s falhou, porque o grupo %s não existe", "Sharing %s failed, because %s is not a member of the group %s" => "A partilha %s falhou, porque o utilizador %s não é membro do grupo %s", +"You need to provide a password to create a public link, only protected links are allowed" => "Necessita de fornecer a senha para criar um link publico, só são permitidos links protegidos", "Sharing %s failed, because sharing with links is not allowed" => "A partilha de %s falhou, porque partilhar com links não é permitido", "Share type %s is not valid for %s" => "O tipo de partilha %s não é válido para %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Definir permissões para %s falhou, porque as permissões excedem as permissões concedidas a %s", @@ -66,6 +73,8 @@ $TRANSLATIONS = array( "Sharing %s failed, because the user %s is the original sharer" => "A partilha %s falhou, porque o utilizador %s é o proprietário original", "Sharing %s failed, because the permissions exceed permissions granted to %s" => "Definir permissões para %s falhou, porque as permissões excedem as permissões concedidas a %s", "Sharing %s failed, because resharing is not allowed" => "A partilha %s falhou, porque repartilhar não é permitido", +"Sharing %s failed, because the sharing backend for %s could not find its source" => "A partilha %s falhou, devido a partilha em segundo plano para %s não conseguir encontrar a sua fonte", +"Sharing %s failed, because the file could not be found in the file cache" => "A partilha %s falhou, devido ao ficheiro não poder ser encontrado na cache de ficheiros", "Could not find category \"%s\"" => "Não foi encontrado a categoria \"%s\"", "seconds ago" => "Minutos atrás", "_%n minute ago_::_%n minutes ago_" => array("","%n minutos atrás"), @@ -81,6 +90,33 @@ $TRANSLATIONS = array( "A valid username must be provided" => "Um nome de utilizador válido deve ser fornecido", "A valid password must be provided" => "Uma password válida deve ser fornecida", "The username is already being used" => "O nome de utilizador já está a ser usado", +"No database drivers (sqlite, mysql, or postgresql) installed." => "Nenhuma base de dados de drivers (sqlite, mysql, or postgresql) instaladas.", +"Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "As autorizações podem ser resolvidas normalmente %sdando ao servidor web direito de escrita para o directório root%s.", +"Cannot write into \"config\" directory" => "Não é possível escrever na directoria \"configurar\"", +"Cannot write into \"apps\" directory" => "Não é possivel escrever na directoria \"aplicações\"", +"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "Isto pode ser normalmente resolvido %sdando ao servidor web direito de escrita para o directório de aplicação%s ou desactivando a loja de aplicações no ficheiro de configuração.", +"Cannot create \"data\" directory (%s)" => "Não é possivel criar a directoria \"data\" (%s)", +"This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "Isto pode ser normalmente resolvido <a href=\"%s\" target=\"_blank\">dando ao servidor web direito de escrita para o directório do root</a>.", +"Setting locale to %s failed" => "Definindo local para %s falhado", +"Please install one of theses locales on your system and restart your webserver." => "Por favor instale um desses locais no seu sistema e reinicie o seu servidor web.", +"Please ask your server administrator to install the module." => "Por favor pergunte ao seu administrador do servidor para instalar o modulo.", +"PHP module %s not installed." => "O modulo %s PHP não está instalado.", +"PHP %s or higher is required." => "Necessário PHP %s ou maior.", +"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." => "Por favor pessa ao seu administrador de servidor para actualizar o PHP para a ultima versão. A sua versão de PHP não é mais suportada pelo owncloud e a comunidade PHP.", +"PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly." => "O modo seguro de PHP está activo. O ownCloud requer que isto esteja desactivado para funcionar em condições.", +"PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "O modo seguro PHP está obsoleto e a maior parte das definições inúteis devem ser desactivadas. Por favor pessa ao seu administrador de servidor para desactivar isto em php.ini ou no seu config do servidor web.", +"Magic Quotes is enabled. ownCloud requires that it is disabled to work properly." => "Aspas mágicas estão activadas. O ownCloud requere que isto esteja desactivado para trabalhar em condições.", +"Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "As aspas mágicas é uma definição obsoleta e inútil que deve ser desactivada. Por favor pessa ao seu administrador do servidor para desactivar isto em php.ini ou no config do seu servidor web.", +"PHP modules have been installed, but they are still listed as missing?" => "Os módulos PHP foram instalados, mas eles ainda estão listados como desaparecidos?", +"Please ask your server administrator to restart the web server." => "Pro favor pergunte ao seu administrador do servidor para reiniciar o servidor da internet.", +"PostgreSQL >= 9 required" => "Necessita PostgreSQL >= 9", +"Please upgrade your database version" => "Por favor actualize a sua versão da base de dados", +"Error occurred while checking PostgreSQL version" => "Ocorreu um erro enquanto pesquisava a versão do PostgreSQL", +"Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" => "Por favor confirme que tem o PostgreSQL >= 9 ou verifique os registos para mais informação sobre o erro", +"Please change the permissions to 0770 so that the directory cannot be listed by other users." => "Por favor altere as permissões para 0770 para que esse directório não possa ser listado por outros utilizadores.", +"Data directory (%s) is readable by other users" => "O directório de dados (%s) é legível para outros utilizadores", +"Data directory (%s) is invalid" => "Directoria data (%s) é invalida", +"Please check that the data directory contains a file \".ocdata\" in its root." => "Por favor verifique que a directoria data contem um ficheiro \".ocdata\" na sua raiz.", "Could not obtain lock type %d on \"%s\"." => "Não foi possível obter o tipo de bloqueio %d em \"%s\"." ); $PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/lib/l10n/ta_IN.php b/lib/l10n/ta_IN.php index 15f78e0bce6..5907e09695d 100644 --- a/lib/l10n/ta_IN.php +++ b/lib/l10n/ta_IN.php @@ -1,5 +1,6 @@ <?php $TRANSLATIONS = array( +"Settings" => "அமைப்புகள்", "_%n minute ago_::_%n minutes ago_" => array("",""), "_%n hour ago_::_%n hours ago_" => array("",""), "_%n day go_::_%n days ago_" => array("",""), diff --git a/lib/l10n/zh_HK.php b/lib/l10n/zh_HK.php index e4039324d98..75085e02ae3 100644 --- a/lib/l10n/zh_HK.php +++ b/lib/l10n/zh_HK.php @@ -5,12 +5,15 @@ $TRANSLATIONS = array( "Settings" => "設定", "Users" => "用戶", "Admin" => "管理", -"_%n minute ago_::_%n minutes ago_" => array(""), -"_%n hour ago_::_%n hours ago_" => array(""), +"seconds ago" => "秒前", +"_%n minute ago_::_%n minutes ago_" => array("%n 分鐘前"), +"_%n hour ago_::_%n hours ago_" => array("%n 小時前"), "today" => "今日", "yesterday" => "昨日", -"_%n day go_::_%n days ago_" => array(""), +"_%n day go_::_%n days ago_" => array("%n 日前"), "last month" => "前一月", -"_%n month ago_::_%n months ago_" => array("") +"_%n month ago_::_%n months ago_" => array("%n 月前"), +"last year" => "上年", +"years ago" => "年前" ); $PLURAL_FORMS = "nplurals=1; plural=0;"; diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index 211d7e9abfc..9d15cd1663a 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -96,7 +96,10 @@ class JobList implements IJobList { $query->execute(); $jobs = array(); while ($row = $query->fetch()) { - $jobs[] = $this->buildJob($row); + $job = $this->buildJob($row); + if ($job) { + $jobs[] = $job; + } } return $jobs; } diff --git a/lib/private/group.php b/lib/private/group.php index bd9e3d37d1f..49f683c411a 100644 --- a/lib/private/group.php +++ b/lib/private/group.php @@ -34,26 +34,19 @@ * post_removeFromGroup(uid, gid) */ class OC_Group { - /** - * @var \OC\Group\Manager $manager - */ - private static $manager; /** - * @var \OC\User\Manager + * @return \OC\Group\Manager */ - private static $userManager; + public static function getManager() { + return \OC::$server->getGroupManager(); + } /** - * @return \OC\Group\Manager + * @return \OC\User\Manager */ - public static function getManager() { - if (self::$manager) { - return self::$manager; - } - self::$userManager = \OC_User::getManager(); - self::$manager = new \OC\Group\Manager(self::$userManager); - return self::$manager; + private static function getUserManager() { + return \OC::$server->getUserManager(); } /** @@ -127,7 +120,7 @@ class OC_Group { */ public static function inGroup($uid, $gid) { $group = self::getManager()->get($gid); - $user = self::$userManager->get($uid); + $user = self::getUserManager()->get($uid); if ($group and $user) { return $group->inGroup($user); } @@ -144,7 +137,7 @@ class OC_Group { */ public static function addToGroup($uid, $gid) { $group = self::getManager()->get($gid); - $user = self::$userManager->get($uid); + $user = self::getUserManager()->get($uid); if ($group and $user) { OC_Hook::emit("OC_Group", "pre_addToGroup", array("run" => true, "uid" => $uid, "gid" => $gid)); $group->addUser($user); @@ -165,7 +158,7 @@ class OC_Group { */ public static function removeFromGroup($uid, $gid) { $group = self::getManager()->get($gid); - $user = self::$userManager->get($uid); + $user = self::getUserManager()->get($uid); if ($group and $user) { OC_Hook::emit("OC_Group", "pre_removeFromGroup", array("run" => true, "uid" => $uid, "gid" => $gid)); $group->removeUser($user); @@ -185,7 +178,7 @@ class OC_Group { * if the user exists at all. */ public static function getUserGroups($uid) { - $user = self::$userManager->get($uid); + $user = self::getUserManager()->get($uid); if ($user) { return self::getManager()->getUserGroupIds($user); } else { diff --git a/lib/private/group/group.php b/lib/private/group/group.php index e0a35924854..6f8b84dff1a 100644 --- a/lib/private/group/group.php +++ b/lib/private/group/group.php @@ -9,7 +9,9 @@ namespace OC\Group; -class Group { +use OCP\IGroup; + +class Group implements IGroup { /** * @var string $id */ diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php index 3613c7547bd..368fa3851d7 100644 --- a/lib/private/group/manager.php +++ b/lib/private/group/manager.php @@ -10,6 +10,7 @@ namespace OC\Group; use OC\Hooks\PublicEmitter; +use OCP\IGroupManager; /** * Class Manager @@ -26,7 +27,7 @@ use OC\Hooks\PublicEmitter; * * @package OC\Group */ -class Manager extends PublicEmitter { +class Manager extends PublicEmitter implements IGroupManager { /** * @var \OC_Group_Backend[]|\OC_Group_Database[] $backends */ diff --git a/lib/private/server.php b/lib/private/server.php index 6bd0eabb6e3..aab3c82bfeb 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -13,6 +13,7 @@ use OCP\IServerContainer; /** * Class Server + * * @package OC * * TODO: hookup all manager classes @@ -20,10 +21,10 @@ use OCP\IServerContainer; class Server extends SimpleContainer implements IServerContainer { function __construct() { - $this->registerService('ContactsManager', function($c) { + $this->registerService('ContactsManager', function ($c) { return new ContactsManager(); }); - $this->registerService('Request', function($c) { + $this->registerService('Request', function ($c) { if (isset($c['urlParams'])) { $urlParams = $c['urlParams']; } else { @@ -37,7 +38,8 @@ class Server extends SimpleContainer implements IServerContainer { } if (defined('PHPUNIT_RUN') && PHPUNIT_RUN - && in_array('fakeinput', stream_get_wrappers())) { + && in_array('fakeinput', stream_get_wrappers()) + ) { $stream = 'fakeinput://data'; } else { $stream = 'php://input'; @@ -52,21 +54,21 @@ class Server extends SimpleContainer implements IServerContainer { 'env' => $_ENV, 'cookies' => $_COOKIE, 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) - ? $_SERVER['REQUEST_METHOD'] - : null, + ? $_SERVER['REQUEST_METHOD'] + : null, 'urlParams' => $urlParams, 'requesttoken' => $requestToken, ), $stream ); }); - $this->registerService('PreviewManager', function($c) { + $this->registerService('PreviewManager', function ($c) { return new PreviewManager(); }); - $this->registerService('TagManager', function($c) { + $this->registerService('TagManager', function ($c) { $user = \OC_User::getUser(); return new TagManager($user); }); - $this->registerService('RootFolder', function($c) { + $this->registerService('RootFolder', function ($c) { // TODO: get user and user manager from container as well $user = \OC_User::getUser(); /** @var $c SimpleContainer */ @@ -76,7 +78,7 @@ class Server extends SimpleContainer implements IServerContainer { $view = new View(); return new Root($manager, $view, $user); }); - $this->registerService('UserManager', function($c) { + $this->registerService('UserManager', function ($c) { /** * @var SimpleContainer $c * @var \OC\AllConfig $config @@ -84,7 +86,15 @@ class Server extends SimpleContainer implements IServerContainer { $config = $c->query('AllConfig'); return new \OC\User\Manager($config); }); - $this->registerService('UserSession', function($c) { + $this->registerService('GroupManager', function ($c) { + /** + * @var SimpleContainer $c + * @var \OC\User\Manager $userManager + */ + $userManager = $c->query('UserManager'); + return new \OC\Group\Manager($userManager); + }); + $this->registerService('UserSession', function ($c) { /** * @var SimpleContainer $c * @var \OC\User\Manager $manager @@ -126,40 +136,40 @@ class Server extends SimpleContainer implements IServerContainer { }); return $userSession; }); - $this->registerService('NavigationManager', function($c) { + $this->registerService('NavigationManager', function ($c) { return new \OC\NavigationManager(); }); - $this->registerService('AllConfig', function($c) { + $this->registerService('AllConfig', function ($c) { return new \OC\AllConfig(); }); $this->registerService('AppConfig', function ($c) { return new \OC\AppConfig(\OC_DB::getConnection()); }); - $this->registerService('L10NFactory', function($c) { + $this->registerService('L10NFactory', function ($c) { return new \OC\L10N\Factory(); }); - $this->registerService('URLGenerator', function($c) { + $this->registerService('URLGenerator', function ($c) { /** @var $c SimpleContainer */ $config = $c->query('AllConfig'); return new \OC\URLGenerator($config); }); - $this->registerService('AppHelper', function($c) { + $this->registerService('AppHelper', function ($c) { return new \OC\AppHelper(); }); - $this->registerService('UserCache', function($c) { + $this->registerService('UserCache', function ($c) { return new UserCache(); }); $this->registerService('MemCacheFactory', function ($c) { $instanceId = \OC_Util::getInstanceId(); return new \OC\Memcache\Factory($instanceId); }); - $this->registerService('ActivityManager', function($c) { + $this->registerService('ActivityManager', function ($c) { return new ActivityManager(); }); - $this->registerService('AvatarManager', function($c) { + $this->registerService('AvatarManager', function ($c) { return new AvatarManager(); }); - $this->registerService('Logger', function($c) { + $this->registerService('Logger', function ($c) { /** @var $c SimpleContainer */ $logClass = $c->query('AllConfig')->getSystemValue('log_type', 'owncloud'); $logger = 'OC_Log_' . ucfirst($logClass); @@ -174,7 +184,7 @@ class Server extends SimpleContainer implements IServerContainer { $config = $c->getConfig(); return new \OC\BackgroundJob\JobList($c->getDatabaseConnection(), $config); }); - $this->registerService('Router', function ($c){ + $this->registerService('Router', function ($c) { /** * @var Server $c */ @@ -186,10 +196,10 @@ class Server extends SimpleContainer implements IServerContainer { } return $router; }); - $this->registerService('Search', function($c){ + $this->registerService('Search', function ($c) { return new Search(); }); - $this->registerService('Db', function($c){ + $this->registerService('Db', function ($c) { return new Db(); }); } @@ -255,18 +265,22 @@ class Server extends SimpleContainer implements IServerContainer { * @return \OCP\Files\Folder */ function getUserFolder() { - $dir = '/' . $this->getUserSession()->getUser()->getUID(); + $user = $this->getUserSession()->getUser(); + if (!$user) { + return null; + } + $dir = '/' . $user->getUID(); $root = $this->getRootFolder(); $folder = null; - if(!$root->nodeExists($dir)) { + if (!$root->nodeExists($dir)) { $folder = $root->newFolder($dir); } else { $folder = $root->get($dir); } $dir = '/files'; - if(!$folder->nodeExists($dir)) { + if (!$folder->nodeExists($dir)) { $folder = $folder->newFolder($dir); } else { $folder = $folder->get($dir); @@ -284,7 +298,7 @@ class Server extends SimpleContainer implements IServerContainer { $dir = '/' . \OC_App::getCurrentApp(); $root = $this->getRootFolder(); $folder = null; - if(!$root->nodeExists($dir)) { + if (!$root->nodeExists($dir)) { $folder = $root->newFolder($dir); } else { $folder = $root->get($dir); @@ -300,6 +314,13 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * @return \OC\Group\Manager + */ + function getGroupManager() { + return $this->query('GroupManager'); + } + + /** * @return \OC\User\Session */ function getUserSession() { @@ -325,12 +346,13 @@ class Server extends SimpleContainer implements IServerContainer { * * @return \OCP\IAppConfig */ - function getAppConfig(){ + function getAppConfig() { return $this->query('AppConfig'); } /** * get an L10N instance + * * @param string $app appid * @return \OC_L10N */ @@ -402,7 +424,7 @@ class Server extends SimpleContainer implements IServerContainer { * * @return \OCP\BackgroundJob\IJobList */ - function getJobList(){ + function getJobList() { return $this->query('JobList'); } @@ -420,12 +442,13 @@ class Server extends SimpleContainer implements IServerContainer { * * @return \OCP\Route\IRouter */ - function getRouter(){ + function getRouter() { return $this->query('Router'); } /** * Returns a search instance + * * @return \OCP\ISearch */ function getSearch() { @@ -434,6 +457,7 @@ class Server extends SimpleContainer implements IServerContainer { /** * Returns an instance of the db facade + * * @return \OCP\IDb */ function getDb() { diff --git a/lib/private/user/user.php b/lib/private/user/user.php index f9c2cb4d130..993fb4c0c64 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -156,7 +156,7 @@ class User implements IUser { * @param string $recoveryPassword for the encryption app to reset encryption keys * @return bool */ - public function setPassword($password, $recoveryPassword) { + public function setPassword($password, $recoveryPassword = null) { if ($this->emitter) { $this->emitter->emit('\OC\User', 'preSetPassword', array($this, $password, $recoveryPassword)); } diff --git a/lib/private/util.php b/lib/private/util.php index eea194288f9..67da7a2f63f 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1217,11 +1217,16 @@ class OC_Util { /** * @Brief Get file content via curl. * @param string $url Url to get content + * @throws Exception If the URL does not start with http:// or https:// * @return string of the response or false on error * This function get the content of a page via curl, if curl is enabled. * If not, file_get_contents is used. */ public static function getUrlContent($url) { + if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) { + throw new Exception('$url must start with https:// or http://', 1); + } + if (function_exists('curl_init')) { $curl = curl_init(); $max_redirects = 10; diff --git a/lib/public/igroup.php b/lib/public/igroup.php new file mode 100644 index 00000000000..392ac5d92b9 --- /dev/null +++ b/lib/public/igroup.php @@ -0,0 +1,81 @@ +<?php + +/** + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCP; + +interface IGroup { + /** + * @return string + */ + public function getGID(); + + /** + * get all users in the group + * + * @return \OCP\IUser[] + */ + public function getUsers(); + + /** + * check if a user is in the group + * + * @param \OCP\IUser $user + * @return bool + */ + public function inGroup($user); + + /** + * add a user to the group + * + * @param \OCP\IUser $user + */ + public function addUser($user); + + /** + * remove a user from the group + * + * @param \OCP\IUser $user + */ + public function removeUser($user); + + /** + * search for users in the group by userid + * + * @param string $search + * @param int $limit + * @param int $offset + * @return \OCP\IUser[] + */ + public function searchUsers($search, $limit = null, $offset = null); + + /** + * returns the number of users matching the search string + * + * @param string $search + * @return int|bool + */ + public function count($search = ''); + + /** + * search for users in the group by displayname + * + * @param string $search + * @param int $limit + * @param int $offset + * @return \OCP\IUser[] + */ + public function searchDisplayName($search, $limit = null, $offset = null); + + /** + * delete the group + * + * @return bool + */ + public function delete(); +} diff --git a/lib/public/igroupmanager.php b/lib/public/igroupmanager.php new file mode 100644 index 00000000000..dc69044c490 --- /dev/null +++ b/lib/public/igroupmanager.php @@ -0,0 +1,83 @@ +<?php + +/** + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCP; + +/** + * Class Manager + * + * Hooks available in scope \OC\Group: + * - preAddUser(\OC\Group\Group $group, \OC\User\User $user) + * - postAddUser(\OC\Group\Group $group, \OC\User\User $user) + * - preRemoveUser(\OC\Group\Group $group, \OC\User\User $user) + * - postRemoveUser(\OC\Group\Group $group, \OC\User\User $user) + * - preDelete(\OC\Group\Group $group) + * - postDelete(\OC\Group\Group $group) + * - preCreate(string $groupId) + * - postCreate(\OC\Group\Group $group) + * + * @package OC\Group + */ +interface IGroupManager { + /** + * @param \OCP\UserInterface $backend + */ + public function addBackend($backend); + + public function clearBackends(); + + /** + * @param string $gid + * @return \OCP\IGroup + */ + public function get($gid); + + /** + * @param string $gid + * @return bool + */ + public function groupExists($gid); + + /** + * @param string $gid + * @return \OCP\IGroup + */ + public function createGroup($gid); + + /** + * @param string $search + * @param int $limit + * @param int $offset + * @return \OCP\IGroup[] + */ + public function search($search, $limit = null, $offset = null); + + /** + * @param \OCP\IUser $user + * @return \OCP\IGroup[] + */ + public function getUserGroups($user); + + /** + * @param \OCP\IUser $user + * @return array with group names + */ + public function getUserGroupIds($user); + + /** + * get a list of all display names in a group + * + * @param string $gid + * @param string $search + * @param int $limit + * @param int $offset + * @return array an array of display names (value) and user ids (key) + */ + public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0); +} diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index f3dbc18322e..9c39ac7ae73 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -100,6 +100,13 @@ interface IServerContainer { function getUserManager(); /** + * Returns a group manager + * + * @return \OCP\IGroupManager + */ + function getGroupManager(); + + /** * Returns the user session * * @return \OCP\IUserSession diff --git a/lib/public/iuser.php b/lib/public/iuser.php index dc4acc7658f..c15edcd14dd 100644 --- a/lib/public/iuser.php +++ b/lib/public/iuser.php @@ -18,14 +18,14 @@ interface IUser { public function getUID(); /** - * get the displayname for the user, if no specific displayname is set it will fallback to the user id + * get the display name for the user, if no specific display name is set it will fallback to the user id * * @return string */ public function getDisplayName(); /** - * set the displayname for the user + * set the display name for the user * * @param string $displayName * @return bool @@ -59,7 +59,7 @@ interface IUser { * @param string $recoveryPassword for the encryption app to reset encryption keys * @return bool */ - public function setPassword($password, $recoveryPassword); + public function setPassword($password, $recoveryPassword = null); /** * get the users home folder to mount |