示例#1
0
 $post = Date::format($article->time, 'Y-m-d-H-i-s');
 $id = (int) time();
 $parent = Request::post('parent');
 $P = array('data' => $request);
 $name = strip_tags($request['name']);
 $email = Text::parse($request['email'], '->broken_entity');
 $url = isset($request['url']) ? $request['url'] : false;
 $parser = strip_tags(Request::post('content_type', $config->html_parser));
 $message = $request['message'];
 $field = Request::post('fields', array());
 include DECK . DS . 'workers' . DS . 'task.field.1.php';
 // Temporarily disallow image(s) in comment to prevent XSS
 $message = strip_tags($message, '<br><img>' . ($parser === 'HTML' ? '<a><abbr><b><blockquote><code><del><dfn><em><i><ins><p><pre><span><strong><sub><sup><time><u><var>' : ""));
 $message = preg_replace('#(\\!\\[.*?\\]\\(.*?\\))#', '`$1`', $message);
 $message = preg_replace('#<img(\\s[^<>]*?)>#', '&lt;img$1&gt;', $message);
 Page::header(array('Name' => $name, 'Email' => $email, 'URL' => $url, 'Status' => Guardian::happy() ? 'pilot' : 'passenger', 'Content Type' => $parser, 'Fields' => !empty($field) ? Text::parse($field, '->encoded_json') : false, 'UA' => Get::UA(), 'IP' => Get::IP()))->content($message)->saveTo(RESPONSE . DS . $post . '_' . Date::format($id, 'Y-m-d-H-i-s') . '_' . ($parent ? Date::format($parent, 'Y-m-d-H-i-s') : '0000-00-00-00-00-00') . $extension);
 Notify::success(Config::speak('notify_success_submitted', $speak->comment));
 if ($extension === '.hold') {
     Notify::info($speak->notify_info_comment_moderation);
 }
 Weapon::fire('on_comment_update', array($P, $P));
 Weapon::fire('on_comment_construct', array($P, $P));
 if ($config->comment_notification_email) {
     $mail = '<p>' . Config::speak('comment_notification', $article->url . '#' . sprintf($comment_id, Date::format($id, 'U'))) . '</p>';
     $mail .= '<p><strong>' . $name . ':</strong></p>';
     $mail .= $parser !== 'HTML' ? Text::parse($message, '->html') : $message;
     $mail .= '<p>' . Date::format($id, 'Y/m/d H:i:s') . '</p>';
     // Sending email notification ...
     if (!Guardian::happy()) {
         if (Notify::send($request['email'], $config->author_email, $speak->comment_notification_subject, $mail, 'comment:')) {
             Weapon::fire('on_comment_notification_construct', array($request, $config->author_email, $speak->comment_notification_subject, $mail));
示例#2
0
<?php

if ($config->page_type === 'article' && Request::method('post')) {
    if (!isset($_POST['fields'])) {
        $_POST['fields'] = array();
    }
    Mecha::extend($_POST['fields'], array('user_ip' => array('type' => 'hidden', 'value' => Get::IP()), 'user_agent' => array('type' => 'hidden', 'value' => Get::UA())));
    // Block comment by IP address
    $fucking_words = explode(',', $config->keywords_spam);
    foreach ($fucking_words as $spam) {
        if ($f**k = trim($spam)) {
            if (Get::IP() === $f**k) {
                Notify::warning($speak->notify_warning_intruder_detected . ' <strong class="text-error pull-right">' . $f**k . '</strong>');
                break;
            }
        }
    }
}