Gateways: List view updates.

This commit is contained in:
Nate 2019-11-22 13:15:53 -07:00
parent 60f577c088
commit d60786eb31
4 changed files with 908 additions and 138 deletions

View File

@ -81,6 +81,86 @@ $text['message-maximum_gateways']['ru-ru'] = "Максимум Шлюзов:";
$text['message-maximum_gateways']['sv-se'] = "Max antal Gateways:";
$text['message-maximum_gateways']['uk-ua'] = "Максимальна кількість шлюзів";
$text['message-gateway_started']['en-us'] = "Gateway(s) Started";
$text['message-gateway_started']['ar-eg'] = "Gateway(s) Started";
$text['message-gateway_started']['de-at'] = "Gateway(s) Started";
$text['message-gateway_started']['de-ch'] = "Gateway(s) Started";
$text['message-gateway_started']['de-de'] = "Gateway(s) Started";
$text['message-gateway_started']['es-cl'] = "Gateway(s) Started";
$text['message-gateway_started']['es-mx'] = "Gateway(s) Started";
$text['message-gateway_started']['fr-ca'] = "Gateway(s) Started";
$text['message-gateway_started']['fr-fr'] = "Gateway(s) Started";
$text['message-gateway_started']['he-il'] = "Gateway(s) Started";
$text['message-gateway_started']['it-it'] = "Gateway(s) Started";
$text['message-gateway_started']['nl-nl'] = "Gateway(s) Started";
$text['message-gateway_started']['pl-pl'] = "Gateway(s) Started";
$text['message-gateway_started']['pt-br'] = "Gateway(s) Started";
$text['message-gateway_started']['pt-pt'] = "Gateway(s) Started";
$text['message-gateway_started']['ro-ro'] = "Gateway(s) Started";
$text['message-gateway_started']['ru-ru'] = "Gateway(s) Started";
$text['message-gateway_started']['sv-se'] = "Gateway(s) Started";
$text['message-gateway_started']['uk-ua'] = "Gateway(s) Started";
$text['message-gateway_stopped']['en-us'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['ar-eg'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['de-at'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['de-ch'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['de-de'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['es-cl'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['es-mx'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['fr-ca'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['fr-fr'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['he-il'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['it-it'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['nl-nl'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['pl-pl'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['pt-br'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['pt-pt'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['ro-ro'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['ru-ru'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['sv-se'] = "Gateway(s) Stopped";
$text['message-gateway_stopped']['uk-ua'] = "Gateway(s) Stopped";
$text['confirm-start_gateways']['en-us'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['ar-eg'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['de-at'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['de-ch'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['de-de'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['es-cl'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['es-mx'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['fr-ca'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['fr-fr'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['he-il'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['it-it'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['nl-nl'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['pl-pl'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['pt-br'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['pt-pt'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['ro-ro'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['ru-ru'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['sv-se'] = "Are you sure you wish to START these gateways?";
$text['confirm-start_gateways']['uk-ua'] = "Are you sure you wish to START these gateways?";
$text['confirm-stop_gateways']['en-us'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['ar-eg'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['de-at'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['de-ch'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['de-de'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['es-cl'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['es-mx'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['fr-ca'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['fr-fr'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['he-il'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['it-it'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['nl-nl'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['pl-pl'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['pt-br'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['pt-pt'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['ro-ro'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['ru-ru'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['sv-se'] = "Are you sure you wish to STOP these gateways?";
$text['confirm-stop_gateways']['uk-ua'] = "Are you sure you wish to STOP these gateways?";
$text['label-username']['en-us'] = "Username";
$text['label-username']['ar-eg'] = "اسم المستخدم";
$text['label-username']['de-at'] = "Benutzername"; //copied from de-de
@ -1361,24 +1441,4 @@ $text['description-auth_username']['ru-ru'] = "Введите имя польз
$text['description-auth_username']['sv-se'] = "Ange 'uth-username' här.";
$text['description-auth_username']['uk-ua'] = "Enter the auth-username here.";
$text['confirm-copy']['en-us'] = "Do you really want to copy this?";
$text['confirm-copy']['ar-eg'] = "";
$text['confirm-copy']['de-at'] = "Wollen Sie das wirklich kopieren?"; //copied from de-de
$text['confirm-copy']['de-ch'] = "Wollen Sie das wirklich kopieren?"; //copied from de-de
$text['confirm-copy']['de-de'] = "Wollen Sie das wirklich kopieren?";
$text['confirm-copy']['es-cl'] = "¿Realmente desea copiar esto?";
$text['confirm-copy']['es-mx'] = "¿Realmente desea copiar esto?"; //copied from es-cl
$text['confirm-copy']['fr-ca'] = "Voulez-vous vraiment copier cela?"; //copied from fr-fr
$text['confirm-copy']['fr-fr'] = "Voulez-vous vraiment copier cela?";
$text['confirm-copy']['he-il'] = "? בטוח שאתה רוצה להעתיק";
$text['confirm-copy']['it-it'] = "Vuoi veramente copiarlo?";
$text['confirm-copy']['nl-nl'] = "";
$text['confirm-copy']['pl-pl'] = "Czy na pewno chcesz to skopiować?";
$text['confirm-copy']['pt-br'] = "Deseja realmente copiar isto?"; //copied from pt-pt
$text['confirm-copy']['pt-pt'] = "Deseja realmente copiar isto?";
$text['confirm-copy']['ro-ro'] = "Chiar doriți să copiați acest lucru?";
$text['confirm-copy']['ru-ru'] = "Вы действительно хотите это скопировать?";
$text['confirm-copy']['sv-se'] = "Vill du verkligen kopiera detta?";
$text['confirm-copy']['uk-ua'] = "Ви дійсно бажаєте це копіювати?";
?>
?>

View File

@ -28,6 +28,7 @@
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//check permissions
if (permission_exists('gateway_view')) {
@ -42,38 +43,77 @@
$language = new text;
$text = $language->get();
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//get posted data
if (is_array($_POST['gateways'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$gateways = $_POST['gateways'];
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//copy the gateways
if (permission_exists('gateway_add')) {
if ($action == 'copy' && is_array($gateways) && @sizeof($gateways) != 0) {
//copy
$obj = new gateways;
$obj->copy($gateways);
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the gateways
if (permission_exists('gateway_edit')) {
if ($action == 'toggle' && is_array($gateways) && @sizeof($gateways) != 0) {
//toggle
$obj = new gateways;
$obj->toggle($gateways);
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the gateways
if (permission_exists('gateway_delete')) {
if ($action == 'delete' && is_array($gateways) && @sizeof($gateways) != 0) {
//delete
$obj = new gateways;
$obj->delete($gateways);
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
if (strlen($_GET["a"]) > 0 && is_uuid($_GET["gateway"])) {
$profile = $_GET["profile"];
if (strlen($profile) == 0) {
$profile = 'external';
}
if ($_GET["a"] == "stop") {
$gateway_uuid = $_GET["gateway"];
$cmd = 'api sofia profile '.$profile.' killgw '.$gateway_uuid;
$response = trim(event_socket_request($fp, $cmd));
$msg = '<strong>Stop Gateway:</strong><pre>'.$response.'</pre>';
}
if ($_GET["a"] == "start") {
$gateway_uuid = $_GET["gateway"];
$cmd = 'api sofia profile '.$profile.' rescan';
$response = trim(event_socket_request($fp, $cmd));
$msg = '<strong>Start Gateway:</strong><pre>'.$response.'</pre>';
}
}
if (!function_exists('switch_gateway_status')) {
function switch_gateway_status($gateway_uuid, $result_type = 'xml') {
//control the gateways
if ($fp && is_array($gateways) && @sizeof($gateways) != 0) {
if ($action == 'start') {
//start
$obj = new gateways;
$obj->start($gateways);
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
if ($action == 'stop') {
//stop
$obj = new gateways;
$obj->stop($gateways);
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//gateway status function
if (!function_exists('switch_gateway_status')) {
function switch_gateway_status($gateway_uuid, $result_type = 'xml') {
global $fp;
if ($fp) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$cmd = 'api sofia xmlstatus gateway '.$gateway_uuid;
$response = trim(event_socket_request($fp, $cmd));
@ -86,47 +126,52 @@
}
}
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-gateways']."</b></td>\n";
echo " <td align='right'>";
if (permission_exists('gateway_all')) {
if ($_GET['show'] == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='gateways.php?show=all';\">\n";
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//add the search term
$search = strtolower($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "lower(gateway) like :search ";
$sql_search .= "or lower(username) like :search ";
$sql_search .= "or lower(auth_username) like :search ";
$sql_search .= "or lower(from_user) like :search ";
$sql_search .= "or lower(from_domain) like :search ";
$sql_search .= "or lower(from_domain) like :search ";
$sql_search .= "or lower(proxy) like :search ";
$sql_search .= "or lower(register_proxy) like :search ";
$sql_search .= "or lower(outbound_proxy) like :search ";
$sql_search .= "or lower(description) like :search ";
$sql_search .= ") ";
$parameters['search'] = '%'.$search.'%';
}
echo " <input type='button' class='btn' name='refresh' alt='".$text['button-refresh']."' onclick=\"window.location='gateways.php'\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " <span class=\"vexpl\">\n";
echo " ".$text['description-gateway']."\n";
echo " </span>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//get total gateway count from the database
$sql = "select count(*) from v_gateways ";
$sql = "select count(*) from v_gateways where true ";
if (!($_GET['show'] == "all" && permission_exists('gateway_all'))) {
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$sql .= "and (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
$database = new database;
$total_gateways = $database->select($sql, $parameters, 'column');
$num_rows = $total_gateways;
//prepare to page the results
if ($sql_search) {
$sql .= $sql_search;
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&order_by=".escape($order_by)."&order=".escape($order);
if (!isset($_GET['page'])) { $_GET['page'] = 0; }
$_GET['page'] = check_str($_GET['page']);
list($paging_controls, $rows_per_page, $var_3) = paging($total_gateways, $param, $rows_per_page);
$param = "&search=".$search;
$param .= $order_by ? "&order_by=".$order_by."&order=".$order : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
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);
$offset = $rows_per_page * $_GET['page'];
//get the list
@ -137,73 +182,148 @@
$gateways = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
//additional includes
require_once "resources/header.php";
//show the content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-gateways']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
if (permission_exists('gateway_edit') && $gateways) {
echo button::create(['type'=>'button','label'=>$text['button-stop'],'icon'=>$_SESSION['theme']['button_icon_stop'],'onclick'=>"if (confirm('".$text['confirm-stop_gateways']."')) { list_action_set('stop'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
echo button::create(['type'=>'button','label'=>$text['button-start'],'icon'=>$_SESSION['theme']['button_icon_start'],'onclick'=>"if (confirm('".$text['confirm-start_gateways']."')) { list_action_set('start'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>$_SESSION['theme']['button_icon_refresh'],'style'=>'margin-right: 15px;','link'=>'gateways.php']);
if (permission_exists('gateway_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'gateway_edit.php']);
}
if (permission_exists('gateway_add') && $gateways) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
if (permission_exists('gateway_edit') && $gateways) {
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
if (permission_exists('gateway_delete') && $gateways) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('gateway_all')) {
if ($_GET['show'] == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'gateways.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
echo " </form>\n";
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo $text['description-gateway']."\n";
echo "<br /><br />\n";
echo "<form id='form_list' method='post'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('gateway_add') || permission_exists('gateway_edit') || permission_exists('gateway_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($gateways ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == "all" && permission_exists('gateway_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param);
}
echo th_order_by('gateway', $text['label-gateway'], $order_by, $order);
echo th_order_by('context', $text['label-context'], $order_by, $order);
if ($fp) {
echo "<th>".$text['label-status']."</th>\n";
echo "<th>".$text['label-action']."</th>\n";
echo "<th class='hide-sm-dn'>".$text['label-status']."</th>\n";
if (permission_exists('gateway_edit')) {
echo "<th class='center'>".$text['label-action']."</th>\n";
}
echo "<th>".$text['label-state']."</th>\n";
}
echo th_order_by('hostname', $text['label-hostname'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('gateway_add')) {
if ($_SESSION['limit']['gateways']['numeric'] == '' || ($_SESSION['limit']['gateways']['numeric'] != '' && $total_gateways < $_SESSION['limit']['gateways']['numeric'])) {
echo "<a href='gateway_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo th_order_by('hostname', $text['label-hostname'], $order_by, $order, null, "class='hide-sm-dn'");
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
if (permission_exists('gateway_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</td>\n";
echo "</tr>\n";
if (is_array($gateways)) {
if (is_array($gateways) && @sizeof($gateways) != 0) {
$x = 0;
foreach($gateways as $row) {
$tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".escape($row['gateway_uuid'])."'" : null;
echo "<tr ".$tr_link.">\n";
if (permission_exists('gateway_edit')) {
$list_row_url = "gateway_edit.php?id=".urlencode($row['gateway_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('gateway_add') || permission_exists('gateway_edit') || permission_exists('gateway_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='gateways[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='gateways[$x][uuid]' value='".escape($row['gateway_uuid'])."' />\n";
echo " <input type='hidden' name='gateways[$x][profile]' value='".escape($row['profile'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('gateway_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
echo " <td>";
if (is_uuid($row['domain_uuid'])) {
echo escape($_SESSION['domains'][$row['domain_uuid']]['domain_name']);
}
else {
$domain = $text['label-global'];
echo $text['label-global'];
}
echo " <td valign='top' class='".$row_style[$c]."'>".escape($domain)."</td>\n";
echo "</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>";
echo " <td>";
if (permission_exists('gateway_edit')) {
echo "<a href='gateway_edit.php?id=".escape($row['gateway_uuid'])."'>".escape($row["gateway"])."</a>";
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['gateway'])."</a>";
}
else {
echo $row["gateway"];
echo escape($row['gateway']);
}
echo "</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row["context"])."</td>\n";
echo " </td>\n";
echo " <td>".escape($row["context"])."</td>\n";
if ($fp) {
if ($row["enabled"] == "true") {
$response = switch_gateway_status($row["gateway_uuid"]);
if ($response == "Invalid Gateway!") {
//not running
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-status-stopped']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='gateways.php?a=start&gateway=".escape($row["gateway_uuid"])."&profile=".escape($row["profile"])."' alt='".$text['label-action-start']."'>".$text['label-action-start']."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
echo " <td class='hide-sm-dn'>".$text['label-status-stopped']."</td>\n";
if (permission_exists('gateway_edit')) {
echo " <td class='no-link center'>";
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-action-start'],'title'=>$text['button-start'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('start'); list_form_submit('form_list')"]);
echo " </td>\n";
// echo " <td><a href='gateways.php?a=start&gateway=".urlencode($row["gateway_uuid"])."&profile=".urlencode($row["profile"])."' alt='".$text['label-action-start']."'>".$text['label-action-start']."</a></td>\n";
}
echo " <td>&nbsp;</td>\n";
}
else {
//running
try {
$xml = new SimpleXMLElement($response);
$state = $xml->state;
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-status-running']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='gateways.php?a=stop&gateway=".escape($row["gateway_uuid"])."&profile=".escape($row["profile"])."' alt='".$text['label-action-stop']."'>".$text['label-action-stop']."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($state)."</td>\n"; //REGED, NOREG, UNREGED
echo " <td class='hide-sm-dn'>".$text['label-status-running']."</td>\n";
if (permission_exists('gateway_edit')) {
echo " <td class='no-link center'>";
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-action-stop'],'title'=>$text['button-stop'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('stop'); list_form_submit('form_list')"]);
echo " </td>\n";
// echo " <td><a href='gateways.php?a=stop&gateway=".urlencode($row["gateway_uuid"])."&profile=".urlencode($row["profile"])."' alt='".$text['label-action-stop']."'>".$text['label-action-stop']."</a></td>\n";
}
echo " <td>".escape($state)."</td>\n"; //REGED, NOREG, UNREGED
}
catch(Exception $e) {
//echo $e->getMessage();
@ -211,41 +331,44 @@
}
}
else {
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
echo " <td class='hide-sm-dn'>&nbsp;</td>\n";
if (permission_exists('gateway_edit')) {
echo " <td>&nbsp;</td>\n";
}
echo " <td>&nbsp;</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row["hostname"])."</td>\n";
if ($row["enabled"] == "true") {
echo " <td valign='top' class='".$row_style[$c]."' style='align: center;'>".$text['label-true']."</td>\n";
}
else {
echo " <td valign='top' class='".$row_style[$c]."' style='align: center;'>".$text['label-false']."</td>\n";
}
echo " <td valign='top' class='row_stylebg'>".escape($row["description"])."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('gateway_edit')) {
echo "<a href='gateway_edit.php?id=".escape($row['gateway_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('gateway_delete')) {
echo "<a href='gateway_delete.php?id=".escape($row['gateway_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
}
$c = $c ? 0 : 1;
echo " <td class='hide-sm-dn'>".escape($row["hostname"])."</td>\n";
if (permission_exists('gateway_edit')) {
echo " <td class='no-link center'>";
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
}
else {
echo " <td class='center'>";
echo $text['label-'.$row['enabled']];
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row["description"])."&nbsp;</td>\n";
if (permission_exists('gateway_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
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 " </td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($gateways, $row);
unset($gateways);
echo "<tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<div align='center'>".$paging_controls."</div>\n";
echo $paging_controls."\n";
echo "<br /><br />\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@ -0,0 +1,579 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//define the gateways class
if (!class_exists('gateways')) {
class gateways {
/**
* declare private variables
*/
private $app_name;
private $app_uuid;
private $permission_prefix;
private $list_page;
private $table;
private $uuid_prefix;
private $toggle_field;
private $toggle_values;
/**
* called when the object is created
*/
public function __construct() {
//assign private variables
$this->app_name = 'gateways';
$this->app_uuid = '297ab33e-2c2f-8196-552c-f3567d2caaf8';
$this->permission_prefix = 'gateway_';
$this->list_page = 'gateways.php';
$this->table = 'gateways';
$this->uuid_prefix = 'gateway_';
$this->toggle_field = 'enabled';
$this->toggle_values = ['true','false'];
}
/**
* called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* start gateways
*/
public function start($records) {
if (permission_exists($this->permission_prefix.'edit')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//start the checked gateways
if (is_array($records) && @sizeof($records) != 0) {
//filter out unchecked gateways, build where clause for below
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
//get necessary gateway details
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, gateway, profile, enabled from v_".$this->table." ";
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$gateways[$row['uuid']]['name'] = $row['gateway'];
$gateways[$row['uuid']]['profile'] = $row['profile'];
$gateways[$row['uuid']]['enabled'] = $row['enabled'];
}
}
unset($sql, $parameters, $rows, $row);
}
if (is_array($gateways) && @sizeof($gateways) != 0) {
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//start gateways
foreach ($gateways as $gateway_uuid => $gateway) {
if ($gateway['enabled'] == 'true') {
$cmd = 'api sofia profile '.$gateway['profile'].' rescan';
$responses[$gateway_uuid]['gateway'] = $gateway['name'];
$responses[$gateway_uuid]['message'] = trim(event_socket_request($fp, $cmd));
}
}
//set message
if (is_array($responses) && @sizeof($responses) != 0) {
$message = $text['message-gateway_started'];
foreach ($responses as $response) {
$message .= "<br><strong>".$response['gateway']."</strong>: ".$response['message'];
}
message::add($message, 'positive', 7000);
}
}
}
}
}
}
/**
* stop gateways
*/
public function stop($records) {
if (permission_exists($this->permission_prefix.'edit')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//stop the checked gateways
if (is_array($records) && @sizeof($records) != 0) {
//filter out unchecked gateways, build where clause for below
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
//get necessary gateway details
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, gateway, profile, enabled from v_".$this->table." ";
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$gateways[$row['uuid']]['name'] = $row['gateway'];
$gateways[$row['uuid']]['profile'] = $row['profile'];
$gateways[$row['uuid']]['enabled'] = $row['enabled'];
}
}
unset($sql, $parameters, $rows, $row);
}
if (is_array($gateways) && @sizeof($gateways) != 0) {
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//stop gateways
foreach ($gateways as $gateway_uuid => $gateway) {
if ($gateway['enabled'] == 'true') {
$cmd = 'api sofia profile '.$gateway['profile'].' killgw '.$gateway_uuid;
$responses[$gateway_uuid]['gateway'] = $gateway['name'];
$responses[$gateway_uuid]['message'] = trim(event_socket_request($fp, $cmd));
}
}
//set message
if (is_array($responses) && @sizeof($responses) != 0) {
$message = $text['message-gateway_stopped'];
foreach ($responses as $response) {
$message .= "<br><strong>".$response['gateway']."</strong>: ".$response['message'];
}
message::add($message, 'positive', 7000);
}
}
}
}
}
}
/**
* delete records
*/
public function delete($records) {
if (permission_exists($this->permission_prefix.'delete')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//delete multiple records
if (is_array($records) && @sizeof($records) != 0) {
//filter out unchecked gateways, build where clause for below
foreach ($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
//get necessary gateway details
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, gateway, profile from v_".$this->table." ";
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$gateways[$row['uuid']]['name'] = $row['gateway'];
$gateways[$row['uuid']]['profile'] = $row['profile'];
}
}
unset($sql, $parameters, $rows, $row);
}
//create the event socket connection
if (!$fp) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
//loop through gateways
$x = 0;
foreach ($gateways as $gateway_uuid => $gateway) {
//remove gateway from session variable
unset($_SESSION['gateways'][$gateway_uuid]);
//remove the xml file (if any)
if ($_SESSION['switch']['sip_profiles']['dir'] != '') {
$gateway_xml_file = $_SESSION['switch']['sip_profiles']['dir']."/".$gateway['profile']."/v_".$gateway_uuid.".xml";
if (file_exists($gateway_xml_file)) {
unlink($gateway_xml_file);
}
}
//send the api command to stop the gateway
$cmd = 'api sofia profile '.$gateway['profile'].' killgw '.$gateway_uuid;
$response = event_socket_request($fp, $cmd);
unset($cmd);
//build delete array
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $gateway_uuid;
$x++;
}
//delete the checked rows
if (is_array($array) && @sizeof($array) != 0) {
//execute delete
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->delete($array);
unset($array);
//syncrhonize configuration
save_gateway_xml();
//clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$hostname = trim(event_socket_request($fp, 'api switchname'));
$cache = new cache;
$cache->delete("configuration:sofia.conf:".$hostname);
//create the event socket connection
if (!$fp) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
//rescan the sip profile to look for new or stopped gateways
if ($fp) {
//get distinct profiles from gateways
foreach ($gateways as $gateway) {
$array[] = $gateway['profile'];
}
$profiles = array_unique($array);
//send the api command to rescan each profile
foreach ($profiles as $profile) {
$cmd = 'api sofia profile '.$profile.' rescan';
$response = event_socket_request($fp, $cmd);
}
unset($cmd);
//close the connection
fclose($fp);
}
usleep(1000);
//clear the apply settings reminder
$_SESSION["reload_xml"] = false;
//set message
message::add($text['message-delete']);
}
unset($records);
}
}
}
/**
* toggle records
*/
public function toggle($records) {
if (permission_exists($this->permission_prefix.'edit')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//toggle the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get current toggle state
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as state, gateway, profile from v_".$this->table." ";
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$gateways[$row['uuid']]['state'] = $row['state'];
$gateways[$row['uuid']]['name'] = $row['gateway'];
$gateways[$row['uuid']]['profile'] = $row['profile'];
}
}
unset($sql, $parameters, $rows, $row);
}
//build update array
$x = 0;
foreach($gateways as $uuid => $gateway) {
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
$array[$this->table][$x][$this->toggle_field] = $gateway['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
$x++;
}
//save the changes
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//update gateway session variables or remove xml files (if necessary)
foreach ($gateways as $gateway_uuid => $gateway) {
if ($gateway['state'] == 'true') {
$_SESSION['gateways'][$gateway_uuid] = $gateway['name'];
}
else {
unset($_SESSION['gateways'][$gateway_uuid]);
//remove the xml file (if any)
if ($_SESSION['switch']['sip_profiles']['dir'] != '') {
$gateway_xml_file = $_SESSION['switch']['sip_profiles']['dir']."/".$gateway['profile']."/v_".$gateway_uuid.".xml";
if (file_exists($gateway_xml_file)) {
unlink($gateway_xml_file);
}
}
}
}
//syncrhonize configuration
save_gateway_xml();
//clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$hostname = trim(event_socket_request($fp, 'api switchname'));
$cache = new cache;
$cache->delete("configuration:sofia.conf:".$hostname);
//create the event socket connection
if (!$fp) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
//rescan the sip profile to look for new or stopped gateways
if ($fp) {
//get distinct profiles from gateways
foreach ($gateways as $gateway) {
$array[] = $gateway['profile'];
}
$profiles = array_unique($array);
//send the api command to rescan each profile
foreach ($profiles as $profile) {
$cmd = 'api sofia profile '.$profile.' rescan';
$response = event_socket_request($fp, $cmd);
}
unset($cmd);
//close the connection
fclose($fp);
}
usleep(1000);
//clear the apply settings reminder
$_SESSION["reload_xml"] = false;
//set message
message::add($text['message-toggle']);
}
unset($records, $gateways);
}
}
}
/**
* copy records
*/
public function copy($records) {
if (permission_exists($this->permission_prefix.'add')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//copy the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get checked records
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
//create insert array from existing data
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select * from v_".$this->table." ";
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $x => $row) {
$primary_uuid = uuid();
//copy data
$array[$this->table][$x] = $row;
//overwrite
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $primary_uuid;
$array[$this->table][$x]['description'] = trim($row['description'].' ('.$text['label-copy'].')');
unset($array[$this->table][$x]['channels']);
//defaults
if (strlen($row['expire_seconds']) == 0) {
$array[$this->table][$x]['expire_seconds'] = '800';
}
if (strlen($row['retry_seconds']) == 0) {
$array[$this->table][$x]['retry_seconds'] = '30';
}
//array of new gateways
if ($row['enabled'] == 'true') {
$gateways[$primary_uuid]['name'] = $row['gateway'];
}
}
}
unset($sql, $parameters, $rows, $row);
}
//save the changes and set the message
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//add new gateways to session variables
if (is_array($gateways) && @sizeof($gateways) != 0) {
foreach ($gateways as $gateway_uuid -> $gateway) {
$_SESSION['gateways'][$gateway_uuid] = $gateway['name'];
}
}
//synchronize the xml config
save_gateway_xml();
//clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$hostname = trim(event_socket_request($fp, 'api switchname'));
$cache = new cache;
$cache->delete("configuration:sofia.conf:".$hostname);
//set message
message::add($text['message-copy']);
}
unset($records, $gateways);
}
}
}
}
}
?>

View File

@ -1918,6 +1918,14 @@
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7e5d0132-a3a8-40b1-9540-f8b7df4cf8ca";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_start";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-play";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "ccfc5c6a-4946-496d-b1aa-45dfb35588f7";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_stop";