if (count($members_clip) <= 0) {
        $disabled['clip'] = ' disabled';
    }
    if (count($members_clir) <= 0) {
        $disabled['clir'] = ' disabled';
    }
    if (count($members_cw) <= 0) {
        $disabled['cw'] = ' disabled';
    }
}
if (@$_REQUEST['action'] == 'save') {
    $clir_internal = @$_REQUEST['clir-internal'] == 'yes' ? 'yes' : 'no';
    $clir_external = @$_REQUEST['clir-external'] == 'yes' ? 'yes' : 'no';
    if ($disabled['clir'] == '') {
        gs_clir_activate($_SESSION['sudo_user']['name'], 'internal', $clir_internal);
        gs_clir_activate($_SESSION['sudo_user']['name'], 'external', $clir_external);
    }
    if ($disabled['cw'] == '') {
        $cw = !!@$_REQUEST['callwaiting'];
        # setting this reboots phone, so check if it has really changed
        $cw_old = gs_callwaiting_get($_SESSION['sudo_user']['name']);
        if (!isGsError($cw_old)) {
            if ($cw != $cw_old) {
                gs_callwaiting_activate($_SESSION['sudo_user']['name'], $cw);
            }
        }
    }
    if ($disabled['clip'] == '') {
        if (isset($_REQUEST['callerid_ext'])) {
            $callerid_num = $_REQUEST['callerid_ext'];
            $ok = gs_user_callerid_set($_SESSION['sudo_user']['name'], $callerid_num, 'external');
Example #2
0
    $user_name = $db->executeGetOne("SELECT `user` FROM `users` WHERE `id`='" . $db->escape($user_id) . "'");
    if ($type == "callwaiting" && $show_cw) {
        $oldresult = (int) $db->executeGetOne("SELECT `active` FROM `callwaiting` WHERE `user_id`=" . $user_id);
        if ($state == "yes" || $state == "no") {
            if ($oldresult == 1 && $state == "no") {
                gs_callwaiting_activate($user_name, 0);
            } else {
                if ($oldresult == 0 && $state == "yes") {
                    gs_callwaiting_activate($user_name, 1);
                }
            }
        }
    } else {
        if ($show_clir && ($type == "internal" || $type == "external")) {
            if ($state == "no" || $state == "yes") {
                gs_clir_activate($user_name, $type, $state);
            }
        } else {
            if ($type == "cidint" && $show_clip) {
                gs_user_callerid_set($user_name, $state, "internal");
            } else {
                if ($type == "cidext" && $show_clip) {
                    gs_user_callerid_set($user_name, $state, "external");
                } else {
                    _err("Forbidden");
                }
            }
        }
    }
    $type = false;
}