diff options
author | mbi <knox@users.noreply.github.com> | 2015-12-08 21:02:52 +0100 |
---|---|---|
committer | mbi <knox@users.noreply.github.com> | 2015-12-08 21:02:52 +0100 |
commit | 508c46a112d3d53b4b0668efcbe1403eb2e143b8 (patch) | |
tree | 29ef86459abae1dcaadf75203851ab9b39ec43bd /lib/private/util.php | |
parent | 27f420e0a797f8a56b5e83e8dd8e19df289c766b (diff) | |
parent | 13993c4a6db83c0a637fc7c20da0470acae47208 (diff) | |
download | nextcloud-server-508c46a112d3d53b4b0668efcbe1403eb2e143b8.tar.gz nextcloud-server-508c46a112d3d53b4b0668efcbe1403eb2e143b8.zip |
Merge branch 'master' into master
Diffstat (limited to 'lib/private/util.php')
-rw-r--r-- | lib/private/util.php | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index ac42b96de2d..eb188b649e8 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -947,6 +947,14 @@ class OC_Util { $parameters['redirect_url'] = $_REQUEST['redirect_url']; } + $parameters['canResetPassword'] = true; + if (!\OC::$server->getSystemConfig()->getValue('lost_password_link')) { + $user = \OC::$server->getUserManager()->get($_REQUEST['user']); + if ($user instanceof IUser) { + $parameters['canResetPassword'] = $user->canChangePassword(); + } + } + $parameters['alt_login'] = OC_App::getAlternativeLogIns(); $parameters['rememberLoginAllowed'] = self::rememberLoginAllowed(); \OC_Hook::emit('OC_Util', 'pre_displayLoginPage', array('parameters' => $parameters)); @@ -1169,14 +1177,16 @@ class OC_Util { * This function is used to sanitize HTML and should be applied on any * string or array of strings before displaying it on a web page. * - * @param string|array &$value + * @param string|array $value * @return string|array an array of sanitized strings or a single sanitized string, depends on the input parameter. */ - public static function sanitizeHTML(&$value) { + public static function sanitizeHTML($value) { if (is_array($value)) { - array_walk_recursive($value, 'OC_Util::sanitizeHTML'); + $value = array_map(function($value) { + return self::sanitizeHTML($value); + }, $value); } else { - //Specify encoding for PHP<5.4 + // Specify encoding for PHP<5.4 $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); } return $value; @@ -1237,7 +1247,11 @@ class OC_Util { // accessing the file via http $url = OC_Helper::makeURLAbsolute(OC::$WEBROOT . '/data' . $fileName); - $content = self::getUrlContent($url); + try { + $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody(); + } catch (\Exception $e) { + $content = false; + } // cleanup @unlink($testFile); @@ -1313,23 +1327,6 @@ class OC_Util { } /** - * Get URL content - * @param string $url Url to get content - * @throws Exception If the URL does not start with http:// or https:// - * @return string of the response or false on error - * This function get the content of a page via curl, if curl is enabled. - * If not, file_get_contents is used. - * @deprecated Use \OC::$server->getHTTPClientService()->newClient()->get($url); - */ - public static function getUrlContent($url) { - try { - return \OC::$server->getHTTPHelper()->getUrlContent($url); - } catch (\Exception $e) { - throw $e; - } - } - - /** * Checks whether the server is running on Windows * * @return bool true if running on Windows, false otherwise @@ -1418,7 +1415,7 @@ class OC_Util { } // XCache if (function_exists('xcache_clear_cache')) { - if (ini_get('xcache.admin.enable_auth')) { + if (\OC::$server->getIniWrapper()->getBool('xcache.admin.enable_auth')) { \OCP\Util::writeLog('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', \OCP\Util::WARN); } else { @xcache_clear_cache(XC_TYPE_PHP, 0); |