Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-01-07 03:16:10 +0400
committerRobin Appelman <icewind@owncloud.com>2013-01-07 03:16:10 +0400
commite8d08d4930fae31a665c679b5ac1a147859eb099 (patch)
tree426671882f753d0fea8f80c786bdd6892d57cdb5 /lib/helper.php
parent1137723b2a46c37d61e7f501694c73562b21ef74 (diff)
parent0b007235b99fa8d66cdb8ca917fe2f45dd8e4edc (diff)
merge master into filesystem
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php63
1 files changed, 44 insertions, 19 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 2dcf0c6de79..b25ec01036a 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -31,8 +31,9 @@ class OC_Helper {
/**
* @brief Creates an url using a defined route
* @param $route
- * @param $parameters
- * @param $args array with param=>value, will be appended to the returned url
+ * @param array $parameters
+ * @return
+ * @internal param array $args with param=>value, will be appended to the returned url
* @returns the url
*
* Returns a url to the given app and file.
@@ -128,6 +129,7 @@ class OC_Helper {
/**
* @brief Creates an absolute url for remote use
* @param string $service id
+ * @param bool $add_slash
* @return string the url
*
* Returns a absolute url to the given service.
@@ -139,6 +141,7 @@ class OC_Helper {
/**
* @brief Creates an absolute url for public use
* @param string $service id
+ * @param bool $add_slash
* @return string the url
*
* Returns a absolute url to the given service.
@@ -319,7 +322,7 @@ class OC_Helper {
self::copyr("$src/$file", "$dest/$file");
}
}
- }elseif(file_exists($src) && !OC_Filesystem::isFileBlacklisted($src)) {
+ }elseif(file_exists($src) && !\OC\Files\Filesystem::isFileBlacklisted($src)) {
copy($src, $dest);
}
}
@@ -450,12 +453,14 @@ class OC_Helper {
}
/**
- * detect if a given program is found in the search PATH
- *
- * @param string $program name
- * @param string $optional search path, defaults to $PATH
- * @return bool true if executable program found in path
- */
+ * detect if a given program is found in the search PATH
+ *
+ * @param $name
+ * @param bool $path
+ * @internal param string $program name
+ * @internal param string $optional search path, defaults to $PATH
+ * @return bool true if executable program found in path
+ */
public static function canExecute($name, $path = false) {
// path defaults to PATH from environment if not set
if ($path === false) {
@@ -676,16 +681,16 @@ class OC_Helper {
}
/**
- * @brief replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.
- *
- * @param string $input The input string. .Opposite to the PHP build-in function does not accept an array.
- * @param string $replacement The replacement string.
- * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
- * @param int $length Length of the part to be replaced
- * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
- * @return string
- *
- */
+ * @brief replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.
+ *
+ * @param $string
+ * @param string $replacement The replacement string.
+ * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
+ * @param int $length Length of the part to be replaced
+ * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
+ * @internal param string $input The input string. .Opposite to the PHP build-in function does not accept an array.
+ * @return string
+ */
public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
$start = intval($start);
$length = intval($length);
@@ -758,4 +763,24 @@ class OC_Helper {
}
return $str;
}
+
+ /**
+ * Checks if a function is available
+ * @param string $function_name
+ * @return bool
+ */
+ public static function is_function_enabled($function_name) {
+ if (!function_exists($function_name)) {
+ return false;
+ }
+ $disabled = explode(', ', ini_get('disable_functions'));
+ if (in_array($function_name, $disabled)) {
+ return false;
+ }
+ $disabled = explode(', ', ini_get('suhosin.executor.func.blacklist'));
+ if (in_array($function_name, $disabled)) {
+ return false;
+ }
+ return true;
+ }
}