예제 #1
0
파일: antibot.php 프로젝트: kozzmen/antibot
/**
 * Block access
 */
function blocked($get_msg, $langcode, $lang_output, $actionname)
{
    $data = array('lang_output' => $lang_output, 'curPageName' => curPageName(), 'actionname' => $actionname, 'query_string' => $_SERVER['QUERY_STRING']);
    $content = replace_vars($get_msg[$langcode], $data);
    header("HTTP/1.0 404 Not Found");
    die(_get_header() . $content . _get_footer());
}
예제 #2
0
파일: view.php 프로젝트: WBCE/form
     }
 }
 $email_body = '';
 // Create blank "required" array
 $required = array();
 // Captcha
 if ($use_captcha) {
     if (isset($_POST['captcha']) and $_POST['captcha'] != '') {
         // Check for a mismatch get email user_id
         if (!isset($_POST['captcha']) or !isset($_SESSION['captcha']) or $_POST['captcha'] != $_SESSION['captcha']) {
             $replace = array('webmaster_email' => emailAdmin());
             $captcha_error = replace_vars($MOD_FORM['INCORRECT_CAPTCHA'], $replace);
         }
     } else {
         $replace = array('webmaster_email' => emailAdmin());
         $captcha_error = replace_vars($MOD_FORM['INCORRECT_CAPTCHA'], $replace);
     }
 }
 if (isset($_SESSION['captcha'])) {
     unset($_SESSION['captcha']);
 }
 // Loop through fields and add to message body
 // Get list of fields
 $sql = 'SELECT * FROM `' . TABLE_PREFIX . 'mod_form_fields` ';
 $sql .= 'WHERE `section_id` = ' . (int) $section_id . ' ';
 $sql .= 'ORDER BY position ASC';
 if ($query_fields = $database->query($sql)) {
     if ($query_fields->numRows() > 0) {
         while ($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
             // Add to message body
             if ($field['type'] != '') {
예제 #3
0
 function get_html()
 {
     // This entire method is an evil hack.
     $post_url = new FreechURL('', $this->get_attribute('subject'));
     $post_url->set_var('action', 'read');
     $post_url->set_var('msg_id', $this->get_attribute('id'));
     $post_url->set_var('forum_id', $this->get_attribute('forum_id'));
     $moderator_url = new FreechURL('', $this->get_moderator_name());
     $moderator_url->set_var('action', 'user_profile');
     $moderator_url->set_var('username', $this->get_moderator_name());
     $mod_icon = htmlentities($this->get_moderator_icon());
     $mod_groupname = htmlentities($this->get_moderator_group_name());
     $mod_icon_html = "<img src='{$mod_icon}'" . " title='{$mod_groupname}' alt='{$mod_groupname}' />";
     $mod_html = $moderator_url->get_html() . $mod_icon_html;
     $user_url = new FreechURL('', $this->get_attribute('username'));
     $user_url->set_var('action', 'user_profile');
     $user_url->set_var('username', $this->get_attribute('username'));
     $user_name = htmlentities($this->get_attribute('username'));
     $user_icon = htmlentities($this->get_attribute('user_icon'));
     $user_groupname = htmlentities($this->get_attribute('user_groupname'));
     $user_icon_html = "<img src='{$user_icon}'" . " title='{$user_groupname}' alt='{$user_groupname}' />";
     if ($this->get_attribute('user_groupname') == 'anonymous') {
         $user_html = $user_name . $user_icon_html;
     } else {
         $user_html = $user_url->get_html() . $user_icon_html;
     }
     $args = array('moderator_link' => $mod_html, 'posting_link' => $post_url->get_html(), 'posting_url' => $post_url->get_string(TRUE), 'user_link' => $user_html);
     $args = array_merge($args, $this->attributes);
     switch ($this->get_action()) {
         case 'lock_user':
             $text = _('[MODERATOR_LINK] has locked the account of "[USERNAME]".');
             break;
         case 'unlock_user':
             $text = _('[MODERATOR_LINK] has unlocked the account of "[USERNAME]".');
             break;
         case 'lock_posting':
             $text = _('[MODERATOR_LINK] has locked a' . ' <a href="[POSTING_URL]">posting</a> by [USER_LINK].');
             break;
         case 'unlock_posting':
             $text = _('[MODERATOR_LINK] has unlocked the posting' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'set_sticky':
             $text = _('[MODERATOR_LINK] has made the posting' . ' [POSTING_LINK] by [USER_LINK] sticky.');
             break;
         case 'remove_sticky':
             $text = _('[MODERATOR_LINK] has removed the sticky from' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'stub_posting':
             $text = _('[MODERATOR_LINK] has disabled responses to the posting' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'unstub_posting':
             $text = _('[MODERATOR_LINK] has enabled responses to the posting' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'move_thread':
             $text = _('[MODERATOR_LINK] has moved the thread' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         default:
             die('Unknown modlog action.');
     }
     return replace_vars($text, $args);
 }
예제 #4
0
파일: plugin.php 프로젝트: useada/freech-1
function contact_on_send(&$api)
{
    $message_width = 75;
    $error = 0;
    $vars = array();
    if (isset($_POST['id_to']) && !is_array($_POST['id_to'])) {
        $id_to = intval($_POST['id_to']);
    } else {
        $error++;
    }
    if (isset($_POST['action']) && $_POST['action'] != 'contact_user') {
        $error++;
    }
    if (isset($_POST['body']) && !is_array($_POST['body'])) {
        $body = unesc(rtrim($_POST['body']));
        $raw_body = wordwrap($body, $message_width, "\n");
    } else {
        $error++;
    }
    if (isset($_POST['subject']) && !is_array($_POST['subject'])) {
        $subject = unesc(trim($_POST['subject']));
    } else {
        $error++;
    }
    if (trim($raw_body) == '' || trim($subject) == '') {
        $error++;
    }
    $subject = cfg('contact_subject_prefix') . $subject;
    $use_realname = (bool) ($_POST['realname'] == 'yes');
    $from = $api->user();
    if ($from->is_anonymous()) {
        $error++;
    } else {
        $vars['username'] = $from->get_name();
        $vars['writer'] = $from->get_nice_mail($use_realname);
    }
    $to = $api->userdb()->get_user_from_id($id_to);
    if (!$to || $to->is_deleted()) {
        $error++;
    } else {
        $vars['to_user'] = $to->get_nice_mail($use_realname);
    }
    $status_head = esc(_("Status: private message"));
    $status_reject = esc(_("The message was rejected, because not all fields" . " were filled."));
    $status_success = esc(_("The email has been sent. A blind carbon copy was" . " delivered to you."));
    if ($error != 0) {
        echo "<h3>" . $status_head . "</h3><p>" . $status_reject . "</p>\n";
        echo html_get_homebutton();
        return;
    }
    $vars['noreply'] = cfg('mail_from');
    //FIXME: $vars['username'] =  $vars['username'];
    // Construction of disclaimer in the top of email.
    $head_seperator = str_pad('', $message_width, "=");
    $head_content = array($head_seperator, _("This email was dispatched with the address [NOREPLY] to make sure" . " under all circumstances that the sender receives your email address" . " not without your explicit consent."), _("Your answer to user [USERNAME] should be forwarded to following" . " address:"), "#\n[WRITER]\n", _("If your mail client does not show this address, you have to put it" . " in manually."), _("All answers to [NOREPLY] will be deleted automatically."), _("The forum operator is not responsible for the contents of the" . " message."), $head_seperator, _("[USERNAME] wrote:"));
    foreach ($head_content as $i => $str) {
        $str = replace_vars($str, $vars);
        if ($str[0] != '#') {
            $str = wordwrap($str, $message_width, "\n", FALSE);
        } else {
            // special case: don't wrap '#' beginning lines
            $str = substr($str, 1);
        }
        $head_content[$i] = $str;
    }
    $mail_head = implode("\n", $head_content) . "\n";
    $head = 'MIME-Version: 1.0' . "\n" . "From: [NOREPLY]\n" . "Reply-To: [WRITER]\n" . 'Content-Type: text/plain; charset=UTF-8' . "\n" . 'Content-Transfer-Encoding: 8bit';
    $head = replace_vars($head, $vars);
    $body = "\n" . $mail_head . "\n" . $raw_body;
    // ready to send the message to user and writer
    // encode to UTF-8
    $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
    mail($vars['to_user'], $subject, $body, $head);
    mail($vars['writer'], $subject, $body, $head);
    echo "<h3>" . $status_head . "</h3><p>" . $status_success . "</p>\n";
    echo html_get_homebutton();
}
예제 #5
0
 function _send_mail(&$user, $subject, $body, $vars = NULL)
 {
     if (!$vars) {
         $vars = array();
     }
     $vars['site_title'] = cfg('site_title');
     $vars['login'] = $user->get_name();
     $vars['firstname'] = $user->get_firstname();
     $vars['lastname'] = $user->get_lastname();
     $head = 'MIME-Version: 1.0' . "\n" . 'From: ' . cfg('mail_from') . "\n" . 'Content-Type: text/plain; charset=UTF-8' . "\n" . 'Content-Transfer-Encoding: 8bit' . "\n";
     $subject = replace_vars($subject, $vars);
     $body = replace_vars($body, $vars);
     // encode to UTF-8
     $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
     mail($user->get_mail(), $subject, $body, $head);
 }
예제 #6
0
 function get_nice_mail($_realname = FALSE)
 {
     if ($_realname) {
         // $var from config.inc.php or use the fall back version
         $format = cfg('email_name_format', '[FIRSTNAME] [LASTNAME]');
     } else {
         $format = '[NAME]';
     }
     $format .= ' <[MAIL]>';
     $arr = array();
     $arr['firstname'] = $this->get_firstname();
     $arr['lastname'] = $this->get_lastname();
     $arr['name'] = $this->get_name();
     $arr['mail'] = $this->get_mail();
     return replace_vars($format, $arr);
 }
예제 #7
0
/**
    * Replaces template variables with their values
    * @author Ivan Lucas
    * @param string $string. The string containing the variables
    * @param string $paramarray An array containing values to be substituted
    * @return string The string with variables replaced
*/
function replace_specials($string, $paramarray)
{
    global $CONFIG, $dbg, $dbIncidents, $ttvararray;
    //manual variables
    $required = array('incidentid');
    //this loops through each variable and creates an array of useable variables' regexs
    foreach ($ttvararray as $identifier => $ttvar) {
        $multiple = FALSE;
        foreach ($ttvar as $key => $value) {
            //this checks if it's a multiply-defined variable
            if (is_numeric($key)) {
                $trigger_replaces = replace_vars($ttvar[$key], $triggerid, $identifier, $paramarray, $required);
                if (!empty($trigger_replaces)) {
                    $trigger_regex[] = $trigger_replaces['trigger_regex'];
                    $trigger_replace[] = $trigger_replaces['trigger_replace'];
                }
                $multiple = TRUE;
            }
        }
        if ($multiple == FALSE) {
            $trigger_replaces = replace_vars($ttvar, $triggerid, $identifier, $paramarray, $required);
            if (!empty($trigger_replaces)) {
                $trigger_regex[] = $trigger_replaces['trigger_regex'];
                $trigger_replace[] = $trigger_replaces['trigger_replace'];
            }
        }
    }
    return preg_replace($trigger_regex, $trigger_replace, $string);
}