summaryrefslogtreecommitdiffstats
path: root/application/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'application/helpers')
-rw-r--r--application/helpers/filebin_helper.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php
index 4c1423725..d9a490bd6 100644
--- a/application/helpers/filebin_helper.php
+++ b/application/helpers/filebin_helper.php
@@ -170,16 +170,25 @@ function mb_str_pad($ps_input, $pn_pad_length, $ps_pad_string = " ", $pn_pad_typ
return $ret;
}
-function is_cli_client()
+function is_cli_client($override = null)
{
- // official client uses "fb-client/$version" as useragent
- $clients = array("fb-client", "libcurl", "pyfb");
- foreach ($clients as $client) {
- if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], $client) !== false) {
- return true;
+ static $is_cli = null;
+
+ if ($override !== null) {
+ $is_cli = $override;
+ }
+
+ if ($is_cli === null) {
+ $is_cli = false;
+ // official client uses "fb-client/$version" as useragent
+ $clients = array("fb-client", "libcurl", "pyfb");
+ foreach ($clients as $client) {
+ if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], $client) !== false) {
+ $is_cli = true;
+ }
}
}
- return false;
+ return $is_cli;
}
function random_alphanum($min_length, $max_length = null)