SIP Profiles: Updates for PHP 8.1
This commit is contained in:
parent
fa93b4e7f5
commit
d8652d72e9
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
Portions created by the Initial Developer are Copyright (C) 2008-2023
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -85,7 +85,7 @@ if (!class_exists('sip_profiles')) {
|
||||||
|
|
||||||
//filter out unchecked sip profiles, build where clause for below
|
//filter out unchecked sip profiles, build where clause for below
|
||||||
foreach ($records as $x => $record) {
|
foreach ($records as $x => $record) {
|
||||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||||
$uuids[] = "'".$record['uuid']."'";
|
$uuids[] = "'".$record['uuid']."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ if (!class_exists('sip_profiles')) {
|
||||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, sip_profile_name, sip_profile_hostname from v_".$this->table." ";
|
$sql = "select ".$this->uuid_prefix."uuid as uuid, sip_profile_name, sip_profile_hostname from v_".$this->table." ";
|
||||||
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$rows = $database->select($sql, $parameters, 'all');
|
$rows = $database->select($sql, $parameters ?? null, 'all');
|
||||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$sip_profiles[$row['uuid']]['name'] = $row['sip_profile_name'];
|
$sip_profiles[$row['uuid']]['name'] = $row['sip_profile_name'];
|
||||||
|
|
@ -236,15 +236,15 @@ if (!class_exists('sip_profiles')) {
|
||||||
$_SESSION["reload_xml"] = true;
|
$_SESSION["reload_xml"] = true;
|
||||||
|
|
||||||
//get system hostname if necessary
|
//get system hostname if necessary
|
||||||
if ($sip_profile_hostname == '') {
|
if (empty($sip_profile_hostname)) {
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
$sip_profile_hostname[] = event_socket_request($fp, 'api switchname');
|
$sip_profile_hostname = event_socket_request($fp, 'api switchname');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear the cache
|
//clear the cache
|
||||||
if ($sip_profile_hostname != '') {
|
if (!empty($sip_profile_hostname)) {
|
||||||
$cache = new cache;
|
$cache = new cache;
|
||||||
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
|
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
|
||||||
}
|
}
|
||||||
|
|
@ -314,15 +314,15 @@ if (!class_exists('sip_profiles')) {
|
||||||
$_SESSION["reload_xml"] = true;
|
$_SESSION["reload_xml"] = true;
|
||||||
|
|
||||||
//get system hostname if necessary
|
//get system hostname if necessary
|
||||||
if ($sip_profile_hostname == '') {
|
if (empty($sip_profile_hostname)) {
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
$sip_profile_hostname[] = event_socket_request($fp, 'api switchname');
|
$sip_profile_hostname = event_socket_request($fp, 'api switchname');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear the cache
|
//clear the cache
|
||||||
if ($sip_profile_hostname != '') {
|
if (!empty($sip_profile_hostname)) {
|
||||||
$cache = new cache;
|
$cache = new cache;
|
||||||
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
|
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
|
||||||
}
|
}
|
||||||
|
|
@ -364,7 +364,7 @@ if (!class_exists('sip_profiles')) {
|
||||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, sip_profile_hostname from v_".$this->table." ";
|
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, sip_profile_hostname from v_".$this->table." ";
|
||||||
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$rows = $database->select($sql, $parameters, 'all');
|
$rows = $database->select($sql, $parameters ?? null, 'all');
|
||||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$sip_profiles[$row['uuid']]['state'] = $row['toggle'];
|
$sip_profiles[$row['uuid']]['state'] = $row['toggle'];
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
//get existing sip profile names to prevent duplicates
|
//get existing sip profile names to prevent duplicates
|
||||||
$sql = "select sip_profile_name from v_sip_profiles";
|
$sql = "select sip_profile_name from v_sip_profiles";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$rows = $database->select($sql, $parameters, 'all');
|
$rows = $database->select($sql, $parameters ?? null, 'all');
|
||||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$sip_profile_names[] = $row['sip_profile_name'];
|
$sip_profile_names[] = $row['sip_profile_name'];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue