Frytimo pr patches for php8.1 (#6630)
* Passing null to parameter #2 ($string) of type string is deprecated * Passing null to parameter #1 ($string) of type string is deprecated * php 8.1 fixes * php 8.1 fixes - replace strlen($var) > 0 with !empty($var) * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - strlower with null * php 8.1 fixes - strreplace with null * php 8.1 fixes - passing null to base64_decode * php 8.1 fixes - check for false and check for null on $this->dir * php 8.1 fixes - remove assignment of $db variable to modules object * php 8.1 fixes - avoid sending null to substr * php 8.1 fixes - change ${var} to {$var} * php 8.1 fixes - check for null before preg_replace * php 8.1 fixes - remove setting db variable on domains object * php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null * php 8.1 fixes - set empty string if $_REQUEST['show'] is not available * php 8.1 fixes * php 8.1 fixes - correct $_POST checking syntax * php 8.1 fixes - correct $_POST variables * php 8.1 fixes * Use brackets consistently * Update user_setting_edit.php * Change to not empty * Update device.php * Update text.php --------- Co-authored-by: Tim Fry <tim@voipstratus.com> Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
co-authored by
Tim Fry
FusionPBX
parent
ebbb2f1a72
commit
fef8165be2
@@ -64,7 +64,7 @@ $pathtofonts = "/captcha/fonts/"; //path from the root of the website
|
||||
|
||||
//--- begin captcha verification ---------------------
|
||||
//ini_set("session.cookie_httponly", True); session_start(); //make sure sessions are started
|
||||
if (strtolower($_SESSION["captcha"]) != strtolower($_REQUEST["captcha"]) || strlen($_SESSION["captcha"]) == 0) {
|
||||
if (strtolower($_SESSION["captcha"]) != strtolower($_REQUEST["captcha"]) || empty($_SESSION["captcha"])) {
|
||||
|
||||
echo " <span class=\"h2\">Sorry!</span>\n";
|
||||
//echo " <br><br>\n";
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
unset($_SESSION["menu"]);
|
||||
|
||||
//clear the template only if the template has not been assigned by the superadmin
|
||||
if (strlen($_SESSION['domain']['template']['name']) == 0) {
|
||||
if (empty($_SESSION['domain']['template']['name'])) {
|
||||
$_SESSION["template_content"] = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class config {
|
||||
*/
|
||||
public function exists() {
|
||||
$this->find();
|
||||
if (strlen($this->config_path) > 0) {
|
||||
if (!empty($this->config_path)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -434,7 +434,7 @@
|
||||
if (!isset($this->path) && isset($db_path)) { $this->path = $db_path; }
|
||||
|
||||
if ($this->driver == "sqlite") {
|
||||
if (strlen($this->db_name) == 0) {
|
||||
if (empty($this->db_name)) {
|
||||
$server_name = $_SERVER["SERVER_NAME"];
|
||||
$server_name = str_replace ("www.", "", $server_name);
|
||||
$db_name_short = $server_name;
|
||||
@@ -467,12 +467,12 @@
|
||||
if ($this->driver == "mysql") {
|
||||
try {
|
||||
//mysql pdo connection
|
||||
if (strlen($this->host) == 0 && strlen($this->port) == 0) {
|
||||
if (strlen($this->host) == 0 && empty($this->port)) {
|
||||
//if both host and port are empty use the unix socket
|
||||
$this->db = new PDO("mysql:host=$this->host;unix_socket=/var/run/mysqld/mysqld.sock;dbname=$this->db_name", $this->username, $this->password);
|
||||
}
|
||||
else {
|
||||
if (strlen($this->port) == 0) {
|
||||
if (empty($this->port)) {
|
||||
//leave out port if it is empty
|
||||
$this->db = new PDO("mysql:host=$this->host;dbname=$this->db_name;", $this->username, $this->password, array(
|
||||
PDO::ATTR_ERRMODE,
|
||||
@@ -496,8 +496,8 @@
|
||||
if ($this->driver == "pgsql") {
|
||||
//database connection
|
||||
try {
|
||||
if (strlen($this->host) > 0) {
|
||||
if (strlen($this->port) == 0) { $this->port = "5432"; }
|
||||
if (!empty($this->host)) {
|
||||
if (empty($this->port)) { $this->port = "5432"; }
|
||||
if ($this->db_secure === true) {
|
||||
$this->db = new PDO("pgsql:host=$this->host port=$this->port dbname=$this->db_name user=$this->username password=$this->password sslmode=verify-ca sslrootcert=$this->db_cert_authority");
|
||||
}
|
||||
@@ -593,7 +593,7 @@
|
||||
}
|
||||
|
||||
//get the table info
|
||||
if (strlen($this->table) == 0) { return false; }
|
||||
if (empty($this->table)) { return false; }
|
||||
if ($this->type == "sqlite") {
|
||||
$sql = "PRAGMA table_info(".$this->table.");";
|
||||
}
|
||||
@@ -927,7 +927,7 @@
|
||||
foreach($this->fields as $name => $value) {
|
||||
$name = self::sanitize($name);
|
||||
if ($field_count == $i) {
|
||||
if (strlen($value) > 0) {
|
||||
if (!empty($value)) {
|
||||
//$sql .= "'".$value."' ";
|
||||
$sql .= ":".$name." \n";
|
||||
$params[$name] = trim($value);
|
||||
@@ -937,7 +937,7 @@
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen($value) > 0) {
|
||||
if (!empty($value)) {
|
||||
//$sql .= "'".$value."', ";
|
||||
$sql .= ":".$name.", \n";
|
||||
$params[$name] = trim($value);
|
||||
@@ -995,7 +995,7 @@
|
||||
foreach($this->fields as $name => $value) {
|
||||
$name = self::sanitize($name);
|
||||
if (count($this->fields) == $i) {
|
||||
if (strlen($name) > 0 && $value == null) {
|
||||
if (!empty($name) && $value == null) {
|
||||
$sql .= $name." = null ";
|
||||
}
|
||||
else {
|
||||
@@ -1005,7 +1005,7 @@
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen($name) > 0 && $value == null) {
|
||||
if (!empty($name) && $value == null) {
|
||||
$sql .= $name." = null, ";
|
||||
}
|
||||
else {
|
||||
@@ -1188,7 +1188,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($field_value) > 0) {
|
||||
if (!empty($field_value)) {
|
||||
$results = $this->execute($sql, $parameters, 'all');
|
||||
unset($parameters);
|
||||
if (is_array($results)) {
|
||||
@@ -1230,7 +1230,7 @@
|
||||
}
|
||||
|
||||
//delete the child data
|
||||
if (isset($row[$relation['field']]) && strlen($row[$relation['field']]) > 0) {
|
||||
if (isset($row[$relation['field']]) && !empty($row[$relation['field']])) {
|
||||
$sql = "delete from ".self::TABLE_PREFIX.$child_table." ";
|
||||
$sql .= "where ".$relation['field']." = :".$relation['field'];
|
||||
$parameters[$relation['field']] = $row[$relation['field']];
|
||||
@@ -1320,7 +1320,7 @@
|
||||
if (isset($this->app_uuid) && is_uuid($this->app_uuid)) {
|
||||
$sql .= "app_uuid, ";
|
||||
}
|
||||
if (isset($this->app_name) && strlen($this->app_name) > 0) {
|
||||
if (isset($this->app_name) && !empty($this->app_name)) {
|
||||
$sql .= "app_name, ";
|
||||
}
|
||||
$sql .= "transaction_code, ";
|
||||
@@ -1343,7 +1343,7 @@
|
||||
if (isset($this->app_uuid) && is_uuid($this->app_uuid)) {
|
||||
$sql .= ":app_uuid, ";
|
||||
}
|
||||
if (isset($this->app_name) && strlen($this->app_name) > 0) {
|
||||
if (isset($this->app_name) && !empty($this->app_name)) {
|
||||
$sql .= ":app_name, ";
|
||||
}
|
||||
$sql .= "'".$message["code"]."', ";
|
||||
@@ -1371,7 +1371,7 @@
|
||||
if (isset($this->app_uuid) && is_uuid($this->app_uuid)) {
|
||||
$statement->bindParam(':app_uuid', $this->app_uuid);
|
||||
}
|
||||
if (isset($this->app_name) && strlen($this->app_name) > 0) {
|
||||
if (isset($this->app_name) && !empty($this->app_name)) {
|
||||
$statement->bindParam(':app_name', $this->app_name);
|
||||
}
|
||||
$statement->bindParam(':remote_address', $_SERVER['REMOTE_ADDR']);
|
||||
@@ -2126,7 +2126,7 @@
|
||||
$array_key != 'insert_date' &&
|
||||
$array_key != 'update_user' &&
|
||||
$array_key != 'update_date') {
|
||||
if (strlen($array_value) == 0) {
|
||||
if (empty($array_value)) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
elseif ($array_value === "now()") {
|
||||
@@ -2228,7 +2228,7 @@
|
||||
foreach ($array as $array_key => $array_value) {
|
||||
if (!is_array($array_value) && $array_key != $parent_key_name) {
|
||||
$array_key = self::sanitize($array_key);
|
||||
if (strlen($array_value) == 0) {
|
||||
if (empty($array_value)) {
|
||||
$sql .= $array_key." = null, ";
|
||||
}
|
||||
elseif ($array_value === "now()") {
|
||||
@@ -2346,7 +2346,7 @@
|
||||
$uuid_exists = false;
|
||||
if (is_array($row)) foreach ($row as $k => $v) {
|
||||
if ($child_key_name == $k) {
|
||||
if (strlen($v) > 0) {
|
||||
if (!empty($v)) {
|
||||
$child_key_value = trim($v);
|
||||
$uuid_exists = true;
|
||||
break;
|
||||
@@ -2418,7 +2418,7 @@
|
||||
foreach ($row as $k => $v) {
|
||||
if (!is_array($v) && ($k != $parent_key_name || $k != $child_key_name)) {
|
||||
$k = self::sanitize($k);
|
||||
if (strlen($v) == 0) {
|
||||
if (empty($v)) {
|
||||
$sql .= $k." = null, ";
|
||||
}
|
||||
elseif ($v === "now()") {
|
||||
@@ -2501,7 +2501,7 @@
|
||||
else {
|
||||
$retval = false;
|
||||
$message["name"] = $child_name;
|
||||
$message["message"] = "Forbidden, does not have '${child_name}_edit'";
|
||||
$message["message"] = "Forbidden, does not have '{$child_name}_edit'";
|
||||
$message["code"] = "403";
|
||||
$message["line"] = __line__;
|
||||
$this->message = $message;
|
||||
@@ -2570,7 +2570,7 @@
|
||||
$k != 'insert_date' &&
|
||||
$k != 'update_user' &&
|
||||
$k != 'update_date') {
|
||||
if (strlen($v) == 0) {
|
||||
if (empty($v)) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
elseif ($v === "now()") {
|
||||
@@ -2655,7 +2655,7 @@
|
||||
else {
|
||||
$retval = false;
|
||||
$message["name"] = $child_name;
|
||||
$message["message"] = "Forbidden, does not have '${child_name}_add'";
|
||||
$message["message"] = "Forbidden, does not have '{$child_name}_add'";
|
||||
$message["code"] = "403";
|
||||
$message["line"] = __line__;
|
||||
$this->message = $message;
|
||||
@@ -2680,7 +2680,7 @@
|
||||
$this->db->commit();
|
||||
|
||||
//set the action if not set
|
||||
if (strlen($action) == 0) {
|
||||
if (strlen($action ?? '') === 0) {
|
||||
if (is_array($old_array)) {
|
||||
$transaction_type = 'update';
|
||||
}
|
||||
@@ -2708,7 +2708,7 @@
|
||||
if (isset($this->app_uuid) && is_uuid($this->app_uuid)) {
|
||||
$sql .= "app_uuid, ";
|
||||
}
|
||||
if (isset($this->app_name) && strlen($this->app_name) > 0) {
|
||||
if (isset($this->app_name) && !empty($this->app_name)) {
|
||||
$sql .= "app_name, ";
|
||||
}
|
||||
$sql .= "transaction_code, ";
|
||||
@@ -2734,7 +2734,7 @@
|
||||
if (isset($this->app_uuid) && is_uuid($this->app_uuid)) {
|
||||
$sql .= ":app_uuid, ";
|
||||
}
|
||||
if (isset($this->app_name) && strlen($this->app_name) > 0) {
|
||||
if (isset($this->app_name) && !empty($this->app_name)) {
|
||||
$sql .= ":app_name, ";
|
||||
}
|
||||
$sql .= "'".$message["code"]."', ";
|
||||
@@ -2762,7 +2762,7 @@
|
||||
if (isset($this->app_uuid) && is_uuid($this->app_uuid)) {
|
||||
$statement->bindParam(':app_uuid', $this->app_uuid);
|
||||
}
|
||||
if (isset($this->app_name) && strlen($this->app_name) > 0) {
|
||||
if (isset($this->app_name) && !empty($this->app_name)) {
|
||||
$statement->bindParam(':app_name', $this->app_name);
|
||||
}
|
||||
$statement->bindParam(':remote_address', $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
@@ -162,13 +162,13 @@
|
||||
$array['extensions'][0]['auth_acl'] = $auth_acl;
|
||||
$array['extensions'][0]['cidr'] = $cidr;
|
||||
$array['extensions'][0]['sip_force_contact'] = $sip_force_contact;
|
||||
if (strlen($sip_force_expires) > 0) {
|
||||
if (!empty($sip_force_expires)) {
|
||||
$array['extensions'][0]['sip_force_expires'] = $sip_force_expires;
|
||||
}
|
||||
if (strlen($nibble_account) > 0) {
|
||||
if (!empty($nibble_account)) {
|
||||
$array['extensions'][0]['nibble_account'] = $nibble_account;
|
||||
}
|
||||
if (strlen($mwi_account) > 0) {
|
||||
if (!empty($mwi_account)) {
|
||||
if (strpos($mwi_account, '@') === false) {
|
||||
$mwi_account .= count($_SESSION["domains"]) > 1 ? "@".$domain_name : "@\$\${domain}";
|
||||
}
|
||||
@@ -234,13 +234,13 @@
|
||||
//$user_list_array = explode("|", $user_list);
|
||||
//foreach($user_list_array as $tmp_user){
|
||||
// $user_password = generate_password();
|
||||
// if (strlen($tmp_user) > 0) {
|
||||
// if (!empty($tmp_user)) {
|
||||
// user_add($tmp_user, $user_password, $user_email);
|
||||
// }
|
||||
//}
|
||||
//unset($tmp_user);
|
||||
|
||||
if (strlen($password) == 0) {
|
||||
if (empty($password)) {
|
||||
$password = generate_password();
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
$array['extensions'][0]['number_alias'] = $number_alias;
|
||||
$array['extensions'][0]['password'] = $password;
|
||||
$array['extensions'][0]['provisioning_list'] = $provisioning_list;
|
||||
$array['extensions'][0]['vm_password'] = strlen($vm_password) > 0 ? $vm_password : 'user-choose';
|
||||
$array['extensions'][0]['vm_password'] = !empty($vm_password) ? $vm_password : 'user-choose';
|
||||
$array['extensions'][0]['accountcode'] = $accountcode;
|
||||
$array['extensions'][0]['effective_caller_id_name'] = $effective_caller_id_name;
|
||||
$array['extensions'][0]['effective_caller_id_number'] = $effective_caller_id_number;
|
||||
@@ -269,9 +269,9 @@
|
||||
$array['extensions'][0]['auth_acl'] = $auth_acl;
|
||||
$array['extensions'][0]['cidr'] = $cidr;
|
||||
$array['extensions'][0]['sip_force_contact'] = $sip_force_contact;
|
||||
$array['extensions'][0]['sip_force_expires'] = strlen($sip_force_expires) > 0 ? $sip_force_expires : null;
|
||||
$array['extensions'][0]['nibble_account'] = strlen($nibble_account) > 0 ? $nibble_account : null;
|
||||
if (strlen($mwi_account) > 0) {
|
||||
$array['extensions'][0]['sip_force_expires'] = !empty($sip_force_expires) ? $sip_force_expires : null;
|
||||
$array['extensions'][0]['nibble_account'] = !empty($nibble_account) ? $nibble_account : null;
|
||||
if (!empty($mwi_account)) {
|
||||
if (strpos($mwi_account, '@') === false) {
|
||||
$mwi_account .= count($_SESSION["domains"]) > 1 ? "@".$domain_name : "@\$\${domain}";
|
||||
}
|
||||
@@ -508,8 +508,8 @@
|
||||
$call_group = str_replace(";", ",", $call_group);
|
||||
$tmp_array = explode(",", $call_group);
|
||||
foreach ($tmp_array as &$tmp_call_group) {
|
||||
if (strlen($tmp_call_group) > 0) {
|
||||
if (strlen($call_group_array[$tmp_call_group]) == 0) {
|
||||
if (!empty($tmp_call_group)) {
|
||||
if (empty($call_group_array[$tmp_call_group])) {
|
||||
$call_group_array[$tmp_call_group] = $row['extension'];
|
||||
}
|
||||
else {
|
||||
@@ -599,7 +599,7 @@
|
||||
foreach ($call_group_array as $key => $value) {
|
||||
$call_group = $key;
|
||||
$extension_list = $value;
|
||||
if (strlen($call_group) > 0) {
|
||||
if (!empty($call_group)) {
|
||||
if ($previous_call_group != $call_group) {
|
||||
$xml .= " <group name=\"$call_group\">\n";
|
||||
$xml .= " <users>\n";
|
||||
|
||||
@@ -169,7 +169,7 @@ if (!class_exists('domains')) {
|
||||
}
|
||||
|
||||
//delete the directories
|
||||
if (strlen($domain_name) > 0) {
|
||||
if (!empty($domain_name)) {
|
||||
//set the needle
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$v_needle = 'v_'.$domain_name.'_';
|
||||
@@ -180,24 +180,24 @@ if (!class_exists('domains')) {
|
||||
|
||||
//delete the dialplan
|
||||
@unlink($_SESSION['switch']['dialplan']['dir'].'/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['dialplan']['dir'])) {
|
||||
system('rm -rf '.$_SESSION['switch']['dialplan']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the dialplan public
|
||||
@unlink($_SESSION['switch']['dialplan']['dir'].'/public/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['dialplan']['dir'])) {
|
||||
system('rm -rf '.$_SESSION['switch']['dialplan']['dir'].'/public/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the extension
|
||||
@unlink($_SESSION['switch']['extensions']['dir'].'/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['extensions']['dir'])) {
|
||||
system('rm -rf '.$_SESSION['switch']['extensions']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete fax
|
||||
if (strlen($_SESSION['switch']['storage']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['storage']['dir'])) {
|
||||
system('rm -rf '.$_SESSION['switch']['storage']['dir'].'/fax/'.$domain_name);
|
||||
}
|
||||
|
||||
@@ -237,12 +237,12 @@ if (!class_exists('domains')) {
|
||||
}
|
||||
|
||||
//delete the recordings
|
||||
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['recordings']['dir'])) {
|
||||
system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete voicemail
|
||||
if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['voicemail']['dir'])) {
|
||||
system('rm -rf '.$_SESSION['switch']['voicemail']['dir'].'/'.$domain_name);
|
||||
}
|
||||
}
|
||||
@@ -460,7 +460,7 @@ if (!class_exists('domains')) {
|
||||
$name = $row['default_setting_name'];
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (empty($subcategory)) {
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['default_setting_value'];
|
||||
}
|
||||
@@ -512,7 +512,7 @@ if (!class_exists('domains')) {
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (empty($subcategory)) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['domain_setting_value'];
|
||||
@@ -549,8 +549,8 @@ if (!class_exists('domains')) {
|
||||
$name = $row['user_setting_name'];
|
||||
$category = $row['user_setting_category'];
|
||||
$subcategory = $row['user_setting_subcategory'];
|
||||
if (strlen($row['user_setting_value']) > 0) {
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (!empty($row['user_setting_value'])) {
|
||||
if (empty($subcategory)) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['user_setting_value'];
|
||||
@@ -575,7 +575,7 @@ if (!class_exists('domains')) {
|
||||
}
|
||||
|
||||
//set the values from the session variables
|
||||
if (strlen($_SESSION['domain']['time_zone']['name']) > 0) {
|
||||
if (!empty($_SESSION['domain']['time_zone']['name'])) {
|
||||
//server time zone
|
||||
$_SESSION['time_zone']['system'] = date_default_timezone_get();
|
||||
//domain time zone set in system settings
|
||||
@@ -674,7 +674,7 @@ if (!class_exists('domains')) {
|
||||
$name = $row['default_setting_name'];
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (empty($subcategory)) {
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['default_setting_value'];
|
||||
}
|
||||
@@ -699,7 +699,7 @@ if (!class_exists('domains')) {
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (empty($subcategory)) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ if (!class_exists('email')) {
|
||||
$body_part = $parts_array["BodyPart"];
|
||||
$body_length = $parts_array["BodyLength"];
|
||||
|
||||
if (strlen($file) > 0) {
|
||||
if (!empty($file)) {
|
||||
//get the file information
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
$file_name = substr($file, 0, (strlen($file) - strlen($file_ext))-1 );
|
||||
@@ -417,10 +417,10 @@ if (!class_exists('email')) {
|
||||
$smtp['validate_certificate'] = $_SESSION['email']['smtp_validate_certificate']['boolean'];
|
||||
$smtp['crypto_method'] = $_SESSION['email']['smtp_crypto_method']['text'];
|
||||
|
||||
if (isset($_SESSION['voicemail']['smtp_from']) && strlen($_SESSION['voicemail']['smtp_from']['text']) > 0) {
|
||||
if (isset($_SESSION['voicemail']['smtp_from']) && !empty($_SESSION['voicemail']['smtp_from']['text'])) {
|
||||
$smtp['from'] = $_SESSION['voicemail']['smtp_from']['text'];
|
||||
}
|
||||
if (isset($_SESSION['voicemail']['smtp_from_name']) && strlen($_SESSION['voicemail']['smtp_from_name']['text']) > 0) {
|
||||
if (isset($_SESSION['voicemail']['smtp_from_name']) && !empty($_SESSION['voicemail']['smtp_from_name']['text'])) {
|
||||
$smtp['from_name'] = $_SESSION['voicemail']['smtp_from_name']['text'];
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ if (!class_exists('email')) {
|
||||
|
||||
//send the email
|
||||
if (!$mail_status) {
|
||||
if (isset($mail->ErrorInfo) && strlen($mail->ErrorInfo) > 0) {
|
||||
if (isset($mail->ErrorInfo) && !empty($mail->ErrorInfo)) {
|
||||
$this->error = $mail->ErrorInfo;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -395,7 +395,7 @@ if (!class_exists('menu')) {
|
||||
if (is_array($row['menu'])) {
|
||||
foreach ($row['menu'] as $menu) {
|
||||
//set the variables
|
||||
if (strlen($menu['title'][$this->menu_language]) > 0) {
|
||||
if (!empty($menu['title'][$this->menu_language])) {
|
||||
$menu_item_title = $menu['title'][$this->menu_language];
|
||||
}
|
||||
else {
|
||||
@@ -449,7 +449,7 @@ if (!class_exists('menu')) {
|
||||
$array['menu_items'][$x]['menu_item_link'] = $menu_item_path;
|
||||
$array['menu_items'][$x]['menu_item_category'] = $menu_item_category;
|
||||
$array['menu_items'][$x]['menu_item_icon'] = $menu_item_icon;
|
||||
if (strlen($menu_item_order) > 0) {
|
||||
if (!empty($menu_item_order)) {
|
||||
$array['menu_items'][$x]['menu_item_order'] = $menu_item_order;
|
||||
}
|
||||
if (is_uuid($menu_item_parent_uuid)) {
|
||||
@@ -466,7 +466,7 @@ if (!class_exists('menu')) {
|
||||
foreach ($language->languages as $menu_language) {
|
||||
//set the menu item title
|
||||
$menu_item_title = $menu["title"][$menu_language];
|
||||
if (strlen($menu_item_title) == 0) {
|
||||
if (empty($menu_item_title)) {
|
||||
$menu_item_title = $menu["title"]['en-us'];
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ if (!class_exists('menu')) {
|
||||
if (!isset($_SESSION["username"])) {
|
||||
$_SESSION["username"] = '';
|
||||
}
|
||||
if (strlen($_SESSION["username"]) == 0) {
|
||||
if (empty($_SESSION["username"])) {
|
||||
$menu_html .= "<a $menu_tags style='padding: 0px 0px; border-style: none; background: none;'><h2 align='center' style=''>".$menu_item_title."</h2></a>\n";
|
||||
}
|
||||
else {
|
||||
@@ -621,7 +621,7 @@ if (!class_exists('menu')) {
|
||||
//hide login and sign-up when the user is logged in
|
||||
}
|
||||
else {
|
||||
if (strlen($submenu_item_link) == 0) {
|
||||
if (empty($submenu_item_link)) {
|
||||
$menu_html .= "<h2 align='center' style=''>".$menu_item_title."</h2>\n";
|
||||
}
|
||||
else {
|
||||
@@ -767,7 +767,7 @@ if (!class_exists('menu')) {
|
||||
|
||||
//add the sub menus to the array
|
||||
$menu_item_level = 0;
|
||||
if (strlen($row['menu_item_uuid']) > 0) {
|
||||
if (!empty($row['menu_item_uuid'])) {
|
||||
$a[$x]['menu_items'] = $this->menu_child_array($menu_item_level, $row['menu_item_uuid']);
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ if (!class_exists('menu')) {
|
||||
}
|
||||
|
||||
//get sub menu for children
|
||||
if (strlen($menu_item_uuid) > 0) {
|
||||
if (!empty($menu_item_uuid)) {
|
||||
$a[$x]['menu_items'] = $this->menu_child_array($menu_item_level, $menu_item_uuid);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ if (!class_exists('message')) {
|
||||
}
|
||||
|
||||
static function html($clear_messages = true, $spacer = "") {
|
||||
$html = "${spacer}//render the messages\n";
|
||||
$html = "{$spacer}//render the messages\n";
|
||||
$spacer .="\t";
|
||||
if (is_string($_SESSION['message']) && strlen(trim($_SESSION['message'])) > 0) {
|
||||
if (is_string($_SESSION['message']) && !empty(trim($_SESSION['message']))) {
|
||||
self::add($_SESSION['message'], $_SESSION['message_mood'], $_SESSION['message_delay']);
|
||||
unset($_SESSION['message'], $_SESSION['message_mood'], $_SESSION['message_delay']);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ if (!class_exists('message')) {
|
||||
foreach ($_SESSION['messages'] as $message_mood => $message) {
|
||||
$message_text = str_replace(array("\r\n", "\n", "\r"),'\\n',addslashes(join('<br/>', $message['message'])));
|
||||
$message_delay = array_sum($message['delay'])/count($message['delay']);
|
||||
$html .= "${spacer}display_message('$message_text', '$message_mood', '$message_delay');\n";
|
||||
$html .= "{$spacer}display_message('$message_text', '$message_mood', '$message_delay');\n";
|
||||
}
|
||||
}
|
||||
if ($clear_messages) {
|
||||
|
||||
@@ -115,7 +115,7 @@ if (!class_exists('ringbacks')) {
|
||||
foreach ($this->music_list as $row) {
|
||||
if ($previous_name != $row['music_on_hold_name']) {
|
||||
$name = '';
|
||||
if (strlen($row['domain_uuid']) > 0) {
|
||||
if (!empty($row['domain_uuid'])) {
|
||||
$name = $row['domain_name'].'/';
|
||||
}
|
||||
$name .= $row['music_on_hold_name'];
|
||||
|
||||
@@ -190,7 +190,7 @@ if (!class_exists('schema')) {
|
||||
|
||||
//get the table information
|
||||
public function table_info($db_name, $table_name) {
|
||||
if (strlen($table_name) == 0) { return false; }
|
||||
if (empty($table_name)) { return false; }
|
||||
if ($this->db_type == "sqlite") {
|
||||
$sql = "PRAGMA table_info(".$table_name.");";
|
||||
}
|
||||
@@ -252,7 +252,7 @@ if (!class_exists('schema')) {
|
||||
|
||||
//database table information
|
||||
private function db_table_info($db_name, $db_type, $table_name) {
|
||||
if (strlen($table_name) == 0) { return false; }
|
||||
if (empty($table_name)) { return false; }
|
||||
if ($db_type == "sqlite") {
|
||||
$sql = "PRAGMA table_info(".$table_name.");";
|
||||
}
|
||||
@@ -564,7 +564,7 @@ if (!class_exists('schema')) {
|
||||
$table_name = $row['table'];
|
||||
}
|
||||
}
|
||||
if (strlen($table_name) > 0) {
|
||||
if (!empty($table_name)) {
|
||||
|
||||
//check if the table exists
|
||||
if ($this->db_table_exists($db_type, $db_name, $table_name)) {
|
||||
@@ -585,7 +585,7 @@ if (!class_exists('schema')) {
|
||||
else {
|
||||
$field_name = $field['name'];
|
||||
}
|
||||
if (strlen($field_name) > 0) {
|
||||
if (!empty($field_name)) {
|
||||
if ($this->db_column_exists ($db_type, $db_name, $table_name, $field_name)) {
|
||||
//found
|
||||
$apps[$x]['db'][$y]['fields'][$z]['exists'] = 'true';
|
||||
@@ -690,7 +690,7 @@ if (!class_exists('schema')) {
|
||||
$db_field_type = $this->db_column_data_type ($db_type, $db_name, $table_name, $field_name);
|
||||
$field_type_array = explode("(", $field_type);
|
||||
$field_type = $field_type_array[0];
|
||||
if (trim($db_field_type) != trim($field_type) && strlen($db_field_type) > 0) {
|
||||
if (trim($db_field_type) != trim($field_type) && !empty($db_field_type)) {
|
||||
if ($db_type == "pgsql") {
|
||||
if (strtolower($field_type) == "uuid") {
|
||||
$sql_update .= "ALTER TABLE ".$table_name." ALTER COLUMN ".$field_name." TYPE uuid USING\n";
|
||||
@@ -790,7 +790,7 @@ if (!class_exists('schema')) {
|
||||
//start the table
|
||||
$response .= "<table width='100%' border='0' cellpadding='20' cellspacing='0'>\n";
|
||||
//show the changes
|
||||
if (strlen($sql_update) > 0) {
|
||||
if (!empty($sql_update)) {
|
||||
$response .= "<tr>\n";
|
||||
$response .= "<td class='row_style1' colspan='3'>\n";
|
||||
$response .= "<br />\n";
|
||||
@@ -887,7 +887,7 @@ if (!class_exists('schema')) {
|
||||
|
||||
//loop line by line through all the lines of sql code
|
||||
$x = 0;
|
||||
if (strlen($sql_update) == 0 && $format == "text") {
|
||||
if (empty($sql_update) && $format == "text") {
|
||||
$response .= " ".$text['label-schema'].": ".$text['label-no_change']."\n";
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -26,7 +26,7 @@ if (!class_exists('switch_settings')) {
|
||||
|
||||
//define the variables
|
||||
if (!isset($this->event_socket_ip_address)) {
|
||||
if (strlen($_SESSION['event_socket_ip_address']) > 0) {
|
||||
if (!empty($_SESSION['event_socket_ip_address'])) {
|
||||
$this->event_socket_ip_address = $_SESSION['event_socket_ip_address'];
|
||||
}
|
||||
else {
|
||||
@@ -34,7 +34,7 @@ if (!class_exists('switch_settings')) {
|
||||
}
|
||||
}
|
||||
if (!isset($this->event_socket_port)) {
|
||||
if (strlen($_SESSION['event_socket_port']) > 0) {
|
||||
if (!empty($_SESSION['event_socket_port'])) {
|
||||
$this->event_socket_port = $_SESSION['event_socket_port'];
|
||||
}
|
||||
else {
|
||||
@@ -42,7 +42,7 @@ if (!class_exists('switch_settings')) {
|
||||
}
|
||||
}
|
||||
if (!isset($this->event_socket_password)) {
|
||||
if (strlen($_SESSION['event_socket_password']) > 0) {
|
||||
if (!empty($_SESSION['event_socket_password'])) {
|
||||
$this->event_socket_password = $_SESSION['event_socket_password'];
|
||||
}
|
||||
else {
|
||||
|
||||
+13
-14
@@ -3,7 +3,6 @@
|
||||
/**
|
||||
* Get the text for the correct translation
|
||||
*
|
||||
* @method array get
|
||||
*/
|
||||
class text {
|
||||
public $languages;
|
||||
@@ -72,9 +71,9 @@ class text {
|
||||
else {
|
||||
$lang_path = getcwd();
|
||||
}
|
||||
if (file_exists("${lang_path}/app_languages.php")) {
|
||||
if (file_exists($lang_path."/app_languages.php")) {
|
||||
if ($lang_path != 'resources' or $exclude_global) {
|
||||
include "${lang_path}/app_languages.php";
|
||||
include "{$lang_path}/app_languages.php";
|
||||
}
|
||||
}
|
||||
//else {
|
||||
@@ -100,7 +99,7 @@ class text {
|
||||
if ($language_code != 'all') {
|
||||
if (is_array($text)) {
|
||||
foreach ($text as $key => $value) {
|
||||
if (isset($value[$language_code]) && strlen($value[$language_code]) > 0) {
|
||||
if (isset($value[$language_code]) && !empty($value[$language_code])) {
|
||||
$text[$key] = $value[$language_code];
|
||||
}
|
||||
else {
|
||||
@@ -177,7 +176,7 @@ class text {
|
||||
if ($app_path == 'resources') {
|
||||
foreach($this->languages as $language) {
|
||||
$label = array_shift($text["language-$language"]);
|
||||
if (strlen($label) == 0)
|
||||
if (empty($label))
|
||||
$label = $language;
|
||||
$text["language-$language"]['en-us'] = $label;
|
||||
}
|
||||
@@ -200,7 +199,7 @@ class text {
|
||||
if (strlen($target_lang) == 11)
|
||||
$spacer = " ";
|
||||
$language_name = $this->escape_str(array_shift($text[$lang_label]));
|
||||
if (strlen($language_name) == 0)
|
||||
if (empty($language_name))
|
||||
$language_name = $this->escape_str($target_lang);
|
||||
fwrite($lang_file, "\$text['language-$target_lang'$spacer]['en-us'] = \"$language_name\";\n");
|
||||
}
|
||||
@@ -223,27 +222,27 @@ class text {
|
||||
$spacer = " ";
|
||||
if (array_key_exists($lang_code, $text[$lang_label]))
|
||||
$value = $text[$lang_label][$lang_code];
|
||||
if (strlen($value) == 0 and array_key_exists($target_lang, $this->legacy_map)) {
|
||||
if (empty($value) and array_key_exists($target_lang, $this->legacy_map)) {
|
||||
$value = $text[$lang_label][$this->legacy_map[$target_lang]];
|
||||
}
|
||||
$base_code = substr($target_lang, 0, 2);
|
||||
if (strlen($value) > 0
|
||||
if (!empty($value)
|
||||
and array_key_exists($base_code, $this->legacy_map )
|
||||
and $this->legacy_map[$base_code] != $target_lang
|
||||
and $value == $text[$lang_label][$this->legacy_map[$base_code]]
|
||||
) {
|
||||
$append = " //copied from ".$this->legacy_map[$base_code];
|
||||
}
|
||||
if (strlen($value) == 0) {
|
||||
if (empty($value)) {
|
||||
foreach($this->languages as $lang_code) {
|
||||
if (substr($lang_code, 0, 2) == $base_code and strlen($text[$lang_label][$lang_code]) > 0) {
|
||||
if (substr($lang_code, 0, 2) == $base_code and !empty($text[$lang_label][$lang_code])) {
|
||||
$value = $text[$lang_label][$lang_code];
|
||||
$append = " //copied from $lang_code";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strlen($append) == 0 && array_key_exists($comment, $lang_label) && array_key_exists($comment[$lang_label], $lang_code)) {
|
||||
if(empty($append) && array_key_exists($comment, $lang_label) && array_key_exists($comment[$lang_label], $lang_code)) {
|
||||
$append = " //$comment[$lang_label][$lang_code]";
|
||||
}
|
||||
fwrite($lang_file, "\$text['$lang_label']['$target_lang'$spacer] = \"".$this->escape_str($value)."\";$append\n");
|
||||
@@ -319,7 +318,7 @@ class text {
|
||||
foreach($text as $label_name => $values) {
|
||||
$language_totals['languages']['total']++;
|
||||
foreach ($this->languages as $language_code) {
|
||||
if (strlen($values[$language_code]) > 0)
|
||||
if (!empty($values[$language_code]))
|
||||
$language_totals['languages'][$language_code]++;
|
||||
}
|
||||
}
|
||||
@@ -342,12 +341,12 @@ class text {
|
||||
foreach($app['menu'] as $menu_item) {
|
||||
$language_totals['menu_items']['total']++;
|
||||
foreach ($this->languages as $language_code) {
|
||||
if (strlen($menu_item['title'][$language_code]) > 0)
|
||||
if (!empty($menu_item['title'][$language_code]))
|
||||
$language_totals['menu_items'][$language_code]++;
|
||||
}
|
||||
}
|
||||
foreach ($this->languages as $language_code) {
|
||||
if (strlen($app['description'][$language_code]) > 0) {
|
||||
if (!empty($app['description'][$language_code])) {
|
||||
$language_totals['app_descriptions'][$language_code]++;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -90,13 +90,13 @@ class vcard {
|
||||
$this->card .= "N:";
|
||||
$this->card .= $this->data['last_name'].";";
|
||||
$this->card .= $this->data['first_name'];
|
||||
if (strlen($this->data['additional_name']) > 0) {
|
||||
if (!empty($this->data['additional_name'])) {
|
||||
$this->card .= ";".$this->data['additional_name'];
|
||||
}
|
||||
if (strlen($this->data['name_prefix']) > 0) {
|
||||
if (!empty($this->data['name_prefix'])) {
|
||||
$this->card .= ";".$this->data['name_prefix'];
|
||||
}
|
||||
if (strlen($this->data['name_suffix']) > 0) {
|
||||
if (!empty($this->data['name_suffix'])) {
|
||||
$this->card .= ";".$this->data['name_suffix'];
|
||||
}
|
||||
$this->card .= "\r\n";
|
||||
@@ -116,25 +116,25 @@ class vcard {
|
||||
|| $this->data[$vcard_address_type_value.'_postal_code']
|
||||
|| $this->data[$vcard_address_type_value.'_country']) {
|
||||
$this->card .= "ADR;TYPE=".$vcard_address_type_value.":";
|
||||
if (strlen($this->data[$vcard_address_type_value.'_po_box']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_po_box'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_po_box'].";";
|
||||
}
|
||||
if (strlen($this->data[$vcard_address_type_value.'_extended_address']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_extended_address'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_extended_address'].";";
|
||||
}
|
||||
if (strlen($this->data[$vcard_address_type_value.'_address']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_address'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_address'].";";
|
||||
}
|
||||
if (strlen($this->data[$vcard_address_type_value.'_city']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_city'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_city'].";";
|
||||
}
|
||||
if (strlen($this->data[$vcard_address_type_value.'_state']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_state'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_state'].";";
|
||||
}
|
||||
if (strlen($this->data[$vcard_address_type_value.'_postal_code']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_postal_code'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_postal_code'].";";
|
||||
}
|
||||
if (strlen($this->data[$vcard_address_type_value.'_country']) > 0) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_country'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_country']."";
|
||||
}
|
||||
$this->card .= "\r\n";
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
//}
|
||||
|
||||
//set a default template
|
||||
if (strlen($_SESSION["template_full_path"]) == 0) { //build template if session template has no length
|
||||
if (empty($_SESSION["template_full_path"])) { //build template if session template has no length
|
||||
$template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if (strlen($template_rss_sub_category) > 0) {
|
||||
if (!empty($template_rss_sub_category)) {
|
||||
//this template was assigned by the content manager
|
||||
//get the contents of the template and save it to the template variable
|
||||
$template_full_path = $template_base_path.'/'.$template_rss_sub_category.'/template.php';
|
||||
|
||||
@@ -866,7 +866,7 @@ class pdf_parser
|
||||
case '/Fl':
|
||||
if (function_exists('gzuncompress')) {
|
||||
$oStream = $stream;
|
||||
$stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';
|
||||
$stream = (!empty($stream)) ? @gzuncompress($stream) : '';
|
||||
} else {
|
||||
throw new Exception(
|
||||
sprintf('To handle %s filter, please compile php with zlib support.', $filter[1])
|
||||
|
||||
+30
-32
@@ -60,7 +60,7 @@
|
||||
else {
|
||||
$tmp_str = mysqli_real_escape_string($db, $string);
|
||||
}
|
||||
if (strlen($tmp_str)) {
|
||||
if (!empty($tmp_str)) {
|
||||
$string = $tmp_str;
|
||||
}
|
||||
else {
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
if (!function_exists('check_cidr')) {
|
||||
function check_cidr($cidr, $ip_address) {
|
||||
if (isset($cidr) && strlen($cidr) > 0) {
|
||||
if (isset($cidr) && !empty($cidr)) {
|
||||
list ($subnet, $mask) = explode ('/', $cidr);
|
||||
return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet);
|
||||
}
|
||||
@@ -362,7 +362,7 @@
|
||||
$result = $database->select($sql, null, 'all');
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
foreach($result as $field) {
|
||||
if (strlen($field[$field_name]) > 0) {
|
||||
if (!empty($field[$field_name])) {
|
||||
$html .= "<option value=\"".escape($field[$field_name])."\" ".($field_current_value == $field[$field_name] ? "selected='selected'" : null).">".escape($field[$field_name])."</option>\n";
|
||||
}
|
||||
}
|
||||
@@ -391,7 +391,7 @@
|
||||
$field_name = preg_replace("#[^a-zA-Z0-9_]#", "", $field_name);
|
||||
$field_value = preg_replace("#[^a-zA-Z0-9_]#", "", $field_value);
|
||||
|
||||
if (strlen($field_value) > 0) {
|
||||
if (!empty($field_value)) {
|
||||
$html .= "<select id=\"".$field_value."\" name=\"".$field_value."\" class='formfld' style='".$style."' ".($on_change != '' ? "onchange=\"".$on_change."\"" : null).">\n";
|
||||
$html .= " <option value=\"\"></option>\n";
|
||||
|
||||
@@ -408,9 +408,9 @@
|
||||
$result = $database->select($sql, null, 'all');
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
foreach($result as $field) {
|
||||
if (strlen($field[$field_name]) > 0) {
|
||||
if (!empty($field[$field_name])) {
|
||||
$selected = $field_current_value == $field[$field_name] ? "selected='selected'" : null;
|
||||
$array_key = strlen($field_value) > 0 ? $field_value : $field_name;
|
||||
$array_key = empty($field_value) ? $field_name : $field_value;
|
||||
$html .= "<option value=\"".urlencode($field[$array_key])."\" ".$selected.">".urlencode($field[$field_name])."</option>\n";
|
||||
}
|
||||
}
|
||||
@@ -429,10 +429,10 @@
|
||||
if (is_uuid($app_uuid) > 0) { $app_uuid = "&app_uuid=".urlencode($app_uuid); } // accomodate need to pass app_uuid where necessary (inbound/outbound routes lists)
|
||||
|
||||
$field_name = preg_replace("#[^a-zA-Z0-9_]#", "", $field_name);
|
||||
$field_value = preg_replace("#[^a-zA-Z0-9_]#", "", $field_value);
|
||||
$field_value = preg_replace("#[^a-zA-Z0-9_]#", "", $field_value ?? '');
|
||||
|
||||
$sanitized_parameters = '';
|
||||
if (isset($http_get_params) && strlen($http_get_params) > 0) {
|
||||
if (isset($http_get_params) && !empty($http_get_params)) {
|
||||
$parameters = explode('&', $http_get_params);
|
||||
if (is_array($parameters)) {
|
||||
foreach ($parameters as $parameter) {
|
||||
@@ -440,11 +440,11 @@
|
||||
$array = explode('=', $parameter);
|
||||
$key = preg_replace('#[^a-zA-Z0-9_\-]#', '', $array['0']);
|
||||
$value = urldecode($array['1']);
|
||||
if ($key == 'order_by' && strlen($value) > 0) {
|
||||
if ($key == 'order_by' && !empty($value)) {
|
||||
//validate order by
|
||||
$sanitized_parameters .= "&order_by=". preg_replace('#[^a-zA-Z0-9_\-]#', '', $value);
|
||||
}
|
||||
else if ($key == 'order' && strlen($value) > 0) {
|
||||
else if ($key == 'order' && !empty($value)) {
|
||||
//validate order
|
||||
switch ($value) {
|
||||
case 'asc':
|
||||
@@ -455,7 +455,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strlen($value) > 0 && is_numeric($value)) {
|
||||
else if (!empty($value) && is_numeric($value)) {
|
||||
$sanitized_parameters .= "&".$key."=".$value;
|
||||
}
|
||||
else {
|
||||
@@ -467,8 +467,8 @@
|
||||
}
|
||||
|
||||
$html = "<th ".$css." nowrap='nowrap'>";
|
||||
$description = (strlen($description) > 0) ? $description . ', ': '';
|
||||
if (strlen($order_by) == 0) {
|
||||
$description = empty($description) ? '' : $description . ', ';
|
||||
if (empty($order_by)) {
|
||||
$order = 'asc';
|
||||
}
|
||||
if ($order_by == $field_name) {
|
||||
@@ -563,7 +563,7 @@
|
||||
//find unique filename: check if file exists if it does then increment the filename
|
||||
$i = 1;
|
||||
while( file_exists($dest_dir.'/'.$file_name)) {
|
||||
if (strlen($file_ext)> 0) {
|
||||
if (!empty($file_ext)) {
|
||||
$file_name = $file_name_base . $i .'.'. $file_ext;
|
||||
}
|
||||
else {
|
||||
@@ -688,8 +688,8 @@
|
||||
if (!function_exists('user_add')) {
|
||||
function user_add($username, $password, $user_email = '') {
|
||||
global $domain_uuid;
|
||||
if (strlen($username) == 0) { return false; }
|
||||
if (strlen($password) == 0) { return false; }
|
||||
if (empty($username)) { return false; }
|
||||
if (empty($password)) { return false; }
|
||||
if (!username_exists($username)) {
|
||||
//build user insert array
|
||||
$user_uuid = uuid();
|
||||
@@ -758,6 +758,10 @@ function switch_module_is_running($fp, $mod) {
|
||||
|
||||
//format a number (n) replace with a number (r) remove the number
|
||||
function format_string($format, $data) {
|
||||
//nothing to do so return
|
||||
if(empty($format))
|
||||
return $data;
|
||||
|
||||
//preset values
|
||||
$x=0;
|
||||
$tmp = '';
|
||||
@@ -783,7 +787,7 @@ function format_string($format, $data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($tmp) == 0) {
|
||||
if (empty($tmp)) {
|
||||
return $data;
|
||||
}
|
||||
else {
|
||||
@@ -1666,8 +1670,8 @@ function number_pad($number,$n) {
|
||||
$string = "^\\+(".substr($string, 1).")$";
|
||||
}
|
||||
//add prefix
|
||||
if (strlen($prefix) > 0) {
|
||||
if (strlen($prefix) > 0 && strlen($prefix) < 4) {
|
||||
if (!empty($prefix)) {
|
||||
if (!empty($prefix) && strlen($prefix) < 4) {
|
||||
$plus = (substr($string, 0, 1) == "+") ? '' : '\+?';
|
||||
$prefix = $plus.$prefix.'?';
|
||||
}
|
||||
@@ -1888,16 +1892,9 @@ function number_pad($number,$n) {
|
||||
|
||||
//escape user data
|
||||
function escape($string) {
|
||||
if (is_array($string)) {
|
||||
return false;
|
||||
}
|
||||
elseif (isset($string) && strlen($string)) {
|
||||
if (is_string($string))
|
||||
return htmlentities($string, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
//return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||
return false;
|
||||
}
|
||||
|
||||
//output pre-formatted array keys and values
|
||||
@@ -2010,8 +2007,9 @@ function number_pad($number,$n) {
|
||||
if (!function_exists('order_by')) {
|
||||
function order_by($col, $dir, $col_default = '', $dir_default = 'asc') {
|
||||
$order_by = ' order by ';
|
||||
$col = preg_replace('#[^a-zA-Z0-9-_.]#', '', $col);
|
||||
$dir = strtolower($dir) == 'desc' ? 'desc' : 'asc';
|
||||
$col = preg_replace('#[^a-zA-Z0-9-_.]#', '', $col ?? '');
|
||||
if(!empty($dir))
|
||||
$dir = strtolower($dir) == 'desc' ? 'desc' : 'asc';
|
||||
if ($col != '') {
|
||||
return $order_by.$col.' '.$dir.' ';
|
||||
}
|
||||
@@ -2037,7 +2035,7 @@ function number_pad($number,$n) {
|
||||
function limit_offset($limit, $offset = 0) {
|
||||
$regex = '#[^0-9]#';
|
||||
$limit = preg_replace($regex, '', $limit);
|
||||
$offset = preg_replace($regex, '', $offset);
|
||||
$offset = preg_replace($regex, '', $offset ?? '');
|
||||
if (is_numeric($limit) && $limit > 0) {
|
||||
$clause = ' limit '.$limit;
|
||||
$offset = is_numeric($offset) ? $offset : 0;
|
||||
@@ -2152,7 +2150,7 @@ function number_pad($number,$n) {
|
||||
//get accountcode
|
||||
if (!function_exists('get_accountcode')) {
|
||||
function get_accountcode() {
|
||||
if (strlen($accountcode = $_SESSION['domain']['accountcode']['text']) > 0) {
|
||||
if (!empty($accountcode = $_SESSION['domain']['accountcode']['text'] ?? '')) {
|
||||
if ($accountcode == "none") {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
//if reloadxml then run the command
|
||||
if (permission_exists('dialplan_edit') && isset($_SESSION["reload_xml"])) {
|
||||
if (strlen($_SESSION["reload_xml"]) > 0) {
|
||||
if (!empty($_SESSION["reload_xml"])) {
|
||||
if ($_SESSION['apply_settings'] == "true") {
|
||||
//show the apply settings prompt
|
||||
}
|
||||
@@ -95,23 +95,23 @@
|
||||
$sql .= ") ";
|
||||
$sql .= "order by rss_order asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['content'] = strlen($content) == 0 ? $_SERVER["PHP_SELF"] : $content;
|
||||
$parameters['content'] = empty($content) ? $_SERVER["PHP_SELF"] : $content;
|
||||
$database = new database;
|
||||
$content_result = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($content_result) && @sizeof($content_result) != 0) {
|
||||
foreach($content_result as $content_row) {
|
||||
$template_rss_sub_category = $content_row['rss_sub_category'];
|
||||
if (strlen($content_row['rss_group']) == 0) {
|
||||
if (empty($content_row['rss_group'])) {
|
||||
//content is public
|
||||
$content_from_db = &$content_row['rss_description'];
|
||||
if (strlen($content_row['rss_title']) > 0) {
|
||||
if (!empty($content_row['rss_title'])) {
|
||||
$page["title"] = $content_row['rss_title'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (if_group($content_row[rss_group])) { //viewable only to designated group
|
||||
$content_from_db = &$content_row[rss_description];
|
||||
if (strlen($content_row['rss_title']) > 0) {
|
||||
if (!empty($content_row['rss_title'])) {
|
||||
$page["title"] = $content_row['rss_title'];
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -251,17 +251,17 @@
|
||||
|
||||
//santize the login destination url and set a default value
|
||||
if (isset($_SESSION['login']['destination']['text'])) {
|
||||
$destination_path = parse_url($_SESSION['login']['destination']['text'])['path'];
|
||||
$destination_query = parse_url($_SESSION['login']['destination']['text'])['query'];
|
||||
$destination_path = parse_url($_SESSION['login']['destination']['text'])['path'] ?? '';
|
||||
$destination_query = parse_url($_SESSION['login']['destination']['text'])['query'] ?? '';
|
||||
$destination_path = preg_replace('#[^a-zA-Z0-9_\-\./]#', '', $destination_path);
|
||||
$destination_query = preg_replace('#[^a-zA-Z0-9_\-\./&=]#', '', $destination_query);
|
||||
$_SESSION['login']['destination']['text'] = (strlen($destination_query) > 0) ? $destination_path.'?'.$destination_query : $destination_path;
|
||||
$_SESSION['login']['destination']['text'] = (!empty($destination_query)) ? $destination_path.'?'.$destination_query : $destination_path;
|
||||
}
|
||||
else {
|
||||
$_SESSION['login']['destination']['text'] = PROJECT_PATH."/core/dashboard/";
|
||||
}
|
||||
|
||||
if (strlen($_REQUEST['path']) > 0) {
|
||||
if (!empty($_REQUEST['path'])) {
|
||||
$_SESSION['redirect_path'] = $_REQUEST['path'];
|
||||
}
|
||||
|
||||
|
||||
@@ -41,18 +41,18 @@ function paging($num_rows, $param, $rows_per_page, $mini = false, $result_count
|
||||
|
||||
//sanitize the parameters
|
||||
$sanitized_parameters = '';
|
||||
if (isset($param) && strlen($param) > 0) {
|
||||
if (isset($param) && !empty($param)) {
|
||||
$param_array = explode("&", $param);
|
||||
if (is_array($param_array)) {
|
||||
foreach($param_array as $row) {
|
||||
$param_sub_array = explode("=", $row);
|
||||
$key = preg_replace('#[^a-zA-Z0-9_\-]#', '', $param_sub_array['0']);
|
||||
$value = urldecode($param_sub_array['1']);
|
||||
if ($key == 'order_by' && strlen($value) > 0) {
|
||||
$value = urldecode($param_sub_array['1'] ?? '');
|
||||
if ($key === 'order_by' && !empty($value)) {
|
||||
//validate order by
|
||||
$sanitized_parameters .= "&order_by=". preg_replace('#[^a-zA-Z0-9_\-]#', '', $value);
|
||||
}
|
||||
else if ($key == 'order' && strlen($value) > 0) {
|
||||
else if ($key == 'order' && !empty($value)) {
|
||||
//validate order
|
||||
switch ($value) {
|
||||
case 'asc':
|
||||
@@ -63,11 +63,11 @@ function paging($num_rows, $param, $rows_per_page, $mini = false, $result_count
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strlen($value) > 0 && is_numeric($value)) {
|
||||
else if (!empty($value) && is_numeric($value)) {
|
||||
$sanitized_parameters .= "&".$key."=".$value;
|
||||
}
|
||||
else {
|
||||
$sanitized_parameters .= "&".$key."=".urlencode($value);
|
||||
$sanitized_parameters .= "&".$key."=".urlencode($value ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -107,13 +107,13 @@ if (!function_exists('get_db_field_names')) {
|
||||
if ($db_type == "sqlite") {
|
||||
|
||||
//set the document_root
|
||||
if (strlen($document_root) == 0) {
|
||||
if (empty($document_root)) {
|
||||
$document_root = $_SERVER["DOCUMENT_ROOT"];
|
||||
}
|
||||
|
||||
//prepare the database connection
|
||||
if (strlen($db_name) == 0) {
|
||||
//if (strlen($_SERVER["SERVER_NAME"]) == 0) { $_SERVER["SERVER_NAME"] = "http://localhost"; }
|
||||
if (empty($db_name)) {
|
||||
//if (empty($_SERVER["SERVER_NAME"])) { $_SERVER["SERVER_NAME"] = "http://localhost"; }
|
||||
$server_name = $_SERVER["SERVER_NAME"];
|
||||
$server_name = str_replace ("www.", "", $server_name);
|
||||
//$server_name = str_replace (".", "_", $server_name);
|
||||
@@ -220,12 +220,12 @@ if ($db_type == "mysql") {
|
||||
//$mysql_connection = mysqli_connect($db_host, $db_username, $db_password,$db_name) or die("Error " . mysqli_error($link));
|
||||
}
|
||||
//mysql pdo connection
|
||||
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
|
||||
if (strlen($db_host) == 0 && empty($db_port)) {
|
||||
//if both host and port are empty use the unix socket
|
||||
$db = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;dbname=$db_name;charset=utf8;", $db_username, $db_password);
|
||||
}
|
||||
else {
|
||||
if (strlen($db_port) == 0) {
|
||||
if (empty($db_port)) {
|
||||
//leave out port if it is empty
|
||||
$db = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8;", $db_username, $db_password, array(
|
||||
PDO::ATTR_ERRMODE,
|
||||
@@ -252,8 +252,8 @@ if ($db_type == "pgsql") {
|
||||
if (!isset($db_secure)) {
|
||||
$db_secure = false;
|
||||
}
|
||||
if (strlen($db_host) > 0) {
|
||||
if (strlen($db_port) == 0) { $db_port = "5432"; }
|
||||
if (!empty($db_host)) {
|
||||
if (empty($db_port)) { $db_port = "5432"; }
|
||||
if ($db_secure == true) {
|
||||
$db = new PDO("pgsql:host=$db_host port=$db_port dbname=$db_name user=$db_username password=$db_password sslmode=verify-ca sslrootcert=$db_cert_authority");
|
||||
}
|
||||
@@ -354,7 +354,7 @@ if ($db_type == "odbc") {
|
||||
}
|
||||
|
||||
//set the domain_uuid variable from the session
|
||||
if (strlen($_SESSION["domain_uuid"]) > 0) {
|
||||
if (!empty($_SESSION["domain_uuid"])) {
|
||||
$domain_uuid = $_SESSION["domain_uuid"];
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
//database connection
|
||||
try {
|
||||
unset($db);
|
||||
if (strlen($odbc_dsn) == 0) {
|
||||
if (empty($odbc_dsn)) {
|
||||
$db = new PDO('sqlite:'.$_SESSION['switch']['db']['dir'].'/voicemail_default.db'); //sqlite 3
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1924,7 +1924,7 @@ class PHPMailer
|
||||
}
|
||||
$buf = '';
|
||||
}
|
||||
while (strlen($word) > 0) {
|
||||
while (!empty($word)) {
|
||||
if ($length <= 0) {
|
||||
break;
|
||||
}
|
||||
@@ -1939,7 +1939,7 @@ class PHPMailer
|
||||
$part = substr($word, 0, $len);
|
||||
$word = substr($word, $len);
|
||||
|
||||
if (strlen($word) > 0) {
|
||||
if (!empty($word)) {
|
||||
$message .= $part . sprintf('=%s', self::CRLF);
|
||||
} else {
|
||||
$buf = $part;
|
||||
|
||||
@@ -420,7 +420,7 @@ class mime_parser_class
|
||||
{
|
||||
$value = substr($remaining, 1, $quote - 1);
|
||||
$p = trim(substr($remaining, $quote + 1));
|
||||
if(strlen($p) > 0
|
||||
if(!empty($p)
|
||||
&& !strcmp($p[0], ';'))
|
||||
$p = substr($p, 1);
|
||||
}
|
||||
@@ -967,7 +967,7 @@ class mime_parser_class
|
||||
$decoded=base64_decode(substr($value, $start, $end - $start));
|
||||
if($end <= $start
|
||||
|| GetType($decoded) != 'string'
|
||||
|| strlen($decoded) == 0)
|
||||
|| empty($decoded))
|
||||
{
|
||||
$warning = 'the header specified an invalid base64 encoded text';
|
||||
$warning_position = $part['Position'] + $start;
|
||||
|
||||
@@ -650,7 +650,7 @@ class pop3_class
|
||||
{
|
||||
if($this->state!="TRANSACTION")
|
||||
return($this->SetError("cannot get the name of a POP3 connection that was not established and the user has logged in"));
|
||||
if(strlen($this->connection_name) == 0)
|
||||
if(empty($this->connection_name))
|
||||
pop3_class::SetConnection(1, $this->connection_name, $this);
|
||||
$connection_name = $this->connection_name;
|
||||
return('');
|
||||
|
||||
@@ -228,7 +228,7 @@ class rfc822_addresses_class
|
||||
|
||||
case 'b':
|
||||
if($e <= $t
|
||||
|| strlen($binary = base64_decode($data = substr($value, $t, $e - $t))) == 0
|
||||
|| empty($binary = base64_decode($data = substr($value, $t, $e - $t)))
|
||||
|| GetType($binary) != 'string')
|
||||
return($this->SetPositionedWarning('invalid Q-encoding b encoded data', $p + $t));
|
||||
$decoded .= $binary;
|
||||
|
||||
+39
-39
@@ -35,7 +35,7 @@
|
||||
|
||||
//get the event socket information
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) {
|
||||
if ((! isset($_SESSION['event_socket_ip_address'])) or strlen($_SESSION['event_socket_ip_address']) == 0) {
|
||||
if ((! isset($_SESSION['event_socket_ip_address'])) or empty($_SESSION['event_socket_ip_address'])) {
|
||||
$sql = "select * from v_settings ";
|
||||
$database = new database;
|
||||
$row = $database->select($sql, null, 'row');
|
||||
@@ -145,7 +145,7 @@ function save_setting_xml() {
|
||||
fclose($fout);
|
||||
|
||||
$event_socket_ip_address = $row['event_socket_ip_address'];
|
||||
if (strlen($event_socket_ip_address) == 0) { $event_socket_ip_address = '127.0.0.1'; }
|
||||
if (empty($event_socket_ip_address)) { $event_socket_ip_address = '127.0.0.1'; }
|
||||
|
||||
$fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/event_socket.conf.xml","w");
|
||||
$xml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n";
|
||||
@@ -153,7 +153,7 @@ function save_setting_xml() {
|
||||
$xml .= " <param name=\"listen-ip\" value=\"" . $event_socket_ip_address . "\"/>\n";
|
||||
$xml .= " <param name=\"listen-port\" value=\"" . $row['event_socket_port'] . "\"/>\n";
|
||||
$xml .= " <param name=\"password\" value=\"" . $row['event_socket_password'] . "\"/>\n";
|
||||
if (strlen($row['event_socket_acl']) > 0) {
|
||||
if (!empty($row['event_socket_acl'])) {
|
||||
$xml .= " <param name=\"apply-inbound-acl\" value=\"" . $row['event_socket_acl'] . "\"/>\n";
|
||||
}
|
||||
$xml .= " </settings>\n";
|
||||
@@ -223,7 +223,7 @@ function filename_safe($filename) {
|
||||
function save_gateway_xml() {
|
||||
|
||||
//skip saving the gateway xml if the directory is not set
|
||||
if (strlen($_SESSION['switch']['sip_profiles']['dir']) == 0) {
|
||||
if (empty($_SESSION['switch']['sip_profiles']['dir'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ function save_gateway_xml() {
|
||||
if ($row['enabled'] != "false") {
|
||||
//set the default profile as external
|
||||
$profile = $row['profile'];
|
||||
if (strlen($profile) == 0) {
|
||||
if (empty($profile)) {
|
||||
$profile = "external";
|
||||
}
|
||||
//open the xml file
|
||||
@@ -261,44 +261,44 @@ function save_gateway_xml() {
|
||||
//build the xml
|
||||
$xml .= "<include>\n";
|
||||
$xml .= " <gateway name=\"" . strtolower($row['gateway_uuid']) . "\">\n";
|
||||
if (strlen($row['username']) > 0) {
|
||||
if (!empty($row['username'])) {
|
||||
$xml .= " <param name=\"username\" value=\"" . $row['username'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['distinct_to']) > 0) {
|
||||
if (!empty($row['distinct_to'])) {
|
||||
$xml .= " <param name=\"distinct-to\" value=\"" . $row['distinct_to'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['auth_username']) > 0) {
|
||||
if (!empty($row['auth_username'])) {
|
||||
$xml .= " <param name=\"auth-username\" value=\"" . $row['auth_username'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['password']) > 0) {
|
||||
if (!empty($row['password'])) {
|
||||
$xml .= " <param name=\"password\" value=\"" . $row['password'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['realm']) > 0) {
|
||||
if (!empty($row['realm'])) {
|
||||
$xml .= " <param name=\"realm\" value=\"" . $row['realm'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['from_user']) > 0) {
|
||||
if (!empty($row['from_user'])) {
|
||||
$xml .= " <param name=\"from-user\" value=\"" . $row['from_user'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['from_domain']) > 0) {
|
||||
if (!empty($row['from_domain'])) {
|
||||
$xml .= " <param name=\"from-domain\" value=\"" . $row['from_domain'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['proxy']) > 0) {
|
||||
if (!empty($row['proxy'])) {
|
||||
$xml .= " <param name=\"proxy\" value=\"" . $row['proxy'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['register_proxy']) > 0) {
|
||||
if (!empty($row['register_proxy'])) {
|
||||
$xml .= " <param name=\"register-proxy\" value=\"" . $row['register_proxy'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['outbound_proxy']) > 0) {
|
||||
if (!empty($row['outbound_proxy'])) {
|
||||
$xml .= " <param name=\"outbound-proxy\" value=\"" . $row['outbound_proxy'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['expire_seconds']) > 0) {
|
||||
if (!empty($row['expire_seconds'])) {
|
||||
$xml .= " <param name=\"expire-seconds\" value=\"" . $row['expire_seconds'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['register']) > 0) {
|
||||
if (!empty($row['register'])) {
|
||||
$xml .= " <param name=\"register\" value=\"" . $row['register'] . "\"/>\n";
|
||||
}
|
||||
|
||||
if (strlen($row['register_transport']) > 0) {
|
||||
if (!empty($row['register_transport'])) {
|
||||
switch ($row['register_transport']) {
|
||||
case "udp":
|
||||
$xml .= " <param name=\"register-transport\" value=\"udp\"/>\n";
|
||||
@@ -314,32 +314,32 @@ function save_gateway_xml() {
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($row['contact_params']) > 0) {
|
||||
if (!empty($row['contact_params'])) {
|
||||
$xml .= " <param name=\"contact-params\" value=\"" . $row['contact_params'] . "\"/>\n";
|
||||
}
|
||||
|
||||
if (strlen($row['retry_seconds']) > 0) {
|
||||
if (!empty($row['retry_seconds'])) {
|
||||
$xml .= " <param name=\"retry-seconds\" value=\"" . $row['retry_seconds'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['extension']) > 0) {
|
||||
if (!empty($row['extension'])) {
|
||||
$xml .= " <param name=\"extension\" value=\"" . $row['extension'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['ping']) > 0) {
|
||||
if (!empty($row['ping'])) {
|
||||
$xml .= " <param name=\"ping\" value=\"" . $row['ping'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['context']) > 0) {
|
||||
if (!empty($row['context'])) {
|
||||
$xml .= " <param name=\"context\" value=\"" . $row['context'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['caller_id_in_from']) > 0) {
|
||||
if (!empty($row['caller_id_in_from'])) {
|
||||
$xml .= " <param name=\"caller-id-in-from\" value=\"" . $row['caller_id_in_from'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['supress_cng']) > 0) {
|
||||
if (!empty($row['supress_cng'])) {
|
||||
$xml .= " <param name=\"supress-cng\" value=\"" . $row['supress_cng'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['sip_cid_type']) > 0) {
|
||||
if (!empty($row['sip_cid_type'])) {
|
||||
$xml .= " <param name=\"sip_cid_type\" value=\"" . $row['sip_cid_type'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['extension_in_contact']) > 0) {
|
||||
if (!empty($row['extension_in_contact'])) {
|
||||
$xml .= " <param name=\"extension-in-contact\" value=\"" . $row['extension_in_contact'] . "\"/>\n";
|
||||
}
|
||||
|
||||
@@ -370,10 +370,10 @@ function save_var_xml() {
|
||||
|
||||
//get the hostname
|
||||
$hostname = trim(event_socket_request_cmd('api switchname'));
|
||||
if (strlen($hostname) == 0){
|
||||
if (empty($hostname)){
|
||||
$hostname = trim(gethostname());
|
||||
}
|
||||
if (strlen($hostname) == 0){
|
||||
if (empty($hostname)){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -390,13 +390,13 @@ function save_var_xml() {
|
||||
if ($row['var_category'] != 'Provision') {
|
||||
if ($prev_var_category != $row['var_category']) {
|
||||
$xml .= "\n<!-- ".$row['var_category']." -->\n";
|
||||
if (strlen($row["var_description"]) > 0) {
|
||||
if (!empty($row["var_description"])) {
|
||||
$xml .= "<!-- ".base64_decode($row['var_description'])." -->\n";
|
||||
}
|
||||
}
|
||||
if (strlen($row['var_command']) == 0) { $row['var_command'] = 'set'; }
|
||||
if (empty($row['var_command'])) { $row['var_command'] = 'set'; }
|
||||
if ($row['var_category'] == 'Exec-Set') { $row['var_command'] = 'exec-set'; }
|
||||
if (strlen($row['var_hostname']) == 0) {
|
||||
if (empty($row['var_hostname'])) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"".$row['var_command']."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
||||
} elseif ($row['var_hostname'] == $hostname) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"".$row['var_command']."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
||||
@@ -434,7 +434,7 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan
|
||||
|
||||
//get the hostname
|
||||
$hostname = trim(event_socket_request_cmd('api switchname'));
|
||||
if (strlen($hostname) == 0) {
|
||||
if (empty($hostname)) {
|
||||
$hostname = 'unknown';
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ function extension_presence_id($extension, $number_alias = false) {
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
||||
if (strlen($number_alias) > 0) {
|
||||
if (!empty($number_alias)) {
|
||||
if ($_SESSION['provision']['number_as_presence_id']['text'] === 'true') {
|
||||
return $number_alias;
|
||||
}
|
||||
@@ -648,7 +648,7 @@ if (!function_exists('save_call_center_xml')) {
|
||||
function save_call_center_xml() {
|
||||
global $domain_uuid;
|
||||
|
||||
if (strlen($_SESSION['switch']['call_center']['dir']) > 0) {
|
||||
if (!empty($_SESSION['switch']['call_center']['dir'])) {
|
||||
|
||||
//get the call center queue array
|
||||
$sql = "select * from v_call_center_queues ";
|
||||
@@ -688,7 +688,7 @@ if (!function_exists('save_call_center_xml')) {
|
||||
}
|
||||
$v_queues .= " <queue name=\"$queue_name@".$_SESSION['domains'][$row["domain_uuid"]]['domain_name']."\">\n";
|
||||
$v_queues .= " <param name=\"strategy\" value=\"$queue_strategy\"/>\n";
|
||||
if (strlen($queue_moh_sound) == 0) {
|
||||
if (empty($queue_moh_sound)) {
|
||||
$v_queues .= " <param name=\"moh-sound\" value=\"local_stream://default\"/>\n";
|
||||
}
|
||||
else {
|
||||
@@ -702,7 +702,7 @@ if (!function_exists('save_call_center_xml')) {
|
||||
$v_queues .= " <param name=\"moh-sound\" value=\"".$queue_moh_sound."\"/>\n";
|
||||
}
|
||||
}
|
||||
if (strlen($queue_record_template) > 0) {
|
||||
if (!empty($queue_record_template)) {
|
||||
$v_queues .= " <param name=\"record-template\" value=\"$queue_record_template\"/>\n";
|
||||
}
|
||||
$v_queues .= " <param name=\"time-base-score\" value=\"$queue_time_base_score\"/>\n";
|
||||
@@ -964,7 +964,7 @@ if (!function_exists('xml_cdr_conf_xml')) {
|
||||
if (!function_exists('save_sip_profile_xml')) {
|
||||
function save_sip_profile_xml() {
|
||||
//skip saving the sip profile xml if the directory is not set
|
||||
if (strlen($_SESSION['switch']['sip_profiles']['dir']) == 0) {
|
||||
if (empty($_SESSION['switch']['sip_profiles']['dir'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1090,7 @@ if(!function_exists('path_join')) {
|
||||
|
||||
$prefix = null;
|
||||
foreach($paths as &$path) {
|
||||
if($prefix === null && strlen($path) > 0) {
|
||||
if($prefix === null && !empty($path)) {
|
||||
if(substr($path, 0, 1) == '/') $prefix = '/';
|
||||
else $prefix = '';
|
||||
}
|
||||
|
||||
@@ -835,11 +835,11 @@ class PDF417 {
|
||||
if ($txtseq[1] > 0) {
|
||||
// extract byte sequence before the text sequence
|
||||
$prevtxtseq = substr($prevseq, $txtoffset, ($txtseq[1] - $txtoffset));
|
||||
if (strlen($prevtxtseq) > 0) {
|
||||
if (!empty($prevtxtseq)) {
|
||||
// add BYTE sequence
|
||||
if ((strlen($prevtxtseq) == 1) AND ((count($sequence_array) > 0) AND ($sequence_array[(count($sequence_array) - 1)][0] == 900))) {
|
||||
if ((!empty($prevtxtseq) == 1) AND ((count($sequence_array)) AND ($sequence_array[(count($sequence_array) - 1)][0] == 900))) {
|
||||
$sequence_array[] = array(913, $prevtxtseq);
|
||||
} elseif ((strlen($prevtxtseq) % 6) == 0) {
|
||||
} elseif ((empty($prevtxtseq) % 6)) {
|
||||
$sequence_array[] = array(924, $prevtxtseq);
|
||||
} else {
|
||||
$sequence_array[] = array(901, $prevtxtseq);
|
||||
@@ -924,7 +924,7 @@ class PDF417 {
|
||||
}
|
||||
case 901:
|
||||
case 924: { // Byte Compaction mode latch
|
||||
while (($codelen = strlen($code)) > 0) {
|
||||
while (($codelen = !empty($code))) {
|
||||
if ($codelen > 6) {
|
||||
$rest = substr($code, 6);
|
||||
$code = substr($code, 0, 6);
|
||||
@@ -960,7 +960,7 @@ class PDF417 {
|
||||
break;
|
||||
}
|
||||
case 902: { // Numeric Compaction mode latch
|
||||
while (($codelen = strlen($code)) > 0) {
|
||||
while (($codelen = !empty($code))) {
|
||||
if ($codelen > 44) {
|
||||
$rest = substr($code, 44);
|
||||
$code = substr($code, 0, 44);
|
||||
|
||||
@@ -1443,7 +1443,7 @@ class QRcode {
|
||||
* @return (int)
|
||||
*/
|
||||
protected function splitString() {
|
||||
while (strlen($this->dataStr) > 0) {
|
||||
while (!empty($this->dataStr)) {
|
||||
$mode = $this->identifyMode(0);
|
||||
switch ($mode) {
|
||||
case QR_MODE_NM: {
|
||||
|
||||
@@ -314,7 +314,7 @@ class TCPDF_COLORS {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
if (strlen($color) == 0) {
|
||||
if (empty($color)) {
|
||||
return $defcol;
|
||||
}
|
||||
// RGB ARRAY
|
||||
|
||||
@@ -1793,10 +1793,10 @@ class TCPDF_FONTS {
|
||||
* @public static
|
||||
*/
|
||||
public static function UTF8ArrSubString($strarr, $start='', $end='', $unicode=true) {
|
||||
if (strlen($start) == 0) {
|
||||
if (empty($start)) {
|
||||
$start = 0;
|
||||
}
|
||||
if (strlen($end) == 0) {
|
||||
if (empty($end)) {
|
||||
$end = count($strarr);
|
||||
}
|
||||
$string = '';
|
||||
@@ -1816,10 +1816,10 @@ class TCPDF_FONTS {
|
||||
* @public static
|
||||
*/
|
||||
public static function UniArrSubString($uniarr, $start='', $end='') {
|
||||
if (strlen($start) == 0) {
|
||||
if (empty($start)) {
|
||||
$start = 0;
|
||||
}
|
||||
if (strlen($end) == 0) {
|
||||
if (empty($end)) {
|
||||
$end = count($uniarr);
|
||||
}
|
||||
$string = '';
|
||||
|
||||
@@ -230,7 +230,7 @@ class TCPDF_STATIC {
|
||||
if (strpos($border, 'B') !== false) {
|
||||
// remove bottom line
|
||||
$newkey = str_replace('B', '', $border);
|
||||
if (strlen($newkey) > 0) {
|
||||
if (!empty($newkey)) {
|
||||
$brd[$newkey] = $style;
|
||||
}
|
||||
unset($brd[$border]);
|
||||
@@ -241,7 +241,7 @@ class TCPDF_STATIC {
|
||||
if (strpos($border, 'B') !== false) {
|
||||
// remove bottom line
|
||||
$newkey = str_replace('B', '', $border);
|
||||
if (strlen($newkey) > 0) {
|
||||
if (!empty($newkey)) {
|
||||
$brd[$newkey] = $style;
|
||||
}
|
||||
unset($brd[$border]);
|
||||
@@ -250,7 +250,7 @@ class TCPDF_STATIC {
|
||||
if (strpos($border, 'T') !== false) {
|
||||
// remove bottom line
|
||||
$newkey = str_replace('T', '', $border);
|
||||
if (strlen($newkey) > 0) {
|
||||
if (!empty($newkey)) {
|
||||
$brd[$newkey] = $style;
|
||||
}
|
||||
unset($brd[$border]);
|
||||
@@ -261,7 +261,7 @@ class TCPDF_STATIC {
|
||||
if (strpos($border, 'T') !== false) {
|
||||
// remove bottom line
|
||||
$newkey = str_replace('T', '', $border);
|
||||
if (strlen($newkey) > 0) {
|
||||
if (!empty($newkey)) {
|
||||
$brd[$newkey] = $style;
|
||||
}
|
||||
unset($brd[$border]);
|
||||
@@ -281,7 +281,7 @@ class TCPDF_STATIC {
|
||||
* @public static
|
||||
*/
|
||||
public static function empty_string($str) {
|
||||
return (is_null($str) OR (is_string($str) AND (strlen($str) == 0)));
|
||||
return (is_null($str) OR (is_string($str) AND (empty($str))));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1799,7 +1799,7 @@ class TCPDF_STATIC {
|
||||
$ret[] = "\n";
|
||||
$subject = substr($subject, ($nl + 1));
|
||||
}
|
||||
if (strlen($subject) > 0) {
|
||||
if (!empty($subject)) {
|
||||
$ret = array_merge($ret, preg_split($pattern.$modifiers, $subject, $limit, $flags));
|
||||
}
|
||||
return $ret;
|
||||
|
||||
+10
-10
@@ -6309,7 +6309,7 @@ class TCPDF {
|
||||
public function Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0, $wadj=0, $margin='') {
|
||||
// check page for no-write regions and adapt page margins if necessary
|
||||
list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y);
|
||||
if (strlen($txt) == 0) {
|
||||
if (empty($txt)) {
|
||||
// fix empty text
|
||||
$txt = ' ';
|
||||
}
|
||||
@@ -10432,7 +10432,7 @@ class TCPDF {
|
||||
$lnkdata = explode(',', $url);
|
||||
if (isset($lnkdata[0]) ) {
|
||||
$page = substr($lnkdata[0], 1);
|
||||
if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
|
||||
if (isset($lnkdata[1]) AND (!empty($lnkdata[1]))) {
|
||||
$lnky = floatval($lnkdata[1]);
|
||||
} else {
|
||||
$lnky = 0;
|
||||
@@ -13476,10 +13476,10 @@ class TCPDF {
|
||||
$this->sig_obj_id = $this->n; // signature widget
|
||||
++$this->n; // signature object ($this->sig_obj_id + 1)
|
||||
$this->signature_data = array();
|
||||
if (strlen($signing_cert) == 0) {
|
||||
if (empty($signing_cert)) {
|
||||
$this->Error('Please provide a certificate file and password!');
|
||||
}
|
||||
if (strlen($private_key) == 0) {
|
||||
if (empty($private_key)) {
|
||||
$private_key = $signing_cert;
|
||||
}
|
||||
$this->signature_data['signcert'] = $signing_cert;
|
||||
@@ -13574,7 +13574,7 @@ class TCPDF {
|
||||
if (!function_exists('curl_init')) {
|
||||
$this->Error('Please enable cURL PHP extension!');
|
||||
}
|
||||
if (strlen($tsa_host) == 0) {
|
||||
if (empty($tsa_host)) {
|
||||
$this->Error('Please specify the host of Time Stamping Authority (TSA)!');
|
||||
}
|
||||
$this->tsa_data['tsa_host'] = $tsa_host;
|
||||
@@ -16326,7 +16326,7 @@ class TCPDF {
|
||||
if (preg_match('/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) {
|
||||
// read CSS data file
|
||||
$cssdata = TCPDF_STATIC::fileGetContents(trim($type[1]));
|
||||
if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) {
|
||||
if (($cssdata !== FALSE) AND (!empty($cssdata))) {
|
||||
$css = array_merge($css, TCPDF_STATIC::extractCSSproperties($cssdata));
|
||||
}
|
||||
}
|
||||
@@ -17604,7 +17604,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
}
|
||||
}
|
||||
// align lines
|
||||
if ($this->newline AND (strlen($dom[$key]['value']) > 0) AND ($dom[$key]['value'] != 'td') AND ($dom[$key]['value'] != 'th')) {
|
||||
if ($this->newline AND (!empty($dom[$key]['value'])) AND ($dom[$key]['value'] != 'td') AND ($dom[$key]['value'] != 'th')) {
|
||||
$newline = true;
|
||||
$fontaligned = false;
|
||||
// we are at the beginning of a new line
|
||||
@@ -18352,7 +18352,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$startlinepage = $this->page;
|
||||
}
|
||||
}
|
||||
} elseif (strlen($dom[$key]['value']) > 0) {
|
||||
} elseif (!empty($dom[$key]['value'])) {
|
||||
// print list-item
|
||||
if (!TCPDF_STATIC::empty_string($this->lispacer) AND ($this->lispacer != '^')) {
|
||||
$this->SetFont($pfontname, $pfontstyle, $pfontsize);
|
||||
@@ -18501,7 +18501,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
}
|
||||
}
|
||||
$this->textindent = 0;
|
||||
if (strlen($strrest) > 0) {
|
||||
if (!empty($strrest)) {
|
||||
// store the remaining string on the previous $key position
|
||||
$this->newline = true;
|
||||
if ($strrest == $dom[$key]['value']) {
|
||||
@@ -18948,7 +18948,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
if (empty($page) OR ($page <= 0)) {
|
||||
$page = $this->page;
|
||||
}
|
||||
if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
|
||||
if (isset($lnkdata[1]) AND (!empty($lnkdata[1]))) {
|
||||
$lnky = floatval($lnkdata[1]);
|
||||
} else {
|
||||
$lnky = 0;
|
||||
|
||||
Reference in New Issue
Block a user