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; }
} else { //add group if ($action == 'addGRP') { findmefollow_add($account, $strategy, $grptime, implode("-", $grplist), $goto, $grppre, $annmsg_id, $dring, $needsconf, $remotealert_id, $toolate_id, $ringing, $pre_ring, $ddial, $changecid, $fixedcid); needreload(); redirect_standard(); } //del group if ($action == 'delGRP') { findmefollow_del($account); needreload(); redirect_standard(); } //edit group - just delete and then re-add the extension if ($action == 'edtGRP') { findmefollow_del($account); findmefollow_add($account, $strategy, $grptime, implode("-", $grplist), $goto, $grppre, $annmsg_id, $dring, $needsconf, $remotealert_id, $toolate_id, $ringing, $pre_ring, $ddial, $changecid, $fixedcid); needreload(); redirect_standard('extdisplay'); } } } ?> </div> <div class="rnav"><ul> <?php //get unique ring groups $gresults = findmefollow_allusers(); $set_users = findmefollow_list(); if (isset($gresults)) {
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 findmefollow_update($grpnum, $settings) { $old = findmefollow_get($grpnum); if (!empty($old)) { findmefollow_del($grpnum); $old['grplist'] = explode("-", $old['grplist']); $settings = array_merge($old, $settings); } extract($settings); findmefollow_add($grpnum, $strategy, $grptime, $grplist, $postdest, $grppre, $annmsg_id, $dring, $needsconf, $remotealert_id, $toolate_id, $ringing, $pre_ring, $ddial, $changecid, $fixedcid); }
/** * Delete user function, it's run twice because of scemantics with * old freepbx but it's harmless * @param string $extension The extension number * @param bool $editmode If we are in edit mode or not */ public function delUser($extension, $editmode = false) { if (!$editmode) { if (!function_exists('findmefollow_destinations')) { $this->FreePBX->Modules->loadFunctionsInc('findmefollow'); } findmefollow_del($extension); } }
/** * @verb PUT * @uri /findmefollow/users/:id */ function put_findmefollow_users_id($params) { findmefollow_del($params['id']); return findmefollow_add($params['id'], $params['strategy'], $params['grptime'], $params['grplist'], $params['postdest'], $params['grppre'], $params['annmsg_id'], $params['dring'], $params['needsconf'], $params['remotealert_id'], $params['toolate_id'], $params['ringing'], $params['pre_ring'], $params['ddial'], $params['changecid'], $params['fixedcid']); }