Multilinquified and permissions fixed.

This commit is contained in:
Nate Jones
2013-05-07 23:38:12 +00:00
parent aa013ee01f
commit afa9e65b96
4 changed files with 201 additions and 61 deletions

View File

@@ -0,0 +1,116 @@
<?php
//Destinations
$text['title-destinations']['en-us'] = 'Destinations';
$text['title-destinations']['pt-pt'] = '';
$text['title-destination-edit']['en-us'] = 'Destination Edit';
$text['title-destination-edit']['pt-pt'] = '';
$text['title-destination-add']['en-us'] = 'Destination Add';
$text['title-destination-add']['pt-pt'] = '';
$text['header-destinations']['en-us'] = 'Destinations';
$text['header-destinations']['pt-pt'] = '';
$text['description-destinations']['en-us'] = 'Inbound destinations are the DID/DDI, DNIS or Alias for inbound calls.';
$text['description-destinations']['pt-pt'] = '';
$text['header-destination-edit']['en-us'] = 'Destination Edit';
$text['header-destination-edit']['pt-pt'] = '';
$text['header-destination-add']['en-us'] = 'Destination Add';
$text['header-destination-add']['pt-pt'] = '';
$text['label-destination_type']['en-us'] = 'Type';
$text['label-destination_type']['pt-pt'] = '';
$text['description-destination_type']['en-us'] = 'Select the type.';
$text['description-destination_type']['pt-pt'] = '';
$text['option-type_inbound']['en-us'] = 'Inbound';
$text['option-type_inbound']['pt-pt'] = '';
$text['option-type_outbound']['en-us'] = 'Outbound';
$text['option-type_outbound']['pt-pt'] = '';
$text['label-destination_number']['en-us'] = 'Destination';
$text['label-destination_number']['pt-pt'] = '';
$text['description-destination_number']['en-us'] = 'Enter the destination.';
$text['description-destination_number']['pt-pt'] = '';
$text['label-destination_caller_id_name']['en-us'] = 'Caller ID Name';
$text['label-destination_caller_id_name']['pt-pt'] = '';
$text['description-destination_caller_id_name']['en-us'] = 'Enter the caller ID name.';
$text['description-destination_caller_id_name']['pt-pt'] = '';
$text['label-destination_caller_id_number']['en-us'] = 'Caller ID Number';
$text['label-destination_caller_id_number']['pt-pt'] = '';
$text['description-destination_caller_id_number']['en-us'] = 'Enter the caller ID number.';
$text['description-destination_caller_id_number']['pt-pt'] = '';
$text['label-destination_context']['en-us'] = 'Context';
$text['label-destination_context']['pt-pt'] = '';
$text['description-destination_context']['en-us'] = 'Enter the context.';
$text['description-destination_context']['pt-pt'] = '';
$text['label-fax_uuid']['en-us'] = 'Fax Destination';
$text['label-fax_uuid']['pt-pt'] = '';
$text['description-fax_uuid']['en-us'] = 'Select the fax destination to enable fax detection. ';
$text['description-fax_uuid']['pt-pt'] = '';
$text['label-destination_enabled']['en-us'] = 'Enabled';
$text['label-destination_enabled']['pt-pt'] = '';
$text['description-destination_enabled']['en-us'] = 'Set the current status of this destination.';
$text['description-destination_enabled']['pt-pt'] = '';
$text['label-destination_description']['en-us'] = 'Description';
$text['label-destination_description']['pt-pt'] = '';
$text['description-destination_description']['en-us'] = 'Enter a description for this destination (optional).';
$text['description-destination_description']['pt-pt'] = '';
$text['label-true']['en-us'] = 'True';
$text['label-true']['pt-pt'] = '';
$text['label-false']['en-us'] = 'False';
$text['label-false']['pt-pt'] = 'falso';
$text['button-add']['en-us'] = 'Add';
$text['button-add']['pt-pt'] = '';
$text['button-edit']['en-us'] = 'Edit';
$text['button-edit']['pt-pt'] = '';
$text['button-delete']['en-us'] = 'Delete';
$text['button-delete']['pt-pt'] = '';
$text['button-save']['en-us'] = 'Save';
$text['button-save']['pt-pt'] = 'Guardar';
$text['button-back']['en-us'] = 'Back';
$text['button-back']['pt-pt'] = 'Voltar';
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
$text['confirm-delete']['pt-pt'] = '';
$text['message-add']['en-us'] = 'Add Completed';
$text['message-add']['pt-pt'] = '';
$text['message-update']['en-us'] = 'Update Completed';
$text['message-update']['pt-pt'] = '';
$text['message-delete']['en-us'] = 'Delete Completed';
$text['message-delete']['pt-pt'] = '';
$text['message-required']['en-us'] = 'Please provide: ';
$text['message-required']['pt-pt'] = '';
?>

View File

@@ -33,7 +33,16 @@ else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
require_once "includes/header.php";
$page["title"] = $text['title-destinations'];
require_once "includes/paging.php";
//get variables used to control the order
@@ -49,12 +58,12 @@ require_once "includes/paging.php";
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>Destinations</b></td>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-destinations']."</b></td>\n";
echo " <td width='50%' align='right'>&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " Inbound destinations are the DID/DDI, DNIS or Alias for inbound calls.<br /><br />\n";
echo " ".$text['description-destinations']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
@@ -79,9 +88,9 @@ require_once "includes/paging.php";
$rows_per_page = 150;
$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_destinations ";
@@ -101,13 +110,13 @@ require_once "includes/paging.php";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('destination_type', 'Type', $order_by, $order);
echo th_order_by('destination_number', 'Destination', $order_by, $order);
echo th_order_by('destination_context', 'Context', $order_by, $order);
echo th_order_by('destination_enabled', 'Enabled', $order_by, $order);
echo th_order_by('destination_description', 'Description', $order_by, $order);
echo th_order_by('destination_type', $text['label-destination_type'], $order_by, $order);
echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order);
echo th_order_by('destination_context', $text['label-destination_context'], $order_by, $order);
echo th_order_by('destination_enabled', $text['label-destination_enabled'], $order_by, $order);
echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
echo " <a href='destinations_edit.php' alt='add'>$v_link_label_add</a>\n";
echo " <a href='destinations_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
@@ -119,8 +128,8 @@ require_once "includes/paging.php";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='destinations_edit.php?id=".$row['destination_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='destinations_delete.php?id=".$row['destination_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='destinations_edit.php?id=".$row['destination_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
echo " <a href='destinations_delete.php?id=".$row['destination_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
@@ -135,7 +144,7 @@ require_once "includes/paging.php";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
echo " <a href='destinations_edit.php' alt='add'>$v_link_label_add</a>\n";
echo " <a href='destinations_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";

View File

@@ -26,7 +26,7 @@
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
if (permission_exists('destination_delete')) {
//access granted
}
else {
@@ -34,6 +34,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
@@ -52,7 +58,7 @@ if (count($_GET)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=destinations.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@@ -26,7 +26,7 @@
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
if (permission_exists('destination_add') || permission_exists('destination_edit')) {
//access granted
}
else {
@@ -34,6 +34,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
@@ -130,7 +136,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=destinations.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo $text['message-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@@ -159,12 +165,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=destinations.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo $text['message-update']."\n";
echo "</div>\n";
require_once "includes/footer.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,6 +203,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//show the header
require_once "includes/header.php";
if ($action == "update") {
$page["title"] = $text['title-destination-edit'];
}
else if ($action == "add") {
$page["title"] = $text['title-destination-add'];
}
//show the content
echo "<div align='center'>";
@@ -209,87 +222,87 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>Destination</b></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='destinations.php'\" value='Back'></td>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-destination-add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-destination-edit']."</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='destinations.php'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "An alias for a call destination. The destination will use the dialplan to find it its target.<br /><br />\n";
echo $text['description-destinations']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Type:\n";
echo " ".$text['label-destination_type'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='destination_type'>\n";
echo " <option value=''></option>\n";
if ($destination_type == "inbound") {
echo " <option value='inbound' selected='selected'>inbound</option>\n";
}
else {
echo " <option value='inbound'>inbound</option>\n";
}
if ($destination_type == "outbound") {
echo " <option value='outbound' selected='selected'>outbound</option>\n";
}
else {
echo " <option value='outbound'>outbound</option>\n";
switch ($destination_type) {
case "inbound" : $selected[1] = "selected='selected'"; break;
case "outbound" : $selected[2] = "selected='selected'"; break;
}
echo " <option value='inbound' ".$selected[1].">".$text['option-type_inbound']."</option>\n";
echo " <option value='outbound' ".$selected[2].">".$text['option-type_outbound']."</option>\n";
unset($selected);
echo " </select>\n";
echo "<br />\n";
echo "Select the type.\n";
echo $text['description-destination_type']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Destination:\n";
echo " ".$text['label-destination_number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_number' maxlength='255' value=\"$destination_number\">\n";
echo "<br />\n";
echo "Enter the destination.\n";
echo $text['description-destination_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Caller ID Name:\n";
echo " ".$text['label-destination_caller_id_name'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_caller_id_name' maxlength='255' value=\"$destination_caller_id_name\">\n";
echo "<br />\n";
echo "Enter the caller id name.\n";
echo $text['description-destination_caller_id_name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Caller ID Number:\n";
echo " ".$text['label-destination_caller_id_number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_caller_id_number' maxlength='255' value=\"$destination_caller_id_number\">\n";
echo "<br />\n";
echo "Enter the caller id number.\n";
echo $text['description-destination_caller_id_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Context:\n";
echo " ".$text['label-destination_context'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_context' maxlength='255' value=\"$destination_context\">\n";
echo "<br />\n";
echo "Enter the context.\n";
echo $text['description-destination_context']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Fax Destination:\n";
echo " ".$text['label-fax_uuid'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$sql = "select * from v_fax ";
@@ -311,42 +324,38 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " </select>\n";
unset ($prep_statement, $extension);
echo " <br />\n";
echo " Select the fax destination to enable fax detection.\n";
echo " ".$text['description-fax_uuid']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Enabled:\n";
echo " ".$text['label-destination_enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='destination_enabled'>\n";
echo " <option value=''></option>\n";
if ($destination_enabled == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($destination_enabled == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
switch ($destination_enabled) {
case "true" : $selected[1] = "selected='selected'"; break;
case "false" : $selected[2] = "selected='selected'"; break;
}
echo " <option value='true' ".$selected[1].">".$text['label-true']."</option>\n";
echo " <option value='false' ".$selected[2].">".$text['label-false']."</option>\n";
unset($selected);
echo " </select>\n";
echo "<br />\n";
echo $text['description-destination_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Description:\n";
echo " ".$text['label-destination_description'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_description' maxlength='255' value=\"$destination_description\">\n";
echo "<br />\n";
echo "Enter the description.\n";
echo $text['description-destination_description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
@@ -355,7 +364,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
echo " <input type='hidden' name='destination_uuid' value='$destination_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";