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
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user