Update gateways.php

Reverse the changes to the Gateways list to fix multiple bugs introduced to it from a pull request.
This commit is contained in:
FusionPBX 2016-11-25 20:37:44 -07:00 committed by GitHub
parent 352877108d
commit 90d9fbff02
1 changed files with 24 additions and 39 deletions

View File

@ -23,16 +23,20 @@
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
*/ */
require_once "root.php";
require_once "resources/require.php"; //includes
require_once "resources/check_auth.php"; require_once "root.php";
if (permission_exists('gateway_view')) { require_once "resources/require.php";
//access granted require_once "resources/check_auth.php";
}
else { //check permissions
echo "access denied"; if (permission_exists('gateway_view')) {
exit; //access granted
} }
else {
echo "access denied";
exit;
}
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
@ -169,30 +173,11 @@ else {
if ($total_gateways > 0) { if ($total_gateways > 0) {
foreach($gateways as $row) { foreach($gateways as $row) {
$edit_link = null; $tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".$row['gateway_uuid']."'" : null;
$delete_link = null; echo "<tr ".$tr_link.">\n";
if (strlen($row['domain_uuid']) == 0) {
if (permission_exists('gateway_domain')) {
if (permission_exists('gateway_edit')) {
$edit_link = "href='gateway_edit.php?id=".$row['gateway_uuid'];
}
if (permission_exists('gateway_delete')) {
$delete_link = "href='gateway_delete.php?id=".$row['gateway_uuid'];
}
}
}
else {
if (permission_exists('gateway_edit')) {
$edit_link = "href='gateway_edit.php?id=".$row['gateway_uuid'];
}
if (permission_exists('gateway_delete')) {
$delete_link = "href='gateway_delete.php?id=".$row['gateway_uuid'];
}
}
echo "<tr ".$edit_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>"; echo " <td valign='top' class='".$row_style[$c]."'>";
if (strlen($edit_link) > 0) { if (permission_exists('gateway_edit')) {
echo "<a href='$edit_link'>".$row["gateway"]."</a>"; echo "<a href='gateway_edit.php?id=".$row['gateway_uuid']."'>".$row["gateway"]."</a>";
} }
else { else {
echo $row["gateway"]; echo $row["gateway"];
@ -236,18 +221,18 @@ else {
} }
echo " <td valign='top' class='row_stylebg'>".$row["description"]."&nbsp;</td>\n"; echo " <td valign='top' class='row_stylebg'>".$row["description"]."&nbsp;</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (strlen($edit_link) > 0) { if (permission_exists('gateway_edit')) {
echo "<a href='$edit_link' alt='".$text['button-edit']."'>$v_link_label_edit</a>"; echo "<a href='gateway_edit.php?id=".$row['gateway_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
} }
if (strlen($delete_link) > 0) { if (permission_exists('gateway_delete')) {
echo "<a href='$delete_link' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>"; echo "<a href='gateway_delete.php?id=".$row['gateway_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
} }
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
if ($c==0) { $c=1; } else { $c=0; } if ($c==0) { $c=1; } else { $c=0; }
} //end foreach } //end foreach
unset($sql, $gateways, $row_count, $edit_link, $delete_link); unset($sql, $gateways, $row_count);
} //end if results } //end if results
echo "<tr>\n"; echo "<tr>\n";
@ -260,4 +245,4 @@ else {
//include the footer //include the footer
require_once "resources/footer.php"; require_once "resources/footer.php";
?> ?>