diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 38 | ||||
-rw-r--r-- | lib/connector/sabre/node.php | 32 | ||||
-rw-r--r-- | lib/eventsource.php | 2 | ||||
-rw-r--r-- | lib/files.php | 2 | ||||
-rw-r--r-- | lib/filesystemview.php | 1 | ||||
-rw-r--r-- | lib/helper.php | 1 | ||||
-rw-r--r-- | lib/l10n/eu.php | 7 | ||||
-rw-r--r-- | lib/l10n/fr.php | 6 | ||||
-rw-r--r-- | lib/l10n/pl.php | 6 | ||||
-rw-r--r-- | lib/l10n/uk.php | 10 | ||||
-rw-r--r-- | lib/l10n/zh_TW.php | 7 | ||||
-rw-r--r-- | lib/public/share.php | 73 | ||||
-rwxr-xr-x | lib/util.php | 21 |
13 files changed, 141 insertions, 65 deletions
diff --git a/lib/base.php b/lib/base.php index 6cde9fc59fb..d6f263b3390 100644 --- a/lib/base.php +++ b/lib/base.php @@ -439,13 +439,9 @@ class OC{ //setup extra user backends OC_User::setupBackends(); - // register cache cleanup jobs - OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc'); - OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener'); - - // Check for blacklisted files - OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted'); - OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); + self::registerCacheHooks(); + self::registerFilesystemHooks(); + self::registerShareHooks(); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); @@ -481,6 +477,34 @@ class OC{ } /** + * register hooks for the cache + */ + public static function registerCacheHooks() { + // register cache cleanup jobs + OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc'); + OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener'); + } + + /** + * register hooks for the filesystem + */ + public static function registerFilesystemHooks() { + // Check for blacklisted files + OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted'); + OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); + } + + /** + * register hooks for sharing + */ + public static function registerShareHooks() { + OC_Hook::connect('OC_User', 'post_deleteUser', 'OCP\Share', 'post_deleteUser'); + OC_Hook::connect('OC_User', 'post_addToGroup', 'OCP\Share', 'post_addToGroup'); + OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OCP\Share', 'post_removeFromGroup'); + OC_Hook::connect('OC_User', 'post_deleteGroup', 'OCP\Share', 'post_deleteGroup'); + } + + /** * @brief Handle the request */ public static function handleRequest() { diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index d0ab0c24988..ad08bd434f2 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -50,8 +50,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr protected $property_cache = null; /** - * Sets up the node, expects a full path name - * + * @brief Sets up the node, expects a full path name * @param string $path * @return void */ @@ -62,8 +61,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr /** - * Returns the name of the node - * + * @brief Returns the name of the node * @return string */ public function getName() { @@ -74,8 +72,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } /** - * Renames the node - * + * @brief Renames the node * @param string $name The new name * @return void */ @@ -102,7 +99,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } /** - * Make sure the fileinfo cache is filled. Uses the file cache or a direct stat + * @brief Ensure that the fileinfo cache is filled + & @note Uses OC_FileCache or a direct stat */ protected function getFileinfoCache() { if (!isset($this->fileinfo_cache)) { @@ -121,8 +119,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } /** - * Returns the last modification time, as a unix timestamp - * + * @brief Returns the last modification time, as a unix timestamp * @return int */ public function getLastModified() { @@ -141,8 +138,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } /** - * Updates properties on this node, - * + * @brief Updates properties on this node, * @param array $mutations * @see Sabre_DAV_IProperties::updateProperties * @return bool|array @@ -177,15 +173,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } /** - * Returns a list of properties for this nodes.; - * - * The properties list is a list of propertynames the client requested, - * encoded as xmlnamespace#tagName, for example: - * http://www.example.org/namespace#author - * If the array is empty, all properties should be returned - * + * @brief Returns a list of properties for this nodes.; * @param array $properties * @return array + * @note The properties list is a list of propertynames the client + * requested, encoded as xmlnamespace#tagName, for example: + * http://www.example.org/namespace#author If the array is empty, all + * properties should be returned */ public function getProperties($properties) { if (is_null($this->property_cache)) { @@ -227,7 +221,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } /** - * Remove the ETag from the cache. + * @brief Remove the ETag from the cache. * @param string $path Path of the file */ static public function removeETagPropertyForPath($path) { diff --git a/lib/eventsource.php b/lib/eventsource.php index 578441ee707..1b8033943a1 100644 --- a/lib/eventsource.php +++ b/lib/eventsource.php @@ -32,7 +32,7 @@ class OC_EventSource{ private $fallBackId=0; public function __construct() { - @ob_end_clean(); + OC_Util::obEnd(); header('Cache-Control: no-cache'); $this->fallback=isset($_GET['fallback']) and $_GET['fallback']=='true'; if($this->fallback) { diff --git a/lib/files.php b/lib/files.php index 323d7ddb7e8..a2387368241 100644 --- a/lib/files.php +++ b/lib/files.php @@ -99,7 +99,7 @@ class OC_Files { $zip = false; $filename = $dir . '/' . $files; } - @ob_end_clean(); + OC_Util::obEnd(); if ($zip or \OC\Files\Filesystem::isReadable($filename)) { header('Content-Disposition: attachment; filename="' . basename($filename) . '"'); header('Content-Transfer-Encoding: binary'); diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 37e2a737e04..d6bca62e06a 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com> * This file is licensed under the Affero General Public License version 3 or diff --git a/lib/helper.php b/lib/helper.php index 536b70b074a..269850e7810 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -758,5 +758,4 @@ class OC_Helper { } return $str; } - } diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php index ae1a89eb854..5d47ecbda23 100644 --- a/lib/l10n/eu.php +++ b/lib/l10n/eu.php @@ -14,16 +14,21 @@ "Token expired. Please reload page." => "Tokena iraungitu da. Mesedez birkargatu orria.", "Files" => "Fitxategiak", "Text" => "Testua", +"Images" => "Irudiak", "seconds ago" => "orain dela segundu batzuk", "1 minute ago" => "orain dela minutu 1", "%d minutes ago" => "orain dela %d minutu", +"1 hour ago" => "orain dela ordu bat", +"%d hours ago" => "orain dela %d ordu", "today" => "gaur", "yesterday" => "atzo", "%d days ago" => "orain dela %d egun", "last month" => "joan den hilabetea", +"%d months ago" => "orain dela %d hilabete", "last year" => "joan den urtea", "years ago" => "orain dela urte batzuk", "%s is available. Get <a href=\"%s\">more information</a>" => "%s eskuragarri dago. Lortu <a href=\"%s\">informazio gehiago</a>", "up to date" => "eguneratuta", -"updates check is disabled" => "eguneraketen egiaztapena ez dago gaituta" +"updates check is disabled" => "eguneraketen egiaztapena ez dago gaituta", +"Could not find category \"%s\"" => "Ezin da \"%s\" kategoria aurkitu" ); diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php index ad5a034f5b6..218c22c1d53 100644 --- a/lib/l10n/fr.php +++ b/lib/l10n/fr.php @@ -18,13 +18,17 @@ "seconds ago" => "à l'instant", "1 minute ago" => "il y a 1 minute", "%d minutes ago" => "il y a %d minutes", +"1 hour ago" => "Il y a une heure", +"%d hours ago" => "Il y a %d heures", "today" => "aujourd'hui", "yesterday" => "hier", "%d days ago" => "il y a %d jours", "last month" => "le mois dernier", +"%d months ago" => "Il y a %d mois", "last year" => "l'année dernière", "years ago" => "il y a plusieurs années", "%s is available. Get <a href=\"%s\">more information</a>" => "%s est disponible. Obtenez <a href=\"%s\">plus d'informations</a>", "up to date" => "À jour", -"updates check is disabled" => "la vérification des mises à jour est désactivée" +"updates check is disabled" => "la vérification des mises à jour est désactivée", +"Could not find category \"%s\"" => "Impossible de trouver la catégorie \"%s\"" ); diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php index f6397936d6c..6f84a328ed9 100644 --- a/lib/l10n/pl.php +++ b/lib/l10n/pl.php @@ -18,13 +18,17 @@ "seconds ago" => "sekund temu", "1 minute ago" => "1 minutę temu", "%d minutes ago" => "%d minut temu", +"1 hour ago" => "1 godzine temu", +"%d hours ago" => "%d godzin temu", "today" => "dzisiaj", "yesterday" => "wczoraj", "%d days ago" => "%d dni temu", "last month" => "ostatni miesiąc", +"%d months ago" => "%d miesiecy temu", "last year" => "ostatni rok", "years ago" => "lat temu", "%s is available. Get <a href=\"%s\">more information</a>" => "%s jest dostępna. Uzyskaj <a href=\"%s\">więcej informacji</a>", "up to date" => "Aktualne", -"updates check is disabled" => "wybór aktualizacji jest wyłączony" +"updates check is disabled" => "wybór aktualizacji jest wyłączony", +"Could not find category \"%s\"" => "Nie można odnaleźć kategorii \"%s\"" ); diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php index f606c4aca48..f5d52f8682d 100644 --- a/lib/l10n/uk.php +++ b/lib/l10n/uk.php @@ -11,16 +11,24 @@ "Selected files too large to generate zip file." => "Вибрані фали завеликі для генерування zip файлу.", "Application is not enabled" => "Додаток не увімкнений", "Authentication error" => "Помилка автентифікації", +"Token expired. Please reload page." => "Строк дії токена скінчився. Будь ласка, перезавантажте сторінку.", "Files" => "Файли", "Text" => "Текст", +"Images" => "Зображення", "seconds ago" => "секунди тому", "1 minute ago" => "1 хвилину тому", "%d minutes ago" => "%d хвилин тому", +"1 hour ago" => "1 годину тому", +"%d hours ago" => "%d годин тому", "today" => "сьогодні", "yesterday" => "вчора", "%d days ago" => "%d днів тому", "last month" => "минулого місяця", +"%d months ago" => "%d місяців тому", "last year" => "минулого року", "years ago" => "роки тому", -"updates check is disabled" => "перевірка оновлень відключена" +"%s is available. Get <a href=\"%s\">more information</a>" => "%s доступно. Отримати <a href=\"%s\">детальну інформацію</a>", +"up to date" => "оновлено", +"updates check is disabled" => "перевірка оновлень відключена", +"Could not find category \"%s\"" => "Не вдалося знайти категорію \"%s\"" ); diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php index 16229fe03d8..4dbf89c2e0e 100644 --- a/lib/l10n/zh_TW.php +++ b/lib/l10n/zh_TW.php @@ -14,16 +14,21 @@ "Token expired. Please reload page." => "Token 過期. 請重新整理頁面", "Files" => "檔案", "Text" => "文字", +"Images" => "圖片", "seconds ago" => "幾秒前", "1 minute ago" => "1 分鐘前", "%d minutes ago" => "%d 分鐘前", +"1 hour ago" => "1小時之前", +"%d hours ago" => "%d小時之前", "today" => "今天", "yesterday" => "昨天", "%d days ago" => "%d 天前", "last month" => "上個月", +"%d months ago" => "%d個月之前", "last year" => "去年", "years ago" => "幾年前", "%s is available. Get <a href=\"%s\">more information</a>" => "%s 已經可用. 取得 <a href=\"%s\">更多資訊</a>", "up to date" => "最新的", -"updates check is disabled" => "檢查更新已停用" +"updates check is disabled" => "檢查更新已停用", +"Could not find category \"%s\"" => "找不到分類-\"%s\"" ); diff --git a/lib/public/share.php b/lib/public/share.php index 83c0bcd5e53..9bb64a38c8b 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -20,11 +20,6 @@ */ namespace OCP; -\OC_Hook::connect('OC_User', 'post_deleteUser', 'OCP\Share', 'post_deleteUser'); -\OC_Hook::connect('OC_User', 'post_addToGroup', 'OCP\Share', 'post_addToGroup'); -\OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OCP\Share', 'post_removeFromGroup'); -\OC_Hook::connect('OC_User', 'post_deleteGroup', 'OCP\Share', 'post_deleteGroup'); - /** * This class provides the ability for apps to share their content between users. * Apps must create a backend class that implements OCP\Share_Backend and register it with this class. @@ -53,6 +48,8 @@ class Share { const FORMAT_STATUSES = -2; const FORMAT_SOURCES = -3; + const TOKEN_LENGTH = 32; // see db_structure.xml + private static $shareTypeUserAndGroups = -1; private static $shareTypeGroupUserUnique = 2; private static $backends = array(); @@ -140,6 +137,20 @@ class Share { } /** + * @brief Get the item shared by a token + * @param string token + * @return Item + */ + public static function getShareByToken($token) { + $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?',1); + $result = $query->execute(array($token)); + if (\OC_DB::isError($result)) { + \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result) . ', token=' . $token, \OC_Log::ERROR); + } + return $result->fetchRow(); + } + + /** * @brief Get the shared items of item type owned by the current user * @param string Item type * @param int Format (optional) Format type must be defined by the backend @@ -168,7 +179,7 @@ class Share { * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK * @param string User or group the item is being shared with * @param int CRUDS permissions - * @return bool Returns true on success or false on failure + * @return bool|string Returns true on success or false on failure, Returns token on success for links */ public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions) { $uidOwner = \OC_User::getUser(); @@ -230,23 +241,33 @@ class Share { $shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner)); } else if ($shareType === self::SHARE_TYPE_LINK) { if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') == 'yes') { + // when updating a link share if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_LINK, null, $uidOwner, self::FORMAT_NONE, null, 1)) { - // If password is set delete the old link - if (isset($shareWith)) { - self::delete($checkExists['id']); - } else { - $message = 'Sharing '.$itemSource.' failed, because this item is already shared with a link'; - \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); - throw new \Exception($message); - } + // remember old token + $oldToken = $checkExists['token']; + //delete the old share + self::delete($checkExists['id']); } + // Generate hash of password - same method as user passwords if (isset($shareWith)) { $forcePortable = (CRYPT_BLOWFISH != 1); $hasher = new \PasswordHash(8, $forcePortable); $shareWith = $hasher->HashPassword($shareWith.\OC_Config::getValue('passwordsalt', '')); } - return self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions); + + // Generate token + if (isset($oldToken)) { + $token = $oldToken; + } else { + $token = \OC_Util::generate_random_bytes(self::TOKEN_LENGTH); + } + $result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, $token); + if ($result) { + return $token; + } else { + return false; + } } $message = 'Sharing '.$itemSource.' failed, because sharing with links is not allowed'; \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); @@ -654,16 +675,16 @@ class Share { } else { if (isset($uidOwner)) { if ($itemType == 'file' || $itemType == 'folder') { - $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`, `expiration`'; + $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`, `expiration`, `token`'; } else { - $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`, `stime`, `file_source`, `expiration`'; + $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`, `stime`, `file_source`, `expiration`, `token`'; } } else { if ($fileDependent) { if (($itemType == 'file' || $itemType == 'folder') && $format == \OC_Share_Backend_File::FORMAT_FILE_APP || $format == \OC_Share_Backend_File::FORMAT_FILE_APP_ROOT) { $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `uid_owner`, `share_type`, `share_with`, `file_source`, `path`, `file_target`, `permissions`, `expiration`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable`'; } else { - $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`, `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`'; + $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`, `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`'; } } else { $select = '*'; @@ -836,7 +857,7 @@ class Share { * @param bool|array Parent folder target (optional) * @return bool Returns true on success or false on failure */ - private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $parentFolder = null) { + private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $parentFolder = null, $token = null) { $backend = self::getBackend($itemType); // Check if this is a reshare if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) { @@ -894,7 +915,7 @@ class Share { $fileSource = null; } } - $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`, `item_target`, `parent`, `share_type`, `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`, `file_target`) VALUES (?,?,?,?,?,?,?,?,?,?,?)'); + $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`, `item_target`, `parent`, `share_type`, `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`, `file_target`, `token`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)'); // Share with a group if ($shareType == self::SHARE_TYPE_GROUP) { $groupItemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $suggestedItemTarget); @@ -915,7 +936,7 @@ class Share { } else { $groupFileTarget = null; } - $query->execute(array($itemType, $itemSource, $groupItemTarget, $parent, $shareType, $shareWith['group'], $uidOwner, $permissions, time(), $fileSource, $groupFileTarget)); + $query->execute(array($itemType, $itemSource, $groupItemTarget, $parent, $shareType, $shareWith['group'], $uidOwner, $permissions, time(), $fileSource, $groupFileTarget, $token)); // Save this id, any extra rows for this group share will need to reference it $parent = \OC_DB::insertid('*PREFIX*share'); // Loop through all users of this group in case we need to add an extra row @@ -949,11 +970,12 @@ class Share { 'permissions' => $permissions, 'fileSource' => $fileSource, 'fileTarget' => $fileTarget, - 'id' => $parent + 'id' => $parent, + 'token' => $token )); // Insert an extra row for the group share if the item or file target is unique for this user if ($itemTarget != $groupItemTarget || (isset($fileSource) && $fileTarget != $groupFileTarget)) { - $query->execute(array($itemType, $itemSource, $itemTarget, $parent, self::$shareTypeGroupUserUnique, $uid, $uidOwner, $permissions, time(), $fileSource, $fileTarget)); + $query->execute(array($itemType, $itemSource, $itemTarget, $parent, self::$shareTypeGroupUserUnique, $uid, $uidOwner, $permissions, time(), $fileSource, $fileTarget, $token)); $id = \OC_DB::insertid('*PREFIX*share'); } } @@ -978,7 +1000,7 @@ class Share { } else { $fileTarget = null; } - $query->execute(array($itemType, $itemSource, $itemTarget, $parent, $shareType, $shareWith, $uidOwner, $permissions, time(), $fileSource, $fileTarget)); + $query->execute(array($itemType, $itemSource, $itemTarget, $parent, $shareType, $shareWith, $uidOwner, $permissions, time(), $fileSource, $fileTarget, $token)); $id = \OC_DB::insertid('*PREFIX*share'); \OC_Hook::emit('OCP\Share', 'post_shared', array( 'itemType' => $itemType, @@ -991,7 +1013,8 @@ class Share { 'permissions' => $permissions, 'fileSource' => $fileSource, 'fileTarget' => $fileTarget, - 'id' => $id + 'id' => $id, + 'token' => $token )); if ($parentFolder === true) { $parentFolders['id'] = $id; diff --git a/lib/util.php b/lib/util.php index 25fdcef1aea..4a434114480 100755 --- a/lib/util.php +++ b/lib/util.php @@ -137,16 +137,16 @@ class OC_Util { * @param string $text the text content for the element */ public static function addHeader( $tag, $attributes, $text='') { - self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text); + self::$headers[] = array('tag'=>$tag, 'attributes'=>$attributes, 'text'=>$text); } /** * formats a timestamp in the "right" way * * @param int timestamp $timestamp - * @param bool dateOnly option to ommit time from the result + * @param bool dateOnly option to omit time from the result */ - public static function formatDate( $timestamp,$dateOnly=false) { + public static function formatDate( $timestamp, $dateOnly=false) { if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it $systemTimeZone = intval(date('O')); $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100); @@ -588,22 +588,31 @@ class OC_Util { $connected = @fsockopen("www.owncloud.org", 80); if ($connected) { fclose($connected); - return true; + return true; }else{ // second try in case one server is down $connected = @fsockopen("apps.owncloud.com", 80); if ($connected) { fclose($connected); - return true; + return true; }else{ - return false; + return false; } } } + /** + * clear all levels of output buffering + */ + public static function obEnd(){ + while (ob_get_level()) { + ob_end_clean(); + } + } + /** * @brief Generates a cryptographical secure pseudorandom string |