Beispiel #1
0
}
$user_id = 0;
$tsi = trim(@$_REQUEST['tsi']);
$to = trim(@$_REQUEST['to']);
$resolution = (int) trim(@$_REQUEST['res']);
$user = trim(@$_REQUEST['user']);
$sidnum = trim(@$_REQUEST['cidnum']);
$local_file = trim(@$_REQUEST['file']);
if ($user != '') {
    $user_id = get_user_id($user);
}
# check if user is known to GS
#
if ($user_id < 1) {
    gs_log(GS_LOG_NOTICE, "User \"{$user}\" unknown");
    die_not_allowed('You are not allowed to send a fax.');
}
# get email address and PIN
#
$email = gs_user_email_address_get($user);
$pin = gs_user_pin_get($user);
# use default fax TSI if not provided in http request
#
if ($tsi == '') {
    $fax_tsis_global = explode(',', gs_get_conf('GS_FAX_TSI'));
    if (array_key_exists(0, $fax_tsis_global) && $fax_tsis_global[0] != '') {
        $tsi = $fax_tsis_global[0];
    } else {
        $tsi = '0';
    }
}
Beispiel #2
0
if (gs_get_conf('GS_LVM_USER_6_DIGIT_INT')) {
    # hack to compare user names as if they were integers
    # padded to 6 digits
    $user_code = lTrim($user_code, '0');
    if (strLen($user_code) < 6) {
        $user_code = str_pad($user_code, 6, '0', STR_PAD_LEFT);
    }
}
$user = @gs_user_get($user_code);
if (isGsError($user)) {
    gs_log(GS_LOG_NOTICE, $user->getMsg());
    die_invalid($user->getMsg());
}
if ($user['nobody_index'] > 0) {
    gs_log(GS_LOG_NOTICE, 'Nobody user. Not allowed to init a call.');
    die_not_allowed('Nobody user. Not allowed to init a call.');
}
$db = gs_db_master_connect();
if (!$db) {
    gs_log(GS_LOG_NOTICE, 'Could not connect to database.');
    die_error('Could not connect to database.');
}
$is_foreign = (bool) (int) $db->executeGetOne('SELECT `is_foreign` FROM `hosts` WHERE `id`=' . $user['host_id']);
$user_ext_obj = new CanonicalPhoneNumber(gs_get_conf('GS_CANONIZE_LOCAL_BRANCH') . $user['ext']);
$user_external_numbers = null;
#####################################################################
# from number
#####################################################################
if (!isset($_REQUEST['from'])) {
    $from_num = null;
    # i.e. use default