Fax Server: List view updates.
This commit is contained in:
parent
6128284a0f
commit
ec3e73a9ab
|
|
@ -3381,46 +3381,6 @@ $text['confirm-ext']['ru-ru'] = "Пожалуйста, укажите: Номе
|
|||
$text['confirm-ext']['sv-se'] = "Por favor indique: Extensión ";
|
||||
$text['confirm-ext']['uk-ua'] = "";
|
||||
|
||||
$text['confirm-copy-info']['en-us'] = "Do you really want to copy this?";
|
||||
$text['confirm-copy-info']['ar-eg'] = "";
|
||||
$text['confirm-copy-info']['de-at'] = "Wollen Sie das wirklich kopieren?"; //copied from de-de
|
||||
$text['confirm-copy-info']['de-ch'] = "Wollen Sie das wirklich kopieren?"; //copied from de-de
|
||||
$text['confirm-copy-info']['de-de'] = "Wollen Sie das wirklich kopieren?";
|
||||
$text['confirm-copy-info']['es-cl'] = "¿Desea realmente copiar esto?";
|
||||
$text['confirm-copy-info']['es-mx'] = "¿Desea realmente copiar esto?"; //copied from es-cl
|
||||
$text['confirm-copy-info']['fr-ca'] = "Voulez-vous vraiment copier cela?"; //copied from fr-fr
|
||||
$text['confirm-copy-info']['fr-fr'] = "Voulez-vous vraiment copier cela?";
|
||||
$text['confirm-copy-info']['he-il'] = "";
|
||||
$text['confirm-copy-info']['it-it'] = "Vuoi veramente copiarlo?";
|
||||
$text['confirm-copy-info']['nl-nl'] = "";
|
||||
$text['confirm-copy-info']['pl-pl'] = "Podgląd ";
|
||||
$text['confirm-copy-info']['pt-br'] = " Você realmente deseja copiar isso?";
|
||||
$text['confirm-copy-info']['pt-pt'] = "Deseja realmente copiar isto?";
|
||||
$text['confirm-copy-info']['ro-ro'] = "";
|
||||
$text['confirm-copy-info']['ru-ru'] = "Вы действительно хотите скопировать это?";
|
||||
$text['confirm-copy-info']['sv-se'] = "Vill du verkligen kopiera detta?";
|
||||
$text['confirm-copy-info']['uk-ua'] = "";
|
||||
|
||||
$text['confirm-copy']['en-us'] = "Copy complete";
|
||||
$text['confirm-copy']['ar-eg'] = "";
|
||||
$text['confirm-copy']['de-at'] = "Erfolgreich kopiert"; //copied from de-de
|
||||
$text['confirm-copy']['de-ch'] = "Erfolgreich kopiert"; //copied from de-de
|
||||
$text['confirm-copy']['de-de'] = "Erfolgreich kopiert";
|
||||
$text['confirm-copy']['es-cl'] = "Copia Completada";
|
||||
$text['confirm-copy']['es-mx'] = "Copia Completada"; //copied from es-cl
|
||||
$text['confirm-copy']['fr-ca'] = "Copié"; //copied from fr-fr
|
||||
$text['confirm-copy']['fr-fr'] = "Copié";
|
||||
$text['confirm-copy']['he-il'] = "העתקה הושלמה";
|
||||
$text['confirm-copy']['it-it'] = "Copia Completata";
|
||||
$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?";
|
||||
$text['confirm-copy']['pt-pt'] = "Cópia Efectuada";
|
||||
$text['confirm-copy']['ro-ro'] = "";
|
||||
$text['confirm-copy']['ru-ru'] = "Копирование завершено";
|
||||
$text['confirm-copy']['sv-se'] = "Kopiering Slutförd";
|
||||
$text['confirm-copy']['uk-ua'] = "";
|
||||
|
||||
$text['confirm-add']['en-us'] = "Add complete";
|
||||
$text['confirm-add']['ar-eg'] = "";
|
||||
$text['confirm-add']['de-at'] = "Erfolgreich hinzugefügt"; //copied from de-de
|
||||
|
|
|
|||
262
app/fax/fax.php
262
app/fax/fax.php
|
|
@ -28,6 +28,7 @@
|
|||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('fax_extension_view')) {
|
||||
|
|
@ -38,23 +39,67 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the http get values and set them as php variables
|
||||
//get posted data
|
||||
if (is_array($_POST['fax_servers'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$fax_servers = $_POST['fax_servers'];
|
||||
}
|
||||
|
||||
//copy the fax servers
|
||||
if (permission_exists('fax_extension_copy')) {
|
||||
if ($action == 'copy' && is_array($fax_servers) && @sizeof($fax_servers) != 0) {
|
||||
//copy
|
||||
$obj = new fax;
|
||||
$obj->copy($fax_servers);
|
||||
//redirect
|
||||
header('Location: fax.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//delete the fax servers
|
||||
if (permission_exists('fax_extension_delete')) {
|
||||
if ($action == 'delete' && is_array($fax_servers) && @sizeof($fax_servers) != 0) {
|
||||
//delete
|
||||
$obj = new fax;
|
||||
$obj->delete($fax_servers);
|
||||
//redirect
|
||||
header('Location: fax.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//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(fax_name) like :search ";
|
||||
$sql_search .= "or lower(fax_email) like :search ";
|
||||
$sql_search .= "or lower(fax_extension) like :search ";
|
||||
$sql_search .= "or lower(fax_destination_number) like :search ";
|
||||
$sql_search .= "or lower(fax_caller_id_name) like :search ";
|
||||
$sql_search .= "or lower(fax_caller_id_number) like :search ";
|
||||
$sql_search .= "or lower(fax_forward_number) like :search ";
|
||||
$sql_search .= "or lower(fax_description) like :search ";
|
||||
$sql_search .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
|
||||
//get record counts
|
||||
if (if_group("superadmin") || if_group("admin")) {
|
||||
//show all fax extensions
|
||||
$sql = "select count(*) from v_fax as f ";
|
||||
$sql .= "where f.domain_uuid = :domain_uuid ";
|
||||
$sql .= $sql_search;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
else {
|
||||
|
|
@ -63,6 +108,7 @@
|
|||
$sql .= "where f.fax_uuid = u.fax_uuid ";
|
||||
$sql .= "and f.domain_uuid = :domain_uuid ";
|
||||
$sql .= "and u.user_uuid = :user_uuid ";
|
||||
$sql .= $sql_search;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['user_uuid'] = $_SESSION['user_uuid'];
|
||||
}
|
||||
|
|
@ -71,10 +117,10 @@
|
|||
|
||||
//prepare paging
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$param = "";
|
||||
$page = check_str($_GET['page']);
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$param = "&search=".$search;
|
||||
$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 * $page;
|
||||
|
||||
//get records
|
||||
|
|
@ -85,115 +131,131 @@
|
|||
$result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"title\">".$text['title-fax']." (".$num_rows.")</span>";
|
||||
echo " <br /><br />\n";
|
||||
echo " ".$text['description']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-fax']." (".$num_rows.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('fax_extension_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'fax_edit.php']);
|
||||
}
|
||||
if (permission_exists('fax_extension_add') && $result) {
|
||||
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('fax_extension_delete') && $result) {
|
||||
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";
|
||||
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'=>'fax.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";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
echo $text['description']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\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('fax_extension_add') || permission_exists('fax_extension_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($result ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo th_order_by('fax_name', $text['label-name'], $order_by, $order);
|
||||
echo th_order_by('fax_extension', $text['label-extension'], $order_by, $order);
|
||||
echo th_order_by('fax_email', $text['label-email'], $order_by, $order);
|
||||
echo "<th>".$text['label-tools']."</th>";
|
||||
echo th_order_by('fax_description', $text['label-description'], $order_by, $order);
|
||||
echo "<td class='list_control_icons'>\n";
|
||||
if (permission_exists('fax_extension_add')) {
|
||||
echo " <a href='fax_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " <th>".$text['label-tools']."</th>";
|
||||
echo th_order_by('fax_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||
if (permission_exists('fax_extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
foreach($result as $row) {
|
||||
//remove the backslash
|
||||
$fax_email = str_replace("\\", "", $row['fax_email']);
|
||||
$fax_email = substr($fax_email, 0, 50);
|
||||
//show the fax extensions
|
||||
$tr_link = (permission_exists('fax_extension_edit')) ? "href='fax_edit.php?id=".urlencode($row['fax_uuid'])."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if (permission_exists('fax_extension_edit')) {
|
||||
echo "<a href='fax_edit.php?id=".urlencode($row['fax_uuid'])."'>".escape($row['fax_name'])."</a>";
|
||||
$x = 0;
|
||||
foreach ($result as $row) {
|
||||
if (permission_exists('fax_extension_edit')) {
|
||||
$list_row_url = "fax_edit.php?id=".urlencode($row['fax_uuid']);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('fax_extension_add') || permission_exists('fax_extension_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='fax_servers[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='fax_servers[$x][uuid]' value='".escape($row['fax_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td>";
|
||||
if (permission_exists('fax_extension_edit')) {
|
||||
echo "<a href='".$list_row_url."'>".escape($row['fax_name'])."</a>";
|
||||
}
|
||||
else {
|
||||
echo escape($row['fax_name']);
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td>".escape($row['fax_extension'])."</td>\n";
|
||||
echo " <td class='overflow' style='min-width: 25%;'>".escape(str_replace("\\",'', $row['fax_email']))." </td>\n";
|
||||
echo " <td class='no-link no-wrap'>";
|
||||
if (permission_exists('fax_send')) {
|
||||
echo " <a href='fax_send.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-new']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_inbox_view')) {
|
||||
if ($row['fax_email_inbound_subject_tag'] != '') {
|
||||
$file = "fax_files_remote.php";
|
||||
$box = escape($row['fax_email_connection_mailbox']);
|
||||
}
|
||||
else {
|
||||
echo escape($row['fax_name']);
|
||||
$file = "fax_files.php";
|
||||
$box = 'inbox';
|
||||
}
|
||||
echo " <a href='".$file."?order_by=fax_date&order=desc&id=".urlencode($row['fax_uuid'])."&box=".$box."'>".$text['label-inbox']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_sent_view')) {
|
||||
echo " <a href='fax_files.php?order_by=fax_date&order=desc&id=".urlencode($row['fax_uuid'])."&box=sent'>".$text['label-sent']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_log_view')) {
|
||||
echo " <a href='fax_logs.php?order_by=fax_epoch&order=desc&id=".urlencode($row['fax_uuid'])."'>".$text['label-log']."</a>";
|
||||
}
|
||||
if (permission_exists('fax_active_view') && isset($_SESSION['fax']['send_mode']['text']) && $_SESSION['fax']['send_mode']['text'] == 'queue') {
|
||||
echo " <a href='fax_active.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-active']."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['fax_description'])." </td>\n";
|
||||
if (permission_exists('fax_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 " <td valign='top' class='".$row_style[$c]."'>".escape($row['fax_extension'])."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($fax_email)." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'>";
|
||||
if (permission_exists('fax_send')) {
|
||||
echo " <a href='fax_send.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-new']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_inbox_view')) {
|
||||
if ($row['fax_email_inbound_subject_tag'] != '') {
|
||||
$file = "fax_files_remote.php";
|
||||
$box = escape($row['fax_email_connection_mailbox']);
|
||||
}
|
||||
else {
|
||||
$file = "fax_files.php";
|
||||
$box = 'inbox';
|
||||
}
|
||||
echo " <a href='".$file."?order_by=fax_date&order=desc&id=".urlencode($row['fax_uuid'])."&box=".$box."'>".$text['label-inbox']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_sent_view')) {
|
||||
echo " <a href='fax_files.php?order_by=fax_date&order=desc&id=".urlencode($row['fax_uuid'])."&box=sent'>".$text['label-sent']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_log_view')) {
|
||||
//echo " <a href='fax_logs.php?"."order_by=fax_epoch&order=asc&id=".escape($row['fax_uuid'])."'>".$text['label-log']."</a>";
|
||||
echo " <a href='fax_logs.php?order_by=fax_epoch&order=desc&id=".urlencode($row['fax_uuid'])."'>".$text['label-log']."</a>";
|
||||
}
|
||||
if (permission_exists('fax_active_view') && isset($_SESSION['fax']['send_mode']['text']) && $_SESSION['fax']['send_mode']['text'] == 'queue') {
|
||||
echo " <a href='fax_active.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-active']."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg' width='35%'>".escape($row['fax_description'])." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('fax_extension_edit')) {
|
||||
echo "<a href='fax_edit.php?id=".urlencode($row['fax_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('fax_extension_delete')) {
|
||||
echo "<a href='fax_delete.php?id=".urlencode($row['fax_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
//alternate the CSS class
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
}
|
||||
unset($result);
|
||||
}
|
||||
unset($result, $row);
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('fax_extension_add')) {
|
||||
echo "<a href='fax_edit.php' alt='add'>$v_link_label_add</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
|
||||
//show the footer
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@
|
|||
$p->delete('fax_add', 'temp');
|
||||
|
||||
//set message
|
||||
message::add($text['confirm-copy']);
|
||||
message::add($text['message-copy']);
|
||||
}
|
||||
|
||||
//redirect
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@
|
|||
echo " <td width='70%' valign='top' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt=\"".$text['button-back']."\" onclick=\"window.location='fax.php'\" value=\"".$text['button-back']."\">\n";
|
||||
if (permission_exists('fax_extension_copy') && $action == "update") {
|
||||
echo " <input type='button' class='btn' alt=\"".$text['button-copy']."\" onclick=\"if (confirm('".$text['confirm-copy-info']."')){window.location='fax_copy.php?id=".urlencode($fax_uuid)."';}\" value=\"".$text['button-copy']."\">\n";
|
||||
echo " <input type='button' class='btn' alt=\"".$text['button-copy']."\" onclick=\"if (confirm('".$text['confirm-copy']."')){window.location='fax_copy.php?id=".urlencode($fax_uuid)."';}\" value=\"".$text['button-copy']."\">\n";
|
||||
}
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
|
|
|
|||
|
|
@ -45,11 +45,31 @@
|
|||
public $destination_number;
|
||||
private $forward_prefix;
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
//place holder
|
||||
|
||||
//assign private variables
|
||||
$this->app_name = 'fax';
|
||||
$this->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
|
||||
$this->permission_prefix = 'fax_extension_';
|
||||
$this->list_page = 'fax.php';
|
||||
$this->table = 'fax';
|
||||
$this->uuid_prefix = 'fax_';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -191,7 +211,209 @@
|
|||
return $dialplan_response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
|
||||
//primary record
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['fax_users'][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array['fax_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
||||
//include the dialplan record
|
||||
$sql = "select dialplan_uuid from v_fax ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and fax_uuid = :fax_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['fax_uuid'] = $record['uuid'];
|
||||
$database = new database;
|
||||
$dialplan_uuid = $database->select($sql, $parameters, 'column');
|
||||
if (is_uuid($dialplan_uuid)) {
|
||||
// dialplan entry
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
||||
//dialplan details
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
unset($sql, $parameters);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('fax_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_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('fax_delete', 'temp');
|
||||
$p->delete('dialplan_delete', 'temp');
|
||||
$p->delete('dialplan_detail_delete', 'temp');
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* copy records
|
||||
*/
|
||||
public function copy($records) {
|
||||
if (permission_exists($this->permission_prefix.'copy')) {
|
||||
|
||||
//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 $x => $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 or domain_uuid is 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) {
|
||||
$y = 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]['dialplan_uuid'] = uuid();
|
||||
if ($row['fax_forward_number'] == '') {
|
||||
unset($array[$this->table][$x]['fax_forward_number']);
|
||||
}
|
||||
$array[$this->table][$x]['fax_description'] = trim($row['fax_description'].' ('.$text['label-copy'].')');
|
||||
|
||||
//fax users sub table
|
||||
$sql_2 = "select e.* from v_fax_users as e, v_users as u ";
|
||||
$sql_2 .= "where e.user_uuid = u.user_uuid ";
|
||||
$sql_2 .= "and e.domain_uuid = :domain_uuid ";
|
||||
$sql_2 .= "and e.fax_uuid = :fax_uuid ";
|
||||
$parameters_2['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters_2['fax_uuid'] = $row['fax_uuid'];
|
||||
$database = new database;
|
||||
$rows_2 = $database->select($sql_2, $parameters_2, 'all');
|
||||
if (is_array($rows_2) && @sizeof($rows_2) != 0) {
|
||||
foreach ($rows_2 as $row_2) {
|
||||
|
||||
//copy data
|
||||
$array['fax_users'][$y] = $row_2;
|
||||
|
||||
//overwrite
|
||||
$array['fax_users'][$y]['fax_user_uuid'] = uuid();
|
||||
$array['fax_users'][$y]['fax_uuid'] = $primary_uuid;
|
||||
|
||||
//increment
|
||||
$y++;
|
||||
|
||||
}
|
||||
}
|
||||
unset($sql_2, $parameters_2, $rows_2, $row_2);
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//save the changes and set the message
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('fax_add', '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('fax_add', 'temp');
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
|
||||
}
|
||||
} //method
|
||||
|
||||
} //class
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue