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 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; }
} if (isset($device_list['callgroup'])) { $_REQUEST['devinfo_callgroup'] = $device_list['callgroup']; } if (isset($device_list['pickupgroup'])) { $_REQUEST['devinfo_pickupgroup'] = $device_list['pickupgroup']; } if (isset($device_list['allow'])) { $_REQUEST['devinfo_allow'] = $device_list['allow']; } if (isset($device_list['disallow'])) { $_REQUEST['devinfo_disallow'] = $device_list['disallow']; } $actions_taken = true; debug("core_users_edit({$ext}, {$user_add_arr})"); core_users_edit($ext, $user_mod_arr); // doesn't return a return code, so hope it worked:-) debug("core_devices_del({$ext}, true)"); debug("core_devices_add({$ext},'sip'," . $device_list['dial'] . ",'fixed',{$ext}," . $device_list['description'] . "," . $device_list['emergency_cid'] . ",true)"); core_devices_del($ext, true); core_devices_add($ext, 'sip', $device_list['dial'], 'fixed', $ext, $device_list['description'], $device_list['emergency_cid'], true); // doesn't return a return code, so hope it worked:-) debug("voicemail_mailbox_del({$ext})"); debug("voicemail_mailbox_add({$ext}, {$user_mod_arr})"); voicemail_mailbox_del($ext); voicemail_mailbox_add($ext, $user_mod_arr); } } if (in_array('addvm', $actions)) { $actions_taken = true; if (($existing_vmbox = voicemail_mailbox_get($ext)) == null) {