diff --git a/app/call_block/app_languages.php b/app/call_block/app_languages.php index bbfa0c7f5f..0a402f5d45 100644 --- a/app/call_block/app_languages.php +++ b/app/call_block/app_languages.php @@ -107,6 +107,11 @@ $text['label-edit-add']['pt-pt'] = "Adicionar Bloqueio de Chamadas"; $text['label-edit-add']['fr-fr'] = "Ajouter bloquage d'appel"; + $text['label-edit-add-recent']['en-us'] = "Recent Calls"; + $text['label-edit-add-recent']['es-cl'] = "Llamadas Recientes"; + $text['label-edit-add-recent']['pt-pt'] = "Chamadas Recentes"; + $text['label-edit-add-recent']['fr-fr'] = "Appels Récents"; + $text['label-edit-edit']['en-us'] = "Call Block Edit"; $text['label-edit-edit']['es-cl'] = "Editar bloqueo de llamada"; $text['label-edit-edit']['pt-pt'] = "Editar Bloqueio de Chamadas"; diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index 17c3dd0b5a..18e63276fb 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -89,9 +89,9 @@ else { $rows_per_page = 10; $param = ""; $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; + if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } + list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $offset = $rows_per_page * $page; //get the list $sql = " select * from v_call_block "; @@ -142,7 +142,7 @@ else { echo " $v_link_label_edit\n"; } if (permission_exists('call_block_delete')) { - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\n"; }; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } diff --git a/app/call_block/call_block_cdr_add.php b/app/call_block/call_block_cdr_add.php index a2df79186b..542af60f74 100644 --- a/app/call_block/call_block_cdr_add.php +++ b/app/call_block/call_block_cdr_add.php @@ -87,12 +87,7 @@ else { $db->exec(check_sql($sql)); unset($sql); - require_once "resources/header.php"; - echo "\n"; - echo "
\n"; - echo $text['label-add-complete']."\n"; - echo "
\n"; - require_once "resources/footer.php"; - return; +$_SESSION["message"] = $text['label-add-complete']; +header("Location: call_block.php"); ?> \ No newline at end of file diff --git a/app/call_block/call_block_delete.php b/app/call_block/call_block_delete.php index da2ccc2c82..921cce810e 100644 --- a/app/call_block/call_block_delete.php +++ b/app/call_block/call_block_delete.php @@ -57,22 +57,9 @@ else { unset($prep_statement, $sql); } -//redirect the user - require_once "resources/header.php"; - echo "\n"; - echo "
\n"; - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
".$text['label-message']."
".$text['label-delete-complete']."
\n"; - echo "
\n"; - echo "
\n"; - require_once "resources/footer.php"; + + $_SESSION["message"] = $text['label-delete-complete']; + header("Location: call_block.php"); return; ?> \ No newline at end of file diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index 1b9192a3e5..241cd9f99a 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -91,10 +91,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { //$call_block_uuid = check_str($_POST["call_block_uuid"]); } - + //check for all required data if (strlen($call_block_name) == 0) { $msg .= $text['label-provide-name']."
\n"; } - if ($action == "add") { + if ($action == "add") { if (strlen($call_block_number) == 0) { $msg .= $text['label-provide-number']."
\n"; } } if (strlen($call_block_enabled) == 0) { $msg .= $text['label-provide-enabled']."
\n"; } @@ -139,12 +139,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); unset($sql); - require_once "resources/header.php"; - echo "\n"; - echo "
\n"; - echo $text['label-add-complete']."\n"; - echo "
\n"; - require_once "resources/footer.php"; + $_SESSION["message"] = $text['label-add-complete']; + header("Location: call_block.php"); return; } //if ($action == "add") @@ -159,15 +155,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); unset($sql); - require_once "resources/header.php"; - echo "\n"; - echo "
\n"; - echo $text['label-update-complete']."\n"; - echo "
\n"; - require_once "resources/footer.php"; + $_SESSION["message"] = $text['label-update-complete']; + header("Location: call_block.php"); return; } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") + } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form @@ -197,63 +189,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
"; // Show last 5-10 calls first, with add button -//get the results from the db - $sql = "select caller_id_number, caller_id_name, start_epoch, uuid from v_xml_cdr "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and direction != 'outbound' "; - $sql .= "order by start_stamp DESC "; - $sql .= "limit 20 "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(); - $result_count = count($result); - unset ($prep_statement); - - echo "\n"; - echo "\n"; - echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order); - echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order); - echo th_order_by('start_stamp', $text['label-called-on'], $order_by, $order); - - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - - if ($result_count > 0) { - foreach($result as $row) { - if (strlen($row['caller_id_number']) >= 7) { - if (defined('TIME_24HR') && TIME_24HR == 1) { - $tmp_start_epoch = date("j M Y H:i:s", $row['start_epoch']); - } else { - $tmp_start_epoch = date("j M Y h:i:sa", $row['start_epoch']); - } - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if ($c==0) { $c=1; } else { $c=0; } - } - } //end foreach - unset($sql, $result, $row_count); - } //end if results - - echo "\n"; - echo "\n"; - echo "
"; - echo $row['caller_id_name'].' '; - echo " "; - if (is_numeric($row['caller_id_number'])) { - echo format_phone($row['caller_id_number']).' '; - } - else { - echo $row['caller_id_number'].' '; - } - echo " ".$tmp_start_epoch."\n"; - echo " $v_link_label_add\n"; - echo "
"; - // end of Display Last 5-10 Calls - echo "\n"; echo "\n"; echo " "; echo " "; echo "
\n"; @@ -343,11 +278,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "
"; - echo "
"; + echo "

"; + + +//get recent calls from the db (if not editing an existing call block record) + if (!isset($_REQUEST["id"])) { + $sql = "select caller_id_number, caller_id_name, start_epoch, uuid from v_xml_cdr "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and direction != 'outbound' "; + $sql .= "order by start_stamp DESC "; + $sql .= "limit 20 "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(); + $result_count = count($result); + unset ($prep_statement); + + echo "".$text['label-edit-add-recent'].""; + echo "

"; + echo "\n"; + echo "\n"; + echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order); + echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order); + echo th_order_by('start_stamp', $text['label-called-on'], $order_by, $order); + + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + + if ($result_count > 0) { + foreach($result as $row) { + if (strlen($row['caller_id_number']) >= 7) { + if (defined('TIME_24HR') && TIME_24HR == 1) { + $tmp_start_epoch = date("j M Y H:i:s", $row['start_epoch']); + } else { + $tmp_start_epoch = date("j M Y h:i:sa", $row['start_epoch']); + } + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($c==0) { $c=1; } else { $c=0; } + } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "
"; + echo $row['caller_id_name'].' '; + echo " "; + if (is_numeric($row['caller_id_number'])) { + echo format_phone($row['caller_id_number']).' '; + } + else { + echo $row['caller_id_number'].' '; + } + echo " ".$tmp_start_epoch."\n"; + echo " $v_link_label_add\n"; + echo "
"; + } +// end of Display Last 5-10 Calls + //include the footer require_once "resources/footer.php"; diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index c43b1cd0a5..e8ab582bf0 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -37,7 +37,7 @@ else { //add multi-lingual support foreach($text as $key => $value) { - $text[$key] = $value[$_SESSION['domain']['language']['code']]; + $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //define the destination_select function @@ -348,12 +348,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //redirect the user - require_once "resources/header.php"; - echo "\n"; - echo "
\n"; - echo "".$text['confirm-update']."
\n"; - echo "
\n"; - require_once "resources/footer.php"; + $_SESSION["message"] = $text['confirm-update']; + header("Location: ".PROJECT_PATH."/core/user_settings/user_dashboard.php"); return; } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) @@ -560,9 +556,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; - echo " ".$text['label-ring-delay']."\n"; + echo " ".$text['label-ring-delay']."\n"; destination_select('destination_delay_1', $destination_delay_1, '0'); - echo " ".$text['label-ring-timeout']."\n"; + echo " ".$text['label-ring-timeout']."\n"; destination_select('destination_timeout_1', $destination_timeout_1, '30'); //echo "
\n"; //echo "This number rings first.\n"; @@ -575,9 +571,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo " \n"; - echo " ".$text['label-ring-delay']."\n"; + echo " ".$text['label-ring-delay']."\n"; destination_select('destination_delay_2', $destination_delay_2, '0'); - echo " ".$text['label-ring-timeout']."\n"; + echo " ".$text['label-ring-timeout']."\n"; destination_select('destination_timeout_2', $destination_timeout_2, '30'); //echo "
\n"; //echo "Enter the destination number.\n"; @@ -590,9 +586,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo " \n"; - echo " ".$text['label-ring-delay']."\n"; + echo " ".$text['label-ring-delay']."\n"; destination_select('destination_delay_3', $destination_delay_3, '0'); - echo " ".$text['label-ring-timeout']."\n"; + echo " ".$text['label-ring-timeout']."\n"; destination_select('destination_timeout_3', $destination_timeout_3, '30'); //echo "
\n"; //echo "Enter the destination number.\n"; @@ -605,9 +601,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo " \n"; - echo " ".$text['label-ring-delay']."\n"; + echo " ".$text['label-ring-delay']."\n"; destination_select('destination_delay_4', $destination_delay_4, '0'); - echo " ".$text['label-ring-timeout']."\n"; + echo " ".$text['label-ring-timeout']."\n"; destination_select('destination_timeout_4', $destination_timeout_4, '30'); //echo "
\n"; //echo "Enter the destination number.\n"; @@ -620,9 +616,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo " \n"; - echo " ".$text['label-ring-delay']."\n"; + echo " ".$text['label-ring-delay']."\n"; destination_select('destination_delay_5', $destination_delay_5, '0'); - echo " ".$text['label-ring-timeout']."\n"; + echo " ".$text['label-ring-timeout']."\n"; destination_select('destination_timeout_5', $destination_timeout_5, '30'); //echo "
\n"; //echo "Enter the destination number.\n";