public function doConfigPageInit($page)
 {
     $request = $_REQUEST;
     isset($request['action']) ? $action = $request['action'] : ($action = '');
     isset($request['view']) ? $view = $request['view'] : ($view = 'form');
     //the extension we are currently displaying
     $account = isset($request['account']) ? $request['account'] : '';
     $extdisplay = isset($request['extdisplay']) && $request['extdisplay'] != '' ? $request['extdisplay'] : $account;
     $orig_account = isset($request['orig_account']) ? $request['orig_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 ($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 ($this->addConference($account, $request['name'], $request['userpin'], $request['adminpin'], $request['options'], $request['joinmsg_id'], $music, $users, $request['adminpin']) !== false) {
                     needreload();
                 }
                 break;
             case "delete":
                 $this->deleteConference($extdisplay);
                 needreload();
                 break;
             case "edit":
                 //just delete and re-add
                 //check to see if the room number has changed
                 if ($orig_account != '' && $orig_account != $account) {
                     $conflict_url = array();
                     $usage_arr = framework_check_extension_usage($account);
                     if (!empty($usage_arr)) {
                         $conflict_url = framework_display_extension_usage_alert($usage_arr);
                         break;
                     } else {
                         $this->deleteConference($orig_account);
                         $request['extdisplay'] = $account;
                         //redirect to the new ext
                         $old = conferences_getdest($orig_account);
                         $new = conferences_getdest($account);
                         framework_change_destination($old[0], $new[0]);
                     }
                 } else {
                     $this->deleteConference($account);
                 }
                 $this->addConference($account, $request['name'], $request['userpin'], $request['adminpin'], $request['options'], $request['joinmsg_id'], $music, $users, $request['language']);
                 needreload();
                 break;
         }
     }
 }
예제 #2
0
 public function doConfigPageInit($page)
 {
     $request = $_REQUEST;
     $dispnum = 'vmblast';
     //used for switch on config.php
     $action = isset($request['action']) ? $request['action'] : '';
     //the extension we are currently displaying
     $account = isset($request['account']) ? $request['account'] : '';
     $extdisplay = isset($request['extdisplay']) ? ltrim($request['extdisplay'], 'GRP-') : ($account != '' ? $account : '');
     $description = isset($request['description']) ? $request['description'] : '';
     $audio_label = isset($request['audio_label']) ? $request['audio_label'] : -1;
     $password = isset($request['password']) ? $request['password'] : '';
     $default_group = isset($request['default_group']) ? $request['default_group'] : '0';
     $vmblast_list = isset($request['vmblast_list']) ? $request['vmblast_list'] : '';
     $view = isset($request['view']) ? $request['view'] : 'form';
     // do if we are submitting a form
     if (isset($request['action'])) {
         //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 {
             //add group
             if ($action == 'addGRP') {
                 $conflict_url = array();
                 $usage_arr = framework_check_extension_usage($account);
                 if (!empty($usage_arr)) {
                     $conflict_url = framework_display_extension_usage_alert($usage_arr);
                 } else {
                     if (vmblast_add($account, $vmblast_list, $description, $audio_label, $password, $default_group)) {
                         //$request['action'] = 'delGRP';
                         $_REQUEST['view'] = 'form';
                         $_REQUEST['extdisplay'] = $account;
                         needreload();
                         //redirect_standard('extdisplay', 'view');
                     }
                 }
             }
             //del group
             if ($action == 'delGRP') {
                 vmblast_del($account);
                 needreload();
             }
             //edit group - just delete and then re-add the extension
             if ($action == 'editGRP') {
                 vmblast_del($account);
                 vmblast_add($account, $vmblast_list, $description, $audio_label, $password, $default_group);
                 needreload();
             }
         }
     }
 }
예제 #3
0
function fbilling_configpageinit($pagename)
{
    global $currentcomponent;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
    $tech_hardware = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null;
    if ($pagename != 'users' && $pagename != 'extensions') {
        return true;
    }
    if ($pagename != 'users' && $pagename != 'extensions') {
        return true;
    }
    if ($tech_hardware != null || $extdisplay != '' || $pagename == 'users') {
        $msgSelectTenant = _("Please select tenant for this extension");
        $msgSelectPermission = _("Please select permission for this extension");
        // since current selectbox does not offer js validation, we are putting permission and tenant validation in credit input
        $js = '
        if (document.getElementById("fbilling_tenant").value == "") {
            document.getElementById("fbilling_tenant").focus();
            return true;
        }
        if (document.getElementById("fbilling_permission").value == "") {
            document.getElementById("fbilling_permission").focus();
            return true;
        }
        ';
        $currentcomponent->addjsfunc('validateTenantPermission()', $js);
        $js = 'document.getElementById("fbilling_alias").innerHTML = document.getElementById("name").value; return true';
        $currentcomponent->addjsfunc('addFbillingAlias()', $js);
    }
    if ($tech_hardware != null) {
        fbilling_applyhooks();
    } elseif ($action == "add") {
        if ($_REQUEST['display'] == 'users') {
            $usage_arr = framework_check_extension_usage($_REQUEST['extension']);
            if (empty($usage_arr)) {
                $currentcomponent->addprocessfunc('fbilling_configprocess', 1);
            } else {
                fbilling_applyhooks();
            }
        } else {
            $currentcomponent->addprocessfunc('fbilling_configprocess', 1);
        }
    } elseif ($extdisplay != '' || $pagename == 'users') {
        fbilling_applyhooks();
        $currentcomponent->addprocessfunc('fbilling_configprocess', 1);
    }
}
/**
 * returns a list of URLs that represent a conflict with the past in extension or null if none
 * @param string  extension number to check for conflicts
 * @return mixed  returns a string with one or more URLs to the conflicting extesion(s) or null
 */
function framework_get_conflict_url_helper($account)
{
    $usage_arr = framework_check_extension_usage($account);
    if (!empty($usage_arr)) {
        $conflict_url = framework_display_extension_usage_alert($usage_arr, false, false);
        return implode('<br />', $conflict_url);
    } else {
        return null;
    }
}
예제 #5
0
$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":
            conferences_del($extdisplay);
            needreload();
            redirect_standard();
            break;
        case "edit":
            //just delete and re-add
            conferences_del($account);
}
$featurecodes = featurecodes_getAllFeaturesDetailed();
$exten_conflict_arr = array();
$conflict_url = array();
$exten_arr = array();
foreach ($featurecodes as $result) {
    /* if the feature code starts with "In-Call Asterisk" then it is not conflicting with normal feature codes. This would be featuremap and future
     * application map type codes. This is a real kludge and instead there should be a category associated with these codes when the feature code
     * is created. However, the logic would be the same, thus my willingness to put in such a kludge for now. When the schema changes to add this
     * then this can be updated to reflect that
     */
    if ($result['featureenabled'] == 1 && $result['moduleenabled'] == 1 && substr($result['featuredescription'], 0, 16) != 'In-Call Asterisk') {
        $exten_arr[] = $result['customcode'] != '' ? $result['customcode'] : $result['defaultcode'];
    }
}
$usage_arr = framework_check_extension_usage($exten_arr);
unset($usage_arr['featurecodeadmin']);
if (!empty($usage_arr)) {
    $conflict_url = framework_display_extension_usage_alert($usage_arr, false, false);
}
$conflicterror = '';
if (!empty($conflict_url)) {
    $str = _("You have feature code conflicts with extension numbers in other modules. This will result in unexpected and broken behavior.");
    $conflicterror .= "<script>javascript:alert('{$str}')</script>";
    $conflicterror .= "<div class='alert alert-danger'>" . _("Feature Code Conflicts with other Extensions") . "</div>";
    $conflicterror .= implode('<br />', $conflict_url);
    // Create hash of conflicting extensions
    foreach ($usage_arr as $details) {
        foreach (array_keys($details) as $exten_conflict) {
            $exten_conflict_arr[$exten_conflict] = true;
        }
예제 #7
0
/** create a comprehensive list of all extensions conflicts
 * @return array    an array of the destinations that are empty, orphaned or custom
 * @description     This returns an array structure with information about all
 *                  extension numbers that are in conflict. This means the same number
 *                  is being used by 2 or more modules and the results will be ambiguous
 *                  which one will be ignored when dialed. See the code for the
 *                  structure of the retured array.
 */
function framework_list_extension_conflicts($module_hash = false)
{
    global $active_modules;
    if (!is_array($module_hash)) {
        $module_hash = $active_modules;
    }
    $exten_list = framework_check_extension_usage(true, $module_hash);
    /** Bookkeeping hashes
     *  full_hash[]     will contain the first extension encountered
     *  conflict_hash[] will contain any subsequent extensions if conflicts
     *
     *  If there are conflicts, the full set is what is in conflict_hash + the
     *  first extension encoutnered in full_hash[]
     */
    $full_hash = array();
    $conflict_hash = array();
    foreach ($exten_list as $mod => $mod_extens) {
        foreach ($mod_extens as $exten => $details) {
            if (!isset($full_hash[$exten])) {
                $full_hash[$exten] = $details;
            } else {
                $conflict_hash[] = array($exten => $details);
            }
        }
    }
    // extract conflicting remaining extension from full_hash but needs to be unique
    //
    if (!empty($conflict_hash)) {
        $other_conflicts = array();
        foreach ($conflict_hash as $item) {
            foreach (array_keys($item) as $exten) {
                $other_conflicts[$exten] = $full_hash[$exten];
            }
        }
        foreach ($other_conflicts as $exten => $details) {
            $conflict_hash[] = array($exten => $details);
        }
        usort($conflict_hash, "_framework_sort_exten");
        return $conflict_hash;
    }
}
예제 #8
0
function voicemail_configprocess()
{
    //create vars from the request
    extract($_REQUEST);
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    //if submitting form, update database
    switch ($action) {
        case "add":
            if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                $usage_arr = framework_check_extension_usage($_REQUEST['extension']);
                if (!empty($usage_arr)) {
                    $GLOBALS['abort'] = true;
                } else {
                    voicemail_mailbox_add($extdisplay, $_REQUEST);
                    needreload();
                }
            }
            break;
        case "del":
            // call remove before del, it needs to know context info
            //
            voicemail_mailbox_remove($extdisplay);
            voicemail_mailbox_del($extdisplay);
            needreload();
            break;
        case "edit":
            if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                voicemail_mailbox_del($extdisplay);
                if ($vm != 'disabled') {
                    voicemail_mailbox_add($extdisplay, $_REQUEST);
                }
                needreload();
            }
            break;
    }
}
예제 #9
0
     if (!empty($usage_arr)) {
         $conflict_url = framework_display_extension_usage_alert($usage_arr);
         $custom_exten = '';
     } else {
         if (customappsreg_customextens_add($custom_exten, $description, $notes)) {
             needreload();
             redirect_standard();
         } else {
             $custom_exten = '';
         }
     }
     break;
 case 'edit':
     $conflict_url = array();
     if ($old_custom_exten != $custom_exten) {
         $usage_arr = framework_check_extension_usage($custom_exten);
         if (!empty($usage_arr)) {
             $conflict_url = framework_display_extension_usage_alert($usage_arr);
         }
     }
     if (empty($conflict_url)) {
         if (customappsreg_customextens_edit($old_custom_exten, $custom_exten, $description, $notes)) {
             needreload();
             redirect_standard('extdisplay');
         }
     }
     break;
 case 'delete':
     customappsreg_customextens_delete($custom_exten);
     needreload();
     redirect_standard();
예제 #10
0
 public function doConfigPageInit($page)
 {
     $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
     $miscapp_id = isset($_REQUEST['miscapp_id']) ? $_REQUEST['miscapp_id'] : false;
     $description = isset($_REQUEST['description']) ? $_REQUEST['description'] : '';
     $ext = isset($_REQUEST['ext']) ? $_REQUEST['ext'] : '';
     $dest = isset($_REQUEST['dest']) ? $_REQUEST['dest'] : '';
     $enabled = isset($_REQUEST['enabled']) ? !empty($_REQUEST['enabled']) : true;
     if (isset($_REQUEST['goto0']) && $_REQUEST['goto0']) {
         $dest = $_REQUEST[$_REQUEST['goto0'] . '0'];
     }
     switch ($action) {
         case 'add':
             $conflict_url = array();
             $usage_arr = framework_check_extension_usage($ext);
             if (!empty($usage_arr)) {
                 $conflict_url = framework_display_extension_usage_alert($usage_arr);
             } else {
                 $id = $this->add($description, $ext, $dest);
                 needreload();
                 redirect('config.php?display=miscapps&type=setup&extdisplay=' . $id);
             }
             break;
             // TODO: need to lookup the current extension based on the id and if it is changing
             //       do a check to make sure it doesn't conflict. If not changing, np.
             //
         // TODO: need to lookup the current extension based on the id and if it is changing
         //       do a check to make sure it doesn't conflict. If not changing, np.
         //
         case 'edit':
             $fc = new \featurecode('miscapps', 'miscapp_' . $miscapp_id);
             $conflict_url = array();
             if ($fc->getDefault() != $ext) {
                 $usage_arr = framework_check_extension_usage($ext);
                 if (!empty($usage_arr)) {
                     $conflict_url = framework_display_extension_usage_alert($usage_arr);
                 }
             }
             if (empty($conflict_url)) {
                 $this->edit($miscapp_id, $description, $ext, $dest, $enabled);
                 needreload();
                 redirect_standard('extdisplay');
             }
             break;
         case 'delete':
             $this->delete($_REQUEST['id']);
             needreload();
             redirect_standard();
             break;
     }
 }
예제 #11
0
 public function doConfigPageInit($page)
 {
     $request = $_REQUEST;
     isset($request['action']) ? $action = $request['action'] : ($action = '');
     //the extension we are currently displaying
     isset($request['extdisplay']) ? $extdisplay = $request['extdisplay'] : ($extdisplay = '');
     isset($request['account']) ? $account = $request['account'] : ($account = '');
     isset($request['grptime']) ? $grptime = $request['grptime'] : ($grptime = '');
     isset($request['progress']) ? $progress = $request['progress'] : ($progress = 'yes');
     isset($request['grppre']) ? $grppre = $request['grppre'] : ($grppre = '');
     isset($request['strategy']) ? $strategy = $request['strategy'] : ($strategy = '');
     isset($request['annmsg_id']) ? $annmsg_id = $request['annmsg_id'] : ($annmsg_id = '');
     isset($request['description']) ? $description = $request['description'] : ($description = '');
     isset($request['alertinfo']) ? $alertinfo = $request['alertinfo'] : ($alertinfo = '');
     isset($request['needsconf']) ? $needsconf = $request['needsconf'] : ($needsconf = '');
     isset($request['cwignore']) ? $cwignore = $request['cwignore'] : ($cwignore = '');
     isset($request['cpickup']) ? $cpickup = $request['cpickup'] : ($cpickup = '');
     isset($request['cfignore']) ? $cfignore = $request['cfignore'] : ($cfignore = '');
     isset($request['remotealert_id']) ? $remotealert_id = $request['remotealert_id'] : ($remotealert_id = '0');
     isset($request['toolate_id']) ? $toolate_id = $request['toolate_id'] : ($toolate_id = '');
     isset($request['ringing']) ? $ringing = $request['ringing'] : ($ringing = '');
     isset($request['changecid']) ? $changecid = $request['changecid'] : ($changecid = 'default');
     isset($request['fixedcid']) ? $fixedcid = $request['fixedcid'] : ($fixedcid = '');
     isset($request['recording']) ? $recording = $request['recording'] : ($recording = 'dontcare');
     if (isset($request['goto0']) && isset($request[$request['goto0'] . "0"])) {
         $goto = $request[$request['goto0'] . "0"];
     } else {
         $goto = '';
     }
     if (isset($request["grplist"])) {
         $grplist = explode("\n", $request["grplist"]);
         if (!$grplist) {
             $grplist = null;
         }
         foreach (array_keys($grplist) as $key) {
             //trim it
             $grplist[$key] = trim($grplist[$key]);
             // remove invalid chars
             $grplist[$key] = preg_replace("/[^0-9#*]/", "", $grplist[$key]);
             if ($grplist[$key] == ltrim($extdisplay, 'GRP-') . '#') {
                 $grplist[$key] = rtrim($grplist[$key], '#');
             }
             // remove blanks
             if ($grplist[$key] == "") {
                 unset($grplist[$key]);
             }
         }
         // check for duplicates, and re-sequence
         $grplist = array_values(array_unique($grplist));
     }
     // do if we are submitting a form
     if (isset($request['action'])) {
         //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 {
             //add group
             if ($action == 'addGRP') {
                 $conflict_url = array();
                 $usage_arr = framework_check_extension_usage($account);
                 if (!empty($usage_arr)) {
                     $conflict_url = framework_display_extension_usage_alert($usage_arr);
                 } elseif (ringgroups_add($account, $strategy, $grptime, implode("-", $grplist), $goto, $description, $grppre, $annmsg_id, $alertinfo, $needsconf, $remotealert_id, $toolate_id, $ringing, $cwignore, $cfignore, $changecid, $fixedcid, $cpickup, $recording, $progress)) {
                     // save the most recent created destination which will be picked up by
                     //
                     $this_dest = ringgroups_getdest($account);
                     \fwmsg::set_dest($this_dest[0]);
                     needreload();
                     $_REQUEST['extdisplay'] = $account;
                 }
             }
             //del group
             if ($action == 'delGRP') {
                 ringgroups_del($account);
                 needreload();
                 unset($_REQUEST['view']);
                 unset($_REQUEST['extdisplay']);
             }
             //edit group - just delete and then re-add the extension
             if ($action == 'edtGRP') {
                 ringgroups_del($account);
                 ringgroups_add($account, $strategy, $grptime, implode("-", $grplist), $goto, $description, $grppre, $annmsg_id, $alertinfo, $needsconf, $remotealert_id, $toolate_id, $ringing, $cwignore, $cfignore, $changecid, $fixedcid, $cpickup, $recording, $progress);
                 needreload();
                 $_REQUEST['extdisplay'] = $account;
             }
         }
     }
 }
예제 #12
0
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;
}
예제 #13
0
 public function doConfigPageInit($page)
 {
     $conf = \FreePBX::Config();
     $ramp_conf = $conf->get_conf_settings();
     foreach ($ramp_conf as $key => $value) {
         $amp_conf[$key] = $value['value'];
     }
     $request = $_REQUEST;
     $action = isset($request['action']) ? $request['action'] : null;
     $extdisplay = isset($request['extdisplay']) ? $request['extdisplay'] : null;
     if ($page == "extensions" || $page == "users") {
         // Catch the POST.
         if (isset($request['extdisplay']) && isset($request['intercom_override'])) {
             if (preg_match('/override=(.+)/', $request['intercom_override'], $match)) {
                 $this->setOverride($request['extdisplay'], $match[1]);
             }
         }
     }
     if ($page == "paging") {
         $get_vars = array('action' => '', 'announce' => '', 'conflict_url' => '', 'default_group' => 0, 'description' => '', 'display' => 'paging', 'duplex' => 0, 'extdisplay' => '', 'force_page' => 0, 'pagegrp' => '', 'pagelist' => '', 'pagenbr' => '', 'Submit' => '', 'announcement' => '', 'type' => 'tool');
         foreach ($get_vars as $k => $v) {
             $vars[$k] = isset($request[$k]) ? $request[$k] : $v;
         }
         $vars['pagenbr'] = trim($vars['pagenbr']);
         if ($vars['Submit'] == _('Delete')) {
             $vars['action'] = 'delete';
             $request['action'] = 'delete';
         }
         $vars['announce'] = $vars['announcement'];
         //action actions
         switch ($vars['action']) {
             case 'delete':
                 paging_del($vars['extdisplay']);
                 break;
             case 'submit':
                 //TODO: issue, we are deleting and adding at the same time so remeber later to check
                 //      if we are deleting a destination
                 $usage_arr = array();
                 if ($vars['pagegrp'] != $vars['pagenbr']) {
                     $usage_arr = framework_check_extension_usage($vars['pagenbr']);
                 }
                 if ($usage_arr) {
                     $vars['conflict_url'] = framework_display_extension_usage_alert($usage_arr);
                     break;
                 } else {
                     //limit saved devices to PAGINGMAXPARTICIPANTS
                     if (isset($amp_conf['PAGINGMAXPARTICIPANTS']) && $amp_conf['PAGINGMAXPARTICIPANTS']) {
                         if (!empty($vars['pagelist'])) {
                             $vars['pagelist'] = array_slice($vars['pagelist'], 0, $amp_conf['PAGINGMAXPARTICIPANTS']);
                         }
                     }
                     paging_modify($vars['pagegrp'], $vars['pagenbr'], $vars['pagelist'], $vars['force_page'], $vars['duplex'], $vars['description'], $vars['default_group'], $vars['announcement']);
                     $request['action'] = $vars['action'] = 'modify';
                     if ($vars['extdisplay'] == '' || $vars['pagegrp'] != $vars['pagenbr']) {
                         $request['extdisplay'] = $vars['extdisplay'] = $vars['pagenbr'];
                     }
                     $_REQUEST['extdisplay'] = $vars['extdisplay'];
                 }
                 break;
             case 'save_settings':
                 $def = paging_get_autoanswer_defaults(true);
                 $doptions = 'b(autoanswer^s^1(${ALERTINFO},${CALLINFO}))';
                 if (ctype_digit($vars['announce'])) {
                     $r = recordings_get($vars['announce']);
                     if ($r) {
                         $vars['announce'] = $r['filename'];
                     } else {
                         $vars['announce'] = 'beep';
                     }
                     $a = 'A(' . $vars['announce'] . ')' . $doptions;
                 } elseif ($vars['announce'] == 'none') {
                     $a = "A(){$doptions}";
                 } elseif ($vars['announce'] == 'beep') {
                     $a = "A(beep){$doptions}";
                 }
                 $this->setDropSilence($state, !empty($vars['drop_silence']));
                 paging_set_autoanswer_defaults(array('DOPTIONS' => $a));
                 needreload();
                 break;
             case 'getJSON':
                 header('Content-Type: application/json');
                 switch ($request['jdata']) {
                     case 'grid':
                         $pagelist = paging_list();
                         $rdata = array();
                         foreach ($pagelist as $pg) {
                             $rdata[] = array('description' => $pg['description'], 'page_group' => $pg['page_group'], 'is_default' => $pg['is_default'], 'link' => array($pg['description'], $pg['page_group']));
                         }
                         echo json_encode($rdata);
                         exit;
                         break;
                     default:
                         echo json_encode(array('error' => _("Unknown Request")));
                         exit;
                         break;
                 }
                 break;
             default:
                 break;
         }
     }
 }
예제 #14
0
파일: page.paging.php 프로젝트: hardikk/HNH
        paging_show(null, $display, $type);
        break;
    case "delete":
        paging_del($selection);
        redirect_standard();
        break;
    case "modify":
        paging_sidebar($selection, $type, $display);
        paging_show($selection, $display, $type);
        break;
    case "submit":
        //TODO: issue, we are deleting and adding at the same time so remeber later to check
        //      if we are deleting a destination
        $usage_arr = array();
        if (trim($pagegrp) != trim($pagenbr)) {
            $usage_arr = framework_check_extension_usage($pagenbr);
        }
        if (!empty($usage_arr)) {
            $conflict_url = array();
            $conflict_url = framework_display_extension_usage_alert($usage_arr);
            paging_sidebar($selection, $type, $display);
            paging_show($pagegrp, $display, $type, $conflict_url);
        } else {
            paging_modify($pagegrp, $pagenbr, $pagelist, $force_page, $duplex, $description, $default_group);
            redirect_standard();
        }
        break;
    default:
        paging_sidebar($selection, $type, $display);
        paging_text();
}
예제 #15
0
 public function doConfigPageInit($page)
 {
     $request = $_REQUEST;
     isset($request['action']) ? $action = $request['action'] : ($action = '');
     //the extension we are currently displaying
     isset($request['extdisplay']) ? $extdisplay = $request['extdisplay'] : ($extdisplay = '');
     isset($request['account']) ? $account = $request['account'] : ($account = '');
     isset($request['name']) ? $name = $request['name'] : ($name = '');
     isset($request['password']) ? $password = $request['password'] : ($password = '');
     isset($request['agentannounce_id']) ? $agentannounce_id = $request['agentannounce_id'] : ($agentannounce_id = '');
     isset($request['prefix']) ? $prefix = $request['prefix'] : ($prefix = '');
     isset($request['alertinfo']) ? $alertinfo = $request['alertinfo'] : ($alertinfo = '');
     isset($request['joinannounce_id']) ? $joinannounce_id = $request['joinannounce_id'] : ($joinannounce_id = '');
     $maxwait = isset($request['maxwait']) ? $request['maxwait'] : '';
     $cwignore = isset($request['cwignore']) ? $request['cwignore'] : '0';
     $queuewait = isset($request['queuewait']) ? $request['queuewait'] : '0';
     $rtone = isset($request['rtone']) ? $request['rtone'] : '0';
     $qregex = isset($request['qregex']) ? $request['qregex'] : '';
     $weight = isset($request['weight']) ? $request['weight'] : '0';
     $autofill = isset($request['autofill']) ? $request['autofill'] : 'no';
     $togglehint = isset($request['togglehint']) ? $request['togglehint'] : '0';
     $dynmemberonly = isset($request['dynmemberonly']) ? $request['dynmemberonly'] : 'no';
     $use_queue_context = isset($request['use_queue_context']) ? $request['use_queue_context'] : '0';
     $exten_context = "from-queue";
     $qnoanswer = isset($request['qnoanswer']) ? $request['qnoanswer'] : '0';
     $callconfirm = isset($request['callconfirm']) ? $request['callconfirm'] : '0';
     $callconfirm_id = isset($request['callconfirm_id']) ? $request['callconfirm_id'] : '';
     $monitor_type = isset($request['monitor_type']) ? $request['monitor_type'] : '';
     $monitor_heard = isset($request['monitor_heard']) ? $request['monitor_heard'] : '0';
     $monitor_spoken = isset($request['monitor_spoken']) ? $request['monitor_spoken'] : '0';
     $answered_elsewhere = isset($request['answered_elsewhere']) ? $request['answered_elsewhere'] : '0';
     $skip_joinannounce = isset($request['skip_joinannounce']) ? $request['skip_joinannounce'] : '';
     //cron code
     $cron_schedule = isset($request['cron_schedule']) ? $request['cron_schedule'] : 'never';
     $cron_minute = isset($request['cron_minute']) ? $request['cron_minute'] : '';
     $cron_hour = isset($request['cron_hour']) ? $request['cron_hour'] : '';
     $cron_dow = isset($request['cron_dow']) ? $request['cron_dow'] : '';
     $cron_month = isset($request['cron_month']) ? $request['cron_month'] : '';
     $cron_dom = isset($request['cron_dom']) ? $request['cron_dom'] : '';
     $cron_random = isset($request['cron_random']) ? $request['cron_random'] : false;
     if (isset($request['goto0']) && isset($request[$request['goto0'] . "0"])) {
         $goto = $request[$request['goto0'] . "0"];
     } else {
         $goto = '';
     }
     if (isset($request["members"])) {
         $members = explode("\n", $request["members"]);
         if (!$members) {
             $members = null;
         }
         foreach (array_keys($members) as $key) {
             //trim it
             $members[$key] = trim($members[$key]);
             // check if an agent (starts with a or A)
             $exten_prefix = strtoupper(substr($members[$key], 0, 1));
             $this_member = preg_replace("/[^0-9#\\,*]/", "", $members[$key]);
             switch ($exten_prefix) {
                 case 'A':
                     $exten_type = 'Agent';
                     break;
                 case 'P':
                     $exten_type = 'PJSIP';
                     break;
                 case 'S':
                     $exten_type = 'SIP';
                     break;
                 case 'X':
                     $exten_type = 'IAX2';
                     break;
                 case 'Z':
                     $exten_type = 'ZAP';
                     break;
                 case 'D':
                     $exten_type = 'DAHDI';
                     break;
                 default:
                     $exten_type = 'Local';
             }
             $penalty_pos = strrpos($this_member, ",");
             if ($penalty_pos === false) {
                 $penalty_val = 0;
             } else {
                 $penalty_val = substr($this_member, $penalty_pos + 1);
                 // get penalty
                 $this_member = substr($this_member, 0, $penalty_pos);
                 // clean up ext
                 $this_member = preg_replace("/[^0-9#*]/", "", $this_member);
                 //clean out other ,'s
                 $penalty_val = preg_replace("/[^0-9*]/", "", $penalty_val);
                 // get rid of #'s if there
                 $penalty_val = $penalty_val == "" ? 0 : $penalty_val;
             }
             // remove blanks // prefix with the channel
             if (empty($this_member)) {
                 unset($members[$key]);
             } else {
                 switch ($exten_type) {
                     case 'Agent':
                     case 'SIP':
                     case 'IAX2':
                     case 'PJSIP':
                     case 'ZAP':
                     case 'DAHDI':
                         $members[$key] = "{$exten_type}/{$this_member},{$penalty_val}";
                         break;
                     case 'Local':
                         $members[$key] = "{$exten_type}/{$this_member}@{$exten_context}/n,{$penalty_val}";
                 }
             }
         }
         // check for duplicates, and re-sequence
         // $members = array_values(array_unique($members));
     }
     if (isset($request["dynmembers"])) {
         $dynmembers = explode("\n", $request["dynmembers"]);
         if (!$dynmembers) {
             $dynmembers = null;
         }
     }
     // do if we are submitting a form
     if (isset($request['action'])) {
         //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);
                     } else {
                         queues_add($account, $name, $password, $prefix, $goto, $agentannounce_id, $members, $joinannounce_id, $maxwait, $alertinfo, $cwignore, $qregex, $queuewait, $use_queue_context, $dynmembers, $dynmemberonly, $togglehint, $qnoanswer, $callconfirm, $callconfirm_id, $monitor_type, $monitor_heard, $monitor_spoken, $answered_elsewhere);
                         needreload();
                         $this_dest = queues_getdest($account);
                         \fwmsg::set_dest($this_dest[0]);
                         $_REQUEST['extdisplay'] = $account;
                     }
                     break;
                 case "delete":
                     queues_del($account);
                     unset($_REQUEST['view']);
                     unset($_REQUEST['extdisplay']);
                     needreload();
                     break;
                 case "edit":
                     //just delete and re-add
                     queues_del($account);
                     queues_add($account, $name, $password, $prefix, $goto, $agentannounce_id, $members, $joinannounce_id, $maxwait, $alertinfo, $cwignore, $qregex, $queuewait, $use_queue_context, $dynmembers, $dynmemberonly, $togglehint, $qnoanswer, $callconfirm, $callconfirm_id, $monitor_type, $monitor_heard, $monitor_spoken, $answered_elsewhere);
                     needreload();
                     break;
             }
         }
     }
 }
//  Copyright (C) 2011 Mikael Carlsson (mickecarlsson at gmail dot com)
//
$dispnum = 'extensionsettings';
$extension = _("Extension");
$vmxlocator = _("VmX Locator");
$followme = _("Follow-Me");
$callstatus = _("Call status");
$status = _("Status");
$html_txt_arr = array();
$module_select = array();
global $active_modules;
$html_txt = '<div class="content">';
if (!$extdisplay) {
    $html_txt .= '<br><h2>' . _("FreePBX Extension Settings") . '</h2>';
}
$full_list = framework_check_extension_usage(true);
$full_list = is_array($full_list) ? $full_list : array();
// Dont waste astman calls, get all family keys in one call
// Get all AMPUSER settings
$ampuser = $astman->database_show("AMPUSER");
// Get all CW settings
$cwsetting = $astman->database_show("CW");
// get all CF settings
$cfsetting = $astman->database_show("CF");
// get all CFB settings
$cfbsetting = $astman->database_show("CFB");
// get all CFU settings
$cfusetting = $astman->database_show("CFU");
// get all DND settings
$dndsetting = $astman->database_show("DND");
foreach ($full_list as $key => $value) {