浏览代码

Update functions.php

FusionPBX 6 年之前
父节点
当前提交
a391f65de7
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      resources/functions.php

+ 13 - 0
resources/functions.php

@@ -1623,6 +1623,19 @@ function number_pad($number,$n) {
 		}
 		}
 	}
 	}
 
 
+//detect if php is running as command line interface
+	if (!function_exists('is_cli')) {
+		function is_cli() {
+			if (defined('STDIN')) {
+				return true;
+			}
+			if (php_sapi_name() == 'cli' && !isset($_SERVER['HTTP_USER_AGENT']) && is_numeric($_SERVER['argc']) {
+				return true;
+			}
+			return false;
+		}
+	}
+
 //format mac address
 //format mac address
 	if (!function_exists('format_mac')) {
 	if (!function_exists('format_mac')) {
 		function format_mac($str, $delim = '-', $case = 'lower') {
 		function format_mac($str, $delim = '-', $case = 'lower') {