Fix multiple PHP warnings

This commit is contained in:
markjcrane
2025-11-01 19:58:21 -06:00
parent a675660473
commit bf5bb4f642
41 changed files with 539 additions and 442 deletions

View File

@@ -216,7 +216,7 @@
//primary table
$sql = "select * from v_" . $this->table . " ";
$sql .= "where " . $this->uuid_prefix . "uuid in (" . implode(', ', $uuids) . ") ";
$rows = $this->database->select($sql, $parameters, 'all');
$rows = $this->database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$y = 0;
foreach ($rows as $x => $row) {

View File

@@ -51,6 +51,9 @@
public $queue_description;
public $destination_number;
public $queue_cc_exit_keys;
public $queue_cid_prefix;
public $queue_greeting;
public $queue_timeout_action;
/**
* Set in the constructor. Must be a database object and cannot be null.
@@ -526,7 +529,7 @@
//primary table
$sql = "select * from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in ('".implode("','", $uuids)."') ";
$rows = $this->database->select($sql, $parameters, 'all');
$rows = $this->database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$y = 0;
foreach ($rows as $x => $row) {

View File

@@ -84,6 +84,8 @@
private $extension;
private $number_alias;
private $toll_allow;
private $toggle_field;
private $toggle_values;
/**
* called when the object is created
@@ -156,6 +158,10 @@
*/
public function toggle(array $records) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
@@ -170,14 +176,10 @@
//check we have permission for this action
if (permission_exists('call_forward')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
// initialize an empty array
$uuids = [];
$extensions = [];
//get current toggle state
foreach ($records as $x => $record) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
@@ -262,7 +264,7 @@
$p->delete('extension_edit', 'temp');
//send feature event notify to the phone
if ($settings->get('device', 'feature_sync', false)) {
if ($this->settings->get('device', 'feature_sync', false)) {
foreach ($extensions as $uuid => $extension) {
$feature_event_notify = new feature_event_notify;
$feature_event_notify->domain_name = $this->domain_name;

View File

@@ -51,6 +51,7 @@
public $debug;
public $extension_uuid;
public $extension;
public $number_alias;
public $enabled;
/**
@@ -110,7 +111,7 @@
$user_status = "Logged Out";
$esl = event_socket::create();
if ($esl->is_connected()) {
$switch_cmd .= "callcenter_config agent set status ".$this->username."@".$this->domain_name." '".$user_status."'";
$switch_cmd = "callcenter_config agent set status ".$this->username."@".$this->domain_name." '".$user_status."'";
$esl->request('api '.$switch_cmd);
}

View File

@@ -430,7 +430,7 @@
$p->delete('follow_me_edit', 'temp');
//send feature event notify to the phone
if ($settings->get('device', 'feature_sync', false)) {
if ($this->settings->get('device', 'feature_sync', false)) {
foreach ($extensions as $uuid => $extension) {
$feature_event_notify = new feature_event_notify;
$feature_event_notify->domain_name = $this->domain_name;

View File

@@ -335,6 +335,7 @@
$call_recording_time = $row['call_recording_time'];
$call_recording_date_formatted = $row['call_recording_date_formatted'];
$call_recording_time_formatted = $row['call_recording_time_formatted'];
$call_recording_base64 = $row['call_recording_base64'];
if (!empty($storage_type) && $storage_type == 'base64' && !empty($row['call_recording_base64'])) {
file_put_contents($call_recording_path.'/'.$call_recording_name, base64_decode($row['call_recording_base64']));
}
@@ -398,7 +399,7 @@
}
//if base64, remove temp recording file
if (!empty($storage_type) && $storage_type == 'base64' && !empty($row['call_recording_base64'])) {
if (!empty($storage_type) && $storage_type == 'base64' && !empty($call_recording_base64)) {
@unlink($full_recording_path);
}
@@ -446,7 +447,7 @@
$sql .= "TO_CHAR(timezone(:time_zone, call_recording_date), 'HH24MISS') AS call_recording_time, ";
$sql .= "TO_CHAR(timezone(:time_zone, call_recording_date), 'DD Mon YYYY') as call_recording_date_formatted, ";
$sql .= "TO_CHAR(timezone(:time_zone, call_recording_date), 'HH12:MI:SS am') as call_recording_time_formatted ";
if (!empty($storage_type) && $storage_type == 'base64' && $row['call_recording_base64'] != '') {
if (!empty($storage_type) && $storage_type == 'base64') {
$sql .= ", call_recording_base64 ";
}
$sql .= "from view_call_recordings ";

View File

@@ -124,7 +124,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
if ($not_admin) {
$sql .= "and r.conference_room_uuid = u.conference_room_uuid ";
$sql .= "and u.user_uuid = :user_uuid ";
$parameters['user_uuid'] = $user_uuid;
$parameters['user_uuid'] = $this->user_uuid;
}
if (isset($this->conference_room_uuid)) {
$sql .= "and r.conference_room_uuid = :conference_room_uuid ";

View File

@@ -86,6 +86,7 @@
private $uuid_prefix;
private $toggle_field;
private $toggle_values;
private $tables;
/**
* Create a settings object using key/value pairs in the $setting_array.

View File

@@ -524,10 +524,10 @@
}
if ($regex_match) {
//get the variables
if ($field[dialplan_detail_type] == "set" && $field[dialplan_detail_tag] == "action") {
if ($field['dialplan_detail_type'] == "set" && $field['dialplan_detail_tag'] == "action") {
//only set variables with values not variables
if (strpos($field[dialplan_detail_data], '$') === false) {
$this->variables .= $field[dialplan_detail_data].",";
if (strpos($field['dialplan_detail_data'], '$') === false) {
$this->variables .= $field['dialplan_detail_data'].",";
}
}
//process the $x detail data variables
@@ -700,9 +700,12 @@
}
//define the values before they are used
$previous_dialplan_uuid = null;
$previous_dialplan_detail_group = null;
$dialplan_tag_status = null;
$previous_dialplan_uuid = '';
$previous_dialplan_detail_group = '';
$dialplan_tag_status = '';
$condition_attribute = '';
$condition_break = '';
$xml = '';
//loop through the results to get the xml from the dialplan_xml field or from dialplan details table
$x = 0;
@@ -869,7 +872,7 @@
}
//get the condition break attribute
$condition_break = "";
$condition_break = '';
if ($dialplan_detail_break) {
if (!empty($dialplan_detail_break)) {
$condition_break = " break=\"" . $dialplan_detail_break . "\"";
@@ -974,7 +977,7 @@
if ($condition_attribute && (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
}
else if (!empty($condition) && substr($string, -1) == ">") {
else if (!empty($condition) && substr($condition, -1) == ">") {
$xml .= $condition . "\n";
}
else if (!empty($condition)) {
@@ -1035,29 +1038,35 @@
$xml_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/resources/switch/conf/dialplan/*.xml");
foreach ($xml_list as $xml_file) {
//get and parse the xml
$xml_string = file_get_contents($xml_file);
//get the order number prefix from the file name
$name_array = explode('_', basename($xml_file));
if (is_numeric($name_array[0])) {
$dialplan_order = $name_array[0];
}
else {
$dialplan_order = 0;
}
$dialplan->dialplan_order = $dialplan_order;
$xml_string = file_get_contents($xml_file);
$this->xml = $xml_string;
$this->import();
//get the order number prefix from the file name
$name_array = explode('_', basename($xml_file));
if (is_numeric($name_array[0])) {
$dialplan_order = $name_array[0];
}
else {
$dialplan_order = 0;
}
//set the xml string
$this->xml = $xml_string;
//get the domains
$sql = 'select * from v_domains';
$domains = $this->database->select($sql, null, 'all');
$this->import($domains);
unset($sql);
}
//update the dialplan order
$sql[] = "update v_dialplans set dialplan_order = '870' where dialplan_order = '980' and dialplan_name = 'cidlookup' ";
$sql[] = "update v_dialplans set dialplan_order = '880' where dialplan_order = '990' and dialplan_name = 'call_screen' ";
$sql[] = "update v_dialplans set dialplan_order = '890' where dialplan_order = '999' and dialplan_name = 'local_extension' ";
foreach ($sql as $query) {
$sql_array[] = "update v_dialplans set dialplan_order = '870' where dialplan_order = '980' and dialplan_name = 'cidlookup' ";
$sql_array[] = "update v_dialplans set dialplan_order = '880' where dialplan_order = '990' and dialplan_name = 'call_screen' ";
$sql_array[] = "update v_dialplans set dialplan_order = '890' where dialplan_order = '999' and dialplan_name = 'local_extension' ";
foreach ($sql_array as $query) {
$this->database->execute($query);
}
unset($sql, $query);
unset($sql_array, $query);
//add xml for each dialplan where the dialplan xml is empty
$this->source = "details";

View File

@@ -219,7 +219,7 @@
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$rows = $this->database->select($sql, $parameters, 'all');
$rows = $this->database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
@@ -286,7 +286,7 @@
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select * from v_".$this->table." ";
$sql .= "where event_guard_log_uuid in (".implode(', ', $uuids).") ";
$rows = $this->database->select($sql, $parameters, 'all');
$rows = $this->database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$x = 0;
foreach ($rows as $row) {
@@ -302,7 +302,7 @@
$array[$this->table][$x] = $row;
//add copy to the description
$array[$this->table][$x][event_guard_log.'_uuid'] = uuid();
$array[$this->table][$x]['event_guard_log_uuid'] = uuid();
//increment the id
$x++;

View File

@@ -68,6 +68,7 @@
private $toggle_values;
private $description_field;
private $location;
private $extension_uuid;
/**
* called when the object is created
@@ -117,6 +118,20 @@
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
if (empty($this->extension_uuid)) {
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle, extension_uuid ";
$sql .= "from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in :uuid ";
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $this->domain_uuid;
$parameters['uuid'] = $record['uuid'];
$rows = $this->database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$this->extension_uuid = $rows[0]['extension_uuid'];
}
unset($sql, $parameters);
}
}
//increment the id
@@ -130,13 +145,15 @@
unset($array);
//clear the cache
$sql = "select extension, number_alias, user_context from v_extensions ";
$sql .= "where extension_uuid = :extension_uuid ";
$parameters['extension_uuid'] = $this->extension_uuid;
$extension = $this->database->select($sql, $parameters, 'row');
$cache = new cache;
$cache->delete(gethostname().":directory:".$extension["extension"]."@".$extension["user_context"]);
$cache->delete(gethostname().":directory:".$extension["number_alias"]."@".$extension["user_context"]);
if (!empty($this->extension_uuid)) {
$sql = "select extension, number_alias, user_context from v_extensions ";
$sql .= "where extension_uuid = :extension_uuid ";
$parameters['extension_uuid'] = $this->extension_uuid;
$extension = $this->database->select($sql, $parameters, 'row');
$cache = new cache;
$cache->delete(gethostname().":directory:".$extension["extension"]."@".$extension["user_context"]);
$cache->delete(gethostname().":directory:".$extension["number_alias"]."@".$extension["user_context"]);
}
//set message
message::add($text['message-delete']);
@@ -179,7 +196,7 @@
$parameters['domain_uuid'] = $this->domain_uuid;
$rows = $this->database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$extension_uuid = $rows[0]['extension_uuid'];
$this->extension_uuid = $rows[0]['extension_uuid'];
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
}
@@ -208,7 +225,7 @@
//clear the cache
$sql = "select extension, number_alias, user_context from v_extensions ";
$sql .= "where extension_uuid = :extension_uuid ";
$parameters['extension_uuid'] = $extension_uuid;
$parameters['extension_uuid'] = $this->extension_uuid;
$extension = $this->database->select($sql, $parameters, 'row');
$cache = new cache;
$cache->delete(gethostname().":directory:".$extension["extension"]."@".$extension["user_context"]);
@@ -259,8 +276,6 @@
$rows = $this->database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $x => $row) {
// var_dump($row); exit;
//convert boolean values to a string
foreach($row as $key => $value) {
if (gettype($value) == 'boolean') {
@@ -285,7 +300,6 @@
//save the changes and set the message
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$this->database->save($array);
unset($array);

View File

@@ -246,6 +246,7 @@
$call_group = $row['call_group'] ?? '';
$call_group = str_replace(";", ",", $call_group);
$tmp_array = explode(",", $call_group);
$call_group_array = [];
foreach ($tmp_array as $tmp_call_group) {
$tmp_call_group = trim($tmp_call_group);
if (!empty($tmp_call_group)) {

View File

@@ -32,6 +32,7 @@
private $toggle_values;
private $description_field;
private $location;
private $uuid_prefix;
/**
* called when the object is created

View File

@@ -40,10 +40,17 @@
public $domain_uuid;
/**
* declare public variables
* declare ivr menu primary uuid key
* @var string
*/
public $ivr_menu_uuid;
/**
* declare order_by variables
* @var string
*/
public $order_by;
/**
* Set in the constructor. Must be a database object and cannot be null.
* @var database Database Object

View File

@@ -48,25 +48,25 @@
private $settings;
/**
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
* User UUID set in the constructor. This can be passed in through the $this->settings_array associative array or set in the session global array
* @var string
*/
private $user_uuid;
/**
* Username set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
* Username set in the constructor. This can be passed in through the $this->settings_array associative array or set in the session global array
* @var string
*/
private $username;
/**
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
* Domain UUID set in the constructor. This can be passed in through the $this->settings_array associative array or set in the session global array
* @var string
*/
private $domain_uuid;
/**
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
* Domain name set in the constructor. This can be passed in through the $this->settings_array associative array or set in the session global array
* @var string
*/
private $domain_name;
@@ -188,12 +188,18 @@
}
public function reload() {
//add multi-lingual support
$language = new text;
$text = $language->get();
//if the handle does not exist create it
$esl = event_socket::create();
//if the handle still does not exist show an error message
if (!$esl->is_connected()) {
$msg = "<div align='center'>".$text['message-event-socket']."<br /></div>";
}
//send the api command to check if the module exists
if ($esl->is_connected()) {
$cmd = "reload mod_local_stream";
@@ -202,48 +208,6 @@
}
}
public function xml() {
//build the list of categories
$music_on_hold_dir = $this->settings->get('switch', 'sounds').'/music';
//default category (note: GLOB_BRACE doesn't work on some systems)
$array_1 = glob($music_on_hold_dir."/8000".$class_name.".php", GLOB_ONLYDIR);
$array_2 = glob($music_on_hold_dir."/16000".$class_name.".php", GLOB_ONLYDIR);
$array_3 = glob($music_on_hold_dir."/32000".$class_name.".php", GLOB_ONLYDIR);
$array_4 = glob($music_on_hold_dir."/48000".$class_name.".php", GLOB_ONLYDIR);
$array = array_merge((array)$array_1,(array)$array_2,(array)$array_3,(array)$array_4);
unset($array_1,$array_2,$array_3,$array_4);
//other categories
if (count($_SESSION['domains']) > 1) {
$array = array_merge($array, glob($music_on_hold_dir."/*/*/*", GLOB_ONLYDIR));
}
else {
$array = array_merge($array, glob($music_on_hold_dir."/*/*", GLOB_ONLYDIR));
}
//list the categories
$xml = "";
foreach($array as $moh_dir) {
//set the directory
$moh_dir = substr($moh_dir, strlen($music_on_hold_dir."/"));
//get and set the rate
$sub_array = explode("/", $moh_dir);
$moh_rate = end($sub_array);
//set the name
$moh_name = $moh_dir;
if ($moh_dir == $moh_rate) {
$moh_name = "default/$moh_rate";
}
//build the xml
$xml .= " <directory name=\"$moh_name\" path=\"\$\${sounds_dir}/music/$moh_dir\">\n";
$xml .= " <param name=\"rate\" value=\"".$moh_rate."\"/>\n";
$xml .= " <param name=\"shuffle\" value=\"true\"/>\n";
$xml .= " <param name=\"channels\" value=\"1\"/>\n";
$xml .= " <param name=\"interval\" value=\"20\"/>\n";
$xml .= " <param name=\"timer-name\" value=\"soft\"/>\n";
$xml .= " </directory>\n";
$this->xml = $xml;
}
}
public function save() {
//get the contents of the template
if (file_exists('/usr/share/examples/fusionpbx')) {
@@ -254,7 +218,7 @@
}
//check where the default music is stored
$default_moh_prefix = 'music/default';
if(file_exists($settings->get('switch', 'sounds').'/music/8000')) {
if(file_exists($this->settings->get('switch', 'sounds').'/music/8000')) {
$default_moh_prefix = 'music';
}
//replace the variables
@@ -262,7 +226,7 @@
$file_contents = preg_replace("/[\t ]*(?:<!--)?{v_moh_categories}(?:-->)?/", $this->xml, $file_contents);
//write the XML config file
$fout = fopen($settings->get('switch', 'conf')."/autoload_configs/local_stream.conf.xml","w");
$fout = fopen($this->settings->get('switch', 'conf')."/autoload_configs/local_stream.conf.xml","w");
fwrite($fout, $file_contents);
fclose($fout);
@@ -288,7 +252,7 @@
//build an array of the sound files
$music_directory = $this->settings->get('switch', 'sounds').'/music';
if (file_exists($music_directory)) {
$files = array_merge(glob($music_directory.'/*/*/*.wav'), glob($music_directory.'/*/*/*/*.wav'), glob($stream_path.'/*/*/*/*.mp3'), glob($stream_path.'/*/*/*/*.ogg'));
$files = array_merge(glob($music_directory.'/*/*/*.wav'), glob($music_directory.'/*/*/*/*.wav'));
}
//build a new file array
@@ -309,10 +273,9 @@
foreach($a2 as $sample_rate => $file_path) {
//echo "domain_name ".$domain_name."<br />\n";
//echo "category_name ".$category_name."<br />\n";
foreach($domains as $domain) {
//view_array($field, false);
foreach($domains as $field) {
if ($field['domain_name'] === $domain_name) {
$domain_uuid = $domain['domain_uuid'];
$domain_uuid = $field['domain_uuid'];
//echo "domain_uuid ".$domain_uuid."<br />\n";
}
}
@@ -320,7 +283,6 @@
if ($domain_name == 'global' || $domain_name == 'default') {
$domain_uuid = null;
}
//view_array($row, false);
$array['music_on_hold'][$i]['music_on_hold_uuid'] = uuid();
$array['music_on_hold'][$i]['domain_uuid'] = $domain_uuid;
@@ -350,7 +312,7 @@
//echo $this->database->message;
unset($array);
$p->delete('music_on_hold_add', 'temp');
$p->delete('music_on_hold_add', 'temp');
}
/**
@@ -375,7 +337,6 @@
if (is_array($records) && @sizeof($records) != 0) {
//filter checked records
// view_array($records, 0);
foreach ($records as $music_on_hold_uuid => $record) {
if (is_uuid($music_on_hold_uuid)) {
if ($record['checked'] == 'true') {

View File

@@ -41,7 +41,6 @@
/**
* declare private variables
*/
private $database;
private $permission_prefix;
private $list_page;
@@ -49,7 +48,10 @@
private $uuid_prefix;
private $toggle_field;
private $toggle_values;
public $xml;
private $json;
private $xml;
private $display_type;
/**
* called when the object is created
@@ -270,7 +272,7 @@
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$rows = $this->database->select($sql, $parameters, 'all');
$rows = $this->database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
@@ -338,7 +340,7 @@
//primary table
$sql = "select * from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$rows = $this->database->select($sql, $parameters, 'all');
$rows = $this->database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$y = 0;
foreach ($rows as $x => $row) {

View File

@@ -217,7 +217,7 @@
//send a request to a remote server to validate the MAC address and secret
if (!empty($_SERVER['auth_server'])) {
$result = send_http_request($_SERVER['auth_server'], 'mac='.url_encode($_REQUEST['mac']).'&secret='.url_encode($_REQUEST['secret']));
$result = send_http_request($_SERVER['auth_server'], 'mac='.urlencode($_REQUEST['mac']).'&secret='.urlencode($_REQUEST['secret']));
if ($result == "false") {
syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt but the remote auth server said no for ".escape($_REQUEST['mac']));
http_error('404');

View File

@@ -52,6 +52,7 @@
public $template_dir;
public $device_address;
public $device_template;
public $file;
/**
* Set in the constructor. Must be a database object and cannot be null.
@@ -555,33 +556,38 @@
//get a new primary key
$device_uuid = uuid();
//prepare the array
$x = 0;
$array['devices'][$x]['domain_uuid'] = $domain_uuid;
$array['devices'][$x]['device_uuid'] = $device_uuid;
$array['devices'][$x]['device_address'] = $device_address;
$array['devices'][$x]['device_vendor'] = $device_vendor;
$array['devices'][$x]['device_enabled'] = true;
$array['devices'][$x]['device_template'] = $device_template;
$array['devices'][$x]['device_description'] = $_SERVER['HTTP_USER_AGENT'];
//prepare the auto insert enabled
if (!empty($device_address)) {
$device_vendor = device::get_vendor($device_address);
//add the dialplan permission
$p = permissions::new();
$p->add("device_add", "temp");
$p->add("device_edit", "temp");
//prepare the array
$x = 0;
$array['devices'][$x]['domain_uuid'] = $domain_uuid;
$array['devices'][$x]['device_uuid'] = $device_uuid;
$array['devices'][$x]['device_address'] = $device_address;
$array['devices'][$x]['device_vendor'] = $device_vendor;
$array['devices'][$x]['device_enabled'] = true;
$array['devices'][$x]['device_template'] = $device_template;
$array['devices'][$x]['device_description'] = $_SERVER['HTTP_USER_AGENT'];
//save to the data
$this->database->app_name = 'devices';
$this->database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
if (!empty($device_uuid)) {
$this->database->uuid($device_uuid);
//add the dialplan permission
$p = permissions::new();
$p->add("device_add", "temp");
$p->add("device_edit", "temp");
//save to the data
$this->database->app_name = 'devices';
$this->database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
if (!empty($device_uuid)) {
$this->database->uuid($device_uuid);
}
$this->database->save($array);
$message = $this->database->message;
//remove the temporary permission
$p->delete("device_add", "temp");
$p->delete("device_edit", "temp");
}
$this->database->save($array);
$message = $this->database->message;
//remove the temporary permission
$p->delete("device_add", "temp");
$p->delete("device_edit", "temp");
}
}
//}

View File

@@ -1,6 +1,8 @@
<?php
function device_by_mac($device_address) {
global $database;
$sql = "select * from v_devices ";
$sql .= "where device_address = :device_address ";
$sql .= "and device_enabled = true ";
@@ -10,6 +12,8 @@ function device_by_mac($device_address) {
}
function device_by_ext($ext, $domain) {
global $database;
$sql = "select t1.* ";
$sql .= "from v_devices t1 ";
$sql .= "inner join v_device_lines t2 on t1.device_uuid = t2.device_uuid ";

View File

@@ -98,6 +98,10 @@
*/
public function get($profile = 'all') {
//add multi-lingual support
$language = new text;
$text = $language->get(null, '/app/registrations');
//initialize the id used in the registrations array
$id = 0;
@@ -116,8 +120,6 @@
}
}
//get the default settings
$sql = "select sip_profile_name from v_sip_profiles ";
$sql .= "where true ";
@@ -142,10 +144,6 @@
//show an error message
if ($xml_response == "Invalid Profile!") {
//add multi-lingual support
$language = new text;
$text = $language->get(null, '/app/registrations');
//show the error message
$xml_response = "<error_msg>".escape($text['label-message'])."</error_msg>";
}
@@ -407,6 +405,7 @@
//set message
if (is_array($response_api)) {
$message = '';
foreach ($response_api as $registration_user => $response) {
if (is_array($response['command'])) {
foreach($response['command'] as $command) {

View File

@@ -78,6 +78,7 @@
private $uuid_prefix;
private $toggle_field;
private $toggle_values;
private $dialplan_global;
public function __construct(array $setting_array = []) {
//set domain and user UUIDs