Пример #1
0
function IniParse($string, $isfile = TRUE, &$hash)
{
    if ($hash == null) {
        $hash = array();
    }
    if ($isfile) {
        $string = file_get_contents($string);
    }
    UnixFormat($string);
    foreach (explode("\n", $string) as $line) {
        if (preg_match("/^=>\\[(.*?)\\]\$/", $line, $submatch)) {
            if (isset($key)) {
                $hash[$key] = trim($hash[$key]);
            }
            $key = $submatch[1];
            $hash[$key] = '';
        } else {
            $hash[$key] .= "{$line}\n";
        }
    }
    if (isset($key)) {
        $hash[$key] = rtrim($hash[$key]);
    }
}
Пример #2
0
function PrepareMessage()
{
    UnixFormat($_REQUEST['plain']);
    UnixFormat($_REQUEST['html']);
    return "=>[subject]\n" . $_REQUEST['subject'] . "\n" . "=>[plain]\n" . trim($_REQUEST['plain']) . "\n" . "=>[html]\n" . trim($_REQUEST['html']);
}
Пример #3
0
function ConvertTemplate($template)
{
    global $replace_global;
    UnixFormat($template);
    $template = preg_replace_callback('~<%([A-Z]+)$(.*?)%>~msi', 'ProcessDirectives', $template);
    $template = str_replace(array_keys($replace_global), array_values($replace_global), $template);
    return trim($template);
}
Пример #4
0
function lxMailUser()
{
    global $DB, $C, $t;
    VerifyPrivileges(P_USER);
    UnixFormat($_REQUEST['plain']);
    UnixFormat($_REQUEST['html']);
    $message = "=>[subject]\n" . $_REQUEST['subject'] . "\n" . "=>[plain]\n" . trim($_REQUEST['plain']) . "\n" . "=>[html]\n" . trim($_REQUEST['html']);
    $t = new Template();
    $t->assign_by_ref('config', $C);
    foreach (explode(',', $_REQUEST['to']) as $to_account) {
        $account = $DB->Row('SELECT * FROM lx_users JOIN lx_user_fields USING (username) WHERE lx_users.username=?', array($to_account));
        if ($account) {
            $t->assign_by_ref('account', $account);
            SendMail($account['email'], $message, $t, FALSE);
        }
    }
    $message = 'The selected user accounts have been e-mailed';
    include_once 'includes/message.php';
}
Пример #5
0
function txBlacklistAdd()
{
    global $DB, $C;
    VerifyAdministrator();
    $v = new Validator();
    $v->Register($_REQUEST['value'], V_EMPTY, 'The Value(s) field must be filled in');
    if (!$v->Validate()) {
        return $v->ValidationError('txShBlacklistAdd');
    }
    UnixFormat($_REQUEST['value']);
    $added = 0;
    foreach (explode("\n", $_REQUEST['value']) as $value) {
        list($value, $reason) = explode('|', $value);
        if (IsEmptyString($value)) {
            continue;
        }
        if (!$reason) {
            $reason = $_REQUEST['reason'];
        }
        // Add blacklist item data to the database
        $DB->Update('INSERT INTO `tx_blacklist` VALUES (?,?,?,?,?)', array(NULL, $_REQUEST['type'], intval($_REQUEST['regex']), $value, $reason));
        $added++;
    }
    $GLOBALS['message'] = 'New blacklist item' . ($added == 1 ? '' : 's') . ' successfully added';
    $GLOBALS['added'] = true;
    UnsetArray($_REQUEST);
    txShBlacklistAdd();
}