diff options
Diffstat (limited to 'lib')
77 files changed, 720 insertions, 150 deletions
diff --git a/lib/base.php b/lib/base.php index 865d174d212..baf73b2fb9f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -178,11 +178,19 @@ class OC { if (file_exists(OC::$SERVERROOT . "/config/config.php") and !is_writable(OC::$SERVERROOT . "/config/config.php")) { $defaults = new OC_Defaults(); - OC_Template::printErrorPage( - "Can't write into config directory!", - 'This can usually be fixed by ' - .'<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.' - ); + if (self::$CLI) { + echo "Can't write into config directory!\n"; + echo "This can usually be fixed by giving the webserver write access to the config directory\n"; + echo "\n"; + echo "See " . \OC_Helper::linkToDocs('admin-dir_permissions') . "\n"; + exit; + } else { + OC_Template::printErrorPage( + "Can't write into config directory!", + 'This can usually be fixed by ' + .'<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.' + ); + } } } @@ -230,6 +238,22 @@ class OC { } } + public static function checkSingleUserMode() { + $user = OC_User::getUserSession()->getUser(); + $group = OC_Group::getManager()->get('admin'); + if ($user && OC_Config::getValue('singleuser', false) && !$group->inGroup($user)) { + // send http status 503 + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + header('Retry-After: 120'); + + // render error page + $tmpl = new OC_Template('', 'singleuser.user', 'guest'); + $tmpl->printPage(); + die(); + } + } + public static function checkUpgrade($showTemplate = true) { if (OC_Config::getValue('installed', false)) { $installedVersion = OC_Config::getValue('version', '0.0.0'); @@ -480,7 +504,14 @@ class OC { $errors = OC_Util::checkServer(); if (count($errors) > 0) { - OC_Template::printGuestPage('', 'error', array('errors' => $errors)); + if (self::$CLI) { + foreach ($errors as $error) { + echo $error['error']."\n"; + echo $error['hint'] . "\n\n"; + } + } else { + OC_Template::printGuestPage('', 'error', array('errors' => $errors)); + } exit; } @@ -652,11 +683,12 @@ class OC { // Test it the user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP OC::tryBasicAuthLogin(); - if (!self::$CLI) { + if (!self::$CLI and (!isset($_GET["logout"]) or ($_GET["logout"] !== 'true'))) { try { if (!OC_Config::getValue('maintenance', false)) { OC_App::loadApps(); } + self::checkSingleUserMode(); OC::getRouter()->match(OC_Request::getRawPathInfo()); return; } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) { @@ -834,7 +866,6 @@ class OC { OC_User::setMagicInCookie($_COOKIE['oc_username'], $token); // login OC_User::setUserId($_COOKIE['oc_username']); - OC_User::setDisplayName($_COOKIE['oc_username'], $_COOKIE['display_name']); OC_Util::redirectToDefaultPage(); // doesn't return } diff --git a/lib/l10n/az.php b/lib/l10n/az.php new file mode 100644 index 00000000000..e7b09649a24 --- /dev/null +++ b/lib/l10n/az.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=1; plural=0;"; diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php index 01457275cf2..e7250befc2f 100644 --- a/lib/l10n/ca.php +++ b/lib/l10n/ca.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Els fitxers s'han de baixar d'un en un.", "Back to Files" => "Torna a Fitxers", "Selected files too large to generate zip file." => "Els fitxers seleccionats son massa grans per generar un fitxer zip.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Baixeu els fitxers separadament en petits trossos o pregunteu a l'administrador.", "No source specified when installing app" => "No heu especificat la font en instal·lar l'aplicació", "No href specified when installing app from http" => "No heu especificat href en instal·lar l'aplicació des de http", "No path specified when installing app from local file" => "No heu seleccionat el camí en instal·lar una aplicació des d'un fitxer local", diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php index 0e44dd2a4bd..96d3660c473 100644 --- a/lib/l10n/cs_CZ.php +++ b/lib/l10n/cs_CZ.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Soubory musí být stahovány jednotlivě.", "Back to Files" => "Zpět k souborům", "Selected files too large to generate zip file." => "Vybrané soubory jsou příliš velké pro vytvoření ZIP souboru.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Prosím stáhněte soubory odděleně po menších množstvích nebo požádejte vašeho správce.", "No source specified when installing app" => "Nebyl zadán zdroj při instalaci aplikace", "No href specified when installing app from http" => "Nebyl zadán odkaz pro instalaci aplikace z HTTP", "No path specified when installing app from local file" => "Nebyla zadána cesta pro instalaci aplikace z místního souboru", diff --git a/lib/l10n/de.php b/lib/l10n/de.php index 5b09d350a7d..8ee4cb71d30 100644 --- a/lib/l10n/de.php +++ b/lib/l10n/de.php @@ -18,17 +18,17 @@ $TRANSLATIONS = array( "Selected files too large to generate zip file." => "Die gewählten Dateien sind zu groß, um eine ZIP-Datei zu erstellen.", "Please download the files separately in smaller chunks or kindly ask your administrator." => "Bitte lade die Dateien einzeln in kleineren Teilen herunter oder bitte Deinen Administrator.", "No source specified when installing app" => "Für die Installation der Applikation wurde keine Quelle angegeben", -"No href specified when installing app from http" => "Der Link (href) wurde nicht angegeben um die Applikation per http zu installieren", +"No href specified when installing app from http" => "Für die Installation der Applikation über http wurde keine Quelle (href) angegeben", "No path specified when installing app from local file" => "Bei der Installation der Applikation aus einer lokalen Datei wurde kein Pfad angegeben", "Archives of type %s are not supported" => "Archive vom Typ %s werden nicht unterstützt", "Failed to open archive when installing app" => "Das Archiv konnte bei der Installation der Applikation nicht geöffnet werden", "App does not provide an info.xml file" => "Die Applikation enthält keine info,xml Datei", -"App can't be installed because of not allowed code in the App" => "Die Applikation kann auf Grund von unerlaubten Code nicht installiert werden", +"App can't be installed because of not allowed code in the App" => "Die Applikation kann auf Grund von unerlaubtem Code nicht installiert werden", "App can't be installed because it is not compatible with this version of ownCloud" => "Die Anwendung konnte nicht installiert werden, weil Sie nicht mit dieser Version von ownCloud kompatibel ist.", -"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Die Applikation konnte nicht installiert werden, da diese das <shipped>true</shipped> Tag beinhaltet und dieses, bei nicht mitausgelieferten Applikationen, nicht erlaubt ist ist", +"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Die Applikation konnte nicht installiert werden, da diese das <shipped>true</shipped> Tag beinhaltet und dieses, bei nicht mitausgelieferten Applikationen, nicht erlaubt ist", "App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Die Applikation konnte nicht installiert werden, da die Version in der info.xml nicht die gleiche Version wie im App-Store ist", "App directory already exists" => "Das Applikationsverzeichnis existiert bereits", -"Can't create app folder. Please fix permissions. %s" => "Es kann kein Applikationsordner erstellt werden. Bitte passen sie die Berechtigungen an. %s", +"Can't create app folder. Please fix permissions. %s" => "Es kann kein Applikationsordner erstellt werden. Bitte passe die Berechtigungen an. %s", "Application is not enabled" => "Die Anwendung ist nicht aktiviert", "Authentication error" => "Fehler bei der Anmeldung", "Token expired. Please reload page." => "Token abgelaufen. Bitte lade die Seite neu.", diff --git a/lib/l10n/es.php b/lib/l10n/es.php index 8e79c9f1059..1412d49c2f5 100644 --- a/lib/l10n/es.php +++ b/lib/l10n/es.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Los archivos deben ser descargados uno por uno.", "Back to Files" => "Volver a Archivos", "Selected files too large to generate zip file." => "Los archivos seleccionados son demasiado grandes para generar el archivo zip.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Descargue los archivos en trozos más pequeños, por separado o solicítelos amablemente a su administrador.", "No source specified when installing app" => "No se ha especificado origen cuando se ha instalado la aplicación", "No href specified when installing app from http" => "No href especificado cuando se ha instalado la aplicación", "No path specified when installing app from local file" => "Sin path especificado cuando se ha instalado la aplicación desde el fichero local", diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php index f28a77eeb03..67a80d90caa 100644 --- a/lib/l10n/eu.php +++ b/lib/l10n/eu.php @@ -1,17 +1,34 @@ <?php $TRANSLATIONS = array( +"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "\"%s\" Aplikazioa ezin da instalatu ownCloud bertsio honekin bateragarria ez delako", +"No app name specified" => "Ez da aplikazioaren izena zehaztu", "Help" => "Laguntza", "Personal" => "Pertsonala", "Settings" => "Ezarpenak", "Users" => "Erabiltzaileak", "Admin" => "Admin", "Failed to upgrade \"%s\"." => "Ezin izan da \"%s\" eguneratu.", +"Unknown filetype" => "Fitxategi mota ezezaguna", +"Invalid image" => "Baliogabeko irudia", "web services under your control" => "web zerbitzuak zure kontrolpean", "cannot open \"%s\"" => "ezin da \"%s\" ireki", "ZIP download is turned off." => "ZIP deskarga ez dago gaituta.", "Files need to be downloaded one by one." => "Fitxategiak banan-banan deskargatu behar dira.", "Back to Files" => "Itzuli fitxategietara", "Selected files too large to generate zip file." => "Hautatuko fitxategiak oso handiak dira zip fitxategia sortzeko.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Mesedez deskargatu fitzategiak zati txikiagoetan, banan-banan edo eskatu mesedez zure administradoreari.", +"No source specified when installing app" => "Ez da jatorririk zehaztu aplikazioa instalatzerakoan", +"No href specified when installing app from http" => "Ez da href parametrorik zehaztu http bidez aplikazioa instalatzerakoan", +"No path specified when installing app from local file" => "Ez da kokalekurik zehaztu fitxategi lokal moduan aplikazioa instalatzerakoan", +"Archives of type %s are not supported" => "%s motako fitxategiak ez dira onartzen", +"Failed to open archive when installing app" => "Fitxategia irekitzeak huts egin du aplikazioa instalatzerakoan", +"App does not provide an info.xml file" => "Aplikazioak ez du info.xml fitxategia", +"App can't be installed because of not allowed code in the App" => "Aplikazioa ezin da instalatu bertan duen baimendu gabeko kodea dela eta", +"App can't be installed because it is not compatible with this version of ownCloud" => "Aplikazioa ezin da instalatu ownCloud bertsio honekin bateragarria ez delako", +"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Aplikazioa ezin da instalatu <shipped>true</shipped> etiketa duelako eta etiketa hau ez da onartzen banaketan ez datozen aplikazioetan", +"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Aplikazioa ezin da instalatu info.xml/version bertsioa ez delako \"app store\"an jartzen duenaren berdina", +"App directory already exists" => "Aplikazioaren karpeta dagoeneko existitzen da", +"Can't create app folder. Please fix permissions. %s" => "Ezin izan da aplikazioaren karpeta sortu. Mesdez konpondu baimenak. %s", "Application is not enabled" => "Aplikazioa ez dago gaituta", "Authentication error" => "Autentifikazio errorea", "Token expired. Please reload page." => "Tokena iraungitu da. Mesedez birkargatu orria.", diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php index c9767565b18..82d5739e540 100644 --- a/lib/l10n/fr.php +++ b/lib/l10n/fr.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Les fichiers nécessitent d'être téléchargés un par un.", "Back to Files" => "Retour aux Fichiers", "Selected files too large to generate zip file." => "Les fichiers sélectionnés sont trop volumineux pour être compressés.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Merci de télécharger les fichiers séparément en parties plus petites, ou demandez aimablement à votre administrateur.", "No source specified when installing app" => "Aucune source spécifiée pour installer l'application", "No href specified when installing app from http" => "Aucun href spécifié pour installer l'application par http", "No path specified when installing app from local file" => "Aucun chemin spécifié pour installer l'application depuis un fichier local", diff --git a/lib/l10n/fr_CA.php b/lib/l10n/fr_CA.php new file mode 100644 index 00000000000..406ff5f5a26 --- /dev/null +++ b/lib/l10n/fr_CA.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/ja_JP.php b/lib/l10n/ja_JP.php index f7af9b592ad..d7baf176a14 100644 --- a/lib/l10n/ja_JP.php +++ b/lib/l10n/ja_JP.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "ファイルは1つずつダウンロードする必要があります。", "Back to Files" => "ファイルに戻る", "Selected files too large to generate zip file." => "選択したファイルはZIPファイルの生成には大きすぎます。", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "少しずつに分けてファイルをダウンロードするか、管理者に問い合わせてください。", "No source specified when installing app" => "アプリインストール時のソースが未指定", "No href specified when installing app from http" => "アプリインストール時のhttpの URL が未指定", "No path specified when installing app from local file" => "アプリインストール時のローカルファイルのパスが未指定", diff --git a/lib/l10n/lt_LT.php b/lib/l10n/lt_LT.php index 9c4eccd9d62..17bbb856e43 100644 --- a/lib/l10n/lt_LT.php +++ b/lib/l10n/lt_LT.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Failai turi būti parsiunčiami vienas po kito.", "Back to Files" => "Atgal į Failus", "Selected files too large to generate zip file." => "Pasirinkti failai per dideli archyvavimui į ZIP.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Prašome atsisiųsti failus mažesnėmis dalimis atskirai, arba mandagiai prašykite savo administratoriaus.", "No source specified when installing app" => "Nenurodytas šaltinis diegiant programą", "No href specified when installing app from http" => "Nenurodytas href diegiant programą iš http", "No path specified when installing app from local file" => "Nenurodytas kelias diegiant programą iš vietinio failo", diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php index d3a94d20f54..0254ce81886 100644 --- a/lib/l10n/nl.php +++ b/lib/l10n/nl.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Bestanden moeten één voor één worden gedownload.", "Back to Files" => "Terug naar bestanden", "Selected files too large to generate zip file." => "De geselecteerde bestanden zijn te groot om een zip bestand te maken.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Download de bestanden afzonderlijk in kleinere porties of vraag het uw beheerder,", "No source specified when installing app" => "Geen bron opgegeven bij installatie van de app", "No href specified when installing app from http" => "Geen href opgegeven bij installeren van de app vanaf http", "No path specified when installing app from local file" => "Geen pad opgegeven bij installeren van de app vanaf een lokaal bestand", diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php index 2b12b4d8a17..55845cf2ae9 100644 --- a/lib/l10n/pt_PT.php +++ b/lib/l10n/pt_PT.php @@ -16,10 +16,17 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Os ficheiros precisam de ser descarregados um por um.", "Back to Files" => "Voltar a Ficheiros", "Selected files too large to generate zip file." => "Os ficheiros seleccionados são grandes demais para gerar um ficheiro zip.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Por favor descarregue os ficheiros divididos em partes mais pequenas ou peça ajuda ao seu administrador.", +"No source specified when installing app" => "Não foi especificada uma fonte de instalação desta aplicação", +"No href specified when installing app from http" => "Não foi especificada uma href http para instalar esta aplicação", +"No path specified when installing app from local file" => "Não foi especificado o caminho de instalação desta aplicação", "Archives of type %s are not supported" => "Arquivos do tipo %s não são suportados", +"Failed to open archive when installing app" => "Ocorreu um erro ao abrir o ficheiro de instalação desta aplicação", "App does not provide an info.xml file" => "A aplicação não disponibiliza um ficheiro info.xml", "App can't be installed because of not allowed code in the App" => "A aplicação não pode ser instalado devido a código não permitido dentro da aplicação", "App can't be installed because it is not compatible with this version of ownCloud" => "A aplicação não pode ser instalada por não ser compatível com esta versão do ownCloud", +"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Esta aplicação não pode ser instalada por que contém o tag <shipped>true</shipped> que só é permitido para aplicações nativas", +"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Esta aplicação não pode ser instalada porque a versão no info.xml/version não coincide com a reportada na loja de aplicações", "App directory already exists" => "A directoria da aplicação já existe", "Can't create app folder. Please fix permissions. %s" => "Não foi possível criar a pasta da aplicação. Por favor verifique as permissões. %s", "Application is not enabled" => "A aplicação não está activada", diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php index 493374ade09..18b455780d1 100644 --- a/lib/l10n/sk_SK.php +++ b/lib/l10n/sk_SK.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Súbory musia byť nahrávané jeden za druhým.", "Back to Files" => "Späť na súbory", "Selected files too large to generate zip file." => "Zvolené súbory sú príliš veľké na vygenerovanie zip súboru.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Prosím, stiahnite si súbory samostatne v menších blokoch alebo sa obráťte na správcu.", "No source specified when installing app" => "Nešpecifikovaný zdroj pri inštalácii aplikácie", "No href specified when installing app from http" => "Nešpecifikovaný atribút \"href\" pri inštalácii aplikácie pomocou protokolu \"http\"", "No path specified when installing app from local file" => "Nešpecifikovaná cesta pri inštalácii aplikácie z lokálneho súboru", diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php index 56be601f54d..69067c2691f 100644 --- a/lib/l10n/sl.php +++ b/lib/l10n/sl.php @@ -1,5 +1,7 @@ <?php $TRANSLATIONS = array( +"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Programa \"%s\" ni mogoče namestiti, ker ni skladen s trenutno nameščeno različico oblaka ownCloud.", +"No app name specified" => "Ni podanega imena programa", "Help" => "Pomoč", "Personal" => "Osebno", "Settings" => "Nastavitve", @@ -14,7 +16,19 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Datoteke je mogoče prejeti le posamično.", "Back to Files" => "Nazaj na datoteke", "Selected files too large to generate zip file." => "Izbrane datoteke so prevelike za ustvarjanje datoteke arhiva zip.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Datoteke je treba prejeti ločeno v manjših paketih, ali pa je treba za pomoč prositi skrbnika.", +"No source specified when installing app" => "Ni podanega vira med nameščenjem programa", +"No href specified when installing app from http" => "Ni podanega podatka naslova HREF med nameščenjem programa preko protokola HTTP.", +"No path specified when installing app from local file" => "Ni podane poti med nameščenjem programa iz krajevne datoteke", +"Archives of type %s are not supported" => "Arhivi vrste %s niso podprti", +"Failed to open archive when installing app" => "Odpiranje arhiva je med nameščanjem spodletelo", +"App does not provide an info.xml file" => "Program je brez datoteke info.xml", +"App can't be installed because of not allowed code in the App" => "Programa ni mogoče namestiti zaradi nedovoljene programske kode.", +"App can't be installed because it is not compatible with this version of ownCloud" => "Programa ni mogoče namestiti, ker ni skladen z trenutno nameščeno različico oblaka ownCloud.", +"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Programa ni mogoče namestiti, ker vsebuje oznako <shipped>potrditve</shipped>, ki pa ni dovoljena za javne programe.", +"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Program ni mogoče namestiti zaradi neustrezne različice datoteke info.xml. Ta ni enaka različici programa.", "App directory already exists" => "Programska mapa že obstaja", +"Can't create app folder. Please fix permissions. %s" => "Programske mape ni mogoče ustvariti. Ni ustreznih dovoljenj. %s", "Application is not enabled" => "Program ni omogočen", "Authentication error" => "Napaka overjanja", "Token expired. Please reload page." => "Žeton je potekel. Stran je treba ponovno naložiti.", @@ -51,6 +65,7 @@ $TRANSLATIONS = array( "last month" => "zadnji mesec", "_%n month ago_::_%n months ago_" => array("pred %n mesecem","pred %n mesecema","pred %n meseci","pred %n meseci"), "last year" => "lansko leto", -"years ago" => "let nazaj" +"years ago" => "let nazaj", +"Caused by:" => "Vzrok:" ); $PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);"; diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php index 66cd34f73dd..4f04cbe3159 100644 --- a/lib/l10n/sv.php +++ b/lib/l10n/sv.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Filer laddas ner en åt gången.", "Back to Files" => "Tillbaka till Filer", "Selected files too large to generate zip file." => "Valda filer är för stora för att skapa zip-fil.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Ladda ner filerna i mindre bitar, separat eller fråga din administratör.", "No source specified when installing app" => "Ingen källa angiven vid installation av app ", "No href specified when installing app from http" => "Ingen href angiven vid installation av app från http", "No path specified when installing app from local file" => "Ingen sökväg angiven vid installation av app från lokal fil", diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php index 11f0c72671f..093984bb952 100644 --- a/lib/l10n/tr.php +++ b/lib/l10n/tr.php @@ -1,6 +1,6 @@ <?php $TRANSLATIONS = array( -"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Owncloud yazılımının bu sürümü ile uyumlu olmadığı için \"%s\" uygulaması kurulamaz.", +"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "ownCloud yazılımının bu sürümü ile uyumlu olmadığı için \"%s\" uygulaması kurulamaz.", "No app name specified" => "Uygulama adı belirtimedli", "Help" => "Yardım", "Personal" => "Kişisel", @@ -18,25 +18,25 @@ $TRANSLATIONS = array( "Selected files too large to generate zip file." => "Seçilen dosyalar bir zip dosyası oluşturmak için fazla büyüktür.", "Please download the files separately in smaller chunks or kindly ask your administrator." => "Dosyaları ayrı ayrı, küçük parçalar halinde indirin veya yöneticinizden yardım isteyin. ", "No source specified when installing app" => "Uygulama kurulurken bir kaynak belirtilmedi", -"No href specified when installing app from http" => "Uygulama kuruluyorken http'de href belirtilmedi.", +"No href specified when installing app from http" => "Uygulama kuruluyorken http'de href belirtilmedi", "No path specified when installing app from local file" => "Uygulama yerel dosyadan kuruluyorken dosya yolu belirtilmedi", -"Archives of type %s are not supported" => "%s arşiv tipi desteklenmiyor", +"Archives of type %s are not supported" => "%s arşiv türü desteklenmiyor", "Failed to open archive when installing app" => "Uygulama kuruluyorken arşiv dosyası açılamadı", "App does not provide an info.xml file" => "Uygulama info.xml dosyası sağlamıyor", -"App can't be installed because of not allowed code in the App" => "Uygulamada izin verilmeyeden kodlar olduğu için kurulamıyor.", -"App can't be installed because it is not compatible with this version of ownCloud" => "Owncloud versiyonunuz ile uyumsuz olduğu için uygulama kurulamıyor.", -"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Uygulama kurulamıyor. Çünkü \"non shipped\" uygulamalar için <shipped>true</shipped> tag içermektedir.", -"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Uygulama kurulamıyor çünkü info.xml/version ile uygulama marketde belirtilen sürüm aynı değil.", -"App directory already exists" => "App dizini zaten mevcut", -"Can't create app folder. Please fix permissions. %s" => "app dizini oluşturulamıyor. Lütfen izinleri düzeltin. %s", +"App can't be installed because of not allowed code in the App" => "Uygulama, izin verilmeyen kodlar barındırdığından kurulamıyor.", +"App can't be installed because it is not compatible with this version of ownCloud" => "ownCloud sürümünüz ile uyumsuz olduğu için uygulama kurulamıyor.", +"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Uygulama kurulamıyor. Çünkü \"birlikte gelmeyen\" uygulamalar için <shipped>true</shipped> etiketi içeriyor", +"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Uygulama kurulamıyor çünkü info.xml/version ile uygulama markette belirtilen sürüm aynı değil", +"App directory already exists" => "Uygulama dizini zaten mevcut", +"Can't create app folder. Please fix permissions. %s" => "Uygulama dizini oluşturulamıyor. Lütfen izinleri düzeltin. %s", "Application is not enabled" => "Uygulama etkinleştirilmedi", "Authentication error" => "Kimlik doğrulama hatası", "Token expired. Please reload page." => "Jetonun süresi geçti. Lütfen sayfayı yenileyin.", "Files" => "Dosyalar", "Text" => "Metin", "Images" => "Resimler", -"%s enter the database username." => "%s veritabanı kullanıcı adını gir.", -"%s enter the database name." => "%s veritabanı adını gir.", +"%s enter the database username." => "%s veritabanı kullanıcı adını girin.", +"%s enter the database name." => "%s veritabanı adını girin.", "%s you may not use dots in the database name" => "%s veritabanı adında nokta kullanamayabilirsiniz", "MS SQL username and/or password not valid: %s" => "MS SQL kullanıcı adı ve/veya parolası geçersiz: %s", "You need to enter either an existing account or the administrator." => "Bir konto veya kullanici birlemek ihtiyacin. ", @@ -46,7 +46,7 @@ $TRANSLATIONS = array( "MySQL user '%s'@'localhost' exists already." => "MySQL kullanici '%s @local host zatan var. ", "Drop this user from MySQL" => "Bu kullanici MySQLden list disari koymak. ", "MySQL user '%s'@'%%' already exists" => "MySQL kullanici '%s @ % % zaten var (zaten yazili)", -"Drop this user from MySQL." => "Bu kulanıcıyı MySQL veritabanından kaldır", +"Drop this user from MySQL." => "Bu kullanıcıyı MySQL veritabanından kaldır", "Oracle connection could not be established" => "Oracle bağlantısı kurulamadı", "Oracle username and/or password not valid" => "Adi klullanici ve/veya parola Oracle mantikli değildir. ", "Offending command was: \"%s\", name: %s, password: %s" => "Hatalı komut: \"%s\", ad: %s, parola: %s", diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php index 906c93b567a..32e010f1d40 100644 --- a/lib/l10n/uk.php +++ b/lib/l10n/uk.php @@ -5,6 +5,8 @@ $TRANSLATIONS = array( "Settings" => "Налаштування", "Users" => "Користувачі", "Admin" => "Адмін", +"Unknown filetype" => "Невідомий тип файлу", +"Invalid image" => "Невірне зображення", "web services under your control" => "підконтрольні Вам веб-сервіси", "ZIP download is turned off." => "ZIP завантаження вимкнено.", "Files need to be downloaded one by one." => "Файли повинні бути завантаженні послідовно.", @@ -37,13 +39,13 @@ $TRANSLATIONS = array( "Please double check the <a href='%s'>installation guides</a>." => "Будь ласка, перевірте <a href='%s'>інструкції по встановленню</a>.", "Could not find category \"%s\"" => "Не вдалося знайти категорію \"%s\"", "seconds ago" => "секунди тому", -"_%n minute ago_::_%n minutes ago_" => array("","",""), -"_%n hour ago_::_%n hours ago_" => array("","",""), +"_%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" => "роки тому" ); diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php index 6d3effbf1fa..b835188661a 100644 --- a/lib/private/appframework/app.php +++ b/lib/private/appframework/app.php @@ -43,8 +43,12 @@ class App { * stored in the DI container * @param string $methodName the method that you want to call * @param DIContainer $container an instance of a pimple container. + * @param array $urlParams list of URL parameters (optional) */ - public static function main($controllerName, $methodName, IAppContainer $container) { + public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) { + if (!is_null($urlParams)) { + $container['urlParams'] = $urlParams; + } $controller = $container[$controllerName]; // initialize the dispatcher and run all the middleware before the controller diff --git a/lib/private/appframework/routing/routeactionhandler.php b/lib/private/appframework/routing/routeactionhandler.php index 7fb56f14eab..2b9dc38dc43 100644 --- a/lib/private/appframework/routing/routeactionhandler.php +++ b/lib/private/appframework/routing/routeactionhandler.php @@ -37,6 +37,6 @@ class RouteActionHandler { } public function __invoke($params) { - App::main($this->controllerName, $this->actionName, $params, $this->container); + App::main($this->controllerName, $this->actionName, $this->container, $params); } } diff --git a/lib/private/avatar.php b/lib/private/avatar.php index 814a9b22bed..e97f55eecaf 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -44,15 +44,19 @@ class OC_Avatar implements \OCP\IAvatar { /** * @brief sets the users avatar - * @param $data mixed imagedata or path to set a new avatar + * @param $data mixed OC_Image, imagedata or path to set a new avatar * @throws Exception if the provided file is not a jpg or png image * @throws Exception if the provided image is not valid * @throws \OC\NotSquareException if the image is not square * @return void */ public function set ($data) { - - $img = new OC_Image($data); + if($data instanceOf OC_Image) { + $img = $data; + $data = $img->data(); + } else { + $img = new OC_Image($data); + } $type = substr($img->mimeType(), -3); if ($type === 'peg') { $type = 'jpg'; diff --git a/lib/private/backgroundjob/job.php b/lib/private/backgroundjob/job.php index 49fbffbd684..92bd0f8fdbd 100644 --- a/lib/private/backgroundjob/job.php +++ b/lib/private/backgroundjob/job.php @@ -9,16 +9,35 @@ namespace OC\BackgroundJob; abstract class Job { + /** + * @var int $id + */ protected $id; + + /** + * @var int $lastRun + */ protected $lastRun; + + /** + * @var mixed $argument + */ protected $argument; /** * @param JobList $jobList + * @param \OC\Log $logger */ - public function execute($jobList) { + public function execute($jobList, $logger = null) { $jobList->setLastRun($this); - $this->run($this->argument); + try { + $this->run($this->argument); + } catch (\Exception $e) { + if ($logger) { + $logger->error('Error while running background job: ' . $e->getMessage()); + } + $jobList->remove($this, $this->argument); + } } abstract protected function run($argument); diff --git a/lib/private/backgroundjob/queuedjob.php b/lib/private/backgroundjob/queuedjob.php index 1714182820d..799eac47848 100644 --- a/lib/private/backgroundjob/queuedjob.php +++ b/lib/private/backgroundjob/queuedjob.php @@ -20,9 +20,10 @@ abstract class QueuedJob extends Job { * run the job, then remove it from the joblist * * @param JobList $jobList + * @param \OC\Log $logger */ - public function execute($jobList) { + public function execute($jobList, $logger = null) { $jobList->remove($this); - $this->run($this->argument); + parent::execute($jobList, $logger); } } diff --git a/lib/private/backgroundjob/timedjob.php b/lib/private/backgroundjob/timedjob.php index ae9f33505ab..09e05f1d846 100644 --- a/lib/private/backgroundjob/timedjob.php +++ b/lib/private/backgroundjob/timedjob.php @@ -31,11 +31,11 @@ abstract class TimedJob extends Job { * run the job if * * @param JobList $jobList + * @param \OC\Log $logger */ - public function execute($jobList) { + public function execute($jobList, $logger = null) { if ((time() - $this->lastRun) > $this->interval) { - $jobList->setLastRun($this); - $this->run($this->argument); + parent::execute($jobList, $logger); } } } diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 26b5d200bde..295575f0af6 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -249,7 +249,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D // allow sync clients to send the mtime along in a header $mtime = OC_Request::hasModificationTime(); if ($mtime !== false) { - if($fs->touch($this->path, $mtime)) { + if($fs->touch($targetPath, $mtime)) { header('X-OC-MTime: accepted'); } } diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php index 1c80ebe8044..65231040fb5 100644 --- a/lib/private/connector/sabre/filesplugin.php +++ b/lib/private/connector/sabre/filesplugin.php @@ -78,7 +78,19 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin * @throws Sabre_DAV_Exception_BadRequest */ public function sendFileIdHeader($filePath, Sabre_DAV_INode $node = null) { + // chunked upload handling + if (isset($_SERVER['HTTP_OC_CHUNKED'])) { + list($path, $name) = \Sabre_DAV_URLUtil::splitPath($filePath); + $info = OC_FileChunking::decodeName($name); + if (!empty($info)) { + $filePath = $path . '/' . $info['name']; + } + } + // we get the node for the given $filePath here because in case of afterCreateFile $node is the parent folder + if (!$this->server->tree->nodeExists($filePath)) { + return; + } $node = $this->server->tree->getNodeForPath($filePath); if ($node instanceof OC_Connector_Sabre_Node) { $fileId = $node->getFileId(); diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php index 416e2f55426..6378c769055 100644 --- a/lib/private/db/mdb2schemamanager.php +++ b/lib/private/db/mdb2schemamanager.php @@ -19,6 +19,8 @@ class MDB2SchemaManager { */ public function __construct($conn) { $this->conn = $conn; + $this->conn->close(); + $this->conn->connect(); } /** diff --git a/lib/private/defaults.php b/lib/private/defaults.php index 4951c6f50ae..cec9a65c7f3 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -1,15 +1,13 @@ <?php -/** - * Default strings and values which differ between the enterprise and the - * community edition. Use the get methods to always get the right strings. - */ - - if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) { require_once 'themes/' . OC_Util::getTheme() . '/defaults.php'; } +/** + * Default strings and values which differ between the enterprise and the + * community edition. Use the get methods to always get the right strings. + */ class OC_Defaults { private $theme; @@ -48,6 +46,10 @@ class OC_Defaults { return false; } + /** + * Returns the base URL + * @return string URL + */ public function getBaseUrl() { if ($this->themeExist('getBaseUrl')) { return $this->theme->getBaseUrl(); @@ -56,6 +58,10 @@ class OC_Defaults { } } + /** + * Returns the URL where the sync clients are listed + * @return string URL + */ public function getSyncClientUrl() { if ($this->themeExist('getSyncClientUrl')) { return $this->theme->getSyncClientUrl(); @@ -64,6 +70,10 @@ class OC_Defaults { } } + /** + * Returns the documentation URL + * @return string URL + */ public function getDocBaseUrl() { if ($this->themeExist('getDocBaseUrl')) { return $this->theme->getDocBaseUrl(); @@ -72,6 +82,10 @@ class OC_Defaults { } } + /** + * Returns the title + * @return string title + */ public function getTitle() { if ($this->themeExist('getTitle')) { return $this->theme->getTitle(); @@ -80,6 +94,10 @@ class OC_Defaults { } } + /** + * Returns the short name of the software + * @return string title + */ public function getName() { if ($this->themeExist('getName')) { return $this->theme->getName(); @@ -88,6 +106,10 @@ class OC_Defaults { } } + /** + * Returns entity (e.g. company name) - used for footer, copyright + * @return string entity name + */ public function getEntity() { if ($this->themeExist('getEntity')) { return $this->theme->getEntity(); @@ -96,6 +118,10 @@ class OC_Defaults { } } + /** + * Returns slogan + * @return string slogan + */ public function getSlogan() { if ($this->themeExist('getSlogan')) { return $this->theme->getSlogan(); @@ -104,6 +130,10 @@ class OC_Defaults { } } + /** + * Returns logo claim + * @return string logo claim + */ public function getLogoClaim() { if ($this->themeExist('getLogoClaim')) { return $this->theme->getLogoClaim(); @@ -112,6 +142,10 @@ class OC_Defaults { } } + /** + * Returns short version of the footer + * @return string short footer + */ public function getShortFooter() { if ($this->themeExist('getShortFooter')) { $footer = $this->theme->getShortFooter(); @@ -123,6 +157,10 @@ class OC_Defaults { return $footer; } + /** + * Returns long version of the footer + * @return string long footer + */ public function getLongFooter() { if ($this->themeExist('getLongFooter')) { $footer = $this->theme->getLongFooter(); diff --git a/lib/private/files.php b/lib/private/files.php index 8b8ff81ec5e..6ffa14c0d91 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -109,6 +109,9 @@ class OC_Files { $zip = false; $filename = $dir . '/' . $files; $name = $files; + if ($xsendfile && OC_App::isEnabled('files_encryption')) { + $xsendfile = false; + } } OC_Util::obEnd(); if ($zip or \OC\Files\Filesystem::isReadable($filename)) { diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index ac50a988e32..8e682a96b75 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -178,6 +178,10 @@ class Cache { if ($file['storage_mtime'] == 0) { $file['storage_mtime'] = $file['mtime']; } + if ($file['encrypted']) { + $file['encrypted_size'] = $file['size']; + $file['size'] = $file['unencrypted_size']; + } } return $files; } else { diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 34184c68c64..a8c069ee99f 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -286,7 +286,7 @@ class Scanner extends BasicEmitter { public function backgroundScan() { $lastPath = null; while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { - $this->scan($path); + $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG); $this->cache->correctFolderSize($path); $lastPath = $path; } diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index d45c5e17fc8..73bc30e538f 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -59,9 +59,13 @@ class Updater { */ list($storage, $internalPath) = self::resolvePath($path); if ($storage) { + $parent = dirname($internalPath); + if ($parent === '.') { + $parent = ''; + } $cache = $storage->getCache($internalPath); $cache->remove($internalPath); - $cache->correctFolderSize($internalPath); + $cache->correctFolderSize($parent); self::correctFolder($path, time()); self::correctParentStorageMtime($storage, $internalPath); } @@ -86,6 +90,12 @@ class Updater { if ($storageFrom === $storageTo) { $cache = $storageFrom->getCache($internalFrom); $cache->move($internalFrom, $internalTo); + if (pathinfo($internalFrom, PATHINFO_EXTENSION) !== pathinfo($internalTo, PATHINFO_EXTENSION)) { + // redetect mime type change + $mimeType = $storageTo->getMimeType($internalTo); + $fileId = $storageTo->getCache()->getId($internalTo); + $storageTo->getCache()->update($fileId, array('mimetype' => $mimeType)); + } $cache->correctFolderSize($internalFrom); $cache->correctFolderSize($internalTo); self::correctFolder($from, time()); diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php index 0336c27efa1..f9adda80314 100644 --- a/lib/private/files/storage/wrapper/wrapper.php +++ b/lib/private/files/storage/wrapper/wrapper.php @@ -424,4 +424,12 @@ class Wrapper implements \OC\Files\Storage\Storage { public function getETag($path) { return $this->storage->getETag($path); } + + /** + * Returns true + * @return true + */ + public function test() { + return $this->storage->test(); + } } diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 8cb56ede91b..ac45a881331 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -159,7 +159,11 @@ class View { } public function rmdir($path) { - return $this->basicOperation('rmdir', $path, array('delete')); + if ($this->is_dir($path)) { + return $this->basicOperation('rmdir', $path, array('delete')); + } else { + return false; + } } public function opendir($path) { @@ -712,7 +716,7 @@ class View { return false; } $defaultRoot = Filesystem::getRoot(); - if($this->fakeRoot === $defaultRoot){ + if ($this->fakeRoot === $defaultRoot) { return true; } return (strlen($this->fakeRoot) > strlen($defaultRoot)) && (substr($this->fakeRoot, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); diff --git a/lib/private/installer.php b/lib/private/installer.php index 9b49543c3fb..8375b231e9b 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -460,8 +460,7 @@ class OC_Installer{ ); // is the code checker enabled? - if(OC_Config::getValue('appcodechecker', false)) { - + if(OC_Config::getValue('appcodechecker', true)) { // check if grep is installed $grep = exec('which grep'); if($grep=='') { diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 2d440850459..98665c84c55 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -262,7 +262,7 @@ class OC_L10N implements \OCP\IL10N { */ public function n($text_singular, $text_plural, $count, $parameters = array()) { $this->init(); - $identifier = "_${text_singular}__${text_plural}_"; + $identifier = "_${text_singular}_::_${text_plural}_"; if( array_key_exists($identifier, $this->translations)) { return new OC_L10N_String( $this, $identifier, $parameters, $count ); } diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php index 15cace88f41..4c86d0e45e0 100644 --- a/lib/private/log/owncloud.php +++ b/lib/private/log/owncloud.php @@ -68,6 +68,8 @@ class OC_Log_Owncloud { $timezone = new DateTimeZone('UTC'); } $time = new DateTime(null, $timezone); + // remove username/passswords from URLs before writing the to the log file + $message = preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $message); $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format)); $entry = json_encode($entry); $handle = @fopen(self::$logFile, 'a'); diff --git a/lib/private/preview.php b/lib/private/preview.php index 266f7795f12..ff93f438f73 100755 --- a/lib/private/preview.php +++ b/lib/private/preview.php @@ -9,7 +9,7 @@ * Thumbnails: * structure of filename: * /data/user/thumbnails/pathhash/x-y.png - * + * */ namespace OC; @@ -40,6 +40,7 @@ class Preview { private $maxX; private $maxY; private $scalingup; + private $mimetype; //preview images object /** @@ -59,11 +60,18 @@ class Preview { * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image * @param bool $scalingUp Disable/Enable upscaling of previews - * @return mixed (bool / string) + * @return mixed (bool / string) * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingUp=true) { + //init fileviews + if($user === ''){ + $user = \OC_User::getUser(); + } + $this->fileView = new \OC\Files\View('/' . $user . '/' . $root); + $this->userView = new \OC\Files\View('/' . $user); + //set config $this->configMaxX = \OC_Config::getValue('preview_max_x', null); $this->configMaxY = \OC_Config::getValue('preview_max_y', null); @@ -75,13 +83,6 @@ class Preview { $this->setMaxY($maxY); $this->setScalingUp($scalingUp); - //init fileviews - if($user === ''){ - $user = \OC_User::getUser(); - } - $this->fileView = new \OC\Files\View('/' . $user . '/' . $root); - $this->userView = new \OC\Files\View('/' . $user); - $this->preview = null; //check if there are preview backends @@ -166,10 +167,21 @@ class Preview { */ public function setFile($file) { $this->file = $file; + if ($file !== '') { + $this->mimetype = $this->fileView->getMimeType($this->file); + } return $this; } /** + * @brief set mimetype explicitely + * @param string $mimetype + */ + public function setMimetype($mimetype) { + $this->mimetype = $mimetype; + } + + /** * @brief set the the max width of the preview * @param int $maxX * @return $this @@ -265,7 +277,7 @@ class Preview { $fileInfo = $this->fileView->getFileInfo($file); $fileId = $fileInfo['fileid']; - + $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; $this->userView->deleteAll($previewPath); $this->userView->rmdir($previewPath); @@ -274,7 +286,7 @@ class Preview { /** * @brief check if thumbnail or bigger version of thumbnail of file is cached - * @return mixed (bool / string) + * @return mixed (bool / string) * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ @@ -386,11 +398,10 @@ class Preview { } if(is_null($this->preview)) { - $mimetype = $this->fileView->getMimeType($file); $preview = null; foreach(self::$providers as $supportedMimetype => $provider) { - if(!preg_match($supportedMimetype, $mimetype)) { + if(!preg_match($supportedMimetype, $this->mimetype)) { continue; } @@ -516,7 +527,7 @@ class Preview { $cropY = 0; $image->crop($cropX, $cropY, $x, $y); - + $this->preview = $image; return; } @@ -598,7 +609,7 @@ class Preview { public static function post_write($args) { self::post_delete($args); } - + public static function post_delete($args) { $path = $args['path']; if(substr($path, 0, 1) === '/') { diff --git a/lib/private/repair.php b/lib/private/repair.php new file mode 100644 index 00000000000..e9de3baa7ce --- /dev/null +++ b/lib/private/repair.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright (c) 2013 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 OC; + +use OC\Hooks\BasicEmitter; + +class Repair extends BasicEmitter { + /** + * run a series of repair steps for common problems + * progress can be reported by emitting \OC\Repair::step events + */ + public function run() { + $this->emit('\OC\Repair', 'step', array('No repair steps configured at the moment')); + } +} diff --git a/lib/private/request.php b/lib/private/request.php index d11e5b16cfe..b2afda35922 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -136,12 +136,40 @@ class OC_Request { * @returns string Path info or false when not found */ public static function getRawPathInfo() { - $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME'])); + $requestUri = $_SERVER['REQUEST_URI']; + // remove too many leading slashes - can be caused by reverse proxy configuration + if (strpos($requestUri, '/') === 0) { + $requestUri = '/' . ltrim($requestUri, '/'); + } + // Remove the query string from REQUEST_URI - if ($pos = strpos($path_info, '?')) { - $path_info = substr($path_info, 0, $pos); + if ($pos = strpos($requestUri, '?')) { + $requestUri = substr($requestUri, 0, $pos); + } + + $scriptName = $_SERVER['SCRIPT_NAME']; + $path_info = $requestUri; + + // strip off the script name's dir and file name + list($path, $name) = \Sabre_DAV_URLUtil::splitPath($scriptName); + if (!empty($path)) { + if( $path === $path_info || strpos($path_info, $path.'/') === 0) { + $path_info = substr($path_info, strlen($path)); + } else { + throw new Exception("The requested uri($requestUri) cannot be processed by the script '$scriptName')"); + } + } + if (strpos($path_info, '/'.$name) === 0) { + $path_info = substr($path_info, strlen($name) + 1); + } + if (strpos($path_info, $name) === 0) { + $path_info = substr($path_info, strlen($name)); + } + if($path_info === '/'){ + return ''; + } else { + return $path_info; } - return $path_info; } /** diff --git a/lib/private/setup/abstractdatabase.php b/lib/private/setup/abstractdatabase.php index 0beada7bd29..84625a217ee 100644 --- a/lib/private/setup/abstractdatabase.php +++ b/lib/private/setup/abstractdatabase.php @@ -3,6 +3,10 @@ namespace OC\Setup; abstract class AbstractDatabase { + + /** + * @var \OC_L10N + */ protected $trans; protected $dbDefinitionFile; protected $dbuser; diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php index 326d7a00531..24863b9e38a 100644 --- a/lib/private/setup/oci.php +++ b/lib/private/setup/oci.php @@ -29,10 +29,10 @@ class OCI extends AbstractDatabase { \OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG); $connection = @oci_connect($this->dbuser, $this->dbpassword, $easy_connect_string); if(!$connection) { - $e = oci_error(); - if (is_array ($e) && isset ($e['message'])) { + $errorMessage = $this->getLastError(); + if ($errorMessage) { throw new \DatabaseSetupException($this->trans->t('Oracle connection could not be established'), - $e['message'].' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME') + $errorMessage.' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME') .' ORACLE_SID='.getenv('ORACLE_SID') .' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH') .' NLS_LANG='.getenv('NLS_LANG') @@ -51,7 +51,7 @@ class OCI extends AbstractDatabase { ." WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'"; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_last_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } @@ -68,25 +68,25 @@ class OCI extends AbstractDatabase { $this->dbpassword=\OC_Util::generateRandomBytes(30); //oracle passwords are treated as identifiers: - // must start with aphanumeric char + // must start with alphanumeric char // needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length. $this->dbpassword=substr($this->dbpassword, 0, 30); $this->createDBUser($connection); - \OC_Config::setValue('dbuser', $this->dbusername); - \OC_Config::setValue('dbname', $this->dbusername); + \OC_Config::setValue('dbuser', $this->dbuser); + \OC_Config::setValue('dbname', $this->dbuser); \OC_Config::setValue('dbpassword', $this->dbpassword); - //create the database not neccessary, oracle implies user = schema - //$this->createDatabase($this->dbname, $this->dbusername, $connection); + //create the database not necessary, oracle implies user = schema + //$this->createDatabase($this->dbname, $this->dbuser, $connection); } else { \OC_Config::setValue('dbuser', $this->dbuser); \OC_Config::setValue('dbname', $this->dbname); \OC_Config::setValue('dbpassword', $this->dbpassword); - //create the database not neccessary, oracle implies user = schema + //create the database not necessary, oracle implies user = schema //$this->createDatabase($this->dbname, $this->dbuser, $connection); } @@ -115,10 +115,10 @@ class OCI extends AbstractDatabase { } $query = "SELECT count(*) FROM user_tables WHERE table_name = :un"; $stmt = oci_parse($connection, $query); - $un = $this->dbtableprefix.'users'; + $un = $this->tableprefix.'users'; oci_bind_by_name($stmt, ':un', $un); if (!$stmt) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } @@ -133,25 +133,22 @@ class OCI extends AbstractDatabase { } /** - * - * @param String $name - * @param String $password * @param resource $connection */ private function createDBUser($connection) { $name = $this->dbuser; - $password = $this->password; + $password = $this->dbpassword; $query = "SELECT * FROM all_users WHERE USERNAME = :un"; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } oci_bind_by_name($stmt, ':un', $name); $result = oci_execute($stmt); if(!$result) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } @@ -162,14 +159,14 @@ class OCI extends AbstractDatabase { $query = 'CREATE USER '.$name.' IDENTIFIED BY "'.$password.'" DEFAULT TABLESPACE '.$this->dbtablespace; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } //oci_bind_by_name($stmt, ':un', $name); $result = oci_execute($stmt); if(!$result) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s', array($query, $name, $password)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); @@ -178,7 +175,7 @@ class OCI extends AbstractDatabase { $query = "ALTER USER :un IDENTIFIED BY :pw"; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } @@ -186,7 +183,7 @@ class OCI extends AbstractDatabase { oci_bind_by_name($stmt, ':pw', $password); $result = oci_execute($stmt); if(!$result) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } @@ -195,16 +192,34 @@ class OCI extends AbstractDatabase { $query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } $result = oci_execute($stmt); if(!$result) { - $entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s', array($query, $name, $password)) . '<br />'; \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } } + + /** + * @param resource $connection + * @return string + */ + protected function getLastError($connection = null) { + if ($connection) { + $error = oci_error($connection); + } else { + $error = oci_error(); + } + foreach (array('message', 'code') as $key) { + if (isset($error[$key])) { + return $error[$key]; + } + } + return ''; + } } diff --git a/lib/private/updater.php b/lib/private/updater.php index 9827d8a8c12..764a0f14120 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -37,7 +37,7 @@ class Updater extends BasicEmitter { /** * Check if a new version is available - * @param string $updateUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php' + * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php' * @return array | bool */ public function check($updaterUrl) { @@ -58,6 +58,7 @@ class Updater extends BasicEmitter { $version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); $version['edition'] = \OC_Util::getEditionString(); + $version['build'] = \OC_Util::getBuild(); $versionString = implode('x', $version); //fetch xml data from updater @@ -115,6 +116,10 @@ class Updater extends BasicEmitter { \OC_App::checkAppsRequirements(); // load all apps to also upgrade enabled apps \OC_App::loadApps(); + + $repair = new Repair(); + $repair->run(); + \OC_Config::setValue('maintenance', false); $this->emit('\OC\Updater', 'maintenanceEnd'); } diff --git a/lib/private/user.php b/lib/private/user.php index 5bd36006750..e0d6b9f3f51 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -314,7 +314,7 @@ class OC_User { * Checks if the user is logged in */ public static function isLoggedIn() { - if (\OC::$session->get('user_id')) { + if (\OC::$session->get('user_id') && self::$incognitoMode === false) { OC_App::loadApps(array('authentication')); self::setupBackends(); return self::userExists(\OC::$session->get('user_id')); @@ -353,7 +353,7 @@ class OC_User { * @return bool */ public static function isAdminUser($uid) { - if (OC_Group::inGroup($uid, 'admin')) { + if (OC_Group::inGroup($uid, 'admin') && self::$incognitoMode === false) { return true; } return false; @@ -425,6 +425,22 @@ class OC_User { } /** + * @brief Check whether user can change his avatar + * @param string $uid The username + * @return bool + * + * Check whether a specified user can change his avatar + */ + public static function canUserChangeAvatar($uid) { + $user = self::getManager()->get($uid); + if ($user) { + return $user->canChangeAvatar(); + } else { + return false; + } + } + + /** * @brief Check whether user can change his password * @param string $uid The username * @return bool diff --git a/lib/private/user/backend.php b/lib/private/user/backend.php index e9be08e429c..02c93d13bdf 100644 --- a/lib/private/user/backend.php +++ b/lib/private/user/backend.php @@ -31,13 +31,13 @@ define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501); /** * actions that user backends can define */ -define('OC_USER_BACKEND_CREATE_USER', 0x000001); -define('OC_USER_BACKEND_SET_PASSWORD', 0x000010); -define('OC_USER_BACKEND_CHECK_PASSWORD', 0x000100); -define('OC_USER_BACKEND_GET_HOME', 0x001000); -define('OC_USER_BACKEND_GET_DISPLAYNAME', 0x010000); -define('OC_USER_BACKEND_SET_DISPLAYNAME', 0x100000); - +define('OC_USER_BACKEND_CREATE_USER', 0x0000001); +define('OC_USER_BACKEND_SET_PASSWORD', 0x0000010); +define('OC_USER_BACKEND_CHECK_PASSWORD', 0x0000100); +define('OC_USER_BACKEND_GET_HOME', 0x0001000); +define('OC_USER_BACKEND_GET_DISPLAYNAME', 0x0010000); +define('OC_USER_BACKEND_SET_DISPLAYNAME', 0x0100000); +define('OC_USER_BACKEND_PROVIDE_AVATAR', 0x1000000); /** * Abstract base class for user management. Provides methods for querying backend @@ -54,6 +54,7 @@ abstract class OC_User_Backend implements OC_User_Interface { OC_USER_BACKEND_GET_HOME => 'getHome', OC_USER_BACKEND_GET_DISPLAYNAME => 'getDisplayName', OC_USER_BACKEND_SET_DISPLAYNAME => 'setDisplayName', + OC_USER_BACKEND_PROVIDE_AVATAR => 'canChangeAvatar', ); /** diff --git a/lib/private/user/user.php b/lib/private/user/user.php index e5f842944f1..e773473ec41 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -140,6 +140,18 @@ class User { } /** + * check if the backend allows the user to change his avatar on Personal page + * + * @return bool + */ + public function canChangeAvatar() { + if($this->backend->implementsActions(\OC_USER_BACKEND_PROVIDE_AVATAR)) { + return $this->backend->canChangeAvatar($this->uid); + } + return true; + } + + /** * check if the backend supports changing passwords * * @return bool diff --git a/lib/private/util.php b/lib/private/util.php index 426c5a025f3..a73564b3f68 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -437,11 +437,11 @@ class OC_Util { ); $webServerRestart = true; } - if(floatval(phpversion()) < 5.3) { + if(version_compare(phpversion(), '5.3.3', '<')) { $errors[] = array( - 'error'=>'PHP 5.3 is required.', - 'hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher.' - .' PHP 5.2 is no longer supported by ownCloud and the PHP community.' + 'error'=>'PHP 5.3.3 or higher is required.', + 'hint'=>'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.' ); $webServerRestart = true; } @@ -875,6 +875,14 @@ class OC_Util { } /** + * @brief Check if a PHP version older then 5.3.8 is installed. + * @return bool + */ + public static function isPHPoutdated() { + return version_compare(phpversion(), '5.3.8', '<'); + } + + /** * @brief Check if the ownCloud server can connect to the internet * @return bool */ @@ -1111,4 +1119,17 @@ class OC_Util { $t = explode('/', $file); return array_pop($t); } + + /** + * A human readable string is generated based on version, channel and build number + * @return string + */ + public static function getHumanVersion() { + $version = OC_Util::getVersionString().' ('.OC_Util::getChannel().')'; + $build = OC_Util::getBuild(); + if(!empty($build) and OC_Util::getChannel() === 'daily') { + $version .= ' Build:' . $build; + } + return $version; + } } diff --git a/lib/public/activity/iconsumer.php b/lib/public/activity/iconsumer.php index a0134a379dc..9afacf4e745 100644 --- a/lib/public/activity/iconsumer.php +++ b/lib/public/activity/iconsumer.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Activity/IConsumer interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Activity; diff --git a/lib/public/activity/imanager.php b/lib/public/activity/imanager.php index 90215d637c0..086e430d677 100644 --- a/lib/public/activity/imanager.php +++ b/lib/public/activity/imanager.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Activity/IManager interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Activity; @@ -47,7 +52,6 @@ interface IManager { * * $callable has to return an instance of OCA\Activity\IConsumer * - * @param string $key * @param \Closure $callable */ function registerConsumer(\Closure $callable); diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php index 6ac48bf102a..90150245c41 100644 --- a/lib/public/appframework/app.php +++ b/lib/public/appframework/app.php @@ -20,7 +20,13 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework/App class + */ + namespace OCP\AppFramework; +use OC\AppFramework\routing\RouteConfig; /** @@ -48,6 +54,28 @@ class App { } /** + * This function is to be called to create single routes and restful routes based on the given $routes array. + * + * Example code in routes.php of tasks app (it will register two restful resources): + * $routes = array( + * 'resources' => array( + * 'lists' => array('url' => '/tasklists'), + * 'tasks' => array('url' => '/tasklists/{listId}/tasks') + * ) + * ); + * + * $a = new TasksApp(); + * $a->registerRoutes($this, $routes); + * + * @param \OC_Router $router + * @param array $routes + */ + public function registerRoutes($router, $routes) { + $routeConfig = new RouteConfig($this->container, $router, $routes); + $routeConfig->register(); + } + + /** * This function is called by the routing component to fire up the frameworks dispatch mechanism. * * Example code in routes.php of the task app: diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index 320e0cfebb2..dc8da967871 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -20,6 +20,10 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework\Controller class + */ namespace OCP\AppFramework; @@ -34,16 +38,19 @@ use OCP\IRequest; abstract class Controller { /** + * app container for dependency injection * @var \OCP\AppFramework\IAppContainer */ protected $app; /** + * current request * @var \OCP\IRequest */ protected $request; /** + * constructor of the controller * @param IAppContainer $app interface to the app * @param IRequest $request an instance of the request */ diff --git a/lib/public/appframework/http.php b/lib/public/appframework/http.php index c584d4ec670..60f314202cc 100644 --- a/lib/public/appframework/http.php +++ b/lib/public/appframework/http.php @@ -20,10 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework\HTTP class + */ namespace OCP\AppFramework; - +/** + * Base class which contains constants for HTTP status codes + */ class Http { const STATUS_CONTINUE = 100; diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php index 7c2b609bc2e..b54b23a34e6 100644 --- a/lib/public/appframework/http/jsonresponse.php +++ b/lib/public/appframework/http/jsonresponse.php @@ -20,6 +20,10 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework\HTTP\JSONResponse class + */ namespace OCP\AppFramework\Http; @@ -30,10 +34,15 @@ use OCP\AppFramework\Http; */ class JSONResponse extends Response { + /** + * response data + * @var array|object + */ protected $data; /** + * constructor of JSONResponse * @param array|object $data the object or array that should be transformed * @param int $statusCode the Http status code, defaults to 200 */ @@ -55,7 +64,7 @@ class JSONResponse extends Response { /** * Sets values in the data json array - * @param array|object $params an array or object which will be transformed + * @param array|object $data an array or object which will be transformed * to JSON */ public function setData($data){ diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php index f776878a814..0f5a18ca4fe 100644 --- a/lib/public/appframework/http/response.php +++ b/lib/public/appframework/http/response.php @@ -20,6 +20,10 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework\HTTP\Response class + */ namespace OCP\AppFramework\Http; diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php index 6156f8062fc..2200a38beca 100644 --- a/lib/public/appframework/http/templateresponse.php +++ b/lib/public/appframework/http/templateresponse.php @@ -20,6 +20,10 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework\HTTP\TemplateResponse class + */ namespace OCP\AppFramework\Http; @@ -29,14 +33,34 @@ namespace OCP\AppFramework\Http; */ class TemplateResponse extends Response { + /** + * name of the template + * @var string + */ protected $templateName; + + /** + * parameters + * @var array + */ protected $params; + + /** + * rendering type (admin, user, blank) + * @var string + */ protected $renderAs; + + /** + * app name + * @var string + */ protected $appName; /** - * @param string $templateName the name of the template + * constructor of TemplateResponse * @param string $appName the name of the app to load the template from + * @param string $templateName the name of the template */ public function __construct($appName, $templateName) { $this->templateName = $templateName; diff --git a/lib/public/appframework/iapi.php b/lib/public/appframework/iapi.php index a22b056635e..963e870f79b 100644 --- a/lib/public/appframework/iapi.php +++ b/lib/public/appframework/iapi.php @@ -20,6 +20,10 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework/IApi interface + */ namespace OCP\AppFramework; diff --git a/lib/public/appframework/middleware.php b/lib/public/appframework/middleware.php index c4ee1c0dbae..24f31939935 100644 --- a/lib/public/appframework/middleware.php +++ b/lib/public/appframework/middleware.php @@ -20,6 +20,10 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework\Middleware class + */ namespace OCP\AppFramework; diff --git a/lib/public/authentication/iapachebackend.php b/lib/public/authentication/iapachebackend.php index 2d2f8c4e486..3979a14302e 100644 --- a/lib/public/authentication/iapachebackend.php +++ b/lib/public/authentication/iapachebackend.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Authentication/IApacheBackend interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Authentication; diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php index 3bfbca7be50..973d48be5ec 100644 --- a/lib/public/contacts/imanager.php +++ b/lib/public/contacts/imanager.php @@ -119,11 +119,15 @@ namespace OCP\Contacts { function isEnabled(); /** + * Registers an address book + * * @param \OCP\IAddressBook $address_book */ function registerAddressBook(\OCP\IAddressBook $address_book); /** + * Unregisters an address book + * * @param \OCP\IAddressBook $address_book */ function unregisterAddressBook(\OCP\IAddressBook $address_book); diff --git a/lib/public/db.php b/lib/public/db.php index b9424b53862..c9997c79c3c 100644 --- a/lib/public/db.php +++ b/lib/public/db.php @@ -37,6 +37,8 @@ class DB { /** * Prepare a SQL query * @param string $query Query string + * @param int $limit Limit of the SQL statement + * @param int $offset Offset of the SQL statement * @return \MDB2_Statement_Common prepared SQL query * * SQL query via MDB2 prepare(), needs to be execute()'d! diff --git a/lib/public/defaults.php b/lib/public/defaults.php index 8f7853a86a3..34b68903ee8 100644 --- a/lib/public/defaults.php +++ b/lib/public/defaults.php @@ -30,19 +30,27 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP; -/* +/** * public api to access default strings and urls for your templates */ class Defaults { + /** + * \OC_Defaults instance to retrieve the defaults + * @return string + */ private $defaults; + /** + * creates a \OC_Defaults instance which is used in all methods to retrieve the + * actual defaults + */ function __construct() { $this->defaults = new \OC_Defaults(); } /** - * @breif get base URL for the organisation behind your ownCloud instance + * get base URL for the organisation behind your ownCloud instance * @return string */ public function getBaseUrl() { @@ -50,7 +58,7 @@ class Defaults { } /** - * @breif link to the desktop sync client + * link to the desktop sync client * @return string */ public function getSyncClientUrl() { @@ -58,7 +66,7 @@ class Defaults { } /** - * @breif base URL to the documentation of your ownCloud instance + * base URL to the documentation of your ownCloud instance * @return string */ public function getDocBaseUrl() { @@ -66,7 +74,7 @@ class Defaults { } /** - * @breif name of your ownCloud instance + * name of your ownCloud instance * @return string */ public function getName() { @@ -74,7 +82,7 @@ class Defaults { } /** - * @breif Entity behind your onwCloud instance + * Entity behind your onwCloud instance * @return string */ public function getEntity() { @@ -82,7 +90,7 @@ class Defaults { } /** - * @breif ownCloud slogan + * ownCloud slogan * @return string */ public function getSlogan() { @@ -90,7 +98,7 @@ class Defaults { } /** - * @breif logo claim + * logo claim * @return string */ public function getLogoClaim() { @@ -98,7 +106,7 @@ class Defaults { } /** - * @breif footer, short version + * footer, short version * @return string */ public function getShortFooter() { @@ -106,7 +114,7 @@ class Defaults { } /** - * @breif footer, long version + * footer, long version * @return string */ public function getLongFooter() { diff --git a/lib/public/files/alreadyexistsexception.php b/lib/public/files/alreadyexistsexception.php index 3132e3b0c31..7bea947aef0 100644 --- a/lib/public/files/alreadyexistsexception.php +++ b/lib/public/files/alreadyexistsexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/AlreadyExistsException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for already existing files/folders + */ class AlreadyExistsException extends \Exception {} diff --git a/lib/public/files/entitytoolargeexception.php b/lib/public/files/entitytoolargeexception.php index e0d93ccbcd0..eaa68a548b9 100644 --- a/lib/public/files/entitytoolargeexception.php +++ b/lib/public/files/entitytoolargeexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/EntityTooLargeException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for too large entity + */ class EntityTooLargeException extends \Exception {} diff --git a/lib/public/files/file.php b/lib/public/files/file.php index 730213039d0..c6cda59f9b0 100644 --- a/lib/public/files/file.php +++ b/lib/public/files/file.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/File interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; diff --git a/lib/public/files/folder.php b/lib/public/files/folder.php index 5c9785db571..7fec1c529a5 100644 --- a/lib/public/files/folder.php +++ b/lib/public/files/folder.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/Folder interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; diff --git a/lib/public/files/invalidcontentexception.php b/lib/public/files/invalidcontentexception.php index 2e1356e2ba3..3dfe7378c4d 100644 --- a/lib/public/files/invalidcontentexception.php +++ b/lib/public/files/invalidcontentexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/InvalidContentException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for invalid content + */ class InvalidContentException extends \Exception {} diff --git a/lib/public/files/invalidpathexception.php b/lib/public/files/invalidpathexception.php index 893eb1e43f8..8ecfa7d89ad 100644 --- a/lib/public/files/invalidpathexception.php +++ b/lib/public/files/invalidpathexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/InvalidPathException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for invalid path + */ class InvalidPathException extends \Exception {} diff --git a/lib/public/files/node.php b/lib/public/files/node.php index e38bfa3b2ef..972b1cfa492 100644 --- a/lib/public/files/node.php +++ b/lib/public/files/node.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/Node interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; diff --git a/lib/public/files/notenoughspaceexception.php b/lib/public/files/notenoughspaceexception.php index 1597a4518b0..17f91b31bfc 100644 --- a/lib/public/files/notenoughspaceexception.php +++ b/lib/public/files/notenoughspaceexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/NotEnoughSpaceException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for not enough space + */ class NotEnoughSpaceException extends \Exception {} diff --git a/lib/public/files/notfoundexception.php b/lib/public/files/notfoundexception.php index 489e43fc5fb..cb35199220b 100644 --- a/lib/public/files/notfoundexception.php +++ b/lib/public/files/notfoundexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/NotFoundException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for not found entity + */ class NotFoundException extends \Exception {} diff --git a/lib/public/files/notpermittedexception.php b/lib/public/files/notpermittedexception.php index a5be43dbf57..e37bd6fad3c 100644 --- a/lib/public/files/notpermittedexception.php +++ b/lib/public/files/notpermittedexception.php @@ -20,8 +20,16 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/NotPermittedException class + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; +/** + * Exception for not permitted action + */ class NotPermittedException extends \Exception {} diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php index 7a7d5ec1efc..194b42a6481 100644 --- a/lib/public/files/storage.php +++ b/lib/public/files/storage.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * Files/Storage interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; diff --git a/lib/public/iaddressbook.php b/lib/public/iaddressbook.php index 77e8750d9da..dcfe08012e6 100644 --- a/lib/public/iaddressbook.php +++ b/lib/public/iaddressbook.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * IAddressBook interface + */ + // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP { diff --git a/lib/public/icontainer.php b/lib/public/icontainer.php index 6b7052cc4f4..eaffa5d5a06 100644 --- a/lib/public/icontainer.php +++ b/lib/public/icontainer.php @@ -64,7 +64,7 @@ interface IContainer { * In case the parameter is false the service will be recreated on every call. * * @param string $name - * @param callable $closure + * @param \Closure $closure * @param bool $shared * @return void */ diff --git a/lib/public/idbconnection.php b/lib/public/idbconnection.php index 17e3de0ffe7..656b5e7e5b2 100644 --- a/lib/public/idbconnection.php +++ b/lib/public/idbconnection.php @@ -45,7 +45,7 @@ interface IDBConnection { /** * Used to get the id of the just inserted element - * @param string $tableName the name of the table where we inserted the item + * @param string $table the name of the table where we inserted the item * @return int the id of the inserted element */ public function lastInsertId($table = null); diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 36296a59850..b958d2d03f4 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -100,11 +100,15 @@ interface IServerContainer { function getUserSession(); /** + * Returns the navigation manager + * * @return \OCP\INavigationManager */ function getNavigationManager(); /** + * Returns the config manager + * * @return \OCP\IConfig */ function getConfig(); @@ -117,11 +121,15 @@ interface IServerContainer { function getL10N($app); /** + * Returns the URL generator + * * @return \OCP\IURLGenerator */ function getURLGenerator(); /** + * Returns the Helper + * * @return \OCP\IHelper */ function getHelper(); @@ -155,7 +163,8 @@ interface IServerContainer { function getDatabaseConnection(); /** - * @brief Returns an avatar manager, used for avatar functionality + * Returns an avatar manager, used for avatar functionality + * * @return \OCP\IAvatarManager */ function getAvatarManager(); diff --git a/lib/public/share.php b/lib/public/share.php index caa274b8579..6b3397c85c6 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -244,7 +244,9 @@ class Share { * Get the items of item type shared with the current user * @param string Item type * @param int Format (optional) Format type must be defined by the backend + * @param mixed Parameters (optional) * @param int Number of items to return (optional) Returns all by default + * @param bool include collections (optional) * @return Return depends on format */ public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, @@ -256,8 +258,10 @@ class Share { /** * Get the item of item type shared with the current user * @param string $itemType - * @param string $ItemTarget + * @param string $itemTarget * @param int $format (optional) Format type must be defined by the backend + * @param mixed Parameters (optional) + * @param bool include collections (optional) * @return Return depends on format */ public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE, @@ -268,8 +272,8 @@ class Share { /** * Get the item of item type shared with a given user by source - * @param string $ItemType - * @param string $ItemSource + * @param string $itemType + * @param string $itemSource * @param string $user User user to whom the item was shared * @return array Return list of items with file_target, permissions and expiration */ @@ -419,11 +423,13 @@ class Share { * @param string Item source * @param string Owner * @param bool Include collections + * @praram bool check expire date * @return Return array of users */ - public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false) { + public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) { + $users = array(); - $items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections); + $items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections, false, $checkExpireDate); if ($items) { foreach ($items as $item) { if ((int)$item['share_type'] === self::SHARE_TYPE_USER) { @@ -823,11 +829,12 @@ class Share { $date = null; } else { $date = new \DateTime($date); - $date = date('Y-m-d H:i', $date->format('U') - $date->getOffset()); } $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); + $query->bindValue(1, $date, 'datetime'); foreach ($items as $item) { - $query->execute(array($date, $item['id'])); + $query->bindValue(2, (int) $item['id']); + $query->execute(); } return true; } @@ -843,7 +850,8 @@ class Share { protected static function expireItem(array $item) { if (!empty($item['expiration'])) { $now = new \DateTime(); - $expirationDate = new \DateTime($item['expiration'], new \DateTimeZone('UTC')); + $expirationDate = \Doctrine\DBAL\Types\Type::getType('datetime') + ->convertToPhpValue($item['expiration'], \OC_DB::getConnection()->getDatabasePlatform()); if ($now > $expirationDate) { self::unshareItem($item); return true; @@ -860,12 +868,14 @@ class Share { protected static function unshareItem(array $item) { // Pass all the vars we have for now, they may be useful $hookParams = array( - 'itemType' => $item['item_type'], - 'itemSource' => $item['item_source'], - 'shareType' => $item['share_type'], - 'shareWith' => $item['share_with'], - 'itemParent' => $item['parent'], + 'itemType' => $item['item_type'], + 'itemSource' => $item['item_source'], + 'shareType' => $item['share_type'], + 'shareWith' => $item['share_with'], + 'itemParent' => $item['parent'], + 'uidOwner' => $item['uid_owner'], ); + \OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams + array( 'fileSource' => $item['file_source'], )); @@ -954,6 +964,8 @@ class Share { * @param mixed Parameters to pass to formatItems() * @param int Number of items to return, -1 to return all matches (optional) * @param bool Include collection item types (optional) + * @param bool TODO (optional) + * @prams bool check expire date * @return mixed * * See public functions getItem(s)... for parameter usage @@ -961,7 +973,7 @@ class Share { */ private static function getItems($itemType, $item = null, $shareType = null, $shareWith = null, $uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, - $includeCollections = false, $itemShareWithBySource = false) { + $includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) { if (!self::isEnabled()) { if ($limit == 1 || (isset($uidOwner) && isset($item))) { return false; @@ -1101,19 +1113,19 @@ class Share { if ($format == self::FORMAT_STATUSES) { if ($itemType == 'file' || $itemType == 'folder') { $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,' - .' `share_type`, `file_source`, `path`, `expiration`, `storage`, `mail_send`'; + .' `share_type`, `file_source`, `path`, `expiration`, `storage`, `share_with`, `mail_send`, `uid_owner`'; } else { - $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`, `mail_send`'; + $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `expiration`, `mail_send`, `uid_owner`'; } } else { if (isset($uidOwner)) { if ($itemType == 'file' || $itemType == 'folder') { $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,' .' `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`,' - .' `expiration`, `token`, `storage`, `mail_send`'; + .' `expiration`, `token`, `storage`, `mail_send`, `uid_owner`'; } else { $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`,' - .' `stime`, `file_source`, `expiration`, `token`, `mail_send`'; + .' `stime`, `file_source`, `expiration`, `token`, `mail_send`, `uid_owner`'; } } else { if ($fileDependent) { @@ -1227,8 +1239,10 @@ class Share { } } } - if (self::expireItem($row)) { - continue; + if($checkExpireDate) { + if (self::expireItem($row)) { + continue; + } } // Check if resharing is allowed, if not remove share permission if (isset($row['permissions']) && !self::isResharingAllowed()) { @@ -1354,8 +1368,11 @@ class Share { * @param string Item source * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK * @param string User or group the item is being shared with + * @param string User that is the owner of shared item * @param int CRUDS permissions * @param bool|array Parent folder target (optional) + * @param string token (optional) + * @param string name of the source item (optional) * @return bool Returns true on success or false on failure */ private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, @@ -1593,6 +1610,7 @@ class Share { * @param string Item source * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK * @param string User or group the item is being shared with + * @param string User that is the owner of shared item * @param string The suggested target originating from a reshare (optional) * @param int The id of the parent group share (optional) * @return string Item target @@ -1780,6 +1798,7 @@ class Share { */ /** + * Function that is called after a user is deleted. Cleans up the shares of that user. * @param array arguments */ public static function post_deleteUser($arguments) { @@ -1796,6 +1815,8 @@ class Share { } /** + * Function that is called after a user is added to a group. + * TODO what does it do? * @param array arguments */ public static function post_addToGroup($arguments) { @@ -1829,6 +1850,7 @@ class Share { } /** + * Function that is called after a user is removed from a group. Shares are cleaned up. * @param array arguments */ public static function post_removeFromGroup($arguments) { @@ -1848,6 +1870,7 @@ class Share { } /** + * Function that is called after a group is removed. Cleans up the shares to that group. * @param array arguments */ public static function post_deleteGroup($arguments) { @@ -1894,7 +1917,7 @@ interface Share_Backend { * Converts the shared item sources back into the item in the specified format * @param array Shared items * @param int Format - * @return ? + * @return TODO * * The items array is a 3-dimensional array with the item_source as the * first key and the share id as the second key to an array with the share @@ -1923,6 +1946,8 @@ interface Share_Backend_File_Dependent extends Share_Backend { /** * Get the file path of the item + * @param string Item source + * @param string User that is the owner of shared item */ public function getFilePath($itemSource, $uidOwner); |