Misc: Implement maximum limits on multiple apps.

This commit is contained in:
Nate Jones 2015-03-22 08:17:04 +00:00
parent 0e67783602
commit fcb53fd7f9
24 changed files with 1173 additions and 865 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,26 @@ else {
$action = "add";
}
//get total call center queues count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['call_center_queues']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_call_center_queues where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_call_center_queues = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_call_center_queues >= $_SESSION['limit']['call_center_queues']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_queues'].' '.$_SESSION['limit']['call_center_queues']['numeric'];
header('Location: call_center_queues.php');
return;
}
}
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//get the post variables a run a security chack on them

View File

@ -62,42 +62,52 @@ else {
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$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 total call center queues count from the database
$sql = "select count(*) as num_rows from v_call_center_queues where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_call_center_queues = $row['num_rows'];
}
unset($prep_statement, $row);
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
//prepare to page the results (reuse $sql from above)
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$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;
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
@ -122,7 +132,9 @@ else {
echo th_order_by('queue_description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('call_center_queue_add')) {
echo "<a href='call_center_queue_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['call_center_queues']['numeric'] == '' || ($_SESSION['limit']['call_center_queues']['numeric'] != '' && $total_call_center_queues < $_SESSION['limit']['call_center_queues']['numeric'])) {
echo "<a href='call_center_queue_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@ -175,7 +187,9 @@ else {
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('call_center_queue_add')) {
echo "<a href='call_center_queue_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['call_center_queues']['numeric'] == '' || ($_SESSION['limit']['call_center_queues']['numeric'] != '' && $total_call_center_queues < $_SESSION['limit']['call_center_queues']['numeric'])) {
echo "<a href='call_center_queue_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";

View File

@ -285,4 +285,9 @@ $text['label-domain-name']['es-cl'] = "Nombre de Dominio";
$text['label-domain-name']['pt-pt'] = "Nome de Domínio";
$text['label-domain-name']['fr-fr'] = "Nom de Domaine";
$text['message-maximum_destinations']['en-us'] = "Maximum Destinations:";
$text['message-maximum_destinations']['es-cl'] = "Destinos Máximo Permitido:";
$text['message-maximum_destinations']['pt-pt'] = "Destinos Máximo Permitido:";
$text['message-maximum_destinations']['fr-fr'] = "Destinations Maximum Autorisé:";
?>

View File

@ -53,6 +53,26 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.
$action = "add";
}
//get total destination count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['destinations']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_destinations where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_destinations = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_destinations >= $_SESSION['limit']['destinations']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_destinations'].' '.$_SESSION['limit']['destinations']['numeric'];
header('Location: destinations.php');
return;
}
}
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//set the variables

View File

@ -26,7 +26,7 @@
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (if_group("admin") || if_group("superadmin")) {
if (permission_exists('destination_view')) {
//access granted
}
else {
@ -56,10 +56,10 @@ else {
if (permission_exists('destination_show_all')) {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='destinations.php?showall=true';\">\n";
if ($_GET['showall'] == 'true') {
echo " <input type='hidden' name='showall' value='true'>";
echo " <input type='hidden' name='showall' value='true'>";
}
}
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </td>\n";
echo " </form>\n";
@ -71,14 +71,24 @@ else {
echo " </tr>\n";
echo "</table>\n";
//get total extension count from the database
$sql = "select count(*) as num_rows from v_destinations where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_destinations = $row['num_rows'];
}
unset($sql, $prep_statement, $row);
//prepare to page the results
$sql = " select count(*) as num_rows from v_destinations ";
$sql = "select count(*) as num_rows from v_destinations ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
if (strlen($search) > 0) {
$sql .= "where ";
}
} else {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
if (strlen($search) > 0) {
$sql .= "and ";
}
@ -159,7 +169,11 @@ else {
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 class='list_control_icons'>";
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if (permission_exists('destination_add')) {
if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $total_destinations < $_SESSION['limit']['destinations']['numeric'])) {
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@ -176,8 +190,12 @@ else {
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['destination_enabled'])."</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['destination_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
echo "<a href='destination_edit.php?id=".$row['destination_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
echo "<a href='destination_delete.php?id=".$row['destination_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
if (permission_exists('destination_edit')) {
echo "<a href='destination_edit.php?id=".$row['destination_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('destination_delete')) {
echo "<a href='destination_delete.php?id=".$row['destination_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; }
@ -196,7 +214,11 @@ else {
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if (permission_exists('destination_add')) {
if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $total_destinations < $_SESSION['limit']['destinations']['numeric'])) {
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";

View File

@ -980,4 +980,9 @@
$text['label-domain-name']['pt-pt'] = "Nome de Domínio";
$text['label-domain-name']['fr-fr'] = "Nom de Domaine";
$text['message-maximum_devices']['en-us'] = "Maximum Devices:";
$text['message-maximum_devices']['es-cl'] = "Dispositivos Máximo Permitido:";
$text['message-maximum_devices']['pt-pt'] = "Dispositivos Máximo Permitido:";
$text['message-maximum_devices']['fr-fr'] = "Appareils Maximum Autorisé:";
?>

View File

@ -76,6 +76,26 @@ require_once "resources/require.php";
$action = "add";
}
//get total device count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['devices']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_devices = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_devices >= $_SESSION['limit']['devices']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_devices'].' '.$_SESSION['limit']['devices']['numeric'];
header('Location: devices.php');
return;
}
}
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//devices

View File

@ -67,7 +67,7 @@ else {
if (permission_exists('device_profile_view')) {
echo " <input type='button' class='btn' value='".$text['button-profiles']."' onclick=\"document.location.href='device_profiles.php';\">&nbsp;&nbsp;&nbsp;&nbsp;";
}
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
@ -75,6 +75,16 @@ else {
echo "</table>\n";
echo "<br />";
//get total devices count from the database
$sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_devices = $row['num_rows'];
}
unset($sql, $prep_statement, $row);
//prepare to page the results
$sql = "select count(*) as num_rows from v_devices ";
if ($_GET['showall'] && permission_exists('device_show_all')) {
@ -179,7 +189,9 @@ else {
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_add')) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
if ($_SESSION['limit']['devices']['numeric'] == '' || ($_SESSION['limit']['devices']['numeric'] != '' && $total_devices < $_SESSION['limit']['devices']['numeric'])) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
}
else {
echo " &nbsp;\n";
@ -225,7 +237,9 @@ else {
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_add')) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['devices']['numeric'] == '' || ($_SESSION['limit']['devices']['numeric'] != '' && $total_devices < $_SESSION['limit']['devices']['numeric'])) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";

View File

@ -640,4 +640,9 @@ $text['button-add']['es-cl'] = "Agregar";
$text['button-add']['pt-pt'] = "Adicionar";
$text['button-add']['fr-fr'] = "Ajouter";
$text['message-maximum_extensions']['en-us'] = "Maximum Extensions:";
$text['message-maximum_extensions']['es-cl'] = "Extensiones Máximo Permitido:";
$text['message-maximum_extensions']['pt-pt'] = "Extensões Máximo Permitido:";
$text['message-maximum_extensions']['fr-fr'] = "Extensions Maximum Autorisé:";
?>

View File

@ -55,6 +55,26 @@ else {
$action = "add";
}
//get total extension count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['extensions']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_extensions = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_extensions >= $_SESSION['limit']['extensions']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_extensions'].' '.$_SESSION['limit']['extensions']['numeric'];
header('Location: extensions.php');
return;
}
}
}
//get the http values and set them as php variables
if (count($_POST) > 0) {
//get the values from the HTTP POST and save them as PHP variables

View File

@ -63,132 +63,144 @@ require_once "resources/paging.php";
echo "</table>\n";
echo "<br />";
//get the number of extensions
$sql = "select count(*) as num_rows from v_extensions ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " extension like '%".$search."%' ";
$sql .= " or call_group like '%".$search."%' ";
$sql .= " or user_context like '%".$search."%' ";
$sql .= " or enabled like '%".$search."%' ";
$sql .= " or description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare(check_sql($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';
}
}
unset($prep_statement, $result);
//get total extension count from the database
$sql = "select count(*) as num_rows from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_extensions = $row['num_rows'];
}
unset($prep_statement, $row);
//prepare to page the results
$rows_per_page = 150;
$param = "";
if (!isset($_GET['page'])) { $_GET['page'] = 0; }
$_GET['page'] = check_str($_GET['page']);
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $_GET['page'];
//get the extensions
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " extension like '%".$search."%' ";
$sql .= " or call_group like '%".$search."%' ";
$sql .= " or user_context like '%".$search."%' ";
$sql .= " or enabled like '%".$search."%' ";
$sql .= " or description like '%".$search."%' ";
$sql .= ") ";
}
if (isset($order_by)) {
$sql .= "order by $order_by $order ";
//get the number of extensions (reuse $sql from above)
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " extension like '%".$search."%' ";
$sql .= " or call_group like '%".$search."%' ";
$sql .= " or user_context like '%".$search."%' ";
$sql .= " or enabled like '%".$search."%' ";
$sql .= " or description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare(check_sql($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 {
$sql .= "order by extension asc ";
$num_rows = '0';
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
}
unset($prep_statement, $result);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//prepare to page the results
$rows_per_page = 150;
$param = "";
if (!isset($_GET['page'])) { $_GET['page'] = 0; }
$_GET['page'] = check_str($_GET['page']);
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $_GET['page'];
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
echo th_order_by('call_group', $text['label-call_group'], $order_by, $order);
//echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order);
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('extension_add')) {
echo " <a href='extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
//get the extensions
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " extension like '%".$search."%' ";
$sql .= " or call_group like '%".$search."%' ";
$sql .= " or user_context like '%".$search."%' ";
$sql .= " or enabled like '%".$search."%' ";
$sql .= " or description like '%".$search."%' ";
$sql .= ") ";
}
if (isset($order_by)) {
$sql .= "order by $order_by $order ";
}
else {
$sql .= "order by extension asc ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
echo th_order_by('call_group', $text['label-call_group'], $order_by, $order);
//echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order);
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('extension_add')) {
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
echo " <a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo "</td>\n";
echo "</tr>\n";
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".$row['extension_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('extension_edit')) {
echo "<a href='extension_edit.php?id=".$row['extension_uuid']."'>".$row['extension']."</a>";
}
else {
echo $row['extension'];
}
echo "</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['call_group']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_mail_to']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['user_context']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['enabled'])."</td>\n";
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('extension_edit')) {
echo "<a href='extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('extension_delete')) {
echo "<a href='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; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".$row['extension_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('extension_edit')) {
echo "<a href='extension_edit.php?id=".$row['extension_uuid']."'>".$row['extension']."</a>";
}
else {
echo $row['extension'];
}
echo "</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['call_group']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_mail_to']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['user_context']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['enabled'])."</td>\n";
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('extension_edit')) {
echo "<a href='extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('extension_delete')) {
echo "<a href='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; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='6' align='left'>\n";
echo " <table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
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%' class='list_control_icons'>\n";
if (permission_exists('extension_add')) {
echo " <a href='extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
echo "<tr>\n";
echo "<td colspan='6' align='left'>\n";
echo " <table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
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%' class='list_control_icons'>\n";
if (permission_exists('extension_add')) {
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
echo " <a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
echo "</table>";
echo "<br><br>";
//show the footer

View File

@ -429,4 +429,9 @@
$text['message-required']['pt-pt'] = "Por favor indique: ";
$text['message-required']['fr-fr'] = "Merci d'indiquer: ";
?>
$text['message-maximum_gateways']['en-us'] = "Maximum Gateways:";
$text['message-maximum_gateways']['es-cl'] = "Gateways Máximo Permitido:";
$text['message-maximum_gateways']['pt-pt'] = "Gateways Máximo Permitido:";
$text['message-maximum_gateways']['fr-fr'] = "Passerelles Maximum Autorisé:";
?>

View File

@ -47,6 +47,26 @@ else {
$action = "add";
}
//get total gateway count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['gateways']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_gateways where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_gateways = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_gateways >= $_SESSION['limit']['gateways']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_gateways'].' '.$_SESSION['limit']['gateways']['numeric'];
header('Location: gateways.php');
return;
}
}
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$domain_uuid = check_str($_POST["domain_uuid"]);

View File

@ -100,6 +100,16 @@ else {
echo "</table>\n";
echo "<br />\n";
//get total gateway count from the database
$sql = "select count(*) as num_rows from v_gateways where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_gateways = $row['num_rows'];
}
unset($sql, $prep_statement, $row);
//prepare to page the results
$sql = "select count(*) as num_rows from v_gateways ";
$sql .= "where (domain_uuid = '$domain_uuid' or domain_uuid is null) ";
@ -153,7 +163,9 @@ else {
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('gateway_add')) {
echo "<a href='gateway_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['gateways']['numeric'] == '' || ($_SESSION['limit']['gateways']['numeric'] != '' && $total_gateways < $_SESSION['limit']['gateways']['numeric'])) {
echo "<a href='gateway_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@ -229,7 +241,9 @@ else {
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('gateway_add')) {
echo "<a href='gateway_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['gateways']['numeric'] == '' || ($_SESSION['limit']['gateways']['numeric'] != '' && $total_gateways < $_SESSION['limit']['gateways']['numeric'])) {
echo "<a href='gateway_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
else {
echo "&nbsp;";

View File

@ -415,4 +415,9 @@
$text['message-message']['pt-pt'] = "Mensagem";
$text['message-message']['fr-fr'] = "Message";
?>
$text['message-maximum_ivr_menus']['en-us'] = "Maximum IVR Menus:";
$text['message-maximum_ivr_menus']['es-cl'] = "Máxima IVR Menús Animales:";
$text['message-maximum_ivr_menus']['pt-pt'] = "Menus Máxima IVR de Estimação:";
$text['message-maximum_ivr_menus']['fr-fr'] = "Menus Maximale SVI Admis:";
?>

View File

@ -52,6 +52,26 @@ else {
$action = "add";
}
//get total ivr menu count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['ivr_menus']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_ivr_menus where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_ivr_menus = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_ivr_menus >= $_SESSION['limit']['ivr_menus']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_ivr_menus'].' '.$_SESSION['limit']['ivr_menus']['numeric'];
header('Location: ivr_menus.php');
return;
}
}
}
//get http post values and set them to php variables
if (count($_POST) > 0) {
//get ivr menu

View File

@ -76,6 +76,9 @@ else {
$ivr->where = $where;
$num_rows = $ivr->count();
//use total ivr menu count from the database
$total_ivr_menus = $num_rows;
//prepare to page the results
$rows_per_page = 150;
$param = "";
@ -107,7 +110,9 @@ else {
echo th_order_by('ivr_menu_description', $text['label-description'], $order_by[0]['name'], $order_by[0]['order']);
echo "<td class='list_control_icons'>";
if (permission_exists('ivr_menu_add')) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['ivr_menus']['numeric'] == '' || ($_SESSION['limit']['ivr_menus']['numeric'] != '' && $total_ivr_menus < $_SESSION['limit']['ivr_menus']['numeric'])) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@ -151,7 +156,9 @@ else {
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('ivr_menu_add')) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['ivr_menus']['numeric'] == '' || ($_SESSION['limit']['ivr_menus']['numeric'] != '' && $total_ivr_menus < $_SESSION['limit']['ivr_menus']['numeric'])) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";

View File

@ -414,4 +414,9 @@
$text['button-delete']['pt-pt'] = "Remover";
$text['button-delete']['fr-fr'] = "Supprimer";
?>
$text['message-maximum_ring_groups']['en-us'] = "Maximum Ring Groups:";
$text['message-maximum_ring_groups']['es-cl'] = "Grupos máximos Anillo Animales:";
$text['message-maximum_ring_groups']['pt-pt'] = "Grupos Máximo Anel de Estimação:";
$text['message-maximum_ring_groups']['fr-fr'] = "Groupes de Sonneries Maximum Autorisé:";
?>

View File

@ -67,6 +67,26 @@ else {
$action = "add";
}
//get total ring group count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['ring_groups']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_ring_groups where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_ring_groups = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_ring_groups >= $_SESSION['limit']['ring_groups']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_ring_groups'].' '.$_SESSION['limit']['ring_groups']['numeric'];
header('Location: ring_groups.php');
return;
}
}
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//set variables from http values

View File

@ -59,9 +59,17 @@ require_once "resources/paging.php";
echo " </tr>\n";
echo "</table>\n";
//prepare to page the results
$sql = "select count(*) as num_rows from v_ring_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
//get total ring group count from the database
$sql = "select count(*) as num_rows from v_ring_groups where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_ring_groups = $row['num_rows'];
}
unset($prep_statement, $row);
//prepare to page the results (reuse $sql from above)
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
@ -114,7 +122,9 @@ require_once "resources/paging.php";
echo th_order_by('ring_group_description', $text['header-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('ring_group_add')) {
echo "<a href='ring_group_edit.php' alt='add'>$v_link_label_add</a>";
if ($_SESSION['limit']['ring_groups']['numeric'] == '' || ($_SESSION['limit']['ring_groups']['numeric'] != '' && $total_ring_groups < $_SESSION['limit']['ring_groups']['numeric'])) {
echo "<a href='ring_group_edit.php' alt='add'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@ -160,7 +170,9 @@ require_once "resources/paging.php";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('ring_group_add')) {
echo "<a href='ring_group_edit.php' alt='add'>$v_link_label_add</a>";
if ($_SESSION['limit']['ring_groups']['numeric'] == '' || ($_SESSION['limit']['ring_groups']['numeric'] != '' && $total_ring_groups < $_SESSION['limit']['ring_groups']['numeric'])) {
echo "<a href='ring_group_edit.php' alt='add'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";

View File

@ -422,5 +422,9 @@
$text['message-cannot_delete_own_account']['pt-pt'] = "Você não pode excluir a sua própria conta de usuário.\\n\\nIdentifique-se como um usuário diferente, em seguida, tente novamente.";
$text['message-cannot_delete_own_account']['fr-fr'] = "Vous ne pouvez pas supprimer votre propre compte utilisateur.\\n\\nSe il vous plaît vous identifier en tant qu'utilisateur différent, puis réessayez.";
$text['message-maximum_users']['en-us'] = "Maximum Users:";
$text['message-maximum_users']['es-cl'] = "Usuarios Máximo Permitido:";
$text['message-maximum_users']['pt-pt'] = "Usuários Máximo Permitido:";
$text['message-maximum_users']['fr-fr'] = "Utilisateurs Maximale Autorisée:";
?>
?>

View File

@ -40,6 +40,24 @@ require_once "resources/require.php";
$language = new text;
$text = $language->get();
//get total user count from the database, check limit, if defined
if ($_SESSION['limit']['users']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_users where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_users = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_users >= $_SESSION['limit']['users']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_users'].' '.$_SESSION['limit']['users']['numeric']
header('Location: index.php');
return;
}
}
//get the values from http and set as variables
$username = check_str($_POST["username"]);
$password = check_str($_POST["password"]);

View File

@ -90,9 +90,17 @@ $field_value = $_REQUEST["field_value"];
}
unset ($sql, $prep_statement);
//get the users from the database
$sql = "select count(*) as num_rows from v_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
//get total user count from the database
$sql = "select count(*) as num_rows from v_users where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_users = $row['num_rows'];
}
unset($prep_statement, $row);
//get the users from the database (reuse $sql from above)
if (strlen($field_name) > 0 && strlen($field_value) > 0) {
$sql .= "and $field_name = '$field_value' ";
}
@ -148,7 +156,9 @@ $field_value = $_REQUEST["field_value"];
echo "<th>".$text['label-enabled']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('user_add')) {
echo "<a href='signup.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['users']['numeric'] == '' || ($_SESSION['limit']['users']['numeric'] != '' && $total_users < $_SESSION['limit']['users']['numeric'])) {
echo "<a href='signup.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@ -209,7 +219,9 @@ $field_value = $_REQUEST["field_value"];
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('user_add')) {
echo "<a href='signup.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['users']['numeric'] == '' || ($_SESSION['limit']['users']['numeric'] != '' && $total_users < $_SESSION['limit']['users']['numeric'])) {
echo "<a href='signup.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";