diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index 1b7f6d7ec0..00a37ea389 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -23,16 +23,20 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('gateway_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//includes + require_once "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('gateway_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; @@ -169,30 +173,11 @@ else { if ($total_gateways > 0) { foreach($gateways as $row) { - $edit_link = null; - $delete_link = null; - 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 "\n"; + $tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".$row['gateway_uuid']."'" : null; + echo "\n"; echo " "; - if (strlen($edit_link) > 0) { - echo "".$row["gateway"].""; + if (permission_exists('gateway_edit')) { + echo "".$row["gateway"].""; } else { echo $row["gateway"]; @@ -236,18 +221,18 @@ else { } echo " ".$row["description"]." \n"; echo " "; - if (strlen($edit_link) > 0) { - echo "$v_link_label_edit"; + if (permission_exists('gateway_edit')) { + echo "$v_link_label_edit"; } - if (strlen($delete_link) > 0) { - echo "$v_link_label_delete"; + if (permission_exists('gateway_delete')) { + echo "$v_link_label_delete"; } echo " \n"; echo "\n"; } if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $gateways, $row_count, $edit_link, $delete_link); + unset($sql, $gateways, $row_count); } //end if results echo "\n"; @@ -260,4 +245,4 @@ else { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?>