diff options
Diffstat (limited to 'lib')
52 files changed, 417 insertions, 62 deletions
diff --git a/lib/base.php b/lib/base.php index 865d174d212..2feedd81d8c 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) { diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php index 0e44dd2a4bd..c9d9e50a2f0 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ě v 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 7ab0345209c..5b09d350a7d 100644 --- a/lib/l10n/de.php +++ b/lib/l10n/de.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Die Dateien müssen einzeln heruntergeladen werden.", "Back to Files" => "Zurück zu \"Dateien\"", "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 path specified when installing app from local file" => "Bei der Installation der Applikation aus einer lokalen Datei wurde kein Pfad angegeben", diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php index b14bafbf69d..e76718b4117 100644 --- a/lib/l10n/de_DE.php +++ b/lib/l10n/de_DE.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Die Dateien müssen einzeln heruntergeladen werden.", "Back to Files" => "Zurück zu \"Dateien\"", "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 laden Sie die Dateien einzeln in kleineren Teilen herunter oder bitten Sie Ihren 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 path specified when installing app from local file" => "Bei der Installation der Applikation aus einer lokalen Datei wurde kein Pfad angegeben", diff --git a/lib/l10n/el.php b/lib/l10n/el.php index f620e1b3542..d536b699a9e 100644 --- a/lib/l10n/el.php +++ b/lib/l10n/el.php @@ -42,7 +42,7 @@ $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 minute ago_::_%n minutes ago_" => array("","%n λεπτά πριν"), "_%n hour ago_::_%n hours ago_" => array("",""), "today" => "σήμερα", "yesterday" => "χτες", diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php index 9cdeb390218..7340ee72c28 100644 --- a/lib/l10n/et_EE.php +++ b/lib/l10n/et_EE.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Failid tuleb alla laadida ükshaaval.", "Back to Files" => "Tagasi failide juurde", "Selected files too large to generate zip file." => "Valitud failid on ZIP-faili loomiseks liiga suured.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Palun laadi failid alla eraldi väiksemate osadena või palu abi oma süsteemihaldurilt.", "No source specified when installing app" => "Ühegi lähteallikat pole rakendi paigalduseks määratletud", "No href specified when installing app from http" => "Ühtegi aadressi pole määratletud rakendi paigalduseks veebist", "No path specified when installing app from local file" => "Ühtegi teed pole määratletud paigaldamaks rakendit kohalikust failist", 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/gl.php b/lib/l10n/gl.php index d6366022e69..cf13408b2cd 100644 --- a/lib/l10n/gl.php +++ b/lib/l10n/gl.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "Os ficheiros necesitan seren descargados dun en un.", "Back to Files" => "Volver aos ficheiros", "Selected files too large to generate zip file." => "Os ficheiros seleccionados son demasiado grandes como para xerar un ficheiro zip.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Descargue os ficheiros en fragmentos máis pequenos e por separado, ou pídallos amabelmente ao seu administrador.", "No source specified when installing app" => "Non foi especificada ningunha orixe ao instalar aplicativos", "No href specified when installing app from http" => "Non foi especificada ningunha href ao instalar aplicativos", "No path specified when installing app from local file" => "Non foi especificada ningunha ruta ao instalar aplicativos desde un ficheiro local", diff --git a/lib/l10n/it.php b/lib/l10n/it.php index 2a1be30c7c9..b1259a0a874 100644 --- a/lib/l10n/it.php +++ b/lib/l10n/it.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Files need to be downloaded one by one." => "I file devono essere scaricati uno alla volta.", "Back to Files" => "Torna ai file", "Selected files too large to generate zip file." => "I file selezionati sono troppo grandi per generare un file zip.", +"Please download the files separately in smaller chunks or kindly ask your administrator." => "Scarica i file separatamente in blocchi più piccoli o chiedi al tuo amministratore.", "No source specified when installing app" => "Nessuna fonte specificata durante l'installazione dell'applicazione", "No href specified when installing app from http" => "Nessun href specificato durante l'installazione dell'applicazione da http", "No path specified when installing app from local file" => "Nessun percorso specificato durante l'installazione dell'applicazione da file locale", diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php index 56be601f54d..49c9c6a3b29 100644 --- a/lib/l10n/sl.php +++ b/lib/l10n/sl.php @@ -1,5 +1,6 @@ <?php $TRANSLATIONS = array( +"No app name specified" => "Ni podanega imena programa", "Help" => "Pomoč", "Personal" => "Osebno", "Settings" => "Nastavitve", @@ -14,6 +15,10 @@ $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.", +"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", "App directory already exists" => "Programska mapa že obstaja", "Application is not enabled" => "Program ni omogočen", "Authentication error" => "Napaka overjanja", 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/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/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/cache/cache.php b/lib/private/files/cache/cache.php index 8c34fa58540..ac50a988e32 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -507,7 +507,7 @@ class Cache { $entry = $this->get($path); if ($entry && $entry['mimetype'] === 'httpd/unix-directory') { $id = $entry['fileid']; - $sql = 'SELECT SUM(`size`), MIN(`size`) FROM `*PREFIX*filecache` '. + $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 FROM `*PREFIX*filecache` '. 'WHERE `parent` = ? AND `storage` = ?'; $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); if ($row = $result->fetchRow()) { diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index da223567001..d45c5e17fc8 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -142,7 +142,7 @@ class Updater { $cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath))); if ($realPath !== '') { $realPath = dirname($realPath); - if($realPath === '/') { + if($realPath === DIRECTORY_SEPARATOR ) { $realPath = ""; } // check storage for parent in case we change the storage in this step diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index f99bbc9ae5e..678bf419023 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -51,6 +51,19 @@ abstract class Common implements \OC\Files\Storage\Storage { } } + public function isReadable($path) { + // at least check whether it exists + // subclasses might want to implement this more thoroughly + return $this->file_exists($path); + } + + public function isUpdatable($path) { + // at least check whether it exists + // subclasses might want to implement this more thoroughly + // a non-existing file/folder isn't updatable + return $this->file_exists($path); + } + public function isCreatable($path) { if ($this->is_dir($path) && $this->isUpdatable($path)) { return true; diff --git a/lib/private/image.php b/lib/private/image.php index b5ae1165f8e..7761a3c7737 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -414,61 +414,60 @@ class OC_Image { */ public function loadFromFile($imagePath=false) { // exif_imagetype throws "read error!" if file is less than 12 byte - $absPath = \OC\Files\Filesystem::getLocalFile($imagePath); - if(!@is_file($absPath) || !file_exists($absPath) || filesize($absPath) < 12 || !is_readable($absPath)) { + if(!@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) { // Debug output disabled because this method is tried before loadFromBase64? - OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$absPath, OC_Log::DEBUG); + OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagePath, OC_Log::DEBUG); return false; } - $iType = exif_imagetype($absPath); + $iType = exif_imagetype($imagePath); switch ($iType) { case IMAGETYPE_GIF: if (imagetypes() & IMG_GIF) { - $this->resource = imagecreatefromgif($absPath); + $this->resource = imagecreatefromgif($imagePath); } else { OC_Log::write('core', - 'OC_Image->loadFromFile, GIF images not supported: '.$absPath, + 'OC_Image->loadFromFile, GIF images not supported: '.$imagePath, OC_Log::DEBUG); } break; case IMAGETYPE_JPEG: if (imagetypes() & IMG_JPG) { - $this->resource = imagecreatefromjpeg($absPath); + $this->resource = imagecreatefromjpeg($imagePath); } else { OC_Log::write('core', - 'OC_Image->loadFromFile, JPG images not supported: '.$absPath, + 'OC_Image->loadFromFile, JPG images not supported: '.$imagePath, OC_Log::DEBUG); } break; case IMAGETYPE_PNG: if (imagetypes() & IMG_PNG) { - $this->resource = imagecreatefrompng($absPath); + $this->resource = imagecreatefrompng($imagePath); } else { OC_Log::write('core', - 'OC_Image->loadFromFile, PNG images not supported: '.$absPath, + 'OC_Image->loadFromFile, PNG images not supported: '.$imagePath, OC_Log::DEBUG); } break; case IMAGETYPE_XBM: if (imagetypes() & IMG_XPM) { - $this->resource = imagecreatefromxbm($absPath); + $this->resource = imagecreatefromxbm($imagePath); } else { OC_Log::write('core', - 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$absPath, + 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath, OC_Log::DEBUG); } break; case IMAGETYPE_WBMP: if (imagetypes() & IMG_WBMP) { - $this->resource = imagecreatefromwbmp($absPath); + $this->resource = imagecreatefromwbmp($imagePath); } else { OC_Log::write('core', - 'OC_Image->loadFromFile, WBMP images not supported: '.$absPath, + 'OC_Image->loadFromFile, WBMP images not supported: '.$imagePath, OC_Log::DEBUG); } break; case IMAGETYPE_BMP: - $this->resource = $this->imagecreatefrombmp($absPath); + $this->resource = $this->imagecreatefrombmp($imagePath); break; /* case IMAGETYPE_TIFF_II: // (intel byte order) @@ -497,7 +496,7 @@ class OC_Image { default: // this is mostly file created from encrypted file - $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents($imagePath)); + $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath))); $iType = IMAGETYPE_PNG; OC_Log::write('core', 'OC_Image->loadFromFile, Default', OC_Log::DEBUG); break; 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/movies.php b/lib/private/preview/movies.php index 28f130f7506..ac771deb413 100644 --- a/lib/private/preview/movies.php +++ b/lib/private/preview/movies.php @@ -46,17 +46,19 @@ if (!\OC_Util::runningOnWindows()) { $handle = $fileview->fopen($path, 'rb'); - $firstmb = stream_get_contents($handle, 1048576); //1024 * 1024 = 1048576 + // we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB. + // in some cases 1MB was no enough to generate thumbnail + $firstmb = stream_get_contents($handle, 5242880); file_put_contents($absPath, $firstmb); if (self::$avconvBinary) { - $cmd = self::$avconvBinary . ' -an -y -ss 1'. + $cmd = self::$avconvBinary . ' -an -y -ss 5'. ' -i ' . escapeshellarg($absPath) . - ' -f mjpeg -vframes 1 ' . escapeshellarg($tmpPath) . + ' -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) . ' > /dev/null 2>&1'; } else { - $cmd = self::$ffmpegBinary . ' -y -ss 1' . + $cmd = self::$ffmpegBinary . ' -y -ss 5' . ' -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1' . ' -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . 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 df33217f95d..37d918d2032 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -9,6 +9,7 @@ class OC_Request { /** * @brief Check overwrite condition + * @param string $type * @returns bool */ private static function isOverwriteCondition($type = '') { @@ -99,7 +100,7 @@ class OC_Request { public static function scriptName() { $name = $_SERVER['SCRIPT_NAME']; if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) { - $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -4)); + $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -strlen('lib/private/'))); $suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot))); $name = OC_Config::getValue('overwritewebroot', '') . $suburi; } @@ -135,12 +136,36 @@ 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); } - return $path_info; + + $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)); + } + return rtrim($path_info, '/'); } /** 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 d4be8eb9bd4..210e5ed3f02 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -54,6 +54,9 @@ class OC_User { private static $_setupedBackends = array(); + // bool, stores if a user want to access a resource anonymously, e.g if he opens a public link + private static $incognitoMode = false; + /** * @brief registers backend * @param string $backend name of the backend @@ -320,6 +323,15 @@ class OC_User { } /** + * @brief set incognito mode, e.g. if a user wants to open a public link + * @param bool $status + */ + public static function setIncognitoMode($status) { + self::$incognitoMode = $status; + + } + + /** * Supplies an attribute to the logout hyperlink. The default behaviour * is to return an href with '?logout=true' appended. However, it can * supply any attribute(s) which are valid for <a>. @@ -354,7 +366,7 @@ class OC_User { */ public static function getUser() { $uid = OC::$session ? OC::$session->get('user_id') : null; - if (!is_null($uid)) { + if (!is_null($uid) && self::$incognitoMode === false) { return $uid; } else { return false; diff --git a/lib/private/util.php b/lib/private/util.php index 426c5a025f3..b5c5546da35 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1111,4 +1111,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..0ff6648c5d4 100644 --- a/lib/public/appframework/app.php +++ b/lib/public/appframework/app.php @@ -20,6 +20,11 @@ * */ +/** + * Public interface of ownCloud for apps to use. + * AppFramework/App class + */ + namespace OCP\AppFramework; 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/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/share.php b/lib/public/share.php index caa274b8579..6178a5ae043 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -256,7 +256,7 @@ 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 * @return Return depends on format */ @@ -268,8 +268,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 */ |