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
@@ -48,6 +48,26 @@ else {
$action = "add"; $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 //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
//get the post variables a run a security chack on them //get the post variables a run a security chack on them
+18 -4
View File
@@ -62,8 +62,17 @@ else {
echo "</tr>\n"; echo "</tr>\n";
echo "</tr></table>\n"; echo "</tr></table>\n";
$sql = "select * from v_call_center_queues "; //get total call center queues count from the database
$sql .= "where domain_uuid = '$domain_uuid' "; $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);
//prepare to page the results (reuse $sql from above)
if (strlen($order_by) == 0) { if (strlen($order_by) == 0) {
$order_by = 'queue_name'; $order_by = 'queue_name';
$order = 'asc'; $order = 'asc';
@@ -76,6 +85,7 @@ else {
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result); $num_rows = count($result);
unset ($prep_statement, $result, $sql); unset ($prep_statement, $result, $sql);
$rows_per_page = 100; $rows_per_page = 100;
$param = ""; $param = "";
$page = $_GET['page']; $page = $_GET['page'];
@@ -122,7 +132,9 @@ else {
echo th_order_by('queue_description', $text['label-description'], $order_by, $order); echo th_order_by('queue_description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>"; echo "<td class='list_control_icons'>";
if (permission_exists('call_center_queue_add')) { 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 "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -175,7 +187,9 @@ else {
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (permission_exists('call_center_queue_add')) { 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
+5
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']['pt-pt'] = "Nome de Domínio";
$text['label-domain-name']['fr-fr'] = "Nom de Domaine"; $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é:";
?> ?>
+20
View File
@@ -53,6 +53,26 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.
$action = "add"; $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 //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
//set the variables //set the variables
+29 -7
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
require_once "resources/check_auth.php"; require_once "resources/check_auth.php";
if (if_group("admin") || if_group("superadmin")) { if (permission_exists('destination_view')) {
//access granted //access granted
} }
else { else {
@@ -59,7 +59,7 @@ else {
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 " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </td>\n"; echo " </td>\n";
echo " </form>\n"; echo " </form>\n";
@@ -71,6 +71,16 @@ else {
echo " </tr>\n"; echo " </tr>\n";
echo "</table>\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 //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 ($_GET['showall'] && permission_exists('xml_cdr_all')) {
@@ -78,7 +88,7 @@ else {
$sql .= "where "; $sql .= "where ";
} }
} else { } else {
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
if (strlen($search) > 0) { if (strlen($search) > 0) {
$sql .= "and "; $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_enabled', $text['label-destination_enabled'], $order_by, $order);
echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order); echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order);
echo "<td class='list_control_icons'>"; 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 "</td>\n";
echo "</tr>\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_style[$c]."'>".ucwords($row['destination_enabled'])."</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['destination_description']."&nbsp;</td>\n"; echo " <td valign='top' class='row_stylebg'>".$row['destination_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>"; 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>"; if (permission_exists('destination_edit')) {
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 "<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 " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; } 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%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>"; 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
echo " </table>\n"; echo " </table>\n";
+5
View File
@@ -980,4 +980,9 @@
$text['label-domain-name']['pt-pt'] = "Nome de Domínio"; $text['label-domain-name']['pt-pt'] = "Nome de Domínio";
$text['label-domain-name']['fr-fr'] = "Nom de Domaine"; $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é:";
?> ?>
+20
View File
@@ -76,6 +76,26 @@ require_once "resources/require.php";
$action = "add"; $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 //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
//devices //devices
+17 -3
View File
@@ -67,7 +67,7 @@ else {
if (permission_exists('device_profile_view')) { 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='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 " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n"; echo " </form>\n";
echo " </td>\n"; echo " </td>\n";
@@ -75,6 +75,16 @@ else {
echo "</table>\n"; echo "</table>\n";
echo "<br />"; 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 //prepare to page the results
$sql = "select count(*) as num_rows from v_devices "; $sql = "select count(*) as num_rows from v_devices ";
if ($_GET['showall'] && permission_exists('device_show_all')) { 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 th_order_by('device_description', $text['label-device_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n"; echo "<td class='list_control_icons'>\n";
if (permission_exists('device_add')) { 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 { else {
echo " &nbsp;\n"; echo " &nbsp;\n";
@@ -225,7 +237,9 @@ else {
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n"; echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (permission_exists('device_add')) { 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
+5
View File
@@ -640,4 +640,9 @@ $text['button-add']['es-cl'] = "Agregar";
$text['button-add']['pt-pt'] = "Adicionar"; $text['button-add']['pt-pt'] = "Adicionar";
$text['button-add']['fr-fr'] = "Ajouter"; $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é:";
?> ?>
+20
View File
@@ -55,6 +55,26 @@ else {
$action = "add"; $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 //get the http values and set them as php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
//get the values from the HTTP POST and save them as PHP variables //get the values from the HTTP POST and save them as PHP variables
+17 -5
View File
@@ -63,9 +63,17 @@ require_once "resources/paging.php";
echo "</table>\n"; echo "</table>\n";
echo "<br />"; echo "<br />";
//get the number of extensions //get total extension count from the database
$sql = "select count(*) as num_rows from v_extensions "; $sql = "select count(*) as num_rows from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "where domain_uuid = '".$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);
//get the number of extensions (reuse $sql from above)
if (strlen($search) > 0) { if (strlen($search) > 0) {
$sql .= "and ("; $sql .= "and (";
$sql .= " extension like '%".$search."%' "; $sql .= " extension like '%".$search."%' ";
@@ -135,7 +143,9 @@ require_once "resources/paging.php";
echo th_order_by('description', $text['label-description'], $order_by, $order); echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>\n"; echo "<td class='list_control_icons'>\n";
if (permission_exists('extension_add')) { if (permission_exists('extension_add')) {
echo " <a href='extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n"; 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 "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -179,7 +189,9 @@ require_once "resources/paging.php";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' class='list_control_icons'>\n"; echo " <td width='33.3%' class='list_control_icons'>\n";
if (permission_exists('extension_add')) { if (permission_exists('extension_add')) {
echo " <a href='extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n"; 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
+5
View File
@@ -429,4 +429,9 @@
$text['message-required']['pt-pt'] = "Por favor indique: "; $text['message-required']['pt-pt'] = "Por favor indique: ";
$text['message-required']['fr-fr'] = "Merci d'indiquer: "; $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é:";
?> ?>
+20
View File
@@ -47,6 +47,26 @@ else {
$action = "add"; $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 //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
$domain_uuid = check_str($_POST["domain_uuid"]); $domain_uuid = check_str($_POST["domain_uuid"]);
+16 -2
View File
@@ -100,6 +100,16 @@ else {
echo "</table>\n"; echo "</table>\n";
echo "<br />\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 //prepare to page the results
$sql = "select count(*) as num_rows from v_gateways "; $sql = "select count(*) as num_rows from v_gateways ";
$sql .= "where (domain_uuid = '$domain_uuid' or domain_uuid is null) "; $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 th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>"; echo "<td class='list_control_icons'>";
if (permission_exists('gateway_add')) { 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 "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -229,7 +241,9 @@ else {
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (permission_exists('gateway_add')) { 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 { else {
echo "&nbsp;"; echo "&nbsp;";
+5
View File
@@ -415,4 +415,9 @@
$text['message-message']['pt-pt'] = "Mensagem"; $text['message-message']['pt-pt'] = "Mensagem";
$text['message-message']['fr-fr'] = "Message"; $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:";
?> ?>
+20
View File
@@ -52,6 +52,26 @@ else {
$action = "add"; $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 //get http post values and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
//get ivr menu //get ivr menu
+9 -2
View File
@@ -76,6 +76,9 @@ else {
$ivr->where = $where; $ivr->where = $where;
$num_rows = $ivr->count(); $num_rows = $ivr->count();
//use total ivr menu count from the database
$total_ivr_menus = $num_rows;
//prepare to page the results //prepare to page the results
$rows_per_page = 150; $rows_per_page = 150;
$param = ""; $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 th_order_by('ivr_menu_description', $text['label-description'], $order_by[0]['name'], $order_by[0]['order']);
echo "<td class='list_control_icons'>"; echo "<td class='list_control_icons'>";
if (permission_exists('ivr_menu_add')) { 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 "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -151,7 +156,9 @@ else {
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (permission_exists('ivr_menu_add')) { 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
+5
View File
@@ -414,4 +414,9 @@
$text['button-delete']['pt-pt'] = "Remover"; $text['button-delete']['pt-pt'] = "Remover";
$text['button-delete']['fr-fr'] = "Supprimer"; $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é:";
?> ?>
+20
View File
@@ -67,6 +67,26 @@ else {
$action = "add"; $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 //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
//set variables from http values //set variables from http values
+17 -5
View File
@@ -59,9 +59,17 @@ require_once "resources/paging.php";
echo " </tr>\n"; echo " </tr>\n";
echo "</table>\n"; echo "</table>\n";
//prepare to page the results //get total ring group count from the database
$sql = "select count(*) as num_rows from v_ring_groups "; $sql = "select count(*) as num_rows from v_ring_groups where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "where domain_uuid = '$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); $prep_statement = $db->prepare($sql);
if ($prep_statement) { if ($prep_statement) {
$prep_statement->execute(); $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 th_order_by('ring_group_description', $text['header-description'], $order_by, $order);
echo "<td class='list_control_icons'>"; echo "<td class='list_control_icons'>";
if (permission_exists('ring_group_add')) { 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 "</td>\n";
echo "</tr>\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 width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (permission_exists('ring_group_add')) { 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
+4
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']['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-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:";
?> ?>
+18
View File
@@ -40,6 +40,24 @@ require_once "resources/require.php";
$language = new text; $language = new text;
$text = $language->get(); $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 //get the values from http and set as variables
$username = check_str($_POST["username"]); $username = check_str($_POST["username"]);
$password = check_str($_POST["password"]); $password = check_str($_POST["password"]);
+17 -5
View File
@@ -90,9 +90,17 @@ $field_value = $_REQUEST["field_value"];
} }
unset ($sql, $prep_statement); unset ($sql, $prep_statement);
//get the users from the database //get total user count from the database
$sql = "select count(*) as num_rows from v_users "; $sql = "select count(*) as num_rows from v_users where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "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) { if (strlen($field_name) > 0 && strlen($field_value) > 0) {
$sql .= "and $field_name = '$field_value' "; $sql .= "and $field_name = '$field_value' ";
} }
@@ -148,7 +156,9 @@ $field_value = $_REQUEST["field_value"];
echo "<th>".$text['label-enabled']."</th>\n"; echo "<th>".$text['label-enabled']."</th>\n";
echo "<td class='list_control_icons'>"; echo "<td class='list_control_icons'>";
if (permission_exists('user_add')) { 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 "</td>\n";
echo "</tr>\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 width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>"; echo " <td class='list_control_icons'>";
if (permission_exists('user_add')) { 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 " </td>\n";
echo " </tr>\n"; echo " </tr>\n";