print_form(1, $error_txt); } elseif (isset($_POST['add_subscriber']) && $error_txt == "") { // no error process form $firstname = $_POST['firstname']; $callerid = $_POST['callerid']; $location = $_POST['location']; // get internal prefix $site = new Configuration(); $info = $site->getSite(); $internalprefix = $info->postcode . $info->pbxcode; $new_num = "{$internalprefix}{$callerid}"; echo "<center>"; $amount = 0; $sub = new Subscriber(); try { $sub->set("", $callerid, $firstname, 1, $amount, "", "", $location); $ret = $sub->create(); echo "<img src='img/true.png' width='200' height='170' /><br/><br/>"; if ($ret != "") { echo "<span style='font-size: 20px;'>" . _("Subscriber already exists! New subscriber number") . ": <b>{$ret}</b> " . _("Successfully provisioned with an initial balance of") . " {$amount}<br/><br/>"; } else { echo "<span style='font-size: 20px;'>" . _("Subscriber number") . ": <b>{$callerid}</b> " . _("Successfully provisioned with an initial balance of") . " {$amount}<br/><br/>"; } echo "<a href='provisioning.php'><button class='b1'>" . _("Go Back") . "</button></a>"; } catch (SubscriberException $e) { echo "<img src='img/false.png' width='200' height='170' /><br/><br/>"; echo "<span style='font-size: 20px; color: red;'>" . _("ERROR PROVISIONING SUBSCRIBER!") . " </span><br/>" . $e->getMessage() . "<br/><br/><br/>"; echo "<a href='provisioning.php'><button class='b1'>" . _("Go Back") . "</button></a>"; } echo "</center>"; } else {
if ($firstname == "") { $error_txt .= _("Name is empty") . "<br/>"; } if ($callerid == "" || strlen($callerid) != 11) { $error_txt .= _("Subscriber number is invalid") . "<br/>"; } } if (isset($_POST['edit_subscriber']) && $error_txt != "") { print_form(1, $error_txt); } elseif (isset($_POST['edit_subscriber']) && $error_txt == "") { echo "<center>"; $sub = new Subscriber(); try { #$sub->get($_POST['msisdn']); if ($_POST['authorized'] == 1) { $sub->set("", $callerid, $firstname, 1, "", "", "", $location); } else { $sub->set("", $callerid, $firstname, 0, "", "", "", $location); } if ($_POST['subscription_status'] == 1) { $sub->subscription_status = 1; } else { $sub->subscription_status = 0; } $sub->edit(); echo "<img src='img/true.png' width='200' height='170' /><br/><br/>"; echo "<span style='font-size: 20px;'>" . _("Subscriber number") . ": <b>{$callerid}</b> " . _("successfully modified") . "<br/><br/>"; echo "<a href='#' onclick=\"parent.jQuery.fancybox.close()\"><button class='b1'>" . _("Close") . "</button></a>"; } catch (SubscriberException $e) { echo "<img src='img/false.png' width='200' height='170' /><br/><br/>"; echo "<span style='font-size: 20px; color: red;'>" . _("ERROR SAVING SUBSCRIBER!") . " " . $e->getMessage() . " </span><br/><br/><br/><br/>";