$mc_select_type = array(); foreach ($lang['MC_COMMENT'] as $key => $value) { $mc_select_type[$key] = $value['type']; } $template->assign_block_vars('postrow', array('ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'POST_ID' => $post_id, 'IS_NEWEST' => $post_id == $newest, 'POSTER_NAME' => profile_url(array('username' => $poster, 'user_rank' => $user_rank)), 'POSTER_NAME_JS' => addslashes($poster), 'POSTER_RANK' => $poster_rank, 'RANK_IMAGE' => $rank_image, 'POSTER_JOINED' => $bb_cfg['show_poster_joined'] ? $poster_longevity : '', 'POSTER_JOINED_DATE' => $poster_joined, 'POSTER_POSTS' => $bb_cfg['show_poster_posts'] ? $poster_posts : '', 'POSTER_FROM' => $bb_cfg['show_poster_from'] ? wbr($poster_from) : '', 'POSTER_BOT' => $poster_id == BOT_UID, 'POSTER_ID' => $poster_id, 'POSTER_AUTHOR' => $poster_id == $t_data['topic_poster'], 'POSTER_GENDER' => $bb_cfg['gender'] ? gender_image($postrow[$i]['user_gender']) : '', 'POSTED_AFTER' => $prev_post_time ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '', 'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id), 'IS_FIRST_POST' => !$start && $post_id == $t_data['topic_first_post_id'], 'MOD_CHECKBOX' => $moderation && ($start || defined('SPLIT_FORM_START')), 'POSTER_AVATAR' => $poster_avatar, 'POST_NUMBER' => $i + $start + 1, 'POST_DATE' => $post_date, 'MESSAGE' => $message, 'SIGNATURE' => $user_sig, 'EDITED_MESSAGE' => $l_edited_by, 'PM' => $pm_btn, 'PROFILE' => $profile_btn, 'QUOTE' => $quote_btn, 'EDIT' => $edit_btn, 'DELETE' => $delpost_btn, 'IP' => $ip_btn, 'POSTER_BIRTHDAY' => $bb_cfg['birthday_enabled'] && $this_date == $poster_birthday ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '', 'MC_COMMENT' => $mc_type ? bbcode2html($mc_comment) : '', 'MC_BBCODE' => $mc_type ? $mc_comment : '', 'MC_CLASS' => $mc_class, 'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id), 'MC_SELECT_TYPE' => build_select("mc_type_{$post_id}", array_flip($mc_select_type), $mc_type), 'RG_AVATAR' => $rg_avatar, 'RG_NAME' => $rg_name, 'RG_URL' => GROUP_URL . $rg_id, 'RG_FIND_URL' => 'tracker.php?srg=' . $rg_id, 'RG_SIG' => $rg_signature, 'RG_SIG_ATTACH' => $postrow[$i]['attach_rg_sig'])); if ($postrow[$i]['post_attachment'] && $is_auth['auth_download'] && function_exists('display_post_attachments')) { display_post_attachments($post_id, $postrow[$i]['post_attachment']); } if ($moderation && !defined('SPLIT_FORM_START') && ($start || $post_id == $t_data['topic_first_post_id'])) { define('SPLIT_FORM_START', TRUE); } if ($poster_id != BOT_UID) { $prev_post_time = $postrow[$i]['post_time']; } } set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id, $max_post_time); if (defined('SPLIT_FORM_START')) { $template->assign_vars(array('SPLIT_FORM' => true, 'START' => $start, 'S_SPLIT_ACTION' => "modcp.php", 'POST_FORUM_URL' => POST_FORUM_URL, 'POST_TOPIC_URL' => POST_TOPIC_URL)); } // Quick Reply if ($bb_cfg['show_quick_reply']) { if ($is_auth['auth_reply'] && !($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED)) { $template->assign_vars(array('QUICK_REPLY' => true, 'QR_POST_ACTION' => POSTING_URL, 'QR_TOPIC_ID' => $topic_id, 'CAPTCHA_HTML' => IS_GUEST ? bb_captcha('get') : '')); if (!IS_GUEST) { $notify_user = bf($userdata['user_opt'], 'user_opt', 'user_notify'); $template->assign_vars(array('QR_NOTIFY_CHECKED' => $notify_user ? $notify_user && $is_watching_topic : $is_watching_topic)); } } } foreach ($is_auth as $name => $is) { $template->assign_vars(array(strtoupper($name) => $is));
case 'delete': require_once INC_DIR . 'functions_admin.php'; delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id); break; } if (!$error_msg) { if (!in_array($mode, array('editpost', 'delete'))) { $user_id = $mode == 'reply' || $mode == 'newtopic' ? $userdata['user_id'] : $post_data['poster_id']; update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); } $attachment_mod['posting']->insert_attachment($post_id); if (!$error_msg) { user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $notify_user); } if ($mode == 'newtopic' || $mode == 'reply') { set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id); } if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg) { include INC_DIR . 'functions_torrent.php'; if (!DB()->fetch_row("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE attach_id = " . TORRENT_ATTACH_ID)) { if ($bb_cfg['premod']) { // Получение списка id форумов начиная с parent $forum_parent = $forum_id; if ($post_info['forum_parent']) { $forum_parent = $post_info['forum_parent']; } $count_rowset = DB()->fetch_rowset("SELECT forum_id FROM " . BB_FORUMS . " WHERE forum_parent = {$forum_parent}"); $sub_forums = array(); foreach ($count_rowset as $count_row) { if ($count_row['forum_id'] != $forum_id) { $sub_forums[] = $count_row['forum_id'];
if (isset($_REQUEST['tst']) && $_REQUEST['tst'] != -1) { $tor_status = (int) $_REQUEST['tst']; // reset other req values unset($_REQUEST['sort'], $_REQUEST['order'], $_REQUEST[$title_match_key]); $show_type_separator = false; } $select_tst = array_merge(array($lang['TOR_STATUS_SELECT_ALL'] => -1), array_flip($lang['TOR_STATUS_NAME'])); $template->assign_vars(array('SELECT_TST' => build_select('tst', $select_tst, $tor_status))); $select_st = array_merge(array($lang['TOR_STATUS_SELECT_ACTION'] => -1), array_flip($lang['TOR_STATUS_NAME'])); $template->assign_vars(array('SELECT_ST' => build_select('st', $select_st, -1))); } // Topics read tracks $tracking_topics = get_tracks('topic'); $tracking_forums = get_tracks('forum'); if ($mark_read && !IS_GUEST) { set_tracks(COOKIE_FORUM, $tracking_forums, $forum_id); set_die_append_msg($forum_id); $message = $lang['TOPICS_MARKED_READ']; bb_die($message); } // Subforums $show_subforums = $bb_cfg['sf_on_first_page_only'] ? !$start : true; if (!($forums = $datastore->get('cat_forums'))) { $datastore->update('cat_forums'); $forums = $datastore->get('cat_forums'); } if ($forums['forum'][$forum_id]['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_porn_forums')) { bb_die($lang['ERROR_PORNO_FORUM']); } if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums']) && $show_subforums) { $not_auth_forums = $user->get_excluded_forums(AUTH_VIEW);
} $template->assign_block_vars('t', array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_name_html[$forum_id], 'TOPIC_ID' => $topic_id, 'TOPIC_TITLE' => $topic_title, 'TOPIC_ICON' => get_topic_icon($first_post, $is_unread_t))); $quote_btn = true; $edit_btn = $delpost_btn = $ip_btn = IS_AM; // Topic posts block foreach ($topic_posts as $row_num => $post) { $message = get_parsed_post($post); if (count($orig_word)) { $message = preg_replace($orig_word, $replacement_word, $message); } $template->assign_block_vars('t.p', array('ROW_NUM' => $row_num, 'POSTER_ID' => $post['poster_id'], 'POSTER' => profile_url($post), 'POST_ID' => $post['post_id'], 'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']), 'IS_UNREAD' => is_unread($post['post_time'], $topic_id, $forum_id), 'MESSAGE' => $message, 'POSTED_AFTER' => '', 'QUOTE' => $quote_btn, 'EDIT' => $edit_btn, 'DELETE' => $delpost_btn, 'IP' => $ip_btn)); $curr_new_track_val = !empty($new_tracks[$topic_id]) ? $new_tracks[$topic_id] : 0; $new_tracks[$topic_id] = max($curr_new_track_val, $post['post_time']); } } set_tracks(COOKIE_TOPIC, $tracking_topics, $new_tracks); } else { $order = $order_opt[$order_val]['sql']; $sort = $sort_opt[$sort_val]['sql']; $per_page = $bb_cfg['topics_per_page']; $display_as_val = $as_topics; // Run initial search for topic_ids if (!$items_found) { $join_t = $title_match || $my_topics || $new_topics || $dl_search || $new_posts || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl)); $join_s = $text_match_sql && !$title_match; $join_p = $my_posts || $join_s; $join_dl = $dl_search; $tbl = $join_p && !$join_t ? 'p' : 't'; $time_field = $join_p && !$join_t ? 'post_time' : 'topic_last_post_time'; // SELECT if ($egosearch) {