function getextens_sib($searchext) { $sip = getSip_sib($searchext); $iax = getIax_sib($searchext); $zap = getZap_sib($searchext); $results = array_merge((array) $sip, (array) $iax, (array) $zap); foreach ($results as $result) { if (checkRange($result[0])) { $extens[] = array($result[0], $result[1], $result[2]); } } if (isset($extens)) { sort($extens); } return $extens; }
function findmefollow_allusers() { global $db; $sql = "SELECT extension,name FROM users ORDER BY extension"; $results = $db->getAll($sql); if (DB::IsError($results)) { $results = null; } foreach ($results as $result) { if (checkRange($result[0])) { $users[] = array($result[0], $result[1]); } } if (isset($users)) { sort($users); } return $users; }
function core_users_configprocess() { //create vars from the request extract($_REQUEST); //make sure we can connect to Asterisk Manager if (!checkAstMan()) { return false; } //check if the extension is within range for this user if (isset($extension) && !checkRange($extension)) { echo "<script>javascript:alert('" . _("Warning! Extension") . " " . $extension . " " . _("is not allowed for your account") . ".');</script>"; $GLOBALS['abort'] = true; } else { //if submitting form, update database if (!isset($action)) { $action = null; } switch ($action) { case "add": if (core_users_add($_REQUEST)) { // TODO: Check this if it's the same in device and user mode, and in fact we can't support this in that // mode at least without fixing the complexities of adding the devices which gets ugly! // $this_dest = core_getdest($_REQUEST['extension']); fwmsg::set_dest($this_dest[0]); needreload(); //redirect_standard_continue(); } else { // really bad hack - but if core_users_add fails, want to stop core_devices_add // Comment, this does not help everywhere. Other hooks functions can hook before // this like voicemail! // $GLOBALS['abort'] = true; } break; case "del": \FreePBX::Core()->delUser($extdisplay); core_users_cleanastdb($extdisplay); if (function_exists('findmefollow_del')) { findmefollow_del($extdisplay); } needreload(); //redirect_standard_continue(); break; case "edit": if (core_users_edit($extdisplay, $_REQUEST)) { needreload(); //redirect_standard_continue('extdisplay'); } else { // really bad hack - but if core_users_edit fails, want to stop core_devices_edit $GLOBALS['abort'] = true; } break; } } return true; }
/** * List all active conferences for the current logged in user * @return array Array of conferences */ public function listConferences() { $sql = "SELECT exten,description FROM meetme ORDER BY exten"; $sth = $this->db->prepare($sql); $sth->execute(); $results = $sth->fetchAll(PDO::FETCH_ASSOC); foreach ($results as $result) { // check to see if we are in-range for the current AMP User. if (isset($result['exten']) && checkRange($result['exten'])) { // return this item's dialplan destination, and the description $extens[] = array($result['exten'], $result['description']); } } if (isset($extens)) { return $extens; } else { return array(); } }
function ringgroups_list($get_all = false) { $results = sql("SELECT grpnum, description FROM ringgroups ORDER BY CAST(grpnum as UNSIGNED)", "getAll", DB_FETCHMODE_ASSOC); foreach ($results as $result) { if ($get_all || isset($result['grpnum']) && checkRange($result['grpnum'])) { $grps[] = array(0 => $result['grpnum'], 1 => $result['description'], 'grpnum' => $result['grpnum'], 'description' => $result['description']); } } if (isset($grps)) { return $grps; } else { return array(); } }
function conferences_list() { $results = sql("SELECT exten,description FROM meetme ORDER BY exten", "getAll", DB_FETCHMODE_ASSOC); foreach ($results as $result) { // check to see if we are in-range for the current AMP User. if (isset($result['exten']) && checkRange($result['exten'])) { // return this item's dialplan destination, and the description $extens[] = array($result['exten'], $result['description']); } } if (isset($extens)) { return $extens; } else { return null; } }
function queues_list($listall = false) { global $db; $sql = "SELECT extension, descr FROM queues_config ORDER BY extension"; $results = $db->getAll($sql); if ($db->IsError($results)) { $results = array(); } foreach ($results as $result) { if ($listall || checkRange($result[0])) { $extens[] = array($result[0], $result[1]); } } if (isset($extens)) { return $extens; } else { return array(); } }
public function listVMBlast() { $sql = "SELECT grpnum, description FROM vmblast ORDER BY grpnum"; $stmt = $this->db->prepare($sql); $stmt->execute(); $results = $stmt->fetchall(\PDO::FETCH_ASSOC); foreach ($results as $result) { if (isset($result['grpnum']) && checkRange($result['grpnum'])) { $grps[] = array($result['grpnum'], $result['description']); } } if (isset($grps)) { return $grps; } else { return null; } }
function core_users_configprocess() { if (!class_exists('agi_asteriskmanager')) { include 'common/php-asmanager.php'; } //create vars from the request extract($_REQUEST); //make sure we can connect to Asterisk Manager if (!checkAstMan()) { return false; } //check if the extension is within range for this user if (isset($extension) && !checkRange($extension)) { echo "<script>javascript:alert('" . _("Warning! Extension") . " " . $extension . " " . _("is not allowed for your account") . ".');</script>"; $GLOBALS['abort'] = true; } else { //if submitting form, update database if (!isset($action)) { $action = null; } switch ($action) { case "add": $conflict_url = array(); $usage_arr = framework_check_extension_usage($_REQUEST['extension']); if (!empty($usage_arr)) { $GLOBALS['abort'] = true; $conflict_url = framework_display_extension_usage_alert($usage_arr, true); global $currentcomponent; $id = 0; $currentcomponent->addguielem('_top', new gui_link_label('conflict', _("Conflicting Extensions"), _("The following extension numbers are in conflict, you can click on the item(s) below to edit the conflicting entity."), true)); foreach ($conflict_url as $edit_link) { $currentcomponent->addguielem('_top', new gui_link('conflict' . $i++, $edit_link['label'], $edit_link['url'])); } $msg = $_REQUEST['display'] == 'users' ? _("Configure user again:") : _("Configure extension again:"); $currentcomponent->addguielem('_top', new gui_subheading('conflict_end', $msg, false)); unset($_REQUEST['action']); redirect_standard_continue(); } elseif (core_users_add($_REQUEST)) { needreload(); redirect_standard_continue(); } else { // really bad hack - but if core_users_add fails, want to stop core_devices_add // Comment, this does not help everywhere. Other hooks functions can hook before // this like voicemail! // $GLOBALS['abort'] = true; } break; case "del": core_users_del($extdisplay); core_users_cleanastdb($extdisplay); if (function_exists('findmefollow_del')) { findmefollow_del($extdisplay); } needreload(); redirect_standard_continue(); break; case "edit": if (core_users_edit($extdisplay, $_REQUEST)) { needreload(); redirect_standard_continue('extdisplay'); } else { // really bad hack - but if core_users_edit fails, want to stop core_devices_edit $GLOBALS['abort'] = true; } break; } } return true; }
function vmblast_list() { $results = sql("SELECT grpnum, description FROM vmblast ORDER BY grpnum", "getAll", DB_FETCHMODE_ASSOC); foreach ($results as $result) { if (isset($result['grpnum']) && checkRange($result['grpnum'])) { $grps[] = array($result['grpnum'], $result['description']); } } if (isset($grps)) { return $grps; } else { return null; } }
function miscd_list() { $sql = "SELECT extension FROM extensions WHERE context = 'ext-miscdests'"; $results = sql($sql, "getAll"); foreach ($results as $result) { if (checkRange($result[0])) { $extens[] = array($result[0]); } } if (isset($extens)) { sort($extens); return $extens; } else { return null; } }
public function listFollowme($get_all = false) { $sql = "SELECT grpnum FROM findmefollow ORDER BY CAST(grpnum as UNSIGNED)"; $stmt = $this->db->prepare($sql); $stmt->execute(); $results = $stmt->fetchall(); if (isset($results)) { foreach ($results as $result) { if ($get_all || checkRange($result)) { $grps[] = $result; } } } if (isset($grps)) { return $grps; } else { return array(); } }
public function listQueues($listall = false) { $sql = "SELECT extension, descr FROM queues_config ORDER BY extension"; $stmt = $this->db->prepare($sql); $stmt->execute(); $results = $stmt->fetchall(\PDO::FETCH_BOTH); foreach ($results as $result) { if ($listall || checkRange($result[0])) { $extens[] = array($result[0], $result[1]); } } if (isset($extens)) { return $extens; } else { return array(); } }
/** * Get all Users by Device Type * @param string $type A specific device type to get */ public function getAllUsersByDeviceType($type = "") { if (empty($type) || $type == "virtual") { $sql = "SELECT * FROM users LEFT JOIN devices ON users.extension = devices.id ORDER BY users.extension"; $sth = $this->database->prepare($sql); try { $sth->execute(); $results = $sth->fetchAll(\PDO::FETCH_ASSOC); } catch (\Exception $e) { return array(); } } else { $sql = "SELECT * FROM users LEFT JOIN devices ON users.extension = devices.id WHERE devices.tech = ? ORDER BY users.extension"; $sth = $this->database->prepare($sql); try { $sth->execute(array($type)); $results = $sth->fetchAll(\PDO::FETCH_ASSOC); } catch (\Exception $e) { return array(); } } $astman = $this->FreePBX->astman; $dbfamily = $astman->connected() ? $astman->database_show("AMPUSER") : array(); //Virtual Extensions are strange $final = array(); foreach ($results as $result) { if (!checkRange($result['extension'])) { continue; } if (empty($result['tech'])) { $result['tech'] = 'virtual'; } elseif (!empty($result['tech']) && $type == "virtual") { continue; } $result['recording_in_external'] = isset($dbfamily['/AMPUSER/' . $result['extension'] . '/recording/in/external']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/recording/in/external'] : ""; $result['recording_out_external'] = isset($dbfamily['/AMPUSER/' . $result['extension'] . '/recording/out/external']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/recording/out/external'] : ""; $result['recording_in_internal'] = isset($dbfamily['/AMPUSER/' . $result['extension'] . '/recording/in/internal']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/recording/in/internal'] : ""; $result['recording_out_internal'] = isset($dbfamily['/AMPUSER/' . $result['extension'] . '/recording/out/internal']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/recording/out/internal'] : ""; $result['recording_ondemand'] = isset($dbfamily['/AMPUSER/' . $result['extension'] . '/recording/ondemand']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/recording/ondemand'] : ""; $result['recording_priority'] = isset($dbfamily['/AMPUSER/' . $result['extension'] . '/recording/priority']) ? (int) $dbfamily['/AMPUSER/' . $result['extension'] . '/recording/priority'] : "10"; $result['answermode'] = $this->FreePBX->Modules->checkStatus("paging") && isset($dbfamily['/AMPUSER/' . $result['extension'] . '/answermode']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/answermode'] : ""; $result['intercom'] = $this->FreePBX->Modules->checkStatus("paging") && isset($dbfamily['/AMPUSER/' . $result['extension'] . '/intercom']) ? $dbfamily['/AMPUSER/' . $result['extension'] . '/intercom'] : ""; $final[] = $result; } return $final; }
public function listRinggroups($get_all = false) { $sql = "SELECT grpnum, description FROM ringgroups ORDER BY CAST(grpnum as UNSIGNED)"; $stmt = $this->db->prepare($sql); $stmt->execute(); $results = $stmt->fetchall(\PDO::FETCH_ASSOC); foreach ($results as $result) { if ($get_all || isset($result['grpnum']) && checkRange($result['grpnum'])) { $grps[] = array(0 => $result['grpnum'], 1 => $result['description'], 'grpnum' => $result['grpnum'], 'description' => $result['description']); } } if (isset($grps)) { return $grps; } else { return array(); } }
// //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. $dispnum = "conferences"; //used for switch on config.php $tabindex = 0; isset($_REQUEST['action']) ? $action = $_REQUEST['action'] : ($action = ''); //the extension we are currently displaying isset($_REQUEST['extdisplay']) ? $extdisplay = $_REQUEST['extdisplay'] : ($extdisplay = ''); $account = isset($_REQUEST['account']) ? $_REQUEST['account'] : ''; $music = isset($_REQUEST['music']) ? $_REQUEST['music'] : ''; $users = isset($_REQUEST['users']) ? $_REQUEST['users'] : '0'; //check if the extension is within range for this user if (isset($account) && !checkRange($account)) { echo "<script>javascript:alert('" . _("Warning! Extension") . " {$account} " . _("is not allowed for your account.") . "');</script>"; } else { //if submitting form, update database switch ($action) { case "add": $conflict_url = array(); $usage_arr = framework_check_extension_usage($account); if (!empty($usage_arr)) { $conflict_url = framework_display_extension_usage_alert($usage_arr); } elseif (conferences_add($account, $_REQUEST['name'], $_REQUEST['userpin'], $_REQUEST['adminpin'], $_REQUEST['options'], $_REQUEST['joinmsg_id'], $music, $users) !== false) { needreload(); redirect_standard(); } break; case "delete":
/** * Get all the users * @param {bool} $get_all=false Whether to get all of check in the range */ function listUsers($get_all = false) { $sql = 'SELECT extension,name,voicemail FROM users ORDER BY extension'; $sth = $this->database->prepare($sql); $sth->execute(); $results = $sth->fetchAll(\PDO::FETCH_BOTH); //only allow extensions that are within administrator's allowed range foreach ($results as $result) { if ($get_all || checkRange($result[0])) { $extens[] = array($result[0], $result[1], $result[2]); } } if (isset($extens)) { sort($extens); return $extens; } else { return null; } }