$fromdata[$i]['POSTS'] = $res['posts']; } } //Weitere IPs des Benutzers if ($postinfo['userid']) { $data = $db->fetch("SELECT ip,count(postid) AS posts FROM " . PRE . "_forum_posts WHERE userid='" . $postinfo['userid'] . "' GROUP BY ip ORDER BY posts DESC"); foreach ($data as $res) { ++$i; $otherdata[$i]['IP'] = $res['ip']; $otherdata[$i]['POSTS'] = $res['posts']; } } $apx->tmpl->assign('USERNAME', replace($postinfo['username'])); $apx->tmpl->assign('USERID', $postinfo['userid']); $apx->tmpl->assign('THISIP', $postinfo['ip']); $apx->tmpl->assign('FROMIP', $fromdata); $apx->tmpl->assign('OTHER', $otherdata); $apx->tmpl->parse('ipstats'); //////////////////////////////////////////////////////////////////////////////////////////////////////// $apx->tmpl->assign('PATH', forum_path($foruminfo, 1)); $apx->tmpl->assign('PATHEND', iif($threadinfo['sticky'], $threadinfo['sticky_text'] . ': ') . $threadinfo['title']); titlebar($threadinfo['title']); } else { die('action does not exist!'); } //////////////////////////////////////////////////////////////////////////////////////////////////////// require 'lib/_end.php'; /////////////////////////////////////////////////////////////////////////// require '../lib/_end.php'; //////////////////////////////////////////////////////// SCRIPT BEENDEN /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
//Die letzten 10 Beiträge $data = $db->fetch("SELECT postid,userid,username,text,time,allowcodes,allowsmilies FROM " . PRE . "_forum_posts WHERE ( del=0 AND threadid='" . $threadinfo['threadid'] . "' ) ORDER BY time DESC LIMIT 10"); if (count($data)) { foreach ($data as $res) { ++$i; //Text $text = forum_replace($res['text'], $res['allowcodes'], $res['allowsmilies']); $postdata[$i]['ID'] = $res['postid']; $postdata[$i]['USERID'] = $res['userid']; $postdata[$i]['USERNAME'] = replace($res['username']); $postdata[$i]['TEXT'] = $text; $postdata[$i]['TIME'] = $res['time']; } } $apx->tmpl->assign('POST', $postdata); $apx->tmpl->assign('ATTACH', forum_access_addattachment($foruminfo)); $apx->tmpl->assign('ID', $threadinfo['threadid']); $apx->tmpl->assign('HASH', $_POST['hash']); $apx->tmpl->parse('newpost'); //////////////////////////////////////////////////////////////////////////////////////////////////////// $threadpath = array(array('TITLE' => trim(compatible_hsc(strip_tags(forum_get_prefix($threadinfo['prefix']) . ' ') . $threadinfo['title'])), 'LINK' => mkrellink('thread.php?id=' . $threadinfo['threadid'], 'thread,' . $threadinfo['threadid'] . ',1' . urlformat($threadinfo['title']) . '.html'))); $apx->tmpl->assign_static('STYLESHEET', compatible_hsc($foruminfo['stylesheet'])); $apx->tmpl->assign('PATH', array_merge(forum_path($foruminfo, 1), $threadpath)); $apx->tmpl->assign('PATHEND', $apx->lang->get('HEADLINE_NEWPOST')); titlebar($apx->lang->get('HEADLINE_NEWPOST')); //////////////////////////////////////////////////////////////////////////////////////////////////////// require 'lib/_end.php'; /////////////////////////////////////////////////////////////////////////// require '../lib/_end.php'; //////////////////////////////////////////////////////// SCRIPT BEENDEN /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
// page the post is on and the correct display of viewtopic) // $join_sql_table = !$post_id ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 "; $join_sql = !$post_id ? "t.topic_id = {$topic_id}" : "p.post_id = {$post_id} AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= {$post_id}"; $count_sql = !$post_id ? '' : ", COUNT(p2.post_id) AS prev_posts"; $order_sql = !$post_id ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, 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_commend, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.auth_ban, f.auth_greencard, f.auth_bluecard ORDER BY p.post_id ASC"; $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_icon, f.forum_status, 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_commend, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.forum_sub, f.auth_ban, f.auth_greencard, f.auth_bluecard" . $count_sql . "\n\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "\n\tWHERE {$join_sql}\n\t\tAND f.forum_id = t.forum_id\n\t\t{$order_sql}"; attach_setup_viewtopic_auth($order_sql, $sql); if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql); } if (!($forum_topic_data = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); } $forum_id = intval($forum_topic_data['forum_id']); $forum_path = forum_path($forum_topic_data, $forum_id); // // Start session management // $userdata = session_pagestart($user_ip, $forum_id); init_userprefs($userdata); // // End session management // // // Start auth check // $is_auth = array(); $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data); if (!$is_auth['auth_view'] || !$is_auth['auth_read']) { if (!$userdata['session_logged_in']) {
$s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"modcp.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}&start=" . $start . "&sid=" . $userdata['session_id'] . '">', '</a>'); } // // Mozilla navigation bar // $nav_links['up'] = array('url' => append_sid('index.' . $phpEx), 'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])); // // Dump out the page header and load viewforum template // define('SHOW_ONLINE', true); $page_title = $lang['View_forum'] . ' - ' . $forum_row['forum_name']; include $phpbb_root_path . 'includes/page_header.' . $phpEx; $template->set_filenames(array('body' => 'viewforum_body.tpl')); make_jumpbox('viewforum.' . $phpEx); $forumicon = !empty($forum_row['forum_icon']) ? '<img src="./images/icons/' . $forum_row['forum_icon'] . '" border="0">' : ''; $forum_path = forum_path($forum_row, $forum_id); $template->assign_vars(array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_row['forum_name'], 'FORUM_ICON' => $forumicon, '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'], 'FOLDER_COMMEND_IMG' => $images['folder_commend'], 'FOLDER_COMMEND_NEW_IMG' => $images['folder_commend_new'], 'FOLDER_GLOBAL_ANNOUNCE_IMG' => $images['folder_global_announce'], 'FOLDER_GLOBAL_ANNOUNCE_NEW_IMG' => $images['folder_global_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_GLOBAL_ANNOUNCEMENT' => $lang['Post_global_announcement'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_STICKY' => $lang['Post_Sticky'], 'L_COMMEND' => $lang['Post_Commend'], 'L_NEW_COMMEND' => $lang['New_Commend'], 'L_NO_NEW_COMMEND' => $lang['No_New_Commend'], 'L_POSTED' => $lang['Posted'], 'L_JOINED' => $lang['Joined'], 'L_AUTHOR' => $lang['Author'], 'L_FORUM_COMMEND' => $lang['Forum_commend'], 'U_VIEW_FORUM_COMMEND' => append_sid("commend.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}"), 'S_AUTH_LIST' => $s_auth_can, 'U_VIEW_FORUM' => append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}"), 'FORUM_PATH' => $forum_path, 'U_MARK_READ' => append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}&mark=topics"))); // // End header // $cat_id = $forum_row[cat_id]; $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id,substring(pt.topic_title,1,18) as topic_title \n\tFROM ((( " . FORUMS_TABLE . " f \n\tLEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) \n\tLEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) \n\tLEFT JOIN " . TOPICS_TABLE . " pt ON pt.topic_id = p.topic_id ) \n\twhere f.forum_sub ={$forum_id} or f.sort_sub = " . ($forum_row[sort_sub] + 2) . " \n\tORDER BY f.cat_id, f.forum_order"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); } $temp_forum_id = ""; $forum_data = array(); $forum_sub = array(); while ($row = $db->sql_fetchrow($result)) { if ($row['sort_sub'] == $forum_row['sort_sub'] + 1) { $forum_data[] = $row;
$forum_id = $topic_row['forum_id']; $forum_name = $topic_row['forum_name']; $forum_path = forum_path($topic_row, $forum_id); } else { if (!empty($forum_id)) { $sql = "SELECT forum_name, forum_topics, forum_sub \n\t\tFROM " . FORUMS_TABLE . "\n\t\tWHERE forum_id = " . $forum_id; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_MESSAGE, 'Forum_not_exist'); } $topic_row = $db->sql_fetchrow($result); if (!$topic_row) { message_die(GENERAL_MESSAGE, 'Forum_not_exist'); } $forum_topics = $topic_row['forum_topics'] == 0 ? 1 : $topic_row['forum_topics']; $forum_name = $topic_row['forum_name']; $forum_path = forum_path($topic_row, $forum_id); } else { message_die(GENERAL_MESSAGE, 'Forum_not_exist'); } } // // Start session management // $userdata = session_pagestart($user_ip, $forum_id); init_userprefs($userdata); // // End session management // // session id check if ($sid == '' || $sid != $userdata['session_id']) { message_die(GENERAL_ERROR, 'Invalid_session');
$select_sql = !$submit ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.hiding_type, p.hiding_condition_value, p.hiding_cash_id, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : ''; $from_sql = !$submit ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : ''; $where_sql = !$submit ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : ''; $submit = $temp; unset($temp); $sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . " \n\t\t\tFROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " \n\t\t\tWHERE p.post_id = {$post_id} \n\t\t\t\tAND t.topic_id = p.topic_id \n\t\t\t\tAND f.forum_id = p.forum_id\n\t\t\t\t{$where_sql}"; break; default: message_die(GENERAL_MESSAGE, $lang['No_valid_mode']); } if ($result = $db->sql_query($sql)) { $post_info = $db->sql_fetchrow($result); $db->sql_freeresult($result); $forum_id = $post_info['forum_id']; $forum_name = $post_info['forum_name']; $forum_path = forum_path($post_info, $forum_id); $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info); if ($post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod']) { message_die(GENERAL_MESSAGE, $lang['Forum_locked']); } else { if ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) { message_die(GENERAL_MESSAGE, $lang['Topic_locked']); } } if ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete') { $topic_id = $post_info['topic_id']; $post_data['post_text'] = $mode == 'editpost' || $mode == 'delete' ? $post_info['post_text'] : ''; $post_data['bbcode_uid'] = $mode == 'editpost' || $mode == 'delete' ? $post_info['bbcode_uid'] : ''; $post_data['poster_post'] = $post_info['poster_id'] == $userdata['user_id'] ? true : false; $post_data['first_post'] = $post_info['topic_first_post_id'] == $post_id ? true : false; $post_data['last_post'] = $post_info['topic_last_post_id'] == $post_id ? true : false;