Destinations update for PHP 8.1

This commit is contained in:
markjcrane 2023-05-17 11:31:53 -06:00
parent 6d7e125743
commit 7d18e3eedc
2 changed files with 103 additions and 57 deletions

View File

@ -46,7 +46,7 @@
$text = $language->get(); $text = $language->get();
//action add or update //action add or update
if (is_uuid($_REQUEST["id"])) { if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update"; $action = "update";
$destination_uuid = $_REQUEST["id"]; $destination_uuid = $_REQUEST["id"];
} }
@ -82,7 +82,7 @@
} }
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST) > 0) { if (!empty($_POST)) {
//get the uuid //get the uuid
if ($action == "update" && is_uuid($_POST["destination_uuid"])) { if ($action == "update" && is_uuid($_POST["destination_uuid"])) {
$destination_uuid = $_POST["destination_uuid"]; $destination_uuid = $_POST["destination_uuid"];
@ -126,7 +126,7 @@
$destination_carrier = $_POST["destination_carrier"]; $destination_carrier = $_POST["destination_carrier"];
//sanitize the destination conditions //sanitize the destination conditions
if (is_array($destination_conditions)) { if (!empty($destination_conditions)) {
$i=0; $i=0;
foreach($destination_conditions as $row) { foreach($destination_conditions as $row) {
if (isset($row['condition_expression']) && !empty($row['condition_expression'])) { if (isset($row['condition_expression']) && !empty($row['condition_expression'])) {
@ -142,11 +142,11 @@
} }
//process the http post //process the http post
if (count($_POST) > 0 && empty($_POST["persistformvar"])) { if (!empty($_POST) && empty($_POST["persistformvar"])) {
//initialize the destinations object //initialize the destinations object
$destination = new destinations; $destination = new destinations;
if (permission_exists('destination_domain') && is_uuid($domain_uuid)) { if (permission_exists('destination_domain') && !empty($domain_uuid) && is_uuid($domain_uuid)) {
$destination->domain_uuid = $domain_uuid; $destination->domain_uuid = $domain_uuid;
} }
@ -172,7 +172,7 @@
} }
//if the user doesn't have permission to set the destination_number then get it from the database //if the user doesn't have permission to set the destination_number then get it from the database
if (is_uuid($destination_uuid) && !permission_exists('destination_number')) { if (!empty($destination_uuid) && is_uuid($destination_uuid) && !permission_exists('destination_number')) {
$sql = "select destination_number from v_destinations "; $sql = "select destination_number from v_destinations ";
$sql .= "where destination_uuid = :destination_uuid "; $sql .= "where destination_uuid = :destination_uuid ";
$parameters['destination_uuid'] = $destination_uuid; $parameters['destination_uuid'] = $destination_uuid;
@ -218,12 +218,12 @@
} }
//get the uuid //get the uuid
if ($action == "update" && is_uuid($_POST["destination_uuid"])) { if ($action == "update" && !empty($_POST["destination_uuid"]) && is_uuid($_POST["destination_uuid"])) {
$destination_uuid = $_POST["destination_uuid"]; $destination_uuid = $_POST["destination_uuid"];
} }
//get the destination row values //get the destination row values
if ($action == 'update' && is_uuid($destination_uuid)) { if ($action == 'update' && !empty($destination_uuid) && is_uuid($destination_uuid)) {
$sql = "select * from v_destinations "; $sql = "select * from v_destinations ";
$sql .= "where destination_uuid = :destination_uuid "; $sql .= "where destination_uuid = :destination_uuid ";
$parameters['destination_uuid'] = $destination_uuid; $parameters['destination_uuid'] = $destination_uuid;
@ -233,7 +233,7 @@
} }
//get the destination settings from the database //get the destination settings from the database
if (is_array($row) && @sizeof($row) != 0) { if (!empty($row)) {
//get the dialplan_uuid from the database //get the dialplan_uuid from the database
$dialplan_uuid = $row["dialplan_uuid"]; $dialplan_uuid = $row["dialplan_uuid"];
@ -246,7 +246,7 @@
//if the user doesn't have the correct permission then //if the user doesn't have the correct permission then
//override variables using information from the database //override variables using information from the database
if (is_array($row) && @sizeof($row) != 0) { if (!empty($row)) {
if (!permission_exists('destination_prefix')) { if (!permission_exists('destination_prefix')) {
$destination_prefix = $row["destination_prefix"]; $destination_prefix = $row["destination_prefix"];
} }
@ -342,7 +342,7 @@
$dialplan_details = $_POST["dialplan_details"]; $dialplan_details = $_POST["dialplan_details"];
//array cleanup //array cleanup
if (is_array($dialplan_details)) { if (!empty($dialplan_details)) {
foreach ($dialplan_details as $index => $row) { foreach ($dialplan_details as $index => $row) {
//unset the empty row //unset the empty row
if (empty($row["dialplan_detail_data"])) { if (empty($row["dialplan_detail_data"])) {
@ -362,7 +362,7 @@
//$parameters['domain_uuid'] = $domain_uuid; //$parameters['domain_uuid'] = $domain_uuid;
$database = new database; $database = new database;
$row = $database->select($sql, $parameters, 'row'); $row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) { if (!empty($row)) {
$fax_extension = $row["fax_extension"]; $fax_extension = $row["fax_extension"];
$fax_destination_number = $row["fax_destination_number"]; $fax_destination_number = $row["fax_destination_number"];
$fax_name = $row["fax_name"]; $fax_name = $row["fax_name"];
@ -422,7 +422,7 @@
$dialplan["app_uuid"] = "b5242951-686f-448f-8b4e-5031ba0601a4"; $dialplan["app_uuid"] = "b5242951-686f-448f-8b4e-5031ba0601a4";
} }
$dialplan["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_uuid"] = $dialplan_uuid;
$dialplan["domain_uuid"] = $domain_uuid; $dialplan["domain_uuid"] = $domain_uuid ?? null;
$dialplan["dialplan_name"] = ($dialplan_name != '') ? $dialplan_name : format_phone($destination_area_code.$destination_number); $dialplan["dialplan_name"] = ($dialplan_name != '') ? $dialplan_name : format_phone($destination_area_code.$destination_number);
$dialplan["dialplan_number"] = $destination_area_code.$destination_number; $dialplan["dialplan_number"] = $destination_area_code.$destination_number;
$dialplan["dialplan_context"] = $destination_context; $dialplan["dialplan_context"] = $destination_context;
@ -469,7 +469,7 @@
$dialplan["dialplan_xml"] = "<extension name=\"".xml::sanitize($dialplan["dialplan_name"])."\" continue=\"false\" uuid=\"".xml::sanitize($dialplan_uuid)."\">\n"; $dialplan["dialplan_xml"] = "<extension name=\"".xml::sanitize($dialplan["dialplan_name"])."\" continue=\"false\" uuid=\"".xml::sanitize($dialplan_uuid)."\">\n";
//add the dialplan xml destination conditions //add the dialplan xml destination conditions
if (is_array($conditions)) { if (!empty($conditions)) {
foreach($conditions as $row) { foreach($conditions as $row) {
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) { if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) {
$condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression']; $condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression'];
@ -544,7 +544,7 @@
$dialplan_detail_order = $dialplan_detail_order + 10; $dialplan_detail_order = $dialplan_detail_order + 10;
//add the dialplan detail destination conditions //add the dialplan detail destination conditions
if (is_array($conditions)) { if (!empty($conditions)) {
foreach($conditions as $row) { foreach($conditions as $row) {
//prepare the expression //prepare the expression
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) { if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) {
@ -902,7 +902,7 @@
} }
//prepare the destination_conditions json //prepare the destination_conditions json
if (is_array($conditions)) { if (!empty($conditions)) {
$array['destinations'][$x]["destination_conditions"] = json_encode($conditions); $array['destinations'][$x]["destination_conditions"] = json_encode($conditions);
unset($conditions); unset($conditions);
} }
@ -1033,8 +1033,45 @@
} }
//set default values
$domain_uuid = '';
$dialplan_uuid = '';
$destination_type = '';
$destination_number = '';
$destination_condition_field = '';
$destination_prefix = '';
$destination_trunk_prefix = '';
$destination_area_code = '';
$destination_caller_id_name = '';
$destination_caller_id_number = '';
$destination_cid_name_prefix = '';
$destination_hold_music = '';
$destination_distinctive_ring = '';
$destination_record = '';
$destination_accountcode = '';
$destination_type_voice = '';
$destination_type_fax = '';
$destination_type_text = '';
$destination_type_emergency = '';
$destination_context = '';
$destination_conditions = '';
$destination_actions = '';
$fax_uuid = '';
$provider_uuid = '';
$user_uuid = '';
$group_uuid = '';
$currency = '';
$destination_sell = '';
$destination_buy = '';
$currency_buy = '';
$destination_carrier = '';
$destination_order = '';
$destination_enabled = '';
$destination_description = '';
$select_style = '';
//pre-populate the form //pre-populate the form
if (is_array($_GET) > 0 && $_POST["persistformvar"] != "true") { if (!empty($_GET["id"]) > 0 && empty($_POST["persistformvar"])) {
if (is_uuid($_GET["id"])) { if (is_uuid($_GET["id"])) {
$destination_uuid = $_GET["id"]; $destination_uuid = $_GET["id"];
$sql = "select * from v_destinations "; $sql = "select * from v_destinations ";
@ -1042,7 +1079,7 @@
$parameters['destination_uuid'] = $destination_uuid; $parameters['destination_uuid'] = $destination_uuid;
$database = new database; $database = new database;
$row = $database->select($sql, $parameters, 'row'); $row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) { if (!empty($row)) {
$domain_uuid = $row["domain_uuid"]; $domain_uuid = $row["domain_uuid"];
$dialplan_uuid = $row["dialplan_uuid"]; $dialplan_uuid = $row["dialplan_uuid"];
$destination_type = $row["destination_type"]; $destination_type = $row["destination_type"];
@ -1083,11 +1120,11 @@
} }
//decode the json to an array //decode the json to an array
$destination_conditions = json_decode($destination_conditions, true); $destination_conditions = json_decode($destination_conditions ?? '', true);
$destination_actions = json_decode($destination_actions ?? '', true); $destination_actions = json_decode($destination_actions ?? '', true);
//prepare the conditions array, add an empty row //prepare the conditions array, add an empty row
if (is_array($destination_conditions)) { if (!empty($destination_conditions)) {
$i=0; $i=0;
foreach ($destination_conditions as $row) { $i++; } foreach ($destination_conditions as $row) { $i++; }
$destination_conditions[$i]['condition_field'] = ''; $destination_conditions[$i]['condition_field'] = '';
@ -1110,10 +1147,10 @@
unset($sql, $parameters); unset($sql, $parameters);
//add an empty row to the array //add an empty row to the array
$x = (is_array($dialplan_details)) ? count($dialplan_details) : $x = 0; $x = (!empty($dialplan_details)) ? count($dialplan_details) : $x = 0;
$limit = $x + 1; $limit = $x + 1;
while($x < $limit) { while($x < $limit) {
$dialplan_details[$x]['domain_uuid'] = $domain_uuid; $dialplan_details[$x]['domain_uuid'] = $domain_uuid ?? null;
$dialplan_details[$x]['dialplan_uuid'] = $dialplan_uuid; $dialplan_details[$x]['dialplan_uuid'] = $dialplan_uuid;
$dialplan_details[$x]['dialplan_detail_type'] = ''; $dialplan_details[$x]['dialplan_detail_type'] = '';
$dialplan_details[$x]['dialplan_detail_data'] = ''; $dialplan_details[$x]['dialplan_detail_data'] = '';
@ -1480,7 +1517,7 @@
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$x=0; $x=0;
if (is_array($destination_actions)) { if (!empty($destination_actions)) {
foreach($destination_actions as $row) { foreach($destination_actions as $row) {
echo $destination->select('dialplan', "destination_actions[$x]", $row['destination_app'].':'.$row['destination_data']); echo $destination->select('dialplan', "destination_actions[$x]", $row['destination_app'].':'.$row['destination_data']);
echo "<br />\n"; echo "<br />\n";
@ -1501,7 +1538,7 @@
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
$database = new database; $database = new database;
$result = $database->select($sql, $parameters, 'all'); $result = $database->select($sql, $parameters, 'all');
if (is_array($result) && @sizeof($result) != 0) { if (!empty($result)) {
echo "<tr id='tr_fax_detection'>\n"; echo "<tr id='tr_fax_detection'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n"; echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-fax_uuid']."\n"; echo " ".$text['label-fax_uuid']."\n";
@ -1527,7 +1564,7 @@
} }
//providers //providers
if (permission_exists('provider_edit') && is_array($providers) && @sizeof($providers) != 0) { if (permission_exists('provider_edit') && !empty($providers)) {
echo "<tr id='tr_provider'>\n"; echo "<tr id='tr_provider'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n"; echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-provider']."\n"; echo " ".$text['label-provider']."\n";

View File

@ -47,14 +47,14 @@
$text = $language->get(); $text = $language->get();
//get posted data //get posted data
if (is_array($_POST['destinations'])) { if (!empty($_POST['destinations'])) {
$action = $_POST['action']; $action = $_POST['action'];
$search = $_POST['search']; $search = $_POST['search'];
$destinations = $_POST['destinations']; $destinations = $_POST['destinations'];
} }
//process the http post data by action //process the http post data by action
if ($action != '' && is_array($destinations) && @sizeof($destinations) != 0) { if (!empty($action) && !empty($destinations)) {
switch ($action) { switch ($action) {
case 'toggle': case 'toggle':
if (permission_exists('destination_edit')) { if (permission_exists('destination_edit')) {
@ -80,9 +80,9 @@
//add a function to return the action_name //add a function to return the action_name
function action_name($destination_array, $detail_action) { function action_name($destination_array, $detail_action) {
if (is_array($destination_array)) { if (!empty($destination_array)) {
foreach($destination_array as $group => $row) { foreach($destination_array as $group => $row) {
if (is_array($row)) { if (!empty($row)) {
foreach ($row as $key => $value) { foreach ($row as $key => $value) {
if ($value == $detail_action) { if ($value == $detail_action) {
//add multi-lingual support //add multi-lingual support
@ -100,24 +100,31 @@
} }
//set the type //set the type
$destination_type = '';
if (!empty($_REQUEST['type'])) {
switch ($_REQUEST['type']) { switch ($_REQUEST['type']) {
case 'inbound': $destination_type = 'inbound'; break; case 'inbound': $destination_type = 'inbound'; break;
case 'outbound': $destination_type = 'outbound'; break; case 'outbound': $destination_type = 'outbound'; break;
case 'local': $destination_type = 'local'; break; case 'local': $destination_type = 'local'; break;
default: $destination_type = 'inbound'; default: $destination_type = 'inbound';
} }
}
//get variables used to control the order //get variables used to control the order
$order_by = $_GET["order_by"]; $order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"]; $order = $_GET["order"] ?? '';
//add the search term //get the HTTP variables
$search = strtolower($_GET["search"] ?? ''); $search = $_GET["search"] ?? '';
$show = $_GET["show"] ?? '';
//set from session variables
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
//prepare to page the results //prepare to page the results
$sql = "select count(*) from v_destinations "; $sql = "select count(*) from v_destinations ";
$sql .= "where destination_type = :destination_type "; $sql .= "where destination_type = :destination_type ";
if ($_GET['show'] != "all" || !permission_exists('destination_all')) { if ($show != "all" || !permission_exists('destination_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
@ -145,11 +152,13 @@
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".urlencode($search); $param = "&search=".urlencode($search);
$param .= "&type=".$destination_type; $param .= "&type=".$destination_type;
if ($_GET['show'] == "all" && permission_exists('destination_all')) { if ($show == "all" && permission_exists('destination_all')) {
$param .= "&show=all"; $param .= "&show=all";
} }
if (!empty($_GET['page'])) {
$page = $_GET['page']; $page = $_GET['page'];
if (empty($page)) { $page = 0; $_GET['page'] = 0; } }
if (!isset($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -157,7 +166,7 @@
//get the list //get the list
$sql = "select * from v_destinations "; $sql = "select * from v_destinations ";
$sql .= "where destination_type = :destination_type "; $sql .= "where destination_type = :destination_type ";
if ($_GET['show'] != "all" || !permission_exists('destination_all')) { if ($show != "all" || !permission_exists('destination_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
@ -195,9 +204,9 @@
echo "<div class='action_bar' id='action_bar'>\n"; echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-destinations']." (".$num_rows.")</b></div>\n"; echo " <div class='heading'><b>".$text['title-destinations']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n"; echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-inbound'],'icon'=>'location-arrow fa-rotate-90','link'=>'?type=inbound'.($_GET['show'] == 'all' ? '&show=all' : null).($search != '' ? "&search=".urlencode($search) : null)]); echo button::create(['type'=>'button','label'=>$text['button-inbound'],'icon'=>'location-arrow fa-rotate-90','link'=>'?type=inbound'.($show == 'all' ? '&show=all' : null).($search != '' ? "&search=".urlencode($search) : null)]);
echo button::create(['type'=>'button','label'=>$text['button-outbound'],'icon'=>'location-arrow','link'=>'?type=outbound'.($_GET['show'] == 'all' ? '&show=all' : null).($search != '' ? "&search=".urlencode($search) : null)]); echo button::create(['type'=>'button','label'=>$text['button-outbound'],'icon'=>'location-arrow','link'=>'?type=outbound'.($show == 'all' ? '&show=all' : null).($search != '' ? "&search=".urlencode($search) : null)]);
echo button::create(['type'=>'button','label'=>$text['button-local'],'icon'=>'vector-square','link'=>'?type=local'.($_GET['show'] == 'all' ? '&show=all' : null).($search != '' ? "&search=".urlencode($search) : null)]); echo button::create(['type'=>'button','label'=>$text['button-local'],'icon'=>'vector-square','link'=>'?type=local'.($show == 'all' ? '&show=all' : null).($search != '' ? "&search=".urlencode($search) : null)]);
if (permission_exists('destination_import')) { if (permission_exists('destination_import')) {
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'link'=>'destination_imports.php']); echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'link'=>'destination_imports.php']);
} }
@ -212,7 +221,7 @@
} }
echo "<form id='form_search' class='inline' method='get'>\n"; echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('destination_all')) { if (permission_exists('destination_all')) {
if ($_GET['show'] == 'all') { if ($show == 'all') {
echo " <input type='hidden' name='show' value='all'>"; echo " <input type='hidden' name='show' value='all'>";
} }
else { else {
@ -247,10 +256,10 @@
echo "<tr class='list-header'>\n"; echo "<tr class='list-header'>\n";
if (permission_exists('destination_delete')) { if (permission_exists('destination_delete')) {
echo " <th class='checkbox'>\n"; echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($destinations ?: "style='visibility: hidden;'").">\n"; echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(!empty($destinations) ?: "style='visibility: hidden;'").">\n";
echo " </th>\n"; echo " </th>\n";
} }
if ($_GET['show'] == "all" && permission_exists('destination_all')) { if ($show == "all" && permission_exists('destination_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'"); echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
} }
echo th_order_by('destination_type', $text['label-destination_type'], $order_by, $order, $param, "class='shrink'"); echo th_order_by('destination_type', $text['label-destination_type'], $order_by, $order, $param, "class='shrink'");
@ -262,7 +271,7 @@
echo th_order_by('destination_area_code', '', $order_by, $order, $param, "class='shrink'"); echo th_order_by('destination_area_code', '', $order_by, $order, $param, "class='shrink'");
} }
echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order, $param, "class='shrink'"); echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order, $param, "class='shrink'");
if (!$_GET['show'] == "all") { if (!$show == "all") {
echo "<th>". $text['label-destination_actions']."</th>"; echo "<th>". $text['label-destination_actions']."</th>";
} }
if (permission_exists("destination_context")) { if (permission_exists("destination_context")) {
@ -274,18 +283,18 @@
} }
echo th_order_by('destination_enabled', $text['label-destination_enabled'], $order_by, $order, $param); echo th_order_by('destination_enabled', $text['label-destination_enabled'], $order_by, $order, $param);
echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order, $param, "class='hide-sm-dn'"); echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order, $param, "class='hide-sm-dn'");
if (permission_exists('destination_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { if (permission_exists('destination_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n"; echo " <td class='action-button'>&nbsp;</td>\n";
} }
echo "</tr>\n"; echo "</tr>\n";
if (is_array($destinations) && @sizeof($destinations) != 0) { if (!empty($destinations)) {
$x = 0; $x = 0;
foreach($destinations as $row) { foreach($destinations as $row) {
//prepare the destination actions //prepare the destination actions
$destination_actions = json_decode($row['destination_actions'], true); $destination_actions = json_decode($row['destination_actions'], true);
if (is_array($destination_actions)) { if (!empty($destination_actions)) {
foreach($destination_actions as $action) { foreach($destination_actions as $action) {
$destination_app = $action['destination_app']; $destination_app = $action['destination_app'];
$destination_data = $action['destination_data']; $destination_data = $action['destination_data'];
@ -305,7 +314,7 @@
echo " <input type='hidden' name='destinations[$x][uuid]' value='".escape($row['destination_uuid'])."' />\n"; echo " <input type='hidden' name='destinations[$x][uuid]' value='".escape($row['destination_uuid'])."' />\n";
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('destination_all')) { if ($show == "all" && permission_exists('destination_all')) {
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
@ -333,7 +342,7 @@
} }
echo " </td>\n"; echo " </td>\n";
if (!$_GET['show'] == "all") { if (!$show == "all") {
echo " <td class='overflow' style='min-width: 125px;'>".action_name($destination_array, $destination_app.':'.$destination_data)."&nbsp;</td>\n"; echo " <td class='overflow' style='min-width: 125px;'>".action_name($destination_array, $destination_app.':'.$destination_data)."&nbsp;</td>\n";
} }
if (permission_exists("destination_context")) { if (permission_exists("destination_context")) {
@ -345,9 +354,9 @@
} }
echo " <td>".escape($text['label-'.$row['destination_enabled']])."&nbsp;</td>\n"; echo " <td>".escape($text['label-'.$row['destination_enabled']])."&nbsp;</td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['destination_description'])."&nbsp;</td>\n"; echo " <td class='description overflow hide-sm-dn'>".escape($row['destination_description'])."&nbsp;</td>\n";
if (permission_exists('destination_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { if (permission_exists('destination_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>"; echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$list_row_edit_button,'link'=>$list_row_url]);
echo " </td>\n"; echo " </td>\n";
} }
echo "</tr>\n"; echo "</tr>\n";