コード例 #1
0
ファイル: bbcode.php プロジェクト: TheProjecter/teamweb
/**
 * 进行了适当修改,以便脱离 phpbb 使用 (dualface@gmail.com)
 */
function bbencode_all($text, $uid)
{
    $text = bbencode_first_pass($text, 'post');
    $text = bbencode_second_pass($text, 'post');
    $text .= "\n";
    $text = str_replace(array("\r\n", "\r"), "\n", $text);
    // cross-platform newlines
    $text = preg_replace('/(.+)\\n(.+)/', "\$1<br />\$2", $text);
    $text = preg_replace('/\\n?(.+?)(?:\\n\\s*\\n|\\z)/s', "<p>\$1</p>\n", $text);
    // make paragraphs, including one at the end
    return $text;
}
コード例 #2
0
ファイル: announcement_center.php プロジェクト: Nekrofage/FJR
 public function __construct()
 {
     global $template, $announcement_centre_config;
     $this->config = $announcement_centre_config;
     $this->config['announcement_text'] = smilies_pass($this->config['announcement_text']);
     $announcement_text_uid = make_bbcode_uid();
     $this->config['announcement_text'] = bbencode_first_pass($this->config['announcement_text'], $announcement_text_uid);
     $this->config['announcement_text'] = bbencode_second_pass($this->config['announcement_text'], $announcement_text_uid);
     $this->config['announcement_text'] = str_replace("\n", "\n<br />\n", $this->config['announcement_text']);
     $this->config['announcement_guest_text'] = smilies_pass($this->config['announcement_guest_text']);
     $announcement_guest_text_uid = make_bbcode_uid();
     $this->config['announcement_guest_text'] = bbencode_first_pass($this->config['announcement_guest_text'], $announcement_guest_text_uid);
     $this->config['announcement_guest_text'] = bbencode_second_pass($this->config['announcement_guest_text'], $announcement_guest_text_uid);
     $this->config['announcement_guest_text'] = str_replace("\n", "\n<br />\n", $this->config['announcement_guest_text']);
     $announcement_guest_text = $this->config['announcement_guest_text'];
     $announcement_title = empty($this->config['announcement_title']) ? $lang['Site_announcement_block_title'] : str_replace("\n", "\n<br />\n", $this->config['announcement_title']);
     $announcement_guest_title = empty($this->config['announcement_guest_title']) ? $lang['Guest_announcement_block_title'] : str_replace("\n", "\n<br />\n", $this->config['announcement_guest_title']);
     // get the post information in case last topic or forum has been entered
     if (!$this->config['announcement_forum_id'] == '' || !$this->config['announcement_topic_id'] == '') {
         if (!($result = $db->sql_query($this->getFetchSql()))) {
             message_die(GENERAL_ERROR, 'Error in getting announcement post', '', __LINE__, __FILE__, $sql);
         }
         if ($row = $db->sql_fetchrow($result)) {
             $row['post_text'] = smilies_pass($row['post_text']);
             $row['post_text'] = bbencode_first_pass($row['post_text'], $row['bbcode_uid']);
             $row['post_text'] = bbencode_second_pass($row['post_text'], $row['bbcode_uid']);
             $row['post_text'] = str_replace("\n", "\n<br />\n", $row['post_text']);
             $announcement_text = $row['post_text'];
         }
     } else {
         $announcement_text = $this->config['announcement_text'];
     }
     // who sees the announcements
     if ($this->config['announcement_status'] == ANNOUNCEMENTS_LEFTY74_SHOW_YES) {
         switch ($this->getDisplay()) {
             case 'normal':
                 $template->assign_block_vars('announcement_displayed', array());
                 break;
             case 'guest':
                 $template->assign_block_vars('guest_announcement_displayed', array());
                 break;
             default:
                 $template->assign_block_vars('announcement_not_displayed', array());
         }
     }
     //BEGIN ACP Site Announcement Centre by lefty74
     $template->assign_vars(array('L_ANNOUNCEMENT_TITLE' => $announcement_title, 'SITE_ANNOUNCEMENTS_LEFTY74' => $announcement_text, 'L_ANNOUNCEMENT_GUEST_TITLE' => $announcement_guest_title, 'GUEST_ANNOUNCEMENTS_LEFTY74' => $announcement_guest_text));
 }
コード例 #3
0
 if (!$board_config['allow_html'] || !$userdata['user_allowhtml']) {
     if ($user_sig != '') {
         $user_sig = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
     }
     if ($postrow[$i]['enable_html']) {
         $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
     }
 }
 //
 // Parse message and/or sig for BBCode if reqd
 //
 if ($user_sig != '' && $user_sig_bbcode_uid != '') {
     $user_sig = $board_config['allow_bbcode'] ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace("/\\:{$user_sig_bbcode_uid}/si", '', $user_sig);
 }
 if ($bbcode_uid != '') {
     $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\\:{$bbcode_uid}/si", '', $message);
 }
 if ($user_sig != '') {
     $user_sig = make_clickable($user_sig);
 }
 $message = make_clickable($message);
 //
 // Parse smilies
 //
 if ($board_config['allow_smilies']) {
     if ($postrow[$i]['user_allowsmile'] && $user_sig != '') {
         $user_sig = smilies_pass($user_sig);
     }
     if ($postrow[$i]['enable_smilies']) {
         $message = smilies_pass($message);
     }
コード例 #4
0
     if ($user_sig != '' && $userdata['user_allowhtml']) {
         $user_sig = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
     }
     if ($postrow[$i]['enable_html']) {
         $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
     }
 }
 //
 // Parse message and/or sig for BBCode if reqd
 //
 if ($board_config['allow_bbcode']) {
     if ($user_sig != '' && $user_sig_bbcode_uid != '') {
         $user_sig = $board_config['allow_bbcode'] ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $user_sig);
     }
     if ($bbcode_uid != '') {
         $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
     }
 }
 if ($user_sig != '') {
     $user_sig = make_clickable($user_sig);
 }
 $message = make_clickable($message);
 //
 // Parse smilies
 //
 if ($board_config['allow_smilies']) {
     if ($postrow[$i]['user_allowsmile'] && $user_sig != '') {
         $user_sig = smilies_pass($user_sig);
     }
     if ($postrow[$i]['enable_smilies']) {
         $message = smilies_pass($message);
コード例 #5
0
              AND t.topic_id IN ( SELECT topic_id
                                      FROM ' . $phpbb_table_prefix . '_topics
                                      LEFT JOIN ' . $phpbb_table_prefix . '_users u ON u.user_id = topic_poster
                                      WHERE topic_status != 2
                                      AND forum_id != 2
                                      AND u.user_active = 1)
              ORDER BY p.post_id ASC';
$req_post = mysql_query($sql_post);
$yml = array();
while ($data = mysql_fetch_array($req_post)) {
    if ($data['poster_id'] == -1) {
        $user = "******" . '    author_name:        ' . $data['post_username'];
    } else {
        $user = "******" . '    sfGuardUser:        '******'username']) . '_user';
    }
    $content = bbencode_second_pass($data['post_text'], $data['bbcode_uid']);
    $content = str_replace("\n\r", ' ', $content);
    $content = str_replace("\n", ' ', $content);
    $content = str_replace("\r", "\n      ", $content);
    $content = str_replace("\t", ' ', $content);
    $content = str_replace("(lien externe)", "", $content);
    $content = str_replace(' class="postlink external"', "", $content);
    $content = str_replace(' class="postlink"', "", $content);
    $content = str_replace('<span> </span>', "", $content);
    $content = str_replace('<span class="postbody">', "", $content);
    $content = str_replace('</span>', "", $content);
    $content = str_replace('<span class="genmed">', "", $content);
    $yml['sfSimpleForumPost'][] = '
  p_' . $data['post_id'] . ':
    sfSimpleForumTopic: t_' . $data['topic_id'] . '
    title:              "' . $data['topic_title'] . '"' . $user . '
コード例 #6
0
ファイル: shoutbox_max.php プロジェクト: Nekrofage/FJR
 if ($highlight_match) {
     $shout = str_replace('\\"', '"', substr(@preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "@preg_replace('#\\b(" . str_replace('\\', '\\\\', addslashes($highlight_match)) . ")\\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $shout . '<'), 1, -1));
 }
 //
 // Replace naughty words
 //
 if (count($orig_word)) {
     if ($user_sig != '') {
         $user_sig = preg_replace($orig_word, $replacement_word, $user_sig);
     }
     $shout = preg_replace($orig_word, $replacement_word, $shout);
 }
 if ($smilies_on && $shout != '' && $shout_row['enable_smilies']) {
     $shout = smilies_pass($shout);
 }
 $shout = bbencode_second_pass($shout, $shout_row['shout_bbcode_uid']);
 $shout = str_replace("\n", "\n<br />\n", $shout);
 if ($is_auth['auth_mod'] && $is_auth['auth_delete']) {
     $temp_url = append_sid("shoutbox_max.{$phpEx}?mode=ip&amp;" . POST_POST_URL . "=" . $shout_row['shout_id']);
     $ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
     $ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';
     $temp_url = append_sid("shoutbox_max.{$phpEx}?mode=delete&amp;" . POST_POST_URL . "=" . $shout_row['shout_id']);
     $delshout_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>&nbsp;';
     $delshout = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
     $temp_url = append_sid("shoutbox_max.{$phpEx}?mode=censor&amp;" . POST_POST_URL . "=" . $shout_row['shout_id']);
     $censorshout_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_censor'] . '" alt="' . $lang['Censor'] . '" title="' . $lang['Censor'] . '" border="0" /></a>&nbsp;';
     $censorshout = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
 } else {
     $ip_img = '';
     $ip = '';
     if ($userdata['user_id'] == $user_id && $is_auth['auth_delete'] && ($userdata['user_id'] != ANONYMOUS || $userdata['user_id'] == ANONYMOUS && $userdata['session_ip'] == $shout_row['shout_ip'])) {
コード例 #7
0
function includeNewsBlock()
{
    global $template, $lang, $db, $board_config, $auction_config_data;
    global $orig_word, $replacement_word;
    include './extension.inc';
    include './includes/bbcode.' . $phpEx;
    if ($auction_config_data['auction_block_display_news'] == 1) {
        $template->assign_block_vars('news_block', array('L_AUCTION_NEWS' => $lang['auction_news']));
        $sql = "SELECT t.*,\r\n                                   u.username,\r\n                                   u.user_id,\r\n                                   p.*,\r\n                                   x.*\r\n                            FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " x\r\n                            WHERE t.forum_id = " . $auction_config_data['auction_news_forum_id'] . " AND\r\n                                  t.topic_poster = u.user_id AND\r\n                                  p.post_id = t.topic_first_post_id AND\r\n                                  x.post_id = t.topic_first_post_id\r\n                            ORDER BY t.topic_first_post_id DESC\r\n                            LIMIT 0,3";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query news block information', '', __LINE__, __FILE__, $sql);
        }
        $total_topics = 0;
        while ($row = $db->sql_fetchrow($result)) {
            $topic_rowset[] = $row;
            $total_topics++;
        }
        $db->sql_freeresult($result);
        // Dump out the news
        if ($total_topics) {
            for ($i = 0; $i < $total_topics; $i++) {
                $topic_id = $topic_rowset[$i]['topic_id'];
                $post_subject = count($orig_word) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
                $topic_poster_url = $topic_rowset[$i]['user_id'] != ANONYMOUS ? append_sid("profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . "=" . $topic_rowset[$i]['user_id']) : '';
                $topic_poster = $topic_rowset[$i]['user_id'] != ANONYMOUS ? $topic_rowset[$i]['username'] : ($topic_rowset[$i]['post_username'] != "" ? $topic_rowset[$i]['post_username'] : $lang['Guest']);
                $topic_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']);
                $bbcode_uid = $topic_rowset[$i]['bbcode_uid'];
                // Format the message
                $message = $topic_rowset[$i]['post_text'];
                if (!$board_config['allow_html'] && $topic_rowset[$i]['enable_html']) {
                    $message = preg_replace("#(<)([\\/]?.*?)(>)#is", "&lt;\\2&gt;", $message);
                }
                if ($board_config['allow_bbcode'] && $bbcode_uid != "") {
                    $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\\:[0-9a-z\\:]+\\]/si", "]", $message);
                }
                $message = make_clickable($message);
                // Define censored word matches
                if (empty($orig_word) && empty($replacement_word)) {
                    $orig_word = array();
                    $replacement_word = array();
                    obtain_word_list($orig_word, $replacement_word);
                }
                // Replace naughty words
                if (count($orig_word)) {
                    $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
                    $message = preg_replace($orig_word, $replacement_word, $message);
                }
                // Parse smilies
                if ($board_config['allow_smilies']) {
                    if ($topic_rowset[$i]['enable_smilies']) {
                        $message = smilies_pass($message);
                    }
                }
                // Replace newlines
                $message = str_replace("\n", "\n<br />\n", $message);
                $view_topic_url = append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}");
                $template->assign_block_vars('news_block.content_block', array('TOPIC_TITLE' => $post_subject, 'POST_TEXT' => $message, 'TOPIC_POSTER' => $topic_poster, 'U_TOPIC_POSTER' => $topic_poster_url, 'TOPIC_TIME' => $no_date ? '' : $topic_time, 'L_VIEW_TOPIC' => $lang['auction_news_more'], 'U_VIEW_TOPIC' => $view_topic_url));
            }
        }
    }
}
コード例 #8
0
ファイル: functions.php プロジェクト: andrewroth/winbolo
function getLatestPosts($numItems)
{
    $URLPath = "/forums";
    //- Not Not Include Closing \ Mark!
    $posts = array();
    $query = "select t.topic_id, t.topic_title, u.username, p.post_id, p.post_time, pt.bbcode_uid, pt.post_text FROM users u, topics t, posts p, posts_text pt where t.topic_id = p.topic_id and pt.post_id = p.post_id and u.user_id = p.poster_id and t.forum_id <> 11 and t.forum_id <> 7 and t.forum_id <> 14 order by p.post_time desc limit {$numItems}";
    $result = mysql_query($query);
    $count = 0;
    $numRows = mysql_numrows($result);
    while ($count < $numRows) {
        $ni = new postClass();
        $postId = mysql_result($result, $count, "post_id");
        $url = "http://www.winbolo.net/forums/viewtopic.php?p=" . $postId . "#" . $postId;
        $text = mysql_result($result, $count, "post_text");
        #$text = ereg_replace ("\n", "<br>", mysql_result($result, $count, "post_text"));
        $text = bbencode_second_pass($text, mysql_result($result, $count, "bbcode_uid"));
        $ni->setup($url, mysql_result($result, $count, "topic_title"), mysql_result($result, $count, "username"), mysql_result($result, $count, "post_time"), $text);
        $posts[$count] = $ni;
        $count++;
    }
    return $posts;
}
コード例 #9
0
                $row++;
            } else {
                $col++;
            }
        }
        if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
            $template->assign_block_vars('switch_smilies_extra', array());
            $template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES_ANNOUNCEMENT_TEXT' => append_sid("../posting.{$phpEx}?mode=smilies_announcement_text")));
        }
        $template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
    }
}
$template->set_filenames(array("body" => "admin/announcement_centre_config_body.tpl"));
//
// Escape any quotes in the site description for proper display in the text
// box on the Announcement Box page
//
$new['announcement_text'] = str_replace('"', '&quot;', $new['announcement_text']);
$new['announcement_guest_text'] = str_replace('"', '&quot;', $new['announcement_guest_text']);
$new['announcement_text_draft'] = str_replace('"', '&quot;', $new['announcement_text_draft']);
$new['announcement_title'] = str_replace('"', '&quot;', $new['announcement_title']);
$new['announcement_guest_title'] = str_replace('"', '&quot;', $new['announcement_guest_title']);
$preview_announcement = $new['announcement_text_draft'];
$preview_announcement_uid = make_bbcode_uid();
$preview_announcement = bbencode_first_pass($preview_announcement, $preview_announcement_uid);
$preview_announcement = bbencode_second_pass($preview_announcement, $preview_announcement_uid);
$preview_announcement = smilies_pass($preview_announcement, './../');
$preview_announcement = str_replace("\n", "\n<br />\n", $preview_announcement);
$template->assign_vars(array("S_ANNOUNCEMENT_ACTION" => append_sid("admin_announcement_centre.{$phpEx}"), "L_BBCODE_B_HELP" => $lang['bbcode_b_help'], "L_BBCODE_I_HELP" => $lang['bbcode_i_help'], "L_BBCODE_U_HELP" => $lang['bbcode_u_help'], "L_BBCODE_Q_HELP" => $lang['bbcode_q_help'], "L_BBCODE_C_HELP" => $lang['bbcode_c_help'], "L_BBCODE_L_HELP" => $lang['bbcode_l_help'], "L_BBCODE_O_HELP" => $lang['bbcode_o_help'], "L_BBCODE_P_HELP" => $lang['bbcode_p_help'], "L_BBCODE_W_HELP" => $lang['bbcode_w_help'], "L_BBCODE_A_HELP" => $lang['bbcode_a_help'], "L_BBCODE_S_HELP" => $lang['bbcode_s_help'], "L_BBCODE_F_HELP" => $lang['bbcode_f_help'], "L_EMPTY_MESSAGE" => $lang['Empty_message'], "L_FONT_COLOR" => $lang['Font_color'], "L_COLOR_DEFAULT" => $lang['color_default'], "L_COLOR_DARK_RED" => $lang['color_dark_red'], "L_COLOR_RED" => $lang['color_red'], "L_COLOR_ORANGE" => $lang['color_orange'], "L_COLOR_BROWN" => $lang['color_brown'], "L_COLOR_YELLOW" => $lang['color_yellow'], "L_COLOR_GREEN" => $lang['color_green'], "L_COLOR_OLIVE" => $lang['color_olive'], "L_COLOR_CYAN" => $lang['color_cyan'], "L_COLOR_BLUE" => $lang['color_blue'], "L_COLOR_DARK_BLUE" => $lang['color_dark_blue'], "L_COLOR_INDIGO" => $lang['color_indigo'], "L_COLOR_VIOLET" => $lang['color_violet'], "L_COLOR_WHITE" => $lang['color_white'], "L_COLOR_BLACK" => $lang['color_black'], "L_FONT_SIZE" => $lang['Font_size'], "L_FONT_TINY" => $lang['font_tiny'], "L_FONT_SMALL" => $lang['font_small'], "L_FONT_NORMAL" => $lang['font_normal'], "L_FONT_LARGE" => $lang['font_large'], "L_FONT_HUGE" => $lang['font_huge'], "L_BBCODE_CLOSE_TAGS" => $lang['Close_Tags'], "L_STYLES_TIP" => $lang['Styles_tip'], "L_ANNOUNCEMENT_MAIN_TITLE" => $lang['Announcement_main_title'], "L_ANNOUNCEMENT_MAIN_TITLE_EXPLAIN" => $lang['Announcement_main_title_explain'], "L_ANNOUNCEMENT_BLOCK_TITLE" => $lang['Announcement_block_title'], "L_ANNOUNCEMENT_DRAFT_TEXT" => $lang['Announcement_draft_text'], "L_ANNOUNCEMENT_DRAFT_TEXT_EXPLAIN" => $lang['Announcement_draft_text_explain'], "L_SHOW_ANNOUNCEMENT_TEXT" => $lang['Show_announcement_text'], "L_ANNOUNCEMENT_TITLE" => $lang['Announcement_title'], "L_ANNOUNCEMENT_TITLE_EXPLAIN" => $lang['Announcement_title_explain'], "L_ANNOUNCEMENT_DEFAULT_TITLE_EXPLAIN" => $lang['Announcement_default_title_explain'] . $lang['Site_announcement_block_title'], "L_ANNOUNCEMENT_TEXT" => $lang['Announcement_text'], "L_ANNOUNCEMENT_TEXT_EXPLAIN" => $lang['Announcement_text_explain'], "L_FORUM_ID" => $lang['Forum_ID'], "L_TOPIC_ID" => $lang['Topic_ID'], "L_ANNOUNCEMENT_FORUM_TOPIC_LATEST" => $lang['Announcement_forum_topic_latest'], "L_ANNOUNCEMENT_FORUM_TOPIC_FIRST" => $lang['Announcement_forum_topic_first'], "L_ANNOUNCEMENT_GUEST_TITLE" => $lang['Announcement_guest_title'], "L_ANNOUNCEMENT_DEFAULT_GUEST_TITLE_EXPLAIN" => $lang['Announcement_default_title_explain'] . $lang['Guest_announcement_block_title'], "L_ANNOUNCEMENT_GUEST_TITLE_EXPLAIN" => $lang['Announcement_guest_title_explain'], "L_ANNOUNCEMENT_GUEST_TEXT" => $lang['Announcement_guest_text'], "L_SELECT_ALL" => $lang['Select_all'], "L_COPY_TO_ANNOUNCEMENT" => $lang['Copy_to_Announcement'], "L_COPY_TO_GUEST_ANNOUNCEMENT" => $lang['Copy_to_Guest_Announcement'], "L_SUBMIT" => $lang['Submit'], "L_PREVIEW" => $lang['Preview'], "L_RESET" => $lang['Reset'], "L_YES" => $lang['Yes'], "L_NO" => $lang['No'], "ANNOUNCEMENT_VERSION" => sprintf($announcement_centre_config['announcement_mod_version']), "L_SHOW_ANNOUNCEMENT_ALL" => $lang['Show_announcement_all'], "L_SHOW_ANNOUNCEMENT_REG" => $lang['Show_announcement_reg'], "L_SHOW_ANNOUNCEMENT_MOD" => $lang['Show_announcement_mod'], "L_SHOW_ANNOUNCEMENT_ADM" => $lang['Show_announcement_adm'], "L_SHOW_ANNOUNCEMENT_WHO" => $lang['Show_announcement_who'], "L_ANNOUNCEMENT_GUESTS_ONLY" => $lang['Announcement_guests_only'], "L_ANNOUNCEMENT_GUESTS_ONLY_EXPLAIN" => $lang['Announcement_guests_only_explain'], "ANNOUNCEMENT_FORUM_ID" => $new['announcement_forum_id'], "ANNOUNCEMENT_TOPIC_ID" => $new['announcement_topic_id'], "ANNOUNCEMENT_TITLE" => $new['announcement_title'], "ANNOUNCEMENT_TEXT" => $new['announcement_text'], "ANNOUNCEMENT_GUEST_TITLE" => $new['announcement_guest_title'], "ANNOUNCEMENT_GUEST_TEXT" => $new['announcement_guest_text'], "ANNOUNCEMENT_TEXT_DRAFT" => $new['announcement_text_draft'], "ANNOUNCEMENT_PREVIEW" => $preview_announcement, "S_ANNOUNCEMENT_STATUS_YES" => $announcement_status_yes, "SHOW_ANNOUNCEMENT_YES" => ANNOUNCEMENTS_LEFTY74_SHOW_YES, "S_ANNOUNCEMENT_STATUS_NO" => $announcement_status_no, "SHOW_ANNOUNCEMENT_NO" => ANNOUNCEMENTS_LEFTY74_SHOW_NO, "S_ANNOUNCEMENT_FORUM_TOPIC_LATEST" => $announcement_forum_topic_latest, "ANNOUNCEMENT_FORUM_TOPIC_LATEST" => ANNOUNCEMENTS_LEFTY74_FORUM_TOPIC_LATEST, "S_ANNOUNCEMENT_FORUM_TOPIC_FIRST" => $announcement_forum_topic_first, "ANNOUNCEMENT_FORUM_TOPIC_FIRST" => ANNOUNCEMENTS_LEFTY74_FORUM_TOPIC_FIRST, "ANNOUNCEMENT_GUEST_SEPARATE_STATUS_YES" => ANNOUNCEMENTS_LEFTY74_GUEST_YES, "S_ANNOUNCEMENT_GUEST_SEPARATE_STATUS_YES" => $announcement_guestannouncement_status_yes, "ANNOUNCEMENT_GUEST_SEPARATE_STATUS_NO" => ANNOUNCEMENTS_LEFTY74_GUEST_NO, "S_ANNOUNCEMENT_GUEST_SEPARATE_STATUS_NO" => $announcement_guestannouncement_status_no, "SHOW_ANNOUNCEMENT_ALL" => ANNOUNCEMENTS_LEFTY74_SHOW_ALL, "S_SHOW_ANNOUNCEMENT_ALL_CHECKED" => $show_announcement_all, "SHOW_ANNOUNCEMENT_REG" => ANNOUNCEMENTS_LEFTY74_SHOW_REG, "S_SHOW_ANNOUNCEMENT_REG_CHECKED" => $show_announcement_reg, "SHOW_ANNOUNCEMENT_MOD" => ANNOUNCEMENTS_LEFTY74_SHOW_MOD, "S_SHOW_ANNOUNCEMENT_MOD_CHECKED" => $show_announcement_mod, "SHOW_ANNOUNCEMENT_ADM" => ANNOUNCEMENTS_LEFTY74_SHOW_ADM, "S_SHOW_ANNOUNCEMENT_ADM_CHECKED" => $show_announcement_adm));
$template->pparse("body");
include './page_footer_admin.' . $phpEx;
コード例 #10
0
function pcp_output_sig($field_name, $view_userdata, $map_name = '')
{
    global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
    global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;
    $txt = '';
    $img = '';
    $res = '';
    if (!empty($view_userdata[$field_name]) && $view_userdata['user_id'] != ANONYMOUS && $view_userdata['user_allow_sig'] && $userdata['user_viewsig']) {
        $user_sig = $view_userdata[$field_name];
        $user_sig_bbcode_uid = $view_userdata[$field_name . '_bbcode_uid'];
        if (!$board_config['allow_html'] && $userdata['user_allowhtml']) {
            $user_sig = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
        }
        if ($board_config['allow_bbcode'] && $user_sig_bbcode_uid != '') {
            $user_sig = $board_config['allow_bbcode'] ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $user_sig);
        }
        $user_sig = make_clickable($user_sig);
        if ($board_config['allow_smilies'] && $view_userdata['user_allowsmile']) {
            $user_sig = smilies_pass($user_sig);
        }
        if (count($orig_word) > 0) {
            $user_sig = str_replace('\\"', '"', substr(preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
        }
        $txt = str_replace("\n", "\n<br />\n", $user_sig);
        // result
        $res = pcp_output_format($field_name, $txt, $img, $map_name);
    }
    return $res;
}
コード例 #11
0
ファイル: viewforum.php プロジェクト: Nekrofage/FJR
//-- add
build_toolbar('viewforum', $l_privmsgs_text, $s_privmsg_new, $forum_id);
//-- fin mod : toolbar ---------------------------------------------------------
$template->set_filenames(array('body' => 'viewforum_body.tpl'));
make_jumpbox('viewforum.' . $phpEx);
// Start Smilies Invasion Mod
if ($board_config['allow_smilies']) {
    $forum_row['forum_name'] = smilies_pass($forum_row['forum_name']);
}
// V: Addon Smilies&Bbcode too long desc
$long_desc = $forum_row['forum_desc_long'];
if ($long_desc) {
    $bbcode_uid = make_bbcode_uid();
    $long_desc = smilies_pass($long_desc);
    $long_desc = bbencode_first_pass($long_desc, $bbcode_uid);
    $long_desc = bbencode_second_pass($long_desc, $bbcode_uid);
    $long_desc = nl2br($long_desc);
}
$template->assign_vars(array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_row['forum_name'], 'FORUM_DESC_LONG' => $long_desc, 'MODERATORS' => $forum_moderators, 'POST_IMG' => $forum_row['forum_status'] == FORUM_LOCKED ? $images['post_locked'] : $images['post_new'], 'FOLDER_IMG' => $images['folder'], 'FOLDER_NEW_IMG' => $images['folder_new'], 'FOLDER_HOT_IMG' => $images['folder_hot'], 'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'], 'FOLDER_LOCKED_IMG' => $images['folder_locked'], 'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'], 'FOLDER_STICKY_IMG' => $images['folder_sticky'], 'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'], 'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'], 'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'], 'L_TOPICS' => $lang['Topics'], 'L_REPLIES' => $lang['Replies'], 'L_VIEWS' => $lang['Views'], 'L_POSTS' => $lang['Posts'], 'L_LASTPOST' => $lang['Last_Post'], 'L_MODERATOR' => $l_moderators, 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'], 'L_POST_NEW_TOPIC' => $forum_row['forum_status'] == FORUM_LOCKED ? $lang['Forum_locked'] : $lang['Post_new_topic'], 'L_NO_NEW_POSTS' => $lang['No_new_posts'], 'L_NEW_POSTS' => $lang['New_posts'], 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], 'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'], 'L_NEW_POSTS_HOT' => $lang['New_posts_hot'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_GLOBAL_ANNOUNCEMENT' => $lang['Post_Global_Announcement'], 'L_STICKY' => $lang['Post_Sticky'], 'L_POSTED' => $lang['Posted'], 'L_JOINED' => $lang['Joined'], 'L_AUTHOR' => $lang['Author'], 'S_AUTH_LIST' => $s_auth_can, 'U_VIEW_FORUM' => append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}"), 'U_MARK_READ' => append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}&amp;mark=topics")));
//
// End header
//
//
// Okay, lets dump out the page ...
//
//-- mod : topic display order ---------------------------------------------------------------------
//-- add
$template->assign_vars(array('S_DISPLAY_ORDER' => $s_display_order));
//-- fin mod : topic display order -----------------------------------------------------------------
if ($total_topics) {
    for ($i = 0; $i < $total_topics; $i++) {
コード例 #12
0
ファイル: newsclass.php プロジェクト: andrewroth/winbolo
 function getText()
 {
     $text = ereg_replace("\n", "<br>", $this->text);
     $text = bbencode_second_pass($text, $this->bbcodeUid);
     return $text;
 }
コード例 #13
0
ファイル: admin_priv_msgs.php プロジェクト: Nekrofage/FJR
        if ($view_id == '') {
            message_die(GENERAL_ERROR, $lang['No_Message_ID'], '', __LINE__, __FILE__);
        }
        $sql = 'SELECT pm.*, pmt.*
		   FROM ' . PRIVMSGS_TABLE . "{$archive_text} pm, " . PRIVMSGS_TEXT_TABLE . " pmt\r\n\t\t   WHERE pm.privmsgs_id = pmt.privmsgs_text_id\r\n\t\t   AND pmt.privmsgs_text_id = {$view_id}";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, $lang['Error_Posts_Table'], '', __LINE__, __FILE__);
        }
        $privmsg = $db->sql_fetchrow($result);
        /************************/
        /* Just stole all the phpBB code for message processing :) And edited a ton of it out since we are all admins here */
        /**********************/
        $private_message = $privmsg['privmsgs_text'];
        $bbcode_uid = $privmsg['privmsgs_bbcode_uid'];
        if ($bbcode_uid != '') {
            $private_message = bbencode_second_pass($private_message, $bbcode_uid);
        }
        $private_message = make_clickable($private_message);
        if ($privmsg['privmsgs_enable_smilies']) {
            $old_config = $board_config['smilies_path'];
            $board_config['smilies_path'] = '../' . $board_config['smilies_path'];
            $private_message = smilies_pass($private_message);
            $board_config['smilies_path'] = $old_config;
        }
        $private_message = str_replace("\n", '<br />', $private_message);
        $template->set_filenames(array('viewmsg_body' => 'admin/admin_priv_msgs_view_body.tpl'));
        $template->assign_vars(array('L_SUBJECT' => $lang['Subject'], 'L_TO' => $lang['To'], 'L_FROM' => $lang['From'], 'L_SENT_DATE' => $lang['Sent_Date'], 'L_PRIVATE_MESSAGES' => $aprvmUtil->modName));
        $template->assign_vars(array('SUBJECT' => $privmsg['privmsgs_subject'], 'FROM' => $aprvmUtil->id_2_name($privmsg['privmsgs_from_userid']), 'FROM_IP' => $board_config['aprvmIP'] ? ' : (' . decode_ip($privmsg['privmsgs_ip']) . ')' : '', 'TO' => $aprvmUtil->id_2_name($privmsg['privmsgs_to_userid']), 'DATE' => create_date($lang['DATE_FORMAT'], $privmsg['privmsgs_date'], $board_config['board_timezone']), 'MESSAGE' => $private_message));
        if ($board_config['aprvmView']) {
            $template->assign_block_vars('popup_switch', array());
            $template->pparse('viewmsg_body');
コード例 #14
0
ファイル: ggs_functions.php プロジェクト: Nekrofage/FJR
 /**
  * format_rss_txt() will put together BBcodes and smilies before the output
  * @access private
  */
 function format_rss_txt($subject, $message, $msg_sumarize = 0, $message_url, $bbcode_uid, $allow_smiles = TRUE, $allow_html = FALSE, $allow_sig = FALSE)
 {
     global $board_config, $userdata, $lang;
     // Since &apos; is not HTML, but is XML convert.
     $message = ' ' . str_replace("’", "'", $message);
     if (!empty($this->rss_config['rss_bbcode_filters'])) {
         $patterns = $this->rss_config['rss_bbcode_filters']['pattern'];
         $replaces = $this->rss_config['rss_bbcode_filters']['replace'];
         if (!empty($patterns)) {
             $message = preg_replace($patterns, $replaces, $message);
             // Take care of nested bbcode tags when filtering all
             if (strpos($this->rss_config['rss_strip_bbcode'], 'all') !== FALSE) {
                 $nested_cnt = preg_match_all("`(\\[[a-z]([^\\[\\]]*)\\])`i", $message, $matches);
                 for ($i = 1; $i <= $nested_cnt; $i++) {
                     $message = preg_replace($patterns, $replaces, $message);
                 }
             }
         }
     }
     if ($msg_sumarize > 0) {
         $message = $this->summarize($message, $msg_sumarize, $this->rss_config['msg_sumarize_method']);
     }
     // Close all possibly broken quote tags after summarize, since they could break the layout.
     if (strpos($message, "[quote:{$bbcode_uid}") !== FALSE) {
         $open_count = preg_match_all("#\\[quote\\:{$bbcode_uid}#si", $message, $open_matches);
         $close_count = preg_match_all("#\\[/quote\\:{$bbcode_uid}#si", $message, $close_matches);
         $tags_to_close = $open_count - $close_count;
         if ($tags_to_close > 0) {
             for ($i = 1; $i <= $tags_to_close; $i++) {
                 $message .= ($i == $tags_to_close ? '<br/><br/><b>...</b>' : '') . " [/quote:{$bbcode_uid}]";
             }
         }
     }
     // If the board has HTML off but the post has HTML
     // on then we process it, else leave it alone
     // Left commented for now as it would only be usefull for atom feed format
     // And everything goes through htmlspecialchars anyway
     //if ( $board_config['allow_html'] || !$userdata['user_allowhtml']) {
     //	if ( !$allow_html ) {
     //		$message = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
     //	}
     //}
     if ($bbcode_uid != '') {
         if ($this->rss_config['rss_allow_bbcode']) {
             if (!$this->rss_config['rss_allow_links']) {
                 $message = preg_replace("`\\[/?url(=.*?)?\\]`si", "", $message);
             }
             $message = bbencode_second_pass($message, $bbcode_uid);
             if ($msg_sumarize > 0 || !empty($this->rss_config['rss_bbcode_filters'])) {
                 // Clean all possible bbcode_uids left
                 $message = preg_replace('`\\:[0-9a-z\\:=\\"]+\\]`si', ']', $message);
             }
         } else {
             $message = preg_replace("`\\:[0-9a-z\\:=\"]+\\]`i", "]", $message);
         }
     }
     if ($this->rss_config['rss_allow_links']) {
         $message = make_clickable($message);
     }
     // Parse smilies
     if ($this->rss_config['rss_allow_smilies']) {
         if ($allow_smiles) {
             $message = smilies_pass($message);
             $message = preg_replace('`' . $this->path_config['smilies_path'] . '`', $this->path_config['smilies_url'], $message);
         }
     }
     // Replace naughty words
     if (count($orig_word)) {
         $message = str_replace('\\"', '"', substr(@preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
     }
     $message .= '<br/><br/><a href="' . $message_url . '" title="' . $subject . '"><b>' . $lang['rss_more'] . '</b></a>';
     $message = str_replace("\n", "\n<br/>\n", $message);
     $message = str_replace("span", "div class=\"detail\"", $message);
     $message = preg_replace('|[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1f]|', '', $message);
     return $message;
 }
コード例 #15
0
function topic_review($topic_id, $is_inline_review)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $userdata, $user_ip;
    global $orig_word, $replacement_word;
    global $starttime;
    if (!$is_inline_review) {
        if (!isset($topic_id)) {
            message_die(GENERAL_MESSAGE, 'Topic_not_exist');
        }
        //
        // Get topic info ...
        //
        $sql = "SELECT t.topic_title, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments \n\t\t\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f \n\t\t\tWHERE t.topic_id = {$topic_id}\n\t\t\t\tAND f.forum_id = t.forum_id";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
        }
        if (!($forum_row = $db->sql_fetchrow($result))) {
            message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
        }
        $db->sql_freeresult($result);
        $forum_id = $forum_row['forum_id'];
        $topic_title = $forum_row['topic_title'];
        //
        // Start session management
        //
        $userdata = session_pagestart($user_ip, $forum_id);
        init_userprefs($userdata);
        //
        // End session management
        //
        $is_auth = array();
        $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
        if (!$is_auth['auth_read']) {
            message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']));
        }
    }
    //
    // Define censored word matches
    //
    if (empty($orig_word) && empty($replacement_word)) {
        $orig_word = array();
        $replacement_word = array();
        obtain_word_list($orig_word, $replacement_word);
    }
    //
    // Dump out the page header and load viewtopic body template
    //
    if (!$is_inline_review) {
        $gen_simple_header = TRUE;
        $page_title = $lang['Topic_review'] . ' - ' . $topic_title;
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        $template->set_filenames(array('reviewbody' => 'posting_topic_review.tpl'));
    }
    //
    // Go ahead and pull all data for this topic
    //
    $sql = "SELECT u.username, u.user_id, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid\n\t\tFROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND p.poster_id = u.user_id\n\t\t\tAND p.post_id = pt.post_id\n\t\tORDER BY p.post_time DESC\n\t\tLIMIT " . $board_config['posts_per_page'];
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not obtain post/user information', '', __LINE__, __FILE__, $sql);
    }
    //
    // Okay, let's do the loop, yeah come on baby let's do the loop
    // and it goes like this ...
    //
    if ($row = $db->sql_fetchrow($result)) {
        $mini_post_img = $images['icon_minipost'];
        $mini_post_alt = $lang['Post'];
        $i = 0;
        do {
            $poster_id = $row['user_id'];
            $poster = $row['username'];
            $post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
            //
            // Handle anon users posting with usernames
            //
            if ($poster_id == ANONYMOUS && $row['post_username'] != '') {
                $poster = $row['post_username'];
                $poster_rank = $lang['Guest'];
            } elseif ($poster_id == ANONYMOUS) {
                $poster = $lang['Guest'];
                $poster_rank = '';
            }
            $post_subject = $row['post_subject'] != '' ? $row['post_subject'] : '';
            $message = $row['post_text'];
            $bbcode_uid = $row['bbcode_uid'];
            //
            // If the board has HTML off but the post has HTML
            // on then we process it, else leave it alone
            //
            if (!$board_config['allow_html'] && $row['enable_html']) {
                $message = preg_replace('#(<)([\\/]?.*?)(>)#is', '&lt;\\2&gt;', $message);
            }
            if ($bbcode_uid != "") {
                $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
            }
            $message = make_clickable($message);
            if (count($orig_word)) {
                $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
                $message = preg_replace($orig_word, $replacement_word, $message);
            }
            if ($board_config['allow_smilies'] && $row['enable_smilies']) {
                $message = smilies_pass($message);
            }
            $message = str_replace("\n", '<br />', $message);
            //
            // Again this will be handled by the templating
            // code at some point
            //
            $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2'];
            $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
            $template->assign_block_vars('postrow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'MINI_POST_IMG' => $mini_post_img, 'POSTER_NAME' => $poster, 'POST_DATE' => $post_date, 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'L_MINI_POST_ALT' => $mini_post_alt));
            $i++;
        } while ($row = $db->sql_fetchrow($result));
    } else {
        message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', '', __LINE__, __FILE__, $sql);
    }
    $db->sql_freeresult($result);
    $template->assign_vars(array('L_AUTHOR' => $lang['Author'], 'L_MESSAGE' => $lang['Message'], 'L_POSTED' => $lang['Posted'], 'L_POST_SUBJECT' => $lang['Post_subject'], 'L_TOPIC_REVIEW' => $lang['Topic_review']));
    if (!$is_inline_review) {
        $template->pparse('reviewbody');
        include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
    }
}
コード例 #16
0
ファイル: privmsg.php プロジェクト: Nekrofage/FJR
 }
 $preview_message = stripslashes(prepare_message($privmsg_message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
 $privmsg_message = stripslashes(preg_replace($html_entities_match, $html_entities_replace, $privmsg_message));
 //
 // Finalise processing as per viewtopic
 //
 if (!$html_on || !$board_config['allow_html'] || !$userdata['user_allowhtml']) {
     if ($user_sig != '') {
         $user_sig = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
     }
 }
 if ($attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid']) {
     $user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
 }
 if ($bbcode_on) {
     $preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
 }
 if ($board_config['allow_colortext']) {
     if ($userdata['user_colortext'] != '') {
         $preview_message = '<font color="' . $userdata['user_colortext'] . '">' . $preview_message . '</font>';
     }
 }
 if ($attach_sig && $user_sig != '') {
     $preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig;
 }
 if (count($orig_word)) {
     $preview_subject = preg_replace($orig_word, $replacement_word, $privmsg_subject);
     $preview_message = preg_replace($orig_word, $replacement_word, $preview_message);
 } else {
     $preview_subject = $privmsg_subject;
 }
コード例 #17
0
ファイル: common.php プロジェクト: Juuro/Dreamapp-Website
function phpbb_parse_text($text = null, $bbcode_uid = null, $enable_smilies = true, $enable_bbcode = true, $enable_html = true, $hide_images = false, $replace_images = '')
{
    global $CFG;
    if (!$text) {
        return;
    }
    //
    // remove slashes
    //
    stripslashes($text);
    //
    // remove images if requested
    //
    if ($hide_images) {
        if ($replace_images) {
            $replacement = '[url=\\1]' . $replace_images . '[/url]';
        } else {
            $replacement = '';
        }
        $text = preg_replace("#\\[img:{$bbcode_uid}\\](.*?)\\[/img:{$bbcode_uid}\\]#si", $replacement, $text);
    }
    //
    // parse html
    //
    if (!$enable_html) {
        $text = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $text);
    }
    //
    // parse bbcode
    //
    if ($enable_bbcode) {
        $text = bbencode_second_pass($text, $bbcode_uid);
    } else {
        $text = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $text);
    }
    //
    // parse smilies if requested
    //
    if ($enable_smilies == 1 and $CFG['enable_smilies'] == true) {
        $text = smilies_pass($text);
        //
        // need to overwrite the smilie path since we might not be
        // within the phpBB directory
        //
        $text = preg_replace("/images\\/smiles/", $CFG['smilie_url'], $text);
    }
    //
    // parse url's
    //
    $text = make_clickable($text);
    //
    // change newlines to HTML
    //
    $text = str_replace("\n", "\n<br />\n", $text);
    return $text;
}