コード例 #1
0
ファイル: txp_css.php プロジェクト: bgarrels/textpattern
function parseCSS($css)
{
    $css = preg_replace("/\\/\\*.+\\*\\//Usi", "", $css);
    // remove comments
    $selectors = preg_replace('/\\s+/', ' ', strip_rn(explode("}", $css)));
    foreach ($selectors as $selector) {
        if (trim($selector)) {
            list($keystr, $codestr) = explode("{", $selector);
            if (trim($keystr)) {
                $codes = explode(";", trim($codestr));
                foreach ($codes as $code) {
                    if (trim($code)) {
                        list($property, $value) = explode(":", $code, 2);
                        $out[trim($keystr)][trim($property)] = trim($value);
                    }
                }
            }
        }
    }
    return isset($out) ? $out : array();
}
コード例 #2
0
ファイル: txplib_misc.php プロジェクト: bgarrels/textpattern
function txpMail($to_address, $subject, $body, $reply_to = null)
{
    global $txp_user, $prefs;
    // if mailing isn't possible, don't even try
    if (is_disabled('mail')) {
        return false;
    }
    // Likely sending passwords
    if (isset($txp_user)) {
        extract(safe_row('RealName, email', 'txp_users', "name = '" . doSlash($txp_user) . "'"));
    } else {
        extract(safe_row('RealName, email', 'txp_users', "email = '" . doSlash($to_address) . "'"));
    }
    if ($prefs['override_emailcharset'] and is_callable('utf8_decode')) {
        $charset = 'ISO-8859-1';
        $RealName = utf8_decode($RealName);
        $subject = utf8_decode($subject);
        $body = utf8_decode($body);
    } else {
        $charset = 'UTF-8';
    }
    $RealName = encode_mailheader(strip_rn($RealName), 'phrase');
    $subject = encode_mailheader(strip_rn($subject), 'text');
    $email = strip_rn($email);
    if (!is_null($reply_to)) {
        $reply_to = strip_rn($reply_to);
    }
    $sep = !IS_WIN ? "\n" : "\r\n";
    $body = str_replace("\r\n", "\n", $body);
    $body = str_replace("\r", "\n", $body);
    $body = str_replace("\n", $sep, $body);
    $headers = "From: {$RealName} <{$email}>" . $sep . 'Reply-To: ' . (isset($reply_to) ? $reply_to : "{$RealName} <{$email}>") . $sep . 'X-Mailer: Textpattern' . $sep . 'Content-Transfer-Encoding: 8bit' . $sep . 'Content-Type: text/plain; charset="' . $charset . '"' . $sep;
    if (is_valid_email($prefs['smtp_from'])) {
        if (IS_WIN) {
            ini_set('sendmail_from', $prefs['smtp_from']);
        } elseif (!ini_get('safe_mode')) {
            return mail($to_address, $subject, $body, $headers, '-f' . $prefs['smtp_from']);
        }
    }
    return mail($to_address, $subject, $body, $headers);
}
コード例 #3
0
function ignMail($to_address, $subject, $body, $reply_to = null, $from = '')
{
    global $txp_user, $prefs, $ign_user_db;
    if (isset($txp_user)) {
        // Likely sending passwords
        extract(safe_row("RealName, email", "txp_users", "name = '{$txp_user}'"));
    } else {
        // Likely sending comments -> "to" equals "from"
        //		 extract(safe_row("RealName, email", $ign_user_db, "email = '$to_address'"));
        $RealName = "Site Administrator";
        $h = parse_url(hu);
        $email = 'no-reply@' . $h['host'];
    }
    if ($prefs['override_emailcharset']) {
        $charset = 'ISO-8599-1';
        if (is_callable('utf8_decode')) {
            $RealName = utf8_decode($RealName);
            $subject = utf8_decode($subject);
            $body = utf8_decode($body);
            $to_address = utf8_decode($to_address);
            if (!is_null($reply_to)) {
                $reply_to = utf8_decode($reply_to);
            }
        }
    } else {
        $charset = 'UTF-8';
    }
    $RealName = strip_rn($RealName);
    $subject = strip_rn($subject);
    $email = strip_rn($email);
    if (!is_null($reply_to)) {
        $reply_to = strip_rn($reply_to);
    }
    if (!is_callable('mail')) {
        if (txpinterface == 'admin' && $GLOBALS['production_status'] != 'live') {
            echo tag(gTxt('warn_mail_unavailable'), 'p', ' style="color:red;" ');
        }
        return false;
    } else {
        return mail($to_address, $subject, $body, "From: {$RealName} <{$email}>\r\n" . "Reply-To: " . (isset($reply_to) ? $reply_to : "{$RealName} <{$email}>") . "\r\n" . "X-Mailer: Textpattern\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . "Content-Type: text/plain; charset=\"{$charset}\"\r\n");
    }
}
コード例 #4
0
ファイル: txplib_misc.php プロジェクト: bgarrels/textpattern
function txpMail($to_address, $subject, $body, $reply_to = null)
{
    global $txp_user, $prefs;
    if (isset($txp_user)) {
        // Likely sending passwords
        extract(safe_row("RealName, email", "txp_users", "name = '" . doSlash($txp_user) . "'"));
    } else {
        // Likely sending comments -> "to" equals "from"
        extract(safe_row("RealName, email", "txp_users", "email = '" . doSlash($to_address) . "'"));
    }
    if ($prefs['override_emailcharset']) {
        $charset = 'ISO-8599-1';
        if (is_callable('utf8_decode')) {
            $RealName = utf8_decode($RealName);
            $subject = utf8_decode($subject);
            $body = utf8_decode($body);
            $to_address = utf8_decode($to_address);
            if (!is_null($reply_to)) {
                $reply_to = utf8_decode($reply_to);
            }
        }
    } else {
        $charset = 'UTF-8';
    }
    $RealName = strip_rn($RealName);
    $subject = strip_rn($subject);
    $email = strip_rn($email);
    if (!is_null($reply_to)) {
        $reply_to = strip_rn($reply_to);
    }
    if (!is_callable('mail')) {
        if (txpinterface == 'admin' && $GLOBALS['production_status'] != 'live') {
            echo tag(gTxt('warn_mail_unavailable'), 'p', ' style="color:red;" ');
        }
        return false;
    } else {
        $sep = !is_windows() ? "\n" : "\r\n";
        $body = str_replace("\r\n", "\n", $body);
        $body = str_replace("\r", "\n", $body);
        $body = str_replace("\n", $sep, $body);
        return mail($to_address, $subject, $body, "From: {$RealName} <{$email}>{$sep}" . "Reply-To: " . (isset($reply_to) ? $reply_to : "{$RealName} <{$email}>") . $sep . "X-Mailer: Textpattern{$sep}" . "Content-Transfer-Encoding: 8bit{$sep}" . "Content-Type: text/plain; charset=\"{$charset}\"{$sep}");
    }
}
コード例 #5
0
ファイル: txplib_misc.php プロジェクト: bgarrels/textpattern
function txpMail($to_address, $subject, $body, $reply_to = null)
{
    global $txp_user, $prefs;
    if (isset($txp_user)) {
        // Likely sending passwords
        extract(safe_row("RealName, email", "txp_users", "name = '{$txp_user}'"));
    } else {
        // Likely sending comments -> "to" equals "from"
        extract(safe_row("RealName, email", "txp_users", "email = '{$to_address}'"));
    }
    if ($prefs['override_emailcharset']) {
        $charset = 'ISO-8599-1';
        if (is_callable('utf8_decode')) {
            $RealName = utf8_decode($RealName);
            $subject = utf8_decode($subject);
            $body = utf8_decode($body);
            $to_address = utf8_decode($to_address);
            if (!is_null($reply_to)) {
                $reply_to = utf8_decode($reply_to);
            }
        }
    } else {
        $charset = 'UTF-8';
    }
    $RealName = strip_rn($RealName);
    $subject = strip_rn($subject);
    $email = strip_rn($email);
    if (!is_null($reply_to)) {
        $reply_to = strip_rn($reply_to);
    }
    return mail($to_address, $subject, $body, "From: {$RealName} <{$email}>\r\n" . "Reply-To: " . (isset($reply_to) ? $reply_to : "{$RealName} <{$email}>") . "\r\n" . "X-Mailer: Textpattern\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . "Content-Type: text/plain; charset=\"{$charset}\"\r\n");
}
コード例 #6
0
ファイル: txplib_misc.php プロジェクト: bgarrels/textpattern
function txpMail($to_address, $subject, $body, $reply_to = null)
{
    global $txp_user, $prefs;
    // Likely sending passwords
    if (isset($txp_user)) {
        extract(safe_row('RealName, email', 'txp_users', "name = '" . doSlash($txp_user) . "'"));
    } else {
        extract(safe_row('RealName, email', 'txp_users', "email = '" . doSlash($to_address) . "'"));
    }
    if ($prefs['override_emailcharset'] and is_callable('utf8_decode')) {
        $charset = 'ISO-8859-1';
        $RealName = utf8_decode($RealName);
        $subject = utf8_decode($subject);
        $body = utf8_decode($body);
    } else {
        $charset = 'UTF-8';
    }
    $RealName = encode_mailheader(strip_rn($RealName), 'phrase');
    $subject = encode_mailheader(strip_rn($subject), 'text');
    $email = strip_rn($email);
    if (!is_null($reply_to)) {
        $reply_to = strip_rn($reply_to);
    }
    if (!is_callable('mail')) {
        return false;
    } else {
        $sep = !is_windows() ? "\n" : "\r\n";
        $body = str_replace("\r\n", "\n", $body);
        $body = str_replace("\r", "\n", $body);
        $body = str_replace("\n", $sep, $body);
        return mail($to_address, $subject, $body, "From: {$RealName} <{$email}>" . $sep . 'Reply-To: ' . (isset($reply_to) ? $reply_to : "{$RealName} <{$email}>") . $sep . 'X-Mailer: Textpattern' . $sep . 'Content-Transfer-Encoding: 8bit' . $sep . 'Content-Type: text/plain; charset="' . $charset . '"' . $sep);
    }
}
コード例 #7
0
ファイル: mem_form.php プロジェクト: netcarver/mem_form
function mem_form_strip($str, $header = TRUE)
{
    if ($header) {
        $str = strip_rn($str);
    }
    return preg_replace('/[\\x00]/', ' ', $str);
}