diff options
Diffstat (limited to 'lib/public/util.php')
-rw-r--r-- | lib/public/util.php | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/lib/public/util.php b/lib/public/util.php index f06ddd66641..3166d4040d8 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -86,21 +86,22 @@ class Util { * if DEBUG mode is enabled * @param string $app app name * @param \Exception $ex exception to log + * @param string $level log level, defaults to \OCP\Util::FATAL */ - public static function logException( $app, \Exception $ex ) { + public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) { $class = get_class($ex); $message = $class . ': ' . $ex->getMessage(); if ($ex->getCode()) { $message .= ' [' . $ex->getCode() . ']'; } - \OCP\Util::writeLog($app, $message, \OCP\Util::FATAL); + \OCP\Util::writeLog($app, $message, $level); if (defined('DEBUG') and DEBUG) { // also log stack trace $stack = explode("\n", $ex->getTraceAsString()); // first element is empty array_shift($stack); foreach ($stack as $s) { - \OCP\Util::writeLog($app, 'Exception: ' . $s, \OCP\Util::FATAL); + \OCP\Util::writeLog($app, 'Exception: ' . $s, $level); } // include cause @@ -110,7 +111,7 @@ class Util { if ($ex->getCode()) { $message .= '[' . $ex->getCode() . '] '; } - \OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL); + \OCP\Util::writeLog($app, 'Exception: ' . $message, $level); } } } @@ -202,7 +203,7 @@ class Util { /** * Creates an url using a defined route - * @param $route + * @param string $route * @param array $parameters * @internal param array $args with param=>value, will be appended to the returned url * @return string the url @@ -292,7 +293,7 @@ class Util { /** * Returns the script name, even if the website uses one or more reverse proxies - * @returns string the script name + * @return string the script name */ public static function getScriptName() { return(\OC_Request::scriptName()); @@ -379,8 +380,8 @@ class 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 of strings - * @return array with sanitized strings or a single sinitized string, depends on the input parameter. + * @param string|array $value + * @return string|array an array of sanitized strings or a single sinitized string, depends on the input parameter. */ public static function sanitizeHTML( $value ) { return(\OC_Util::sanitizeHTML($value)); @@ -457,7 +458,7 @@ class Util { * * @param string $dir the current folder where the user currently operates * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly - * @return number of bytes representing + * @return int number of bytes representing */ public static function maxUploadFilesize($dir, $free = null) { return \OC_Helper::maxUploadFilesize($dir, $free); @@ -475,7 +476,7 @@ class Util { /** * Calculate PHP upload limit * - * @return number of bytes representing + * @return int number of bytes representing */ public static function uploadLimit() { return \OC_Helper::uploadLimit(); @@ -483,7 +484,7 @@ class Util { /** * Returns whether the given file name is valid - * @param $file string file name to check + * @param string $file file name to check * @return bool true if the file name is valid, false otherwise */ public static function isValidFileName($file) { @@ -491,11 +492,19 @@ class Util { } /** - * @brief Generates a cryptographic secure pseudo-random string - * @param Int $length of the random string - * @return String + * Generates a cryptographic secure pseudo-random string + * @param int $length of the random string + * @return string */ public static function generateRandomBytes($length = 30) { return \OC_Util::generateRandomBytes($length); } + + /** + * check if a password is required for each public link + * @return boolean + */ + public static function isPublicLinkPasswordRequired() { + return \OC_Util::isPublicLinkPasswordRequired(); + } } |