function getZap_sib($searchext) { global $db; zapexists(); $sql = "SELECT id,data FROM zap WHERE keyword = 'callerid' AND data LIKE '%" . $searchext . "%' ORDER BY id"; $results = $db->getAll($sql); if (DB::IsError($results)) { $results = null; } foreach ($results as $result) { $result[] = 'zap'; $zap[] = $result; } return $zap; }
<?php session_start(); require_once 'functions.php'; $amp_conf = parse_amportal_conf("/etc/amportal.conf"); require_once 'common/db_connect.php'; sipexists(); iaxexists(); zapexists(); backuptableexists(); if (isset($_REQUEST['display'])) { $display = $_REQUEST['display']; } else { $display = ''; } if (isset($_REQUEST['mode'])) { $mode = $_REQUEST['mode']; } else { $mode = 'pbx'; } include 'header.php'; $pbx_sections = array(9 => _("Incoming Calls"), 3 => _("Extensions"), 20 => _("Extensions Search"), 21 => _("Extensions Auto"), 4 => _("Ring Groups"), 11 => _("Queues"), 2 => _("Digital Receptionist"), 6 => _("Trunks"), 7 => _("Inbound Routing"), 8 => _("Outbound Routing"), 1 => _("On Hold Music"), 12 => _("System Recordings"), 22 => _("Conferences"), 14 => _("Speeddial/Forward"), 19 => _("Misc Destinations"), 16 => _("Trunk Tone")); $settings_sections = array(1 => _("General Settings"), 2 => _("Sip Settings"), 3 => _("Iax Settings"), 6 => _("VM Settings"), 7 => _("Feature Settings"), 4 => _("Manager Settings"), 5 => _("PHPAgi Settings"), 8 => _("Cti Settings"), 9 => _("BI4Data Settings")); $file_sections = array(1 => _("Recorded Files"), 2 => _("Fax Files")); $tools_sections = array(1 => _("Backup & Restore"), 2 => _("Cti Users"), 6 => _("Phonebook"), 3 => _("Csv Import"), 4 => _("Csv Export"), 5 => _("Asterisk Info")); if ($mode == 'pbx') { echo "<table width=\"100%\" cellspacing='0' cellpadding='0'><tr><td>"; echo "<div class=\"nav\">"; foreach ($pbx_sections as $key => $value) { echo "<li><a id=\"" . ($display == $key ? 'current' : '') . "\" href=\"config.php?display=" . $key . "&mode=" . $mode . "\" onFocus=\"this.blur()\">+ " . _($value) . "</a></li>"; }
function addzap($account, $callerid, $action) { zapexists(); global $db; if ($action == "add") { $devices = extension_list(); if (is_array($devices)) { foreach ($devices as $device) { if ($device[0] === $account) { echo "<script>javascript:alert('" . _("This ZAP Extension [") . $device[0] . "] is already in use" . "');</script>"; return false; } } } } $zapfields = array(array($account, 'account', $account), array($account, 'context', isset($_REQUEST['context']) ? $_REQUEST['context'] : ''), array($account, 'mailbox', isset($_REQUEST['mailbox']) ? $_REQUEST['mailbox'] : ''), array($account, 'callerid', $callerid), array($account, 'signalling', isset($_REQUEST['signalling']) ? $_REQUEST['signalling'] : 'fxo_ks'), array($account, 'echocancel', isset($_REQUEST['echocancel']) ? $_REQUEST['echocancel'] : 'yes'), array($account, 'echocancelwhenbridged', isset($_REQUEST['echocancelwhenbridged']) ? $_REQUEST['echocancelwhenbridged'] : 'yes'), array($account, 'echotraining', isset($_REQUEST['echotraining']) ? $_REQUEST['echotraining'] : '400'), array($account, 'busydetect', isset($_REQUEST['busydetect']) ? $_REQUEST['busydetect'] : 'yes'), array($account, 'busycount', isset($_REQUEST['busycount']) ? $_REQUEST['busycount'] : '5'), array($account, 'callprogress', isset($_REQUEST['callprogress']) ? $_REQUEST['callprogress'] : 'no'), array($account, 'callwaiting', isset($_REQUEST['callwaiting']) ? $_REQUEST['callwaiting'] : 'yes'), array($account, 'restrictcid', isset($_REQUEST['restrictcid']) ? $_REQUEST['restrictcid'] : 'no'), array($account, 'callwaitingcallerid', isset($_REQUEST['callwaitingcallerid']) ? $_REQUEST['callwaitingcallerid'] : 'no'), array($account, 'threewaycalling', isset($_REQUEST['threewaycalling']) ? $_REQUEST['threewaycalling'] : 'yes'), array($account, 'transfer', isset($_REQUEST['transfer']) ? $_REQUEST['transfer'] : 'yes'), array($account, 'cancallforward', isset($_REQUEST['cancallforward']) ? $_REQUEST['cancallforward'] : 'yes'), array($account, 'callreturn', isset($_REQUEST['callreturn']) ? $_REQUEST['callreturn'] : 'yes'), array($account, 'relaxdtmf', isset($_REQUEST['relaxdtmf']) ? $_REQUEST['relaxdtmf'] : 'yes'), array($account, 'callgroup', isset($_REQUEST['callgroup']) ? $_REQUEST['callgroup'] : ''), array($account, 'pickupgroup', isset($_REQUEST['pickupgroup']) ? $_REQUEST['pickupgroup'] : ''), array($account, 'record_in', isset($_REQUEST['record_in']) ? $_REQUEST['record_in'] : 'Never'), array($account, 'record_out', isset($_REQUEST['record_out']) ? $_REQUEST['record_out'] : 'Never'), array($account, 'accountcode', isset($_REQUEST['accountcode']) ? $_REQUEST['accountcode'] : ''), array($account, 'nocall', isset($_REQUEST['nocall']) ? $_REQUEST['nocall'] : ''), array($account, 'allowcall', isset($_REQUEST['allowcall']) ? $_REQUEST['allowcall'] : ''), array($account, 'language', isset($_REQUEST['language']) ? $_REQUEST['language'] : ''), array($account, 'channel', isset($_REQUEST['channel']) ? $_REQUEST['channel'] : '')); $compiled = $db->prepare('INSERT INTO zap (id, keyword, data) values (?,?,?)'); $result = $db->executeMultiple($compiled, $zapfields); if (DB::IsError($result)) { die($result->getMessage() . "<br><br>error adding to ZAP table"); } //add E<enten>=ZAP to global vars (appears in extensions_additional.conf) $sql = "INSERT INTO globals VALUES ('E{$account}', 'ZAP')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . $sql); } //add ZAPCHAN_<exten>=<zapchannel> to global vars. Needed in dialparties.agi to decide channel number without hitting the database. $zapchannel = $_REQUEST['channel']; $sql = "INSERT INTO globals VALUES ('ZAPCHAN_{$account}', '{$zapchannel}')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . $sql); } //add ECID<enten> to global vars if using outbound CID if ($_REQUEST['outcid'] != '') { $outcid = $_REQUEST['outcid']; $sql = "INSERT INTO globals VALUES ('ECID{$account}', '{$outcid}')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . $sql); } } return true; }