From 218629a79a0fe8aff5394077d64053b09505ebe0 Mon Sep 17 00:00:00 2001 From: nanosimbiot Date: Thu, 30 Jun 2011 11:04:35 +0000 Subject: [PATCH] r51 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Удаление bbcode_uid git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@51 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/admin/admin_rebuild_search.php | 5 +- upload/admin/admin_users.php | 6 +- upload/ajax/view_post.php | 2 +- upload/callseed.php | 2 +- upload/includes/bbcode.php | 7 +- upload/includes/functions.php | 28 +++++--- upload/includes/functions_post.php | 47 ++++--------- .../includes/report_hack/report_privmsg.php | 2 +- upload/language/lang_english/lang_main.php | 2 +- upload/language/lang_russian/lang_main.php | 2 +- upload/modcp.php | 3 +- upload/posting.php | 49 +------------ upload/privmsg.php | 69 +++---------------- upload/search.php | 2 +- upload/templates/default/posting.tpl | 23 ------- upload/templates/default/viewtopic.tpl | 21 +----- upload/viewtopic.php | 7 +- 17 files changed, 64 insertions(+), 213 deletions(-) diff --git a/upload/admin/admin_rebuild_search.php b/upload/admin/admin_rebuild_search.php index 98a9d0a75..316227527 100644 --- a/upload/admin/admin_rebuild_search.php +++ b/upload/admin/admin_rebuild_search.php @@ -167,8 +167,7 @@ if ($mode == 'submit' || $mode == 'refresh') // get the post subject/text of each post $result = DB()->query(" SELECT - pt.post_id, - pt.post_text, pt.bbcode_uid, + pt.post_id, pt.post_text, IF(p.post_id = t.topic_first_post_id, t.topic_title, '') AS post_subject FROM ". BB_POSTS_TEXT ." pt, @@ -196,7 +195,7 @@ if ($mode == 'submit' || $mode == 'refresh') // Get search words $words_sql[] = array( 'post_id' => (int) $row['post_id'], - 'search_words' => add_search_words($row['post_id'], stripslashes($row['post_text']), stripslashes($row['post_subject']), $row['bbcode_uid'], true), + 'search_words' => add_search_words($row['post_id'], stripslashes($row['post_text']), stripslashes($row['post_subject']), true), ); $timer_expired = (time() > $expire_time); diff --git a/upload/admin/admin_users.php b/upload/admin/admin_users.php index 1f4a067eb..fb4fcd60b 100644 --- a/upload/admin/admin_users.php +++ b/upload/admin/admin_users.php @@ -20,7 +20,7 @@ array_deep($_POST, 'trim'); $html_entities_match = array('#<#', '#>#'); $html_entities_replace = array('<', '>'); -$message = $error_msg = $username_sql = $signature_bbcode_uid = ''; +$message = $error_msg = $username_sql = ''; $group_moderator = $mark_list = array(); $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : ''; @@ -216,8 +216,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset( if ($signature != '') { $sig_length_check = preg_replace('/(\[.*?)(=.*?)\]/is', '\\1]', stripslashes($signature)); - $signature_bbcode_uid = ($bb_cfg['allow_bbcode']) ? make_bbcode_uid() : ''; - $signature = prepare_message($signature, $bb_cfg['allow_bbcode'], $bb_cfg['allow_smilies'], $signature_bbcode_uid); if ( strlen($sig_length_check) > $bb_cfg['max_sig_chars'] ) { @@ -523,7 +521,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset( user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, - user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowavatar = $user_allowavatar, user_allow_pm = $user_allowpm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', @@ -627,7 +624,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset( $occupation = htmlspecialchars($this_userdata['user_occ']); $interests = htmlspecialchars($this_userdata['user_interests']); - $signature = ($this_userdata['user_sig_bbcode_uid'] != '') ? preg_replace('#:' . $this_userdata['user_sig_bbcode_uid'] . '#si', '', $this_userdata['user_sig']) : $this_userdata['user_sig']; $signature = preg_replace($html_entities_match, $html_entities_replace, $signature); $viewemail = bf($this_userdata['user_opt'], 'user_opt', 'viewemail'); diff --git a/upload/ajax/view_post.php b/upload/ajax/view_post.php index 7e4ff07bc..c69c506b0 100644 --- a/upload/ajax/view_post.php +++ b/upload/ajax/view_post.php @@ -16,7 +16,7 @@ $sql = " SELECT p.*, h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text, - pt.post_subject, pt.bbcode_uid, + pt.post_subject, f.auth_read FROM ". BB_POSTS ." p INNER JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id) diff --git a/upload/callseed.php b/upload/callseed.php index ca5079b3a..9d91cfca4 100644 --- a/upload/callseed.php +++ b/upload/callseed.php @@ -55,7 +55,7 @@ function send_pm($topic_id, $t_info, $to_user_id) $id = DB()->sql_nextid(); - $sql = "INSERT INTO ". BB_PRIVMSGS_TEXT ." VALUES($id, '". make_bbcode_uid() ."', '$text')"; + $sql = "INSERT INTO ". BB_PRIVMSGS_TEXT ." VALUES($id, '$text')"; if (!DB()->sql_query($sql)) { $msg_error = "MSG_TEXT"; return; diff --git a/upload/includes/bbcode.php b/upload/includes/bbcode.php index 92b486abe..45835691c 100644 --- a/upload/includes/bbcode.php +++ b/upload/includes/bbcode.php @@ -497,10 +497,10 @@ function replace_synonyms ($text) return ($syn_match && $syn_replace) ? str_replace($syn_match, $syn_replace, $text) : $text; } -function add_search_words ($post_id, $post_message, $post_title = '', $bbcode_uid = '', $only_return_words = false) +function add_search_words ($post_id, $post_message, $post_title = '', $only_return_words = false) { $text = $post_title .' '. $post_message; - $text = strip_bbcode_uid($text, $bbcode_uid); + $text = strip_bbcode_uid($text); $words = ($text) ? extract_search_words($text) : array(); if ($only_return_words) @@ -882,14 +882,13 @@ function bbcode2html ($text) return $bbcode->bbcode2html($text); } -function strip_bbcode_uid ($text, $bbcode_uid) +function strip_bbcode_uid ($text) { $text = str_replace('[tab]', ' ', $text); $text = str_replace('"', '"', $text); $text = str_replace('code:1:', 'code:', $text); $text = str_replace('list:u:', 'list:', $text); $text = str_replace('list:o:', 'list:', $text); - $text = str_replace(":$bbcode_uid", '', $text); return $text; } diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 0145ba91e..158fe516d 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -2061,18 +2061,13 @@ function smiley_sort ($a, $b) // CRITICAL_ERROR : Used when config data cannot be obtained, eg // no database connection. Should _not_ be used in 99.5% of cases // -function bb_die ($msg_text, $msg_code = GENERAL_MESSAGE, $msg_title = '') +function bb_die ($msg_text) { if (defined('IN_AJAX')) { - ajax_die($msg_text, $msg_code); + $GLOBALS['ajax']->ajax_die($msg_text); } - message_die($msg_code, $msg_text, $msg_title); -} - -function ajax_die ($msg_text, $msg_code = E_AJAX_GENERAL_ERROR) -{ - $GLOBALS['ajax']->ajax_die($msg_text, $msg_code); + message_die(GENERAL_MESSAGE, $msg_text); } function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') @@ -2975,4 +2970,21 @@ function get_path_from_id ($id, $ext_id, $base_path, $first_div, $sec_div) global $bb_cfg; $ext = isset($bb_cfg['file_id_ext'][$ext_id]) ? $bb_cfg['file_id_ext'][$ext_id] : ''; return ($base_path ? "$base_path/" : '') . ($id % $sec_div) .'/'. $id . ($ext ? ".$ext" : ''); +} + +function send_pm($user_id, $subject, $message) +{ $subject = DB()->escape($subject); + $message = DB()->escape($message); + + DB()->sql_query("INSERT INTO ". BB_PRIVMSGS ." (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip) + VALUES (". PRIVMSGS_NEW_MAIL .", '$subject', {$userdata['user_id']}, $user_id, ". TIMENOW .", '". USER_IP ."')"); + $pm_id = DB()->sql_nextid(); + + DB()->sql_query("INSERT INTO ". BB_PRIVMSGS_TEXT ." VALUES($pm_id, '$text')"); + + DB()->sql_query("UPDATE ". BB_USERS ." SET + user_new_privmsg = user_new_privmsg + 1, + user_last_privmsg = ". TIMENOW .", + user_newest_pm_id = $pm_id + WHERE user_id = $user_id"); } \ No newline at end of file diff --git a/upload/includes/functions_post.php b/upload/includes/functions_post.php index 1bcd36b32..a5dfadfce 100644 --- a/upload/includes/functions_post.php +++ b/upload/includes/functions_post.php @@ -22,28 +22,10 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); -$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); -$html_entities_replace = array('&', '<', '>', '"'); - -$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#'); -$unhtml_specialchars_replace = array('>', '<', '"', '&'); - -// -// This function will prepare a posted message for -// entry into the database. -// - -function unprepare_message($message) -{ - global $unhtml_specialchars_match, $unhtml_specialchars_replace; - - return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $message); -} - // // Prepare a message for posting // -function prepare_post(&$mode, &$post_data, &$bbcode_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length) +function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length) { global $bb_cfg, $userdata, $lang; @@ -147,7 +129,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$smilies_on, &$error_ms // // Post a new topic/reply/poll or edit existing post/poll // -function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$smilies_on, &$attach_sig, &$bbcode_uid, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length, $update_post_time) +function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length, $update_post_time) { global $bb_cfg, $lang; global $userdata, $post_info, $is_auth; @@ -178,7 +160,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_ if ($mode != 'editpost' && !empty($row['last_post_time']) && !IS_AM) { $sql = " - SELECT pt.post_text, pt.bbcode_uid + SELECT pt.post_text FROM ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt WHERE $where_sql @@ -189,7 +171,6 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_ if ($row = DB()->fetch_row($sql)) { - $last_msg = addslashes(str_replace($row['bbcode_uid'], $bbcode_uid, $row['post_text'])); $last_msg = str_replace("\'", "''", $last_msg); if ($last_msg == $post_message) @@ -232,7 +213,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_ "); } - $sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."', $bbcode_on, $smilies_on, $attach_sig)" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id"; + $sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."')" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . " WHERE post_id = $post_id"; if (!DB()->sql_query($sql)) { message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql); @@ -243,7 +224,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_ $post_id = DB()->sql_nextid(); } - $sql = ($mode != 'editpost') ? "INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . BB_POSTS_TEXT . " SET post_text = '$post_message', bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id"; + $sql = ($mode != 'editpost') ? "INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_subject, post_text) VALUES ($post_id, '$post_subject', '$post_message')" : "UPDATE " . BB_POSTS_TEXT . " SET post_text = '$post_message', post_subject = '$post_subject' WHERE post_id = $post_id"; if (!DB()->sql_query($sql)) { message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql); @@ -251,14 +232,12 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_ if ($userdata['user_id'] != BOT_UID) { - add_search_words($post_id, stripslashes($post_message), stripslashes($post_subject), $bbcode_uid); + add_search_words($post_id, stripslashes($post_message), stripslashes($post_subject)); } update_post_html(array( 'post_id' => $post_id, 'post_text' => $post_message, - 'bbcode_uid' => $bbcode_uid, - 'enable_smilies' => $smilies_on, )); // @@ -576,7 +555,10 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi $emailer->from($bb_cfg['board_email']); $emailer->replyto($bb_cfg['board_email']); - $topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title); + if(count($orig_word)) + { + $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); + } @reset($bcc_list_ary); while (list($user_lang, $bcc_list) = each($bcc_list_ary)) @@ -666,7 +648,7 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new if (!$topic_id) return; - $post_username = $post_subject = $post_text = $poster_ip = $bbcode_uid = ''; + $post_username = $post_subject = $post_text = $poster_ip = ''; $enable_bbcode = $enable_smilies = 0; $enable_sig = 1; @@ -737,8 +719,8 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new $post_id = DB()->sql_nextid(); $post_text = DB()->escape($post_text); - $post_text_columns = 'post_id, post_subject, bbcode_uid, post_text'; - $post_text_values = "$post_id, '$post_subject', '$bbcode_uid', '$post_text'"; + $post_text_columns = 'post_id, post_subject, post_text'; + $post_text_values = "$post_id, '$post_subject, '$post_text'"; DB()->query("INSERT INTO ". BB_POSTS_TEXT ." ($post_text_columns) VALUES ($post_text_values)"); } @@ -750,8 +732,7 @@ function topic_review ($topic_id) // Fetch posts data $review_posts = DB()->fetch_rowset(" SELECT - p.*, - pt.post_text, pt.bbcode_uid, + p.*, pt.post_text IF(p.poster_id = ". ANONYMOUS .", p.post_username, u.username) AS username, u.user_id FROM ". BB_POSTS ." p, diff --git a/upload/includes/report_hack/report_privmsg.php b/upload/includes/report_hack/report_privmsg.php index 17825515d..9d0fd319f 100644 --- a/upload/includes/report_hack/report_privmsg.php +++ b/upload/includes/report_hack/report_privmsg.php @@ -193,7 +193,7 @@ class report_privmsg extends report_module // function subject_details_obtain($report_subject) { - $sql = 'SELECT p.privmsgs_subject, p.privmsgs_from_userid, p.privmsgs_enable_bbcode, p.privmsgs_enable_smilies, pt.privmsgs_bbcode_uid, pt.privmsgs_text, u.username + $sql = 'SELECT p.privmsgs_subject, p.privmsgs_from_userid, p.privmsgs_enable_bbcode, p.privmsgs_enable_smilies, pt.privmsgs_text, u.username FROM ' . BB_PRIVMSGS . ' p INNER JOIN ' . BB_PRIVMSGS_TEXT . ' pt ON pt.privmsgs_text_id = privmsgs_id diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php index 053597615..a64cbae82 100644 --- a/upload/language/lang_english/lang_main.php +++ b/upload/language/lang_english/lang_main.php @@ -1527,6 +1527,6 @@ $lang['TRACKER_S'] = 'on tracker'; // copyright $lang['NOTICE'] = '!ATTENTION!'; -$lang['POWERED'] = 'Powered by TorrentPier © Meithar'; +$lang['POWERED'] = 'Powered by TorrentPier © Meithar'; $lang['DIVE'] = 'The forum is submitted on base phpBB © phpBB Group'; $lang['COPY'] = 'The site does not give electronic versions of products, and is engaged only in a collecting and cataloguing of the references sent and published at a forum by our readers. If you are the legal owner of any submitted material and do not wish that the reference to him{it} was in our catalogue, contact us and we shall immediately remove her. Files for an exchange on tracker are given by users of a site, and the administration does not bear the responsibility for their maintenance. The request to not fill in the files protected by copyrights, and also files of the illegal maintenance!'; \ No newline at end of file diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php index 3aefb074e..2c846d6c9 100644 --- a/upload/language/lang_russian/lang_main.php +++ b/upload/language/lang_russian/lang_main.php @@ -1534,6 +1534,6 @@ $lang['TRACKER_S'] = 'по трекеру'; // copyright $lang['NOTICE'] = '!ВНИМАНИЕ!'; -$lang['POWERED'] = 'Powered by TorrentPier © Meithar'; +$lang['POWERED'] = 'Powered by TorrentPier © Meithar'; $lang['DIVE'] = 'Форум представлен на базе phpBB © phpBB Group'; $lang['COPY'] = 'Сайт не предоставляет электронные версии произведений, а занимается лишь коллекционированием и каталогизацией ссылок, присылаемых и публикуемых на форуме нашими читателями. Если вы являетесь правообладателем какого-либо представленного материала и не желаете чтобы ссылка на него находилась в нашем каталоге, свяжитесь с нами и мы незамедлительно удалим её. Файлы для обмена на трекере предоставлены пользователями сайта, и администрация не несёт ответственности за их содержание. Просьба не заливать файлы, защищенные авторскими правами, а также файлы нелегального содержания!'; \ No newline at end of file diff --git a/upload/modcp.php b/upload/modcp.php index 81f5690f5..d62b0e524 100644 --- a/upload/modcp.php +++ b/upload/modcp.php @@ -542,7 +542,7 @@ switch ($mode) //mpd end else { - $sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username + $sql = "SELECT u.username, p.*, pt.post_text, pt.post_subject, p.post_username FROM " . BB_POSTS . " p, " . BB_USERS . " u, " . BB_POSTS_TEXT . " pt WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id @@ -575,7 +575,6 @@ switch ($mode) $post_date = bb_date($postrow[$i]['post_time']); - $bbcode_uid = $postrow[$i]['bbcode_uid']; $message = $postrow[$i]['post_text']; $post_subject = ( isset($postrow[$i]['post_subject']) ) ? $postrow[$i]['post_subject'] : $topic_title; diff --git a/upload/posting.php b/upload/posting.php index e422d5682..fc9c091ed 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -292,26 +292,6 @@ if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id']) require(INC_DIR .'topic_templates.php'); } -// BBCode -if (!$bb_cfg['allow_bbcode']) -{ - $bbcode_on = 0; -} -else -{ - $bbcode_on = ($submit || $refresh) ? (int) empty($_POST['disable_bbcode']) : $bb_cfg['allow_bbcode']; -} - -// Smilies -if (!$bb_cfg['allow_smilies']) -{ - $smilies_on = 0; -} -else -{ - $smilies_on = ($submit || $refresh) ? (int) empty($_POST['disable_smilies']) : $bb_cfg['allow_smilies']; -} - // Notify if ($submit || $refresh) { @@ -346,7 +326,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote' { if ($topic_last_read = max(intval(@$tracking_topics[$topic_id]), intval(@$tracking_forums[$forum_id]))) { - $sql = "SELECT p.*, pt.post_text, pt.bbcode_uid, u.username + $sql = "SELECT p.*, pt.post_text, u.username FROM ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt, ". BB_USERS ." u WHERE p.topic_id = ". (int) $topic_id ." AND u.user_id = p.poster_id @@ -507,15 +487,14 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts ) $poll_title = ( isset($_POST['poll_title']) && $is_auth['auth_pollcreate'] ) ? $_POST['poll_title'] : ''; $poll_options = ( isset($_POST['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $_POST['poll_option_text'] : ''; $poll_length = ( isset($_POST['poll_length']) && $is_auth['auth_pollcreate'] ) ? $_POST['poll_length'] : ''; - $bbcode_uid = ''; - prepare_post($mode, $post_data, $bbcode_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length); + prepare_post($mode, $post_data, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length); if (!$error_msg) { $topic_type = ( isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type; - submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length, $update_post_time); + submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length, $update_post_time); } break; @@ -677,22 +656,6 @@ else $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject']; $message = $post_info['post_text']; - if ( $mode == 'editpost' ) - { - $attach_sig = $post_info['enable_sig']; - $bbcode_on = $post_info['enable_bbcode']; - $smilies_on = $post_info['enable_smilies']; - } - else - { - $attach_sig = bf($userdata['user_opt'], 'user_opt', 'attachsig'); - } - - if ( $post_info['bbcode_uid'] != '' ) - { - $message = preg_replace('/\:(([a-z0-9]:)?)' . $post_info['bbcode_uid'] . '/s', '', $message); - } - $message = str_replace('<', '<', $message); $message = str_replace('>', '>', $message); $message = str_replace('
', "\n", $message); @@ -877,15 +840,12 @@ if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) // // Output the data to the template // -$bbcode_status = ($bb_cfg['allow_bbcode']) ? $lang['BBCODE_IS_ON'] : $lang['BBCODE_IS_OFF']; $template->assign_vars(array( 'USERNAME' => @$username, 'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '', 'SUBJECT' => $subject, 'MESSAGE' => $message, - 'BBCODE_STATUS' => sprintf($bbcode_status, '', ''), - 'SMILIES_STATUS' => ($bb_cfg['allow_smilies']) ? $lang['SMILIES_ARE_ON'] : $lang['SMILIES_ARE_OFF'], 'L_SUBJECT' => $lang['SUBJECT'], 'L_MESSAGE_BODY' => $lang['MESSAGE_BODY'], @@ -938,9 +898,6 @@ $template->assign_vars(array( 'U_VIEWTOPIC' => ( $mode == 'reply' ) ? append_sid("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&postorder=desc") : '', - 'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '', - 'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '', - 'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '', 'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_TOPIC_ID' => $topic_id, diff --git a/upload/privmsg.php b/upload/privmsg.php index ca26df16a..382345705 100644 --- a/upload/privmsg.php +++ b/upload/privmsg.php @@ -174,7 +174,7 @@ if ( $mode == 'read' ) // // Major query obtains the message ... // - $sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, u.user_posts, u.user_from, u.user_email, u.user_regdate, u.user_rank, u.user_avatar, pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text + $sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, u.user_posts, u.user_from, u.user_email, u.user_regdate, u.user_rank, u.user_avatar, pm.*, pmt.privmsgs_text FROM " . BB_PRIVMSGS . " pm, " . BB_PRIVMSGS_TEXT . " pmt, " . BB_USERS . " u, " . BB_USERS . " u2 WHERE pm.privmsgs_id = $privmsgs_id AND pmt.privmsgs_text_id = pm.privmsgs_id @@ -288,8 +288,8 @@ if ( $mode == 'read' ) $privmsg_sent_id = DB()->sql_nextid(); - $sql = "INSERT INTO " . BB_PRIVMSGS_TEXT . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) - VALUES ($privmsg_sent_id, '" . $privmsg['privmsgs_bbcode_uid'] . "', '" . str_replace("\'", "''", addslashes($privmsg['privmsgs_text'])) . "')"; + $sql = "INSERT INTO " . BB_PRIVMSGS_TEXT . " (privmsgs_text_id, privmsgs_text) + VALUES ($privmsg_sent_id, '" . str_replace("\'", "''", addslashes($privmsg['privmsgs_text'])) . "')"; if ( !DB()->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql); @@ -473,12 +473,6 @@ if ( $mode == 'read' ) $post_subject = htmlCHR($privmsg['privmsgs_subject']); $private_message = $privmsg['privmsgs_text']; - $bbcode_uid = $privmsg['privmsgs_bbcode_uid']; - - if ( $bbcode_uid != '' ) - { - $private_message = ( $bb_cfg['allow_bbcode'] ) ? bbencode_second_pass($private_message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $private_message); - } $orig_word = array(); $replacement_word = array(); @@ -490,7 +484,7 @@ if ( $mode == 'read' ) $private_message = preg_replace($orig_word, $replacement_word, $private_message); } - $private_message = str_replace("\n", '
', $private_message); + $private_message = bbcode2html($private_message); // // Dump it to the templating engine @@ -1027,7 +1021,7 @@ else if ( $submit || $refresh || $mode != '' ) { if ( !$error ) { - $privmsg_message = bbcode2html($_POST['message']); + $privmsg_message = DB()->escape($_POST['message']); } } else @@ -1118,13 +1112,13 @@ else if ( $submit || $refresh || $mode != '' ) { $privmsg_sent_id = DB()->sql_nextid(); - $sql = "INSERT INTO " . BB_PRIVMSGS_TEXT . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) - VALUES ($privmsg_sent_id, '" . @$bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')"; + $sql = "INSERT INTO " . BB_PRIVMSGS_TEXT . " (privmsgs_text_id, privmsgs_text) + VALUES ($privmsg_sent_id, '" . str_replace("\'", "''", $privmsg_message) . "')"; } else { $sql = "UPDATE " . BB_PRIVMSGS_TEXT . " - SET privmsgs_text = '" . str_replace("\'", "''", $privmsg_message) . "', privmsgs_bbcode_uid = '$bbcode_uid' + SET privmsgs_text = '" . str_replace("\'", "''", $privmsg_message) . "' WHERE privmsgs_text_id = $privmsg_id"; } @@ -1188,7 +1182,6 @@ else if ( $submit || $refresh || $mode != '' ) } else if ( $preview || $refresh || $error ) { - // // If we're previewing or refreshing then obtain the data // passed to the script, process it a little, do some checks @@ -1265,7 +1258,7 @@ else if ( $submit || $refresh || $mode != '' ) else if ( $mode == 'edit' ) { - $sql = "SELECT pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text, u.username, u.user_id + $sql = "SELECT pm.*, pmt.privmsgs_text, u.username, u.user_id FROM " . BB_PRIVMSGS . " pm, " . BB_PRIVMSGS_TEXT . " pmt, " . BB_USERS . " u WHERE pm.privmsgs_id = $privmsg_id AND pmt.privmsgs_text_id = pm.privmsgs_id @@ -1285,16 +1278,8 @@ else if ( $submit || $refresh || $mode != '' ) $privmsg_subject = $privmsg['privmsgs_subject']; $privmsg_message = $privmsg['privmsgs_text']; - $privmsg_bbcode_uid = $privmsg['privmsgs_bbcode_uid']; $privmsg_bbcode_enabled = ($privmsg['privmsgs_enable_bbcode'] == 1); - if ( $privmsg_bbcode_enabled ) - { - $privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message); - } - - $privmsg_message = str_replace('
', "\n", $privmsg_message); - $to_username = $privmsg['username']; $to_userid = $privmsg['user_id']; @@ -1302,7 +1287,7 @@ else if ( $submit || $refresh || $mode != '' ) else if ( $mode == 'reply' || $mode == 'quote' ) { - $sql = "SELECT pm.privmsgs_subject, pm.privmsgs_date, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text, u.username, u.user_id + $sql = "SELECT pm.privmsgs_subject, pm.privmsgs_date, pmt.privmsgs_text, u.username, u.user_id FROM " . BB_PRIVMSGS . " pm, " . BB_PRIVMSGS_TEXT . " pmt, " . BB_USERS . " u WHERE pm.privmsgs_id = $privmsg_id AND pmt.privmsgs_text_id = pm.privmsgs_id @@ -1326,10 +1311,6 @@ else if ( $submit || $refresh || $mode != '' ) if ( $mode == 'quote' ) { $privmsg_message = $privmsg['privmsgs_text']; - $privmsg_bbcode_uid = $privmsg['privmsgs_bbcode_uid']; - - $privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message); - $privmsg_message = str_replace('
', "\n", $privmsg_message); $msg_date = bb_date($privmsg['privmsgs_date']); @@ -1422,32 +1403,6 @@ else if ( $submit || $refresh || $mode != '' ) $template->assign_block_vars('switch_privmsg', array()); $template->assign_var('POSTING_USERNAME'); - // - // BBCode toggle selection - // - if ( $bb_cfg['allow_bbcode'] ) - { - $bbcode_status = $lang['BBCODE_IS_ON']; - $template->assign_block_vars('switch_bbcode_checkbox', array()); - } - else - { - $bbcode_status = $lang['BBCODE_IS_OFF']; - } - - // - // Smilies toggle selection - // - if ( $bb_cfg['allow_smilies'] ) - { - $smilies_status = $lang['SMILIES_ARE_ON']; - $template->assign_block_vars('switch_smilies_checkbox', array()); - } - else - { - $smilies_status = $lang['SMILIES_ARE_OFF']; - } - $post_a = ' '; if ( $mode == 'post' ) { @@ -1524,10 +1479,6 @@ else if ( $submit || $refresh || $mode != '' ) } else { - // - // Default page - // - // // Reset PM counters // diff --git a/upload/search.php b/upload/search.php index c55b35dd9..b74ebd0ea 100644 --- a/upload/search.php +++ b/upload/search.php @@ -488,7 +488,7 @@ if ($post_mode) t.*, p.*, h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text, - pt.post_subject, pt.bbcode_uid, + pt.post_subject, IF(p.poster_id = $anon_id, p.post_username, u.username) AS username, u.user_id FROM $posts_tbl INNER JOIN $topics_tbl ON(t.topic_id = p.topic_id) diff --git a/upload/templates/default/posting.tpl b/upload/templates/default/posting.tpl index 487bfae93..ebaac5b3e 100644 --- a/upload/templates/default/posting.tpl +++ b/upload/templates/default/posting.tpl @@ -119,30 +119,11 @@

{L_OPTIONS}

-

- {BBCODE_STATUS}
- {SMILIES_STATUS}
-

-
- - - - - - - - - -
disabled="disabled" />
checked="checked" disabled="disabled" />
-
- -
  
-
@@ -151,10 +132,6 @@ - - - - diff --git a/upload/templates/default/viewtopic.tpl b/upload/templates/default/viewtopic.tpl index 97e595d9c..233d20ba2 100644 --- a/upload/templates/default/viewtopic.tpl +++ b/upload/templates/default/viewtopic.tpl @@ -341,25 +341,8 @@ function set_hid_chbox (id)
- - {L_QR_DISABLE}:  - - - - - -   - - - -   - - - +
diff --git a/upload/viewtopic.php b/upload/viewtopic.php index fd743d2b0..d80459d61 100644 --- a/upload/viewtopic.php +++ b/upload/viewtopic.php @@ -371,11 +371,11 @@ $post_order = (isset($_POST['postorder']) && $_POST['postorder'] !== 'asc') ? 'd $sql = " SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_from_flag, - u.user_regdate, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, + u.user_regdate, u.user_rank, u.user_sig, u.user_avatar, u.user_avatar_type, u.user_allowavatar, p.*, h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text, - pt.post_subject, pt.bbcode_uid + pt.post_subject FROM ". BB_POSTS ." p LEFT JOIN ". BB_USERS ." u ON(u.user_id = p.poster_id) LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id) @@ -870,8 +870,6 @@ for($i = 0; $i < $total_posts; $i++) $message = get_parsed_post($postrow[$i]); - $bbcode_uid = $postrow[$i]['bbcode_uid']; - $user_sig = ($bb_cfg['allow_sig'] && !$user->opt_js['h_sig'] && $postrow[$i]['enable_sig'] && $postrow[$i]['user_sig']) ? $postrow[$i]['user_sig'] : ''; if ($user_sig) @@ -1044,7 +1042,6 @@ if ($bb_cfg['show_quick_reply']) if (!IS_GUEST) { $template->assign_vars(array( - 'QR_ATTACHSIG_CHECKED' => bf($userdata['user_opt'], 'user_opt', 'attachsig'), 'QR_NOTIFY_CHECKED' => ($userdata['user_notify'] || $is_watching_topic), )); }