Esempio n. 1
0
$var['attachformat'] = !empty($var['attachformat']) ? $var['attachformat'] : 'pdf';
$var['remotestationid'] = !empty($var['remotestationid']) ? $var['remotestationid'] : '';
//double check some of the options
foreach ($var as $k => $v) {
    if (!is_string($k)) {
        continue;
    }
    switch ($k) {
        case 'file':
            if (!file_exists($var['file'])) {
                die_fax('email-fax dying, file ' . $var['file'] . ' not found!');
            }
            break;
        case 'to':
            if (empty($var['to']) && !$var['keep_file']) {
                die_fax('email-fax dying, no destination found ($var[\'to\'] is empty) and we arent keeping the file!');
            }
            break;
        case 'subject':
            if (!$var['subject']) {
                if (isset($var['direction']) && $var['direction'] == 'outgoing') {
                    $var['subject'] = _('Outgoing fax results');
                } else {
                    if ($var['callerid']) {
                        $var['subject'] = sprintf(_('New fax from: %s'), $var['callerid']);
                    } else {
                        $var['subject'] = _('New fax received');
                    }
                }
            }
            break;
Esempio n. 2
0
$var['attachformat'] = !empty($var['attachformat']) ? $var['attachformat'] : 'pdf';
$var['remotestationid'] = !empty($var['remotestationid']) ? $var['remotestationid'] : '';
//double check some of the options
foreach ($var as $k => $v) {
    if (!is_string($k)) {
        continue;
    }
    switch ($k) {
        case 'file':
            if (!file_exists($var['file'])) {
                die_fax('email-fax dying, file ' . $var['file'] . ' not found!');
            }
            break;
        case 'to':
            if (empty($var['to'])) {
                die_fax('email-fax dying, no destination found ($var[\'to\'] is empty)');
            }
            break;
        case 'subject':
            if (!$var['subject']) {
                if (isset($var['direction']) && $var['direction'] == 'outgoing') {
                    $var['subject'] = _('Outgoing fax results');
                } else {
                    if ($var['callerid']) {
                        $var['subject'] = sprintf(_('New fax from: %s'), $var['callerid']);
                    } else {
                        $var['subject'] = _('New fax received');
                    }
                }
            }
            break;