Contacts: Fixed/implemented permissions, added Relations.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('contact_view')) {
|
||||
if (permission_exists('contact_extension_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
@@ -34,15 +34,6 @@ else {
|
||||
exit;
|
||||
}
|
||||
|
||||
//require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
if (isset($_GET["order_by"])) {
|
||||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
}
|
||||
|
||||
//javascript function: send_cmd
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
echo "function send_cmd(url) {\n";
|
||||
@@ -59,7 +50,6 @@ require_once "resources/paging.php";
|
||||
echo "</script>\n";
|
||||
|
||||
//show the content
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-contact_extensions']."</b></td>\n";
|
||||
@@ -67,43 +57,14 @@ require_once "resources/paging.php";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows ";
|
||||
//get the extension list
|
||||
$sql = "select e.extension_uuid, e.extension, e.enabled, e.description ";
|
||||
$sql .= " from v_extensions e, v_extension_users eu, v_users u ";
|
||||
$sql .= " where e.extension_uuid = eu.extension_uuid ";
|
||||
$sql .= " and u.user_uuid = eu.user_uuid ";
|
||||
$sql .= " and e.domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and u.contact_uuid = '$contact_uuid' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 10;
|
||||
$param = "";
|
||||
$page = $_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);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the extension list
|
||||
$sql = "select e.extension_uuid, e.extension, e.enabled, e.description ";
|
||||
$sql .= " from v_extensions e, v_extension_users eu, v_users u ";
|
||||
$sql .= " where e.extension_uuid = eu.extension_uuid ";
|
||||
$sql .= " and u.user_uuid = eu.user_uuid ";
|
||||
$sql .= " and e.domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and u.contact_uuid = '$contact_uuid' ";
|
||||
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$sql .= "order by e.extension asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
@@ -121,7 +82,7 @@ require_once "resources/paging.php";
|
||||
echo "<th>".$text['label-description']."</th>\n";
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('extension_add')) {
|
||||
echo " <a href='/app/extensions/extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
echo "<a href='/app/extensions/extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
@@ -141,14 +102,14 @@ require_once "resources/paging.php";
|
||||
echo " <td valign='top' class='row_stylebg'>".$row['description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('extension_edit')) {
|
||||
echo "<a href='/app/extensions/extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
echo "<a href='/app/extensions/extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('extension_delete')) {
|
||||
echo "<a href='/app/extensions/extension_delete.php?id=".$row['extension_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
echo "<a href='/app/extensions/extension_delete.php?id=".$row['extension_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$c = ($c) ? 0 : 1;
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
Reference in New Issue
Block a user