Extensions: List view updates.
This commit is contained in:
parent
6eddd05cba
commit
0e56d1b7e5
|
|
@ -86,7 +86,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get order and order by and sanatize the values
|
//get order and order by
|
||||||
$order_by = $_GET["order_by"];
|
$order_by = $_GET["order_by"];
|
||||||
$order = $_GET["order"];
|
$order = $_GET["order"];
|
||||||
|
|
||||||
|
|
@ -124,8 +124,7 @@
|
||||||
if ($_GET['show'] == "all" && permission_exists('bridge_all')) {
|
if ($_GET['show'] == "all" && permission_exists('bridge_all')) {
|
||||||
$param .= "&show=all";
|
$param .= "&show=all";
|
||||||
}
|
}
|
||||||
$page = $_GET['page'];
|
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
||||||
if (strlen($page) == 0) { $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;
|
||||||
|
|
@ -225,10 +224,10 @@
|
||||||
}
|
}
|
||||||
echo " <td>";
|
echo " <td>";
|
||||||
if (permission_exists('bridge_edit')) {
|
if (permission_exists('bridge_edit')) {
|
||||||
echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['bridge_name'])."</a>\n";
|
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['bridge_name'])."</a>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo " ".escape($row['bridge_name'])."\n";
|
echo escape($row['bridge_name']);
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td>".escape($row['bridge_destination'])."</td>\n";
|
echo " <td>".escape($row['bridge_destination'])."</td>\n";
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,10 @@
|
||||||
//prepare to page the results
|
//prepare to page the results
|
||||||
$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=".$search;
|
$param = "&search=".$search;
|
||||||
$page = $_GET['page'];
|
if ($_GET['show'] == "all" && permission_exists('email_template_all')) {
|
||||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
$param .= "&show=all";
|
||||||
|
}
|
||||||
|
$page = is_numeric($_GET['page']) ? $_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;
|
||||||
|
|
|
||||||
|
|
@ -841,6 +841,26 @@ $text['label-outbound_caller_id_name']['ru-ru'] = "Идентификатор (C
|
||||||
$text['label-outbound_caller_id_name']['sv-se'] = "Utgående Namnpresentation";
|
$text['label-outbound_caller_id_name']['sv-se'] = "Utgående Namnpresentation";
|
||||||
$text['label-outbound_caller_id_name']['uk-ua'] = "";
|
$text['label-outbound_caller_id_name']['uk-ua'] = "";
|
||||||
|
|
||||||
|
$text['label-outbound_cid_name']['en-us'] = "Outbound CID Name";
|
||||||
|
$text['label-outbound_cid_name']['ar-eg'] = "";
|
||||||
|
$text['label-outbound_cid_name']['de-at'] = "Ausgehende Anruferkennung (Name)"; //copied from de-de
|
||||||
|
$text['label-outbound_cid_name']['de-ch'] = "Ausgehende Anruferkennung (Name)"; //copied from de-de
|
||||||
|
$text['label-outbound_cid_name']['de-de'] = "Ausgehende Anruferkennung (Name)";
|
||||||
|
$text['label-outbound_cid_name']['es-cl'] = "Nombre de Caller ID Saliente";
|
||||||
|
$text['label-outbound_cid_name']['es-mx'] = "Nombre de Caller ID Saliente"; //copied from es-cl
|
||||||
|
$text['label-outbound_cid_name']['fr-ca'] = "Nom de l'appelant sortant"; //copied from fr-fr
|
||||||
|
$text['label-outbound_cid_name']['fr-fr'] = "Nom de l'appelant sortant";
|
||||||
|
$text['label-outbound_cid_name']['he-il'] = "";
|
||||||
|
$text['label-outbound_cid_name']['it-it'] = "ID Nome Chiamante Esterno";
|
||||||
|
$text['label-outbound_cid_name']['nl-nl'] = "";
|
||||||
|
$text['label-outbound_cid_name']['pl-pl'] = "Nazwa prezentowana w rozmowach wychodzacych";
|
||||||
|
$text['label-outbound_cid_name']['pt-br'] = "Nome público"; //copied from pt-pt
|
||||||
|
$text['label-outbound_cid_name']['pt-pt'] = "Nome público";
|
||||||
|
$text['label-outbound_cid_name']['ro-ro'] = "";
|
||||||
|
$text['label-outbound_cid_name']['ru-ru'] = "Идентификатор (Caller ID) имени вызывающего абонента";
|
||||||
|
$text['label-outbound_cid_name']['sv-se'] = "Utgående Namnpresentation";
|
||||||
|
$text['label-outbound_cid_name']['uk-ua'] = "";
|
||||||
|
|
||||||
$text['label-number_alias']['en-us'] = "Number Alias";
|
$text['label-number_alias']['en-us'] = "Number Alias";
|
||||||
$text['label-number_alias']['ar-eg'] = "";
|
$text['label-number_alias']['ar-eg'] = "";
|
||||||
$text['label-number_alias']['de-at'] = "Alternative Nummer"; //copied from de-de
|
$text['label-number_alias']['de-at'] = "Alternative Nummer"; //copied from de-de
|
||||||
|
|
@ -1121,6 +1141,26 @@ $text['label-effective_caller_id_name']['ru-ru'] = "Эффективный ид
|
||||||
$text['label-effective_caller_id_name']['sv-se'] = "Effektiv Namnpresentation";
|
$text['label-effective_caller_id_name']['sv-se'] = "Effektiv Namnpresentation";
|
||||||
$text['label-effective_caller_id_name']['uk-ua'] = "";
|
$text['label-effective_caller_id_name']['uk-ua'] = "";
|
||||||
|
|
||||||
|
$text['label-effective_cid_name']['en-us'] = "Effective CID Name";
|
||||||
|
$text['label-effective_cid_name']['ar-eg'] = "إسم المتصل الفعال";
|
||||||
|
$text['label-effective_cid_name']['de-at'] = "Tatsächliche Anruferkennung (Name)"; //copied from de-de
|
||||||
|
$text['label-effective_cid_name']['de-ch'] = "Tatsächliche Anruferkennung (Name)"; //copied from de-de
|
||||||
|
$text['label-effective_cid_name']['de-de'] = "Tatsächliche Anruferkennung (Name)";
|
||||||
|
$text['label-effective_cid_name']['es-cl'] = "Nombre de Caller ID Efectivo";
|
||||||
|
$text['label-effective_cid_name']['es-mx'] = "Nombre de Caller ID Efectivo"; //copied from es-cl
|
||||||
|
$text['label-effective_cid_name']['fr-ca'] = "Nom interne"; //copied from fr-fr
|
||||||
|
$text['label-effective_cid_name']['fr-fr'] = "Nom interne";
|
||||||
|
$text['label-effective_cid_name']['he-il'] = "";
|
||||||
|
$text['label-effective_cid_name']['it-it'] = "ID Nome Chiamante Effettivo";
|
||||||
|
$text['label-effective_cid_name']['nl-nl'] = "";
|
||||||
|
$text['label-effective_cid_name']['pl-pl'] = "Prezentacja nazwy dzwoniącego (rozmowy wew)";
|
||||||
|
$text['label-effective_cid_name']['pt-br'] = "Nome interno";
|
||||||
|
$text['label-effective_cid_name']['pt-pt'] = "Nome Interno";
|
||||||
|
$text['label-effective_cid_name']['ro-ro'] = "";
|
||||||
|
$text['label-effective_cid_name']['ru-ru'] = "Эффективный идентификатор (Caller ID) имени вызывающего абонента";
|
||||||
|
$text['label-effective_cid_name']['sv-se'] = "Effektiv Namnpresentation";
|
||||||
|
$text['label-effective_cid_name']['uk-ua'] = "";
|
||||||
|
|
||||||
$text['label-domain']['en-us'] = "Domain";
|
$text['label-domain']['en-us'] = "Domain";
|
||||||
$text['label-domain']['ar-eg'] = "النطاق";
|
$text['label-domain']['ar-eg'] = "النطاق";
|
||||||
$text['label-domain']['de-at'] = "Domäne"; //copied from de-de
|
$text['label-domain']['de-at'] = "Domäne"; //copied from de-de
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
include "root.php";
|
include "root.php";
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
|
require_once "resources/paging.php";
|
||||||
|
|
||||||
//check permissions
|
//check permissions
|
||||||
if (permission_exists('extension_view')) {
|
if (permission_exists('extension_view')) {
|
||||||
|
|
@ -38,64 +39,100 @@
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the registrations
|
|
||||||
if (permission_exists('extension_registered')) {
|
|
||||||
$obj = new registrations;
|
|
||||||
$registrations = $obj->get('all');
|
|
||||||
}
|
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
$language = new text;
|
$language = new text;
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
//get the http values and set them as variables
|
//get posted data
|
||||||
$search = $_GET["search"];
|
if (is_array($_POST['extensions'])) {
|
||||||
|
$action = $_POST['action'];
|
||||||
|
$search = $_POST['search'];
|
||||||
|
$extensions = $_POST['extensions'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//toggle the extensions
|
||||||
|
if (permission_exists('extension_enabled')) {
|
||||||
|
if ($action == 'toggle' && is_array($extensions) && @sizeof($extensions) != 0) {
|
||||||
|
//toggle
|
||||||
|
$obj = new extension;
|
||||||
|
$obj->toggle($extensions);
|
||||||
|
//redirect
|
||||||
|
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete the extensions
|
||||||
|
if (permission_exists('extension_delete')) {
|
||||||
|
if ($action == 'delete' && is_array($extensions) && @sizeof($extensions) != 0) {
|
||||||
|
//delete
|
||||||
|
$obj = new extension;
|
||||||
|
$obj->delete($extensions);
|
||||||
|
//redirect
|
||||||
|
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//get order and order by
|
||||||
$order_by = $_GET["order_by"];
|
$order_by = $_GET["order_by"];
|
||||||
$order = $_GET["order"];
|
$order = $_GET["order"];
|
||||||
|
|
||||||
//handle search term
|
//add the search term
|
||||||
$search = $_GET["search"];
|
$search = strtolower($_GET["search"]);
|
||||||
if (strlen($search) > 0) {
|
if (strlen($search) > 0) {
|
||||||
$search = strtolower($search);
|
$sql_search = " and ( ";
|
||||||
$sql_search = "and ( ";
|
$sql_search .= "lower(extension) like :search ";
|
||||||
$sql_search .= " lower(extension) like :search ";
|
$sql_search .= "or lower(number_alias) like :search ";
|
||||||
$sql_search .= " or lower(call_group) like :search ";
|
$sql_search .= "or lower(effective_caller_id_name) like :search ";
|
||||||
$sql_search .= " or lower(user_context) like :search ";
|
$sql_search .= "or lower(effective_caller_id_number) like :search ";
|
||||||
$sql_search .= " or lower(enabled) like :search ";
|
$sql_search .= "or lower(outbound_caller_id_name) like :search ";
|
||||||
$sql_search .= " or lower(description) like :search ";
|
$sql_search .= "or lower(outbound_caller_id_number) like :search ";
|
||||||
|
$sql_search .= "or lower(emergency_caller_id_name) like :search ";
|
||||||
|
$sql_search .= "or lower(emergency_caller_id_number) like :search ";
|
||||||
|
$sql_search .= "or lower(directory_first_name) like :search ";
|
||||||
|
$sql_search .= "or lower(directory_last_name) like :search ";
|
||||||
|
$sql_search .= "or lower(call_group) like :search ";
|
||||||
|
$sql_search .= "or lower(user_context) like :search ";
|
||||||
|
$sql_search .= "or lower(enabled) like :search ";
|
||||||
|
$sql_search .= "or lower(description) like :search ";
|
||||||
$sql_search .= ") ";
|
$sql_search .= ") ";
|
||||||
$parameters['search'] = '%'.$search.'%';
|
$parameters['search'] = '%'.$search.'%';
|
||||||
}
|
}
|
||||||
|
|
||||||
//get total extension count
|
//get total extension count for domain
|
||||||
$sql = "select count(extension_uuid) from v_extensions ";
|
if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
if (!($_GET['show'] == "all" && permission_exists('extension_all'))) {
|
$sql = "select count(*) from v_extensions ";
|
||||||
$sql .= "where domain_uuid = :domain_uuid ";
|
$sql .= "where domain_uuid = :domain_uuid ";
|
||||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
|
$database = new database;
|
||||||
|
$total_extensions = $database->select($sql, $parameters, 'column');
|
||||||
|
unset($sql, $parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get total extension count
|
||||||
|
$sql = "select count(*) from v_extensions where true ";
|
||||||
|
if (!($_GET['show'] == "all" && permission_exists('extension_all'))) {
|
||||||
|
$sql .= "and domain_uuid = :domain_uuid ";
|
||||||
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
}
|
}
|
||||||
$sql .= $sql_search;
|
$sql .= $sql_search;
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$total_extensions = $database->select($sql, $parameters, 'column');
|
$num_rows = $database->select($sql, $parameters, 'column');
|
||||||
|
|
||||||
//additional includes
|
|
||||||
$document['title'] = $text['title-extensions'];
|
|
||||||
require_once "resources/paging.php";
|
|
||||||
|
|
||||||
//prepare to page the results
|
//prepare to page the results
|
||||||
$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=".$search;
|
||||||
|
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||||
|
$param .= "&show=all";
|
||||||
|
}
|
||||||
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
||||||
list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_extensions, $param, $rows_per_page, true); //top
|
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom
|
||||||
list($paging_controls, $rows_per_page, $var_3) = paging($total_extensions, $param, $rows_per_page); //bottom
|
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top
|
||||||
$offset = $rows_per_page * $page;
|
$offset = $rows_per_page * $page;
|
||||||
|
|
||||||
//get the extensions
|
//get the extensions
|
||||||
$sql = "select * from v_extensions ";
|
$sql = str_replace('count(*)', '*', $sql);
|
||||||
if (!($_GET['show'] == "all" && permission_exists('extension_all'))) {
|
|
||||||
$sql .= "where domain_uuid = :domain_uuid ";
|
|
||||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
||||||
}
|
|
||||||
$sql .= $sql_search;
|
|
||||||
if ($order_by == '' || $order_by == 'extension') {
|
if ($order_by == '' || $order_by == 'extension') {
|
||||||
if ($db_type == 'pgsql') {
|
if ($db_type == 'pgsql') {
|
||||||
$sql .= 'order by natural_sort(extension) '.$order; //function in app_defaults.php
|
$sql .= 'order by natural_sort(extension) '.$order; //function in app_defaults.php
|
||||||
|
|
@ -112,115 +149,131 @@
|
||||||
$extensions = $database->select($sql, $parameters, 'all');
|
$extensions = $database->select($sql, $parameters, 'all');
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
//set the alternating styles
|
//get the registrations
|
||||||
$c = 0;
|
if (permission_exists('extension_registered')) {
|
||||||
$row_style["0"] = "row_style0";
|
$obj = new registrations;
|
||||||
$row_style["1"] = "row_style1";
|
$registrations = $obj->get('all');
|
||||||
|
}
|
||||||
|
|
||||||
|
//create token
|
||||||
|
$object = new token;
|
||||||
|
$token = $object->create($_SERVER['PHP_SELF']);
|
||||||
|
|
||||||
//include the header
|
//include the header
|
||||||
|
$document['title'] = $text['title-extensions'];
|
||||||
require_once "resources/header.php";
|
require_once "resources/header.php";
|
||||||
|
|
||||||
//show the content
|
//show the content
|
||||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
echo "<div class='action_bar' id='action_bar'>\n";
|
||||||
echo " <tr>\n";
|
echo " <div class='heading'><b>".$text['header-extensions']." (".$num_rows.")</b></div>\n";
|
||||||
echo " <td align='left' width='100%'>\n";
|
echo " <div class='actions'>\n";
|
||||||
echo " <b>".$text['header-extensions']." (".$total_extensions.")</b><br>\n";
|
if (permission_exists('extension_import') && (!is_numeric($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
||||||
echo " </td>\n";
|
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'link'=>'extension_imports.php']);
|
||||||
echo " <form method='get' action=''>\n";
|
}
|
||||||
echo " <td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
|
if (permission_exists('extension_export')) {
|
||||||
|
echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'link'=>'extension_download.php']);
|
||||||
|
}
|
||||||
|
$margin_left = permission_exists('extension_import') || permission_exists('extension_export') ? "margin-left: 15px;" : null;
|
||||||
|
if (permission_exists('extension_add') && (!is_numeric($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
||||||
|
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'style'=>$margin_left,'link'=>'extension_edit.php']);
|
||||||
|
unset($margin_left);
|
||||||
|
}
|
||||||
|
if (permission_exists('extension_enabled') && $extensions) {
|
||||||
|
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'style'=>$margin_left,'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||||
|
unset($margin_left);
|
||||||
|
}
|
||||||
|
if (permission_exists('extension_delete') && $extensions) {
|
||||||
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'style'=>$margin_left,'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||||
|
unset($margin_left);
|
||||||
|
}
|
||||||
|
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||||
if (permission_exists('extension_all')) {
|
if (permission_exists('extension_all')) {
|
||||||
if ($_GET['show'] == 'all') {
|
if ($_GET['show'] == 'all') {
|
||||||
echo " <input type='hidden' name='show' value='all'>";
|
echo " <input type='hidden' name='show' value='all'>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='extensions.php?show=all';\">\n";
|
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (permission_exists('extension_import')) {
|
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
|
||||||
echo "<input type='button' class='btn' alt='".$text['button-import']."' onclick=\"window.location='extension_imports.php'\" value='".$text['button-import']."'>\n";
|
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'=>'extensions.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||||
if (permission_exists('extension_export')) {
|
|
||||||
echo " <input type='button' class='btn' value='".$text['button-export']."' onclick=\"window.location.href='extension_download.php'\">\n";
|
|
||||||
}
|
|
||||||
echo " <input type='text' class='txt' style='width: 150px; margin-left: 15px;' name='search' id='search' value='".escape($search)."'>";
|
|
||||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
|
||||||
if ($paging_controls_mini != '') {
|
if ($paging_controls_mini != '') {
|
||||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
|
||||||
echo " </form>\n";
|
echo " </form>\n";
|
||||||
echo " </tr>\n";
|
echo " </div>\n";
|
||||||
echo " <tr>\n";
|
echo " <div style='clear: both;'></div>\n";
|
||||||
echo " <td colspan='2'>\n";
|
echo "</div>\n";
|
||||||
echo " ".$text['description-extensions']."\n";
|
|
||||||
echo " </td>\n";
|
|
||||||
echo " </tr>\n";
|
|
||||||
echo "</table>\n";
|
|
||||||
echo "<br />";
|
|
||||||
|
|
||||||
echo "<form name='frm' method='post' action='extension_delete.php'>\n";
|
echo $text['description-extensions']."\n";
|
||||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
echo "<br /><br />\n";
|
||||||
echo "<tr>\n";
|
|
||||||
if (permission_exists('extension_delete') && is_array($extensions)) {
|
echo "<form id='form_list' method='post'>\n";
|
||||||
echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
|
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('extension_enabled') || permission_exists('extension_delete')) {
|
||||||
|
echo " <th class='checkbox'>\n";
|
||||||
|
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($extensions ?: "style='visibility: hidden;'").">\n";
|
||||||
|
echo " </th>\n";
|
||||||
}
|
}
|
||||||
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param);
|
echo "<th>".$text['label-domain']."</th>\n";
|
||||||
|
//echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||||
}
|
}
|
||||||
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
|
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
|
||||||
|
echo th_order_by('effective_caller_id_name', $text['label-effective_cid_name'], $order_by, $order, null, "class='hide-xs'");
|
||||||
|
echo th_order_by('outbound_caller_id_name', $text['label-outbound_cid_name'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||||
echo th_order_by('call_group', $text['label-call_group'], $order_by, $order);
|
echo th_order_by('call_group', $text['label-call_group'], $order_by, $order);
|
||||||
//echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order);
|
|
||||||
if (permission_exists("extension_user_context")) {
|
if (permission_exists("extension_user_context")) {
|
||||||
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
|
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
|
||||||
}
|
}
|
||||||
if (permission_exists('extension_registered')) {
|
if (permission_exists('extension_registered')) {
|
||||||
echo "<th>".$text['label-is_registered']."</th>\n";
|
echo "<th>".$text['label-is_registered']."</th>\n";
|
||||||
}
|
}
|
||||||
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
|
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);
|
echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||||
|
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||||
echo "<td class='list_control_icon'>\n";
|
echo " <td class='action-button'> </td>\n";
|
||||||
if (permission_exists('extension_add')) {
|
|
||||||
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
|
||||||
echo "<a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (permission_exists('extension_delete') && is_array($extensions)) {
|
|
||||||
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
|
||||||
}
|
|
||||||
echo "</td>\n";
|
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
||||||
|
$x = 0;
|
||||||
foreach($extensions as $row) {
|
foreach($extensions as $row) {
|
||||||
if (permission_exists('extension_edit')) {
|
if (permission_exists('extension_edit')) {
|
||||||
$tr_link = "href='extension_edit.php?id=".urlencode($row['extension_uuid']).(is_numeric($page) ? '&page='.$page : null)."'";
|
$list_row_url = "extension_edit.php?id=".urlencode($row['extension_uuid']).(is_numeric($page) ? '&page='.urlencode($page) : null);
|
||||||
}
|
}
|
||||||
echo "<tr ".$tr_link.">\n";
|
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||||
if (permission_exists('extension_delete')) {
|
if (permission_exists('extension_enabled') || permission_exists('extension_delete')) {
|
||||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
|
echo " <td class='checkbox'>\n";
|
||||||
echo " <input type='checkbox' name='id[]' id='checkbox_".escape($row['extension_uuid'])."' value='".escape($row['extension_uuid'])."' onclick=\"if (!this.checked) { document.getElementById('chk_all').checked = false; }\">";
|
echo " <input type='checkbox' name='extensions[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||||
echo " </td>";
|
echo " <input type='hidden' name='extensions[$x][uuid]' value='".escape($row['extension_uuid'])."' />\n";
|
||||||
$ext_ids[] = 'checkbox_'.$row['extension_uuid'];
|
echo " </td>\n";
|
||||||
}
|
}
|
||||||
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||||
}
|
}
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
echo " <td>";
|
||||||
if (permission_exists('extension_edit')) {
|
if (permission_exists('extension_edit')) {
|
||||||
echo "<a ".$tr_link.">".escape($row['extension'])."</a>";
|
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['extension'])."</a>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo escape($row['extension']);
|
echo escape($row['extension']);
|
||||||
}
|
}
|
||||||
echo "</td>\n";
|
echo " </td>\n";
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['call_group'])." </td>\n";
|
|
||||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_mail_to']." </td>\n";
|
echo " <td class='hide-xs'>".escape($row['effective_caller_id_name'])." </td>\n";
|
||||||
|
echo " <td class='hide-sm-dn'>".escape($row['outbound_caller_id_name'])." </td>\n";
|
||||||
|
echo " <td>".escape($row['call_group'])." </td>\n";
|
||||||
if (permission_exists("extension_user_context")) {
|
if (permission_exists("extension_user_context")) {
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['user_context'])."</td>\n";
|
echo " <td>".escape($row['user_context'])."</td>\n";
|
||||||
}
|
}
|
||||||
if (permission_exists('extension_registered')) {
|
if (permission_exists('extension_registered')) {
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
echo " <td>";
|
||||||
$extension_number = $row['extension'].'@'.$_SESSION['domain_name'];
|
$extension_number = $row['extension'].'@'.$_SESSION['domain_name'];
|
||||||
$extension_number_alias = $row['number_alias'];
|
$extension_number_alias = $row['number_alias'];
|
||||||
if(strlen($extension_number_alias) > 0) {
|
if(strlen($extension_number_alias) > 0) {
|
||||||
|
|
@ -229,87 +282,60 @@
|
||||||
$found_count = 0;
|
$found_count = 0;
|
||||||
if (is_array($registrations)) {
|
if (is_array($registrations)) {
|
||||||
foreach ($registrations as $array) {
|
foreach ($registrations as $array) {
|
||||||
if (
|
if ($extension_number == $array['user'] || ($extension_number_alias != '' && $extension_number_alias == $array['user'])) {
|
||||||
($extension_number == $array['user']) ||
|
|
||||||
($extension_number_alias != '' &&
|
|
||||||
$extension_number_alias == $array['user']
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
$found_count++;
|
$found_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($found_count > 0) {
|
if ($found_count > 0) {
|
||||||
echo "Yes ($found_count)";
|
echo $text['label-true']." (".$found_count.")";
|
||||||
} else {
|
}
|
||||||
echo "No";
|
else {
|
||||||
|
echo $text['label-false'];
|
||||||
}
|
}
|
||||||
unset($extension_number, $extension_number_alias, $found_count, $array);
|
unset($extension_number, $extension_number_alias, $found_count, $array);
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
}
|
}
|
||||||
|
if (permission_exists('extension_enabled')) {
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>".($row['enabled'] == 'true' ? $text['label-true'] : $text['label-false'])."</td>\n";
|
echo " <td class='no-link center'>";
|
||||||
echo " <td valign='top' class='row_stylebg' width='30%'>".escape($row['description'])." </td>\n";
|
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')"]);
|
||||||
|
|
||||||
echo " <td class='list_control_icons'>";
|
|
||||||
if (permission_exists('extension_edit')) {
|
|
||||||
echo "<a ".$tr_link." alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
|
||||||
}
|
}
|
||||||
if (permission_exists('extension_delete')) {
|
else {
|
||||||
echo "<a href='extension_delete.php?id[]=".escape($row['extension_uuid']).(is_numeric($page) ? '&page='.$page : null)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
echo " <td class='center'>";
|
||||||
}
|
echo $text['label-'.$row['enabled']];
|
||||||
echo "</td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
$c = ($c) ? 0 : 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo " <td colspan='20' class='list_control_icons'>\n";
|
|
||||||
if (permission_exists('extension_add')) {
|
|
||||||
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
|
||||||
echo "<a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (permission_exists('extension_delete')) {
|
|
||||||
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
|
echo " <td class='description overflow hide-sm-dn'>".escape($row['description'])."</td>\n";
|
||||||
|
if (permission_exists('extension_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";
|
echo "</tr>\n";
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($extensions, $row);
|
echo "</table>\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||||
|
|
||||||
echo "</table>";
|
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||||
echo "</form>";
|
|
||||||
|
|
||||||
if (strlen($paging_controls) > 0) {
|
echo "</form>\n";
|
||||||
echo "<br />";
|
|
||||||
echo $paging_controls."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<br /><br />".((is_array($extensions)) ? "<br /><br />" : null);
|
//define keyboard shortcuts
|
||||||
|
if ($extensions) {
|
||||||
// check or uncheck all checkboxes
|
// check all
|
||||||
if (is_array($ext_ids) && @sizeof($ext_ids) != 0) {
|
key_press('ctrl+a', 'down', 'document', null, null, "list_all_check();", true);
|
||||||
echo "<script>\n";
|
|
||||||
echo " function check(what) {\n";
|
|
||||||
echo " document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
|
|
||||||
foreach ($ext_ids as $ext_id) {
|
|
||||||
echo " document.getElementById('".$ext_id."').checked = (what == 'all') ? true : false;\n";
|
|
||||||
}
|
|
||||||
echo " }\n";
|
|
||||||
echo "</script>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($extensions)) {
|
|
||||||
// check all checkboxes
|
|
||||||
key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
|
|
||||||
|
|
||||||
// delete checked
|
// delete checked
|
||||||
key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
|
if (permission_exists('extension_delete')) {
|
||||||
|
key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], "list_action_set('delete'); list_form_submit('form_list');", true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($extensions);
|
||||||
|
|
||||||
//show the footer
|
//show the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Copyright (C) 2010 - 2016
|
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||||
All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
|
@ -27,9 +27,12 @@
|
||||||
//define the directory class
|
//define the directory class
|
||||||
if (!class_exists('extension')) {
|
if (!class_exists('extension')) {
|
||||||
class extension {
|
class extension {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* declare public variables
|
||||||
|
*/
|
||||||
public $domain_uuid;
|
public $domain_uuid;
|
||||||
public $domain_name;
|
public $domain_name;
|
||||||
private $app_uuid;
|
|
||||||
public $extension_uuid;
|
public $extension_uuid;
|
||||||
public $extension;
|
public $extension;
|
||||||
public $voicemail_id;
|
public $voicemail_id;
|
||||||
|
|
@ -70,11 +73,39 @@ if (!class_exists('extension')) {
|
||||||
public $enabled;
|
public $enabled;
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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() {
|
public function __construct() {
|
||||||
//set the application id
|
|
||||||
|
//assign private variables
|
||||||
|
$this->app_name = 'extensions';
|
||||||
$this->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
$this->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||||
|
$this->permission_prefix = 'extension_';
|
||||||
|
$this->list_page = 'extensions.php';
|
||||||
|
$this->table = 'extensions';
|
||||||
|
$this->uuid_prefix = 'extension_';
|
||||||
|
$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() {
|
public function __destruct() {
|
||||||
foreach ($this as $key => $value) {
|
foreach ($this as $key => $value) {
|
||||||
unset($this->$key);
|
unset($this->$key);
|
||||||
|
|
@ -512,6 +543,221 @@ if (!class_exists('extension')) {
|
||||||
$_SESSION["reload_xml"] = true;
|
$_SESSION["reload_xml"] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
|
||||||
|
//build the delete array
|
||||||
|
$y = @sizeof($records) + 1;
|
||||||
|
foreach ($records as $x => $record) {
|
||||||
|
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||||
|
|
||||||
|
//get the extension details
|
||||||
|
$sql = "select extension, number_alias, user_context, follow_me_uuid from v_extensions ";
|
||||||
|
$sql .= "where domain_uuid = :domain_uuid ";
|
||||||
|
$sql .= "and extension_uuid = :extension_uuid ";
|
||||||
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
|
$parameters['extension_uuid'] = $record['uuid'];
|
||||||
|
$database = new database;
|
||||||
|
$row = $database->execute($sql, $parameters, 'row');
|
||||||
|
if (is_array($row) && @sizeof($row) != 0) {
|
||||||
|
|
||||||
|
//for use below and to clear cache (bottom)
|
||||||
|
$extensions[$x] = $row;
|
||||||
|
|
||||||
|
//build delete array
|
||||||
|
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||||
|
$array['extension_users'][$x]['extension_uuid'] = $record['uuid'];
|
||||||
|
$array['follow_me'][$x]['follow_me_uuid'] = $extensions[$x]['follow_me_uuid'];
|
||||||
|
$array['follow_me_destinations'][$x]['follow_me_uuid'] = $extensions[$x]['follow_me_uuid'];
|
||||||
|
|
||||||
|
//include ring group destinations, if exists
|
||||||
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ring_groups/app_config.php")) {
|
||||||
|
$array['ring_group_destinations'][$x]['destination_number'] = $extensions[$x]['extension'];
|
||||||
|
$array['ring_group_destinations'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
|
if ($extensions[$x]['number_alias'] != '') {
|
||||||
|
$array['ring_group_destinations'][$y]['destination_number'] = $extensions[$x]['number_alias'];
|
||||||
|
$array['ring_group_destinations'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
|
}
|
||||||
|
$y++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
unset($sql, $parameters, $row);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete the checked rows
|
||||||
|
if (is_array($array) && @sizeof($array) != 0) {
|
||||||
|
|
||||||
|
//grant temporary permissions
|
||||||
|
$p = new permissions;
|
||||||
|
$p->add('extension_user_delete', 'temp');
|
||||||
|
$p->add('follow_me_delete', 'temp');
|
||||||
|
$p->add('follow_me_destination_delete', 'temp');
|
||||||
|
$p->add('ring_group_destination_delete', 'temp');
|
||||||
|
|
||||||
|
//execute delete
|
||||||
|
$database = new database;
|
||||||
|
$database->app_name = $this->app_name;
|
||||||
|
$database->app_uuid = $this->app_uuid;
|
||||||
|
$database->delete($array);
|
||||||
|
unset($array);
|
||||||
|
|
||||||
|
//revoke temporary permissions
|
||||||
|
$p->delete('extension_user_delete', 'temp');
|
||||||
|
$p->delete('follow_me_delete', 'temp');
|
||||||
|
$p->delete('follow_me_destination_delete', 'temp');
|
||||||
|
$p->delete('ring_group_destination_delete', 'temp');
|
||||||
|
|
||||||
|
//clear the cache
|
||||||
|
foreach ($extensions as $x => $extension) {
|
||||||
|
$cache = new cache;
|
||||||
|
$cache->delete("directory:".$extension['extension']."@".$extension['user_context']);
|
||||||
|
if (permission_exists('number_alias') && strlen($extension['number_alias']) > 0) {
|
||||||
|
$cache->delete("directory:".$extension['number_alias']."@".$extension['user_context']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($extensions);
|
||||||
|
|
||||||
|
//synchronize configuration
|
||||||
|
if (is_writable($_SESSION['switch']['extensions']['dir'])) {
|
||||||
|
$this->xml();
|
||||||
|
}
|
||||||
|
|
||||||
|
//set message
|
||||||
|
message::add($text['message-delete']);
|
||||||
|
|
||||||
|
}
|
||||||
|
unset($records);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* toggle records
|
||||||
|
*/
|
||||||
|
public function toggle($records) {
|
||||||
|
if (permission_exists($this->permission_prefix.'enabled')) {
|
||||||
|
|
||||||
|
//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 $x => $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 toggle, extension, number_alias, user_context from v_".$this->table." ";
|
||||||
|
$sql .= "where domain_uuid = :domain_uuid ";
|
||||||
|
$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) {
|
||||||
|
//for use below and to clear cache (bottom)
|
||||||
|
$extensions[$row['uuid']]['state'] = $row['toggle'];
|
||||||
|
$extensions[$row['uuid']]['extension'] = $row['extension'];
|
||||||
|
$extensions[$row['uuid']]['number_alias'] = $row['number_alias'];
|
||||||
|
$extensions[$row['uuid']]['user_context'] = $row['user_context'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($sql, $parameters, $rows, $row);
|
||||||
|
}
|
||||||
|
|
||||||
|
//build update array
|
||||||
|
$x = 0;
|
||||||
|
foreach($extensions as $uuid => $extension) {
|
||||||
|
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
||||||
|
$array[$this->table][$x][$this->toggle_field] = $extension['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//save the changes
|
||||||
|
if (is_array($array) && @sizeof($array) != 0) {
|
||||||
|
|
||||||
|
//grant temporary permissions
|
||||||
|
$p = new permissions;
|
||||||
|
$p->add('extension_edit', 'temp');
|
||||||
|
|
||||||
|
//save the array
|
||||||
|
$database = new database;
|
||||||
|
$database->app_name = $this->app_name;
|
||||||
|
$database->app_uuid = $this->app_uuid;
|
||||||
|
$database->save($array);
|
||||||
|
unset($array);
|
||||||
|
|
||||||
|
//revoke temporary permissions
|
||||||
|
$p->delete('extension_edit', 'temp');
|
||||||
|
|
||||||
|
//synchronize configuration
|
||||||
|
if (is_writable($_SESSION['switch']['extensions']['dir'])) {
|
||||||
|
$this->xml();
|
||||||
|
}
|
||||||
|
|
||||||
|
//write the provision files
|
||||||
|
if (strlen($_SESSION['provision']['path']['text']) > 0) {
|
||||||
|
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) {
|
||||||
|
$prov = new provision;
|
||||||
|
$prov->domain_uuid = $_SESSION['domain_uuid'];
|
||||||
|
$response = $prov->write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//clear the cache
|
||||||
|
foreach ($extensions as $uuid => $extension) {
|
||||||
|
$cache = new cache;
|
||||||
|
$cache->delete("directory:".$extension['extension']."@".$extension['user_context']);
|
||||||
|
if (permission_exists('number_alias') && strlen($extension['number_alias']) > 0) {
|
||||||
|
$cache->delete("directory:".$extension['number_alias']."@".$extension['user_context']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($extensions);
|
||||||
|
|
||||||
|
//set message
|
||||||
|
message::add($text['message-toggle']);
|
||||||
|
|
||||||
|
}
|
||||||
|
unset($records);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -429,6 +429,16 @@ echo "<script language='JavaScript' type='text/javascript' src='<!--{project_pat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function list_all_check() {
|
||||||
|
var inputs = document.getElementsByTagName('input');
|
||||||
|
document.getElementById('checkbox_all').checked;
|
||||||
|
for (var i = 0, max = inputs.length; i < max; i++) {
|
||||||
|
if (inputs[i].type === 'checkbox') {
|
||||||
|
inputs[i].checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function list_self_check(checkbox_id) {
|
function list_self_check(checkbox_id) {
|
||||||
var inputs = document.getElementsByTagName('input');
|
var inputs = document.getElementsByTagName('input');
|
||||||
for (var i = 0, max = inputs.length; i < max; i++) {
|
for (var i = 0, max = inputs.length; i < max; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue