root / tags / release_2_0_1 / phpBB / posting.php
History | View | Annotate | Download (33.2 kB)
| 1 | 2 | thefinn | <?php
|
|---|---|---|---|
| 2 | 169 | thefinn | /***************************************************************************
|
| 3 | 932 | psotfx | * posting.php |
| 4 | 169 | thefinn | * ------------------- |
| 5 | 169 | thefinn | * begin : Saturday, Feb 13, 2001 |
| 6 | 169 | thefinn | * copyright : (C) 2001 The phpBB Group |
| 7 | 169 | thefinn | * email : support@phpbb.com |
| 8 | 169 | thefinn | * |
| 9 | 169 | thefinn | * $Id$ |
| 10 | 169 | thefinn | * |
| 11 | 169 | thefinn | * |
| 12 | 169 | thefinn | ***************************************************************************/ |
| 13 | 2 | thefinn | |
| 14 | 943 | thefinn | /***************************************************************************
|
| 15 | 943 | thefinn | * |
| 16 | 943 | thefinn | * This program is free software; you can redistribute it and/or modify |
| 17 | 943 | thefinn | * it under the terms of the GNU General Public License as published by |
| 18 | 943 | thefinn | * the Free Software Foundation; either version 2 of the License, or |
| 19 | 943 | thefinn | * (at your option) any later version. |
| 20 | 943 | thefinn | * |
| 21 | 943 | thefinn | ***************************************************************************/ |
| 22 | 943 | thefinn | |
| 23 | 2305 | psotfx | define('IN_PHPBB', true); |
| 24 | 2448 | psotfx | $phpbb_root_path = './'; |
| 25 | 646 | psotfx | include($phpbb_root_path . 'extension.inc'); |
| 26 | 646 | psotfx | include($phpbb_root_path . 'common.'.$phpEx); |
| 27 | 646 | psotfx | include($phpbb_root_path . 'includes/bbcode.'.$phpEx); |
| 28 | 2305 | psotfx | include($phpbb_root_path . 'includes/functions_post.'.$phpEx); |
| 29 | 169 | thefinn | |
| 30 | 1220 | psotfx | //
|
| 31 | 2183 | psotfx | // Check and set various parameters
|
| 32 | 2183 | psotfx | //
|
| 33 | 2599 | psotfx | $params = array('submit' => 'post', 'confirm' => 'confirm', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode'); |
| 34 | 2183 | psotfx | while( list($var, $param) = @each($params) ) |
| 35 | 1220 | psotfx | {
|
| 36 | 2183 | psotfx | if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) ) |
| 37 | 1220 | psotfx | {
|
| 38 | 2183 | psotfx | $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? $HTTP_POST_VARS[$param] : $HTTP_GET_VARS[$param]; |
| 39 | 1220 | psotfx | } |
| 40 | 1974 | psotfx | else
|
| 41 | 1974 | psotfx | {
|
| 42 | 2305 | psotfx | $$var = ''; |
| 43 | 1974 | psotfx | } |
| 44 | 1220 | psotfx | } |
| 45 | 1220 | psotfx | |
| 46 | 2599 | psotfx | $params = array('forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL); |
| 47 | 2599 | psotfx | while( list($var, $param) = @each($params) ) |
| 48 | 2599 | psotfx | {
|
| 49 | 2599 | psotfx | if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) ) |
| 50 | 2599 | psotfx | {
|
| 51 | 2599 | psotfx | $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? intval($HTTP_POST_VARS[$param]) : intval($HTTP_GET_VARS[$param]); |
| 52 | 2599 | psotfx | } |
| 53 | 2599 | psotfx | else
|
| 54 | 2599 | psotfx | {
|
| 55 | 2599 | psotfx | $$var = ''; |
| 56 | 2599 | psotfx | } |
| 57 | 2599 | psotfx | } |
| 58 | 2599 | psotfx | |
| 59 | 2183 | psotfx | $refresh = $preview || $poll_add || $poll_edit || $poll_delete; |
| 60 | 1851 | psotfx | |
| 61 | 171 | thefinn | //
|
| 62 | 2183 | psotfx | // Set topic type
|
| 63 | 2183 | psotfx | //
|
| 64 | 2600 | psotfx | $topic_type = ( !empty($HTTP_POST_VARS['topictype']) ) ? intval($HTTP_POST_VARS['topictype']) : POST_NORMAL; |
| 65 | 987 | psotfx | |
| 66 | 323 | thefinn | //
|
| 67 | 2183 | psotfx | // If the mode is set to topic review then output
|
| 68 | 2183 | psotfx | // that review ...
|
| 69 | 378 | psotfx | //
|
| 70 | 2448 | psotfx | if ( $mode == 'topicreview' ) |
| 71 | 987 | psotfx | {
|
| 72 | 2183 | psotfx | require($phpbb_root_path . 'includes/topic_review.'.$phpEx); |
| 73 | 169 | thefinn | |
| 74 | 2183 | psotfx | topic_review($topic_id, false); |
| 75 | 2183 | psotfx | exit;
|
| 76 | 378 | psotfx | } |
| 77 | 2448 | psotfx | else if ( $mode == 'smilies' ) |
| 78 | 378 | psotfx | {
|
| 79 | 2448 | psotfx | generate_smilies('window', PAGE_POSTING); |
| 80 | 2183 | psotfx | exit;
|
| 81 | 378 | psotfx | } |
| 82 | 987 | psotfx | |
| 83 | 836 | psotfx | //
|
| 84 | 2570 | psotfx | // Start session management
|
| 85 | 2570 | psotfx | //
|
| 86 | 2570 | psotfx | $userdata = session_pagestart($user_ip, PAGE_POSTING); |
| 87 | 2570 | psotfx | init_userprefs($userdata);
|
| 88 | 2570 | psotfx | //
|
| 89 | 2570 | psotfx | // End session management
|
| 90 | 2570 | psotfx | //
|
| 91 | 2570 | psotfx | |
| 92 | 2570 | psotfx | //
|
| 93 | 987 | psotfx | // Was cancel pressed? If so then redirect to the appropriate
|
| 94 | 987 | psotfx | // page, no point in continuing with any further checks
|
| 95 | 836 | psotfx | //
|
| 96 | 2448 | psotfx | if ( isset($HTTP_POST_VARS['cancel']) ) |
| 97 | 836 | psotfx | {
|
| 98 | 2183 | psotfx | if ( $post_id ) |
| 99 | 987 | psotfx | {
|
| 100 | 1190 | psotfx | $redirect = "viewtopic.$phpEx?" . POST_POST_URL . "=$post_id"; |
| 101 | 1190 | psotfx | $post_append = "#$post_id"; |
| 102 | 987 | psotfx | } |
| 103 | 2183 | psotfx | else if ( $topic_id ) |
| 104 | 987 | psotfx | {
|
| 105 | 998 | psotfx | $redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"; |
| 106 | 2496 | psotfx | $post_append = ''; |
| 107 | 987 | psotfx | } |
| 108 | 2183 | psotfx | else if ( $forum_id ) |
| 109 | 987 | psotfx | {
|
| 110 | 998 | psotfx | $redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"; |
| 111 | 2496 | psotfx | $post_append = ''; |
| 112 | 987 | psotfx | } |
| 113 | 987 | psotfx | else
|
| 114 | 987 | psotfx | {
|
| 115 | 998 | psotfx | $redirect = "index.$phpEx"; |
| 116 | 2496 | psotfx | $post_append = ''; |
| 117 | 987 | psotfx | } |
| 118 | 503 | psotfx | |
| 119 | 2448 | psotfx | $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; |
| 120 | 2570 | psotfx | header($header_location . append_sid($redirect, true) . $post_append); |
| 121 | 2448 | psotfx | exit;
|
| 122 | 836 | psotfx | } |
| 123 | 836 | psotfx | |
| 124 | 987 | psotfx | //
|
| 125 | 2183 | psotfx | // What auth type do we need to check?
|
| 126 | 987 | psotfx | //
|
| 127 | 2183 | psotfx | $is_auth = array(); |
| 128 | 987 | psotfx | switch( $mode ) |
| 129 | 378 | psotfx | {
|
| 130 | 378 | psotfx | case 'newtopic': |
| 131 | 2448 | psotfx | if ( $topic_type == POST_ANNOUNCE ) |
| 132 | 437 | thefinn | {
|
| 133 | 2305 | psotfx | $is_auth_type = 'auth_announce'; |
| 134 | 437 | thefinn | } |
| 135 | 2448 | psotfx | else if ( $topic_type == POST_STICKY ) |
| 136 | 437 | thefinn | {
|
| 137 | 2305 | psotfx | $is_auth_type = 'auth_sticky'; |
| 138 | 437 | thefinn | } |
| 139 | 437 | thefinn | else
|
| 140 | 437 | thefinn | {
|
| 141 | 2305 | psotfx | $is_auth_type = 'auth_post'; |
| 142 | 437 | thefinn | } |
| 143 | 378 | psotfx | break;
|
| 144 | 378 | psotfx | case 'reply': |
| 145 | 582 | psotfx | case 'quote': |
| 146 | 2305 | psotfx | $is_auth_type = 'auth_reply'; |
| 147 | 582 | psotfx | break;
|
| 148 | 378 | psotfx | case 'editpost': |
| 149 | 2305 | psotfx | $is_auth_type = 'auth_edit'; |
| 150 | 378 | psotfx | break;
|
| 151 | 378 | psotfx | case 'delete': |
| 152 | 2183 | psotfx | case 'poll_delete': |
| 153 | 2305 | psotfx | $is_auth_type = 'auth_delete'; |
| 154 | 378 | psotfx | break;
|
| 155 | 987 | psotfx | case 'vote': |
| 156 | 2305 | psotfx | $is_auth_type = 'auth_vote'; |
| 157 | 987 | psotfx | break;
|
| 158 | 1220 | psotfx | case 'topicreview': |
| 159 | 2305 | psotfx | $is_auth_type = 'auth_read'; |
| 160 | 1220 | psotfx | break;
|
| 161 | 378 | psotfx | default:
|
| 162 | 987 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_post_mode']); |
| 163 | 378 | psotfx | break;
|
| 164 | 378 | psotfx | } |
| 165 | 378 | psotfx | |
| 166 | 987 | psotfx | //
|
| 167 | 2183 | psotfx | // Here we do various lookups to find topic_id, forum_id, post_id etc.
|
| 168 | 2183 | psotfx | // Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
|
| 169 | 987 | psotfx | //
|
| 170 | 2305 | psotfx | $error_msg = ''; |
| 171 | 2183 | psotfx | $post_data = array(); |
| 172 | 2183 | psotfx | switch ( $mode ) |
| 173 | 378 | psotfx | {
|
| 174 | 2183 | psotfx | case 'newtopic': |
| 175 | 2183 | psotfx | if ( empty($forum_id) ) |
| 176 | 706 | psotfx | {
|
| 177 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']); |
| 178 | 706 | psotfx | } |
| 179 | 378 | psotfx | |
| 180 | 2183 | psotfx | $sql = "SELECT * |
| 181 | 2183 | psotfx | FROM " . FORUMS_TABLE . " |
| 182 | 2183 | psotfx | WHERE forum_id = $forum_id"; |
| 183 | 2183 | psotfx | break;
|
| 184 | 706 | psotfx | |
| 185 | 2183 | psotfx | case 'reply': |
| 186 | 2183 | psotfx | case 'vote': |
| 187 | 2183 | psotfx | if ( empty( $topic_id) ) |
| 188 | 2183 | psotfx | {
|
| 189 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_topic_id']); |
| 190 | 2183 | psotfx | } |
| 191 | 706 | psotfx | |
| 192 | 2183 | psotfx | $sql = "SELECT f.*, t.topic_status |
| 193 | 2183 | psotfx | FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t |
| 194 | 2183 | psotfx | WHERE t.topic_id = $topic_id |
| 195 | 2183 | psotfx | AND f.forum_id = t.forum_id";
|
| 196 | 2183 | psotfx | break;
|
| 197 | 378 | psotfx | |
| 198 | 2183 | psotfx | case 'quote': |
| 199 | 2183 | psotfx | case 'editpost': |
| 200 | 2183 | psotfx | case 'delete': |
| 201 | 2183 | psotfx | case 'poll_delete': |
| 202 | 2183 | psotfx | if ( empty($post_id) ) |
| 203 | 1061 | psotfx | {
|
| 204 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_post_id']); |
| 205 | 1061 | psotfx | } |
| 206 | 1061 | psotfx | |
| 207 | 2448 | psotfx | $select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : ''; |
| 208 | 2448 | psotfx | $from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : ''; |
| 209 | 2448 | psotfx | $where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : ''; |
| 210 | 1061 | psotfx | |
| 211 | 2183 | psotfx | $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 . " |
| 212 | 2183 | psotfx | FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " |
| 213 | 2183 | psotfx | WHERE p.post_id = $post_id |
| 214 | 2183 | psotfx | AND t.topic_id = p.topic_id |
| 215 | 2183 | psotfx | AND f.forum_id = p.forum_id |
| 216 | 2183 | psotfx | $where_sql"; |
| 217 | 2183 | psotfx | break;
|
| 218 | 987 | psotfx | |
| 219 | 2183 | psotfx | default:
|
| 220 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_valid_mode']); |
| 221 | 2183 | psotfx | } |
| 222 | 987 | psotfx | |
| 223 | 2183 | psotfx | if ( $result = $db->sql_query($sql) ) |
| 224 | 323 | thefinn | {
|
| 225 | 2183 | psotfx | $post_info = $db->sql_fetchrow($result); |
| 226 | 2005 | psotfx | |
| 227 | 2183 | psotfx | $forum_id = $post_info['forum_id']; |
| 228 | 2183 | psotfx | $forum_name = $post_info['forum_name']; |
| 229 | 463 | thefinn | |
| 230 | 2183 | psotfx | $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info); |
| 231 | 336 | thefinn | |
| 232 | 2183 | psotfx | if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod']) |
| 233 | 2183 | psotfx | {
|
| 234 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['Forum_locked']); |
| 235 | 2183 | psotfx | } |
| 236 | 2305 | psotfx | else if ( $mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) |
| 237 | 2183 | psotfx | {
|
| 238 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['Topic_locked']); |
| 239 | 2183 | psotfx | } |
| 240 | 2005 | psotfx | |
| 241 | 2305 | psotfx | if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' ) |
| 242 | 328 | thefinn | {
|
| 243 | 2183 | psotfx | $topic_id = $post_info['topic_id']; |
| 244 | 987 | psotfx | |
| 245 | 2183 | psotfx | $post_data['poster_post'] = ( $post_info['poster_id'] == $userdata['user_id'] ) ? true : false; |
| 246 | 2183 | psotfx | $post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false; |
| 247 | 2183 | psotfx | $post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false; |
| 248 | 2183 | psotfx | $post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false; |
| 249 | 2183 | psotfx | $post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false; |
| 250 | 2183 | psotfx | $post_data['topic_type'] = $post_info['topic_type']; |
| 251 | 2203 | psotfx | $post_data['poster_id'] = $post_info['poster_id']; |
| 252 | 987 | psotfx | |
| 253 | 2183 | psotfx | if ( $post_data['first_post'] && $post_data['has_poll'] ) |
| 254 | 987 | psotfx | {
|
| 255 | 2183 | psotfx | $sql = "SELECT * |
| 256 | 2183 | psotfx | FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr |
| 257 | 2183 | psotfx | WHERE vd.topic_id = $topic_id |
| 258 | 2183 | psotfx | AND vr.vote_id = vd.vote_id |
| 259 | 2183 | psotfx | ORDER BY vr.vote_option_id";
|
| 260 | 2183 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 261 | 987 | psotfx | {
|
| 262 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql); |
| 263 | 987 | psotfx | } |
| 264 | 987 | psotfx | |
| 265 | 2183 | psotfx | $poll_options = array(); |
| 266 | 2183 | psotfx | $poll_results_sum = 0; |
| 267 | 2183 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 268 | 987 | psotfx | {
|
| 269 | 2183 | psotfx | $poll_title = $row['vote_text']; |
| 270 | 2183 | psotfx | $poll_id = $row['vote_id']; |
| 271 | 2183 | psotfx | $poll_length = $row['vote_length'] / 86400; |
| 272 | 987 | psotfx | |
| 273 | 2183 | psotfx | do
|
| 274 | 987 | psotfx | {
|
| 275 | 2183 | psotfx | $poll_options[$row['vote_option_id']] = $row['vote_option_text']; |
| 276 | 2183 | psotfx | $poll_results_sum += $row['vote_result']; |
| 277 | 987 | psotfx | } |
| 278 | 2183 | psotfx | while ( $row = $db->sql_fetchrow($result) ); |
| 279 | 987 | psotfx | } |
| 280 | 987 | psotfx | |
| 281 | 2183 | psotfx | $post_data['edit_poll'] = ( ( !$poll_results_sum || $is_auth['auth_mod'] ) && $post_data['first_post'] ) ? true : 0; |
| 282 | 987 | psotfx | } |
| 283 | 2183 | psotfx | else
|
| 284 | 987 | psotfx | {
|
| 285 | 2183 | psotfx | $post_data['edit_poll'] = false; |
| 286 | 582 | psotfx | } |
| 287 | 2183 | psotfx | |
| 288 | 987 | psotfx | //
|
| 289 | 2183 | psotfx | // Can this user edit/delete the post/poll?
|
| 290 | 987 | psotfx | //
|
| 291 | 2183 | psotfx | if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] ) |
| 292 | 582 | psotfx | {
|
| 293 | 2448 | psotfx | $message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts']; |
| 294 | 2183 | psotfx | $message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>'); |
| 295 | 326 | thefinn | |
| 296 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 297 | 987 | psotfx | } |
| 298 | 2448 | psotfx | else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && ( $mode == 'delete' || $delete ) ) |
| 299 | 987 | psotfx | {
|
| 300 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['Cannot_delete_replied']); |
| 301 | 987 | psotfx | } |
| 302 | 2448 | psotfx | else if ( !$post_data['edit_poll'] && !$is_auth['auth_mod'] && ( $mode == 'poll_delete' || $poll_delete ) ) |
| 303 | 987 | psotfx | {
|
| 304 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['Cannot_delete_poll']); |
| 305 | 2183 | psotfx | } |
| 306 | 2183 | psotfx | } |
| 307 | 2183 | psotfx | else
|
| 308 | 2183 | psotfx | {
|
| 309 | 2305 | psotfx | if ( $mode == 'quote' ) |
| 310 | 2183 | psotfx | {
|
| 311 | 2183 | psotfx | $topic_id = $post_info['topic_id']; |
| 312 | 2183 | psotfx | } |
| 313 | 987 | psotfx | |
| 314 | 2305 | psotfx | $post_data['first_post'] = ( $mode == 'newtopic' ) ? true : 0; |
| 315 | 2183 | psotfx | $post_data['last_post'] = false; |
| 316 | 2183 | psotfx | $post_data['has_poll'] = false; |
| 317 | 2183 | psotfx | $post_data['edit_poll'] = false; |
| 318 | 2183 | psotfx | } |
| 319 | 2183 | psotfx | } |
| 320 | 2183 | psotfx | else
|
| 321 | 2183 | psotfx | {
|
| 322 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_such_post']); |
| 323 | 2183 | psotfx | } |
| 324 | 987 | psotfx | |
| 325 | 2183 | psotfx | //
|
| 326 | 2183 | psotfx | // The user is not authed, if they're not logged in then redirect
|
| 327 | 2183 | psotfx | // them, else show them an error message
|
| 328 | 2183 | psotfx | //
|
| 329 | 2183 | psotfx | if ( !$is_auth[$is_auth_type] ) |
| 330 | 2183 | psotfx | {
|
| 331 | 2183 | psotfx | if ( $userdata['session_logged_in'] ) |
| 332 | 2183 | psotfx | {
|
| 333 | 2183 | psotfx | message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_' . $is_auth_type], $is_auth[$is_auth_type . "_type"])); |
| 334 | 2183 | psotfx | } |
| 335 | 549 | psotfx | |
| 336 | 2183 | psotfx | switch( $mode ) |
| 337 | 2183 | psotfx | {
|
| 338 | 2183 | psotfx | case 'newtopic': |
| 339 | 2183 | psotfx | $redirect = "mode=newtopic&" . POST_FORUM_URL . "=" . $forum_id; |
| 340 | 2183 | psotfx | break;
|
| 341 | 2183 | psotfx | case 'reply': |
| 342 | 2183 | psotfx | case 'topicreview': |
| 343 | 2183 | psotfx | $redirect = "mode=reply&" . POST_TOPIC_URL . "=" . $topic_id; |
| 344 | 2183 | psotfx | break;
|
| 345 | 2183 | psotfx | case 'quote': |
| 346 | 2183 | psotfx | case 'editpost': |
| 347 | 2183 | psotfx | $redirect = "mode=quote&" . POST_POST_URL ."=" . $post_id; |
| 348 | 2183 | psotfx | break;
|
| 349 | 2183 | psotfx | } |
| 350 | 1230 | psotfx | |
| 351 | 2448 | psotfx | $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; |
| 352 | 2408 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true)); |
| 353 | 2200 | psotfx | exit;
|
| 354 | 2183 | psotfx | } |
| 355 | 549 | psotfx | |
| 356 | 2183 | psotfx | //
|
| 357 | 2183 | psotfx | // Set toggles for various options
|
| 358 | 2183 | psotfx | //
|
| 359 | 2600 | psotfx | if ( !$board_config['allow_html'] ) |
| 360 | 2183 | psotfx | {
|
| 361 | 2183 | psotfx | $html_on = 0; |
| 362 | 2183 | psotfx | } |
| 363 | 2183 | psotfx | else
|
| 364 | 2183 | psotfx | {
|
| 365 | 2183 | psotfx | $html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] ); |
| 366 | 2183 | psotfx | } |
| 367 | 1295 | psotfx | |
| 368 | 2600 | psotfx | if ( !$board_config['allow_bbcode'] ) |
| 369 | 2183 | psotfx | {
|
| 370 | 2183 | psotfx | $bbcode_on = 0; |
| 371 | 2183 | psotfx | } |
| 372 | 2183 | psotfx | else
|
| 373 | 2183 | psotfx | {
|
| 374 | 2183 | psotfx | $bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] ); |
| 375 | 2183 | psotfx | } |
| 376 | 1128 | psotfx | |
| 377 | 2600 | psotfx | if ( !$board_config['allow_smilies'] ) |
| 378 | 2183 | psotfx | {
|
| 379 | 2183 | psotfx | $smilies_on = 0; |
| 380 | 2183 | psotfx | } |
| 381 | 2183 | psotfx | else
|
| 382 | 2183 | psotfx | {
|
| 383 | 2183 | psotfx | $smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] ); |
| 384 | 2183 | psotfx | } |
| 385 | 1634 | psotfx | |
| 386 | 2183 | psotfx | if ( $submit || $refresh ) |
| 387 | 2183 | psotfx | {
|
| 388 | 2183 | psotfx | $notify_user = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0; |
| 389 | 2183 | psotfx | } |
| 390 | 2183 | psotfx | else
|
| 391 | 2183 | psotfx | {
|
| 392 | 2375 | psotfx | if ( $mode != 'newtopic' && $userdata['session_logged_in'] ) |
| 393 | 2183 | psotfx | {
|
| 394 | 2183 | psotfx | $sql = "SELECT topic_id |
| 395 | 2183 | psotfx | FROM " . TOPICS_WATCH_TABLE . " |
| 396 | 2183 | psotfx | WHERE topic_id = $topic_id |
| 397 | 2183 | psotfx | AND user_id = " . $userdata['user_id']; |
| 398 | 2183 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 399 | 2183 | psotfx | {
|
| 400 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql); |
| 401 | 2183 | psotfx | } |
| 402 | 1128 | psotfx | |
| 403 | 2183 | psotfx | $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify']; |
| 404 | 2183 | psotfx | } |
| 405 | 2183 | psotfx | else
|
| 406 | 2183 | psotfx | {
|
| 407 | 2375 | psotfx | $notify_user = ( $userdata['session_logged_in'] ) ? $userdata['user_notify'] : 0; |
| 408 | 2183 | psotfx | } |
| 409 | 2183 | psotfx | } |
| 410 | 1974 | psotfx | |
| 411 | 2183 | psotfx | $attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] ); |
| 412 | 862 | psotfx | |
| 413 | 2183 | psotfx | // --------------------
|
| 414 | 2183 | psotfx | // What shall we do?
|
| 415 | 2183 | psotfx | //
|
| 416 | 2448 | psotfx | if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm ) |
| 417 | 2183 | psotfx | {
|
| 418 | 2183 | psotfx | //
|
| 419 | 2183 | psotfx | // Confirm deletion
|
| 420 | 2183 | psotfx | //
|
| 421 | 2183 | psotfx | $s_hidden_fields = '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />'; |
| 422 | 2183 | psotfx | $s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />'; |
| 423 | 1084 | psotfx | |
| 424 | 2305 | psotfx | $l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll']; |
| 425 | 862 | psotfx | |
| 426 | 2183 | psotfx | //
|
| 427 | 2183 | psotfx | // Output confirmation page
|
| 428 | 2183 | psotfx | //
|
| 429 | 2183 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 430 | 862 | psotfx | |
| 431 | 2183 | psotfx | $template->set_filenames(array( |
| 432 | 2305 | psotfx | 'confirm_body' => 'confirm_body.tpl') |
| 433 | 2183 | psotfx | ); |
| 434 | 862 | psotfx | |
| 435 | 2183 | psotfx | $template->assign_vars(array( |
| 436 | 2305 | psotfx | 'MESSAGE_TITLE' => $lang['Information'], |
| 437 | 2305 | psotfx | 'MESSAGE_TEXT' => $l_confirm, |
| 438 | 862 | psotfx | |
| 439 | 2305 | psotfx | 'L_YES' => $lang['Yes'], |
| 440 | 2305 | psotfx | 'L_NO' => $lang['No'], |
| 441 | 862 | psotfx | |
| 442 | 2305 | psotfx | 'S_CONFIRM_ACTION' => append_sid("posting.$phpEx"), |
| 443 | 2305 | psotfx | 'S_HIDDEN_FIELDS' => $s_hidden_fields) |
| 444 | 2183 | psotfx | ); |
| 445 | 987 | psotfx | |
| 446 | 2305 | psotfx | $template->pparse('confirm_body'); |
| 447 | 1851 | psotfx | |
| 448 | 2183 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 449 | 2183 | psotfx | } |
| 450 | 2305 | psotfx | else if ( $mode == 'vote' ) |
| 451 | 2183 | psotfx | {
|
| 452 | 2183 | psotfx | //
|
| 453 | 2183 | psotfx | // Vote in a poll
|
| 454 | 2183 | psotfx | //
|
| 455 | 2183 | psotfx | if ( !empty($HTTP_POST_VARS['vote_id']) ) |
| 456 | 2183 | psotfx | {
|
| 457 | 2503 | psotfx | $vote_option_id = intval($HTTP_POST_VARS['vote_id']); |
| 458 | 1851 | psotfx | |
| 459 | 2183 | psotfx | $sql = "SELECT vd.vote_id |
| 460 | 2183 | psotfx | FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr |
| 461 | 2183 | psotfx | WHERE vd.topic_id = $topic_id |
| 462 | 2183 | psotfx | AND vr.vote_id = vd.vote_id |
| 463 | 2183 | psotfx | AND vr.vote_option_id = $vote_option_id |
| 464 | 2183 | psotfx | GROUP BY vd.vote_id";
|
| 465 | 2183 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 466 | 582 | psotfx | {
|
| 467 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql); |
| 468 | 582 | psotfx | } |
| 469 | 987 | psotfx | |
| 470 | 2183 | psotfx | if ( $vote_info = $db->sql_fetchrow($result) ) |
| 471 | 582 | psotfx | {
|
| 472 | 2183 | psotfx | $vote_id = $vote_info['vote_id']; |
| 473 | 615 | psotfx | |
| 474 | 2183 | psotfx | $sql = "SELECT * |
| 475 | 2183 | psotfx | FROM " . VOTE_USERS_TABLE . " |
| 476 | 2183 | psotfx | WHERE vote_id = $vote_id |
| 477 | 2183 | psotfx | AND vote_user_id = " . $userdata['user_id']; |
| 478 | 2183 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 479 | 615 | psotfx | {
|
| 480 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql); |
| 481 | 615 | psotfx | } |
| 482 | 943 | thefinn | |
| 483 | 2183 | psotfx | if ( !($row = $db->sql_fetchrow($result)) ) |
| 484 | 615 | psotfx | {
|
| 485 | 2183 | psotfx | $sql = "UPDATE " . VOTE_RESULTS_TABLE . " |
| 486 | 2183 | psotfx | SET vote_result = vote_result + 1 |
| 487 | 2183 | psotfx | WHERE vote_id = $vote_id |
| 488 | 2183 | psotfx | AND vote_option_id = $vote_option_id"; |
| 489 | 2183 | psotfx | if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) |
| 490 | 615 | psotfx | {
|
| 491 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql); |
| 492 | 987 | psotfx | } |
| 493 | 1263 | psotfx | |
| 494 | 2183 | psotfx | $sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip) |
| 495 | 2183 | psotfx | VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')"; |
| 496 | 2183 | psotfx | if ( !$db->sql_query($sql, END_TRANSACTION) ) |
| 497 | 1151 | psotfx | {
|
| 498 | 2448 | psotfx | message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql); |
| 499 | 1151 | psotfx | } |
| 500 | 987 | psotfx | |
| 501 | 2183 | psotfx | $message = $lang['Vote_cast']; |
| 502 | 615 | psotfx | } |
| 503 | 615 | psotfx | else
|
| 504 | 615 | psotfx | {
|
| 505 | 2183 | psotfx | $message = $lang['Already_voted']; |
| 506 | 615 | psotfx | } |
| 507 | 582 | psotfx | } |
| 508 | 582 | psotfx | else
|
| 509 | 582 | psotfx | {
|
| 510 | 2183 | psotfx | $message = $lang['No_vote_option']; |
| 511 | 2183 | psotfx | } |
| 512 | 824 | psotfx | |
| 513 | 2183 | psotfx | $template->assign_vars(array( |
| 514 | 2305 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">') |
| 515 | 2183 | psotfx | ); |
| 516 | 2183 | psotfx | $message .= '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>'); |
| 517 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 518 | 2183 | psotfx | } |
| 519 | 2183 | psotfx | } |
| 520 | 2183 | psotfx | else if ( $submit || $confirm ) |
| 521 | 2183 | psotfx | {
|
| 522 | 2183 | psotfx | //
|
| 523 | 2183 | psotfx | // Submit post/vote (newtopic, edit, reply, etc.)
|
| 524 | 2183 | psotfx | //
|
| 525 | 2305 | psotfx | $return_message = ''; |
| 526 | 2305 | psotfx | $return_meta = ''; |
| 527 | 1061 | psotfx | |
| 528 | 2183 | psotfx | switch ( $mode ) |
| 529 | 2183 | psotfx | {
|
| 530 | 2183 | psotfx | case 'editpost': |
| 531 | 2183 | psotfx | case 'newtopic': |
| 532 | 2183 | psotfx | case 'reply': |
| 533 | 2305 | psotfx | $username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ''; |
| 534 | 2460 | the_systech | $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : ''; |
| 535 | 2305 | psotfx | $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : ''; |
| 536 | 2305 | psotfx | $poll_title = ( isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_title'] : ''; |
| 537 | 2305 | psotfx | $poll_options = ( isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_option_text'] : ''; |
| 538 | 2305 | psotfx | $poll_length = ( isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_length'] : ''; |
| 539 | 2305 | psotfx | $bbcode_uid = ''; |
| 540 | 1295 | psotfx | |
| 541 | 2183 | psotfx | prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length); |
| 542 | 2183 | psotfx | |
| 543 | 2305 | psotfx | if ( $error_msg == '' ) |
| 544 | 582 | psotfx | {
|
| 545 | 2183 | psotfx | $topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type; |
| 546 | 582 | psotfx | |
| 547 | 2183 | psotfx | submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length); |
| 548 | 2383 | psotfx | if ( $error_msg == '' ) |
| 549 | 2599 | psotfx | {
|
| 550 | 2599 | psotfx | user_notification($mode, $post_data, $forum_id, $topic_id, $post_id, $notify_user); |
| 551 | 2599 | psotfx | } |
| 552 | 328 | thefinn | } |
| 553 | 2183 | psotfx | break;
|
| 554 | 2183 | psotfx | |
| 555 | 2183 | psotfx | case 'delete': |
| 556 | 2183 | psotfx | case 'poll_delete': |
| 557 | 2183 | psotfx | delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id); |
| 558 | 2183 | psotfx | break;
|
| 559 | 624 | psotfx | } |
| 560 | 987 | psotfx | |
| 561 | 2383 | psotfx | if ( $error_msg == '' ) |
| 562 | 2183 | psotfx | {
|
| 563 | 2383 | psotfx | if ( $mode != 'editpost' ) |
| 564 | 2383 | psotfx | {
|
| 565 | 2383 | psotfx | $user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id']; |
| 566 | 2383 | psotfx | update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); |
| 567 | 2383 | psotfx | } |
| 568 | 2305 | psotfx | |
| 569 | 2305 | psotfx | if ( $mode == 'newtopic' || $mode == 'reply' ) |
| 570 | 328 | thefinn | {
|
| 571 | 2305 | psotfx | $tracking_topics = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); |
| 572 | 2305 | psotfx | $tracking_forums = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array(); |
| 573 | 502 | psotfx | |
| 574 | 2183 | psotfx | if ( count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id]) ) |
| 575 | 328 | thefinn | {
|
| 576 | 2183 | psotfx | asort($tracking_topics); |
| 577 | 2183 | psotfx | unset($tracking_topics[key($tracking_topics)]); |
| 578 | 987 | psotfx | } |
| 579 | 326 | thefinn | |
| 580 | 2183 | psotfx | $tracking_topics[$topic_id] = time(); |
| 581 | 987 | psotfx | |
| 582 | 2305 | psotfx | setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); |
| 583 | 987 | psotfx | } |
| 584 | 837 | psotfx | |
| 585 | 2183 | psotfx | $template->assign_vars(array( |
| 586 | 2599 | psotfx | 'META' => $return_meta) |
| 587 | 2183 | psotfx | ); |
| 588 | 2183 | psotfx | message_die(GENERAL_MESSAGE, $return_message); |
| 589 | 987 | psotfx | } |
| 590 | 987 | psotfx | } |
| 591 | 2183 | psotfx | |
| 592 | 2305 | psotfx | if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' ) |
| 593 | 987 | psotfx | {
|
| 594 | 2305 | psotfx | $username = ( !empty($HTTP_POST_VARS['username']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['username']))) : ''; |
| 595 | 2305 | psotfx | $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : ''; |
| 596 | 2305 | psotfx | $message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : ''; |
| 597 | 582 | psotfx | |
| 598 | 2305 | psotfx | $poll_title = ( !empty($HTTP_POST_VARS['poll_title']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['poll_title']))) : ''; |
| 599 | 2183 | psotfx | $poll_length = ( isset($HTTP_POST_VARS['poll_length']) ) ? max(0, intval($HTTP_POST_VARS['poll_length'])) : 0; |
| 600 | 502 | psotfx | |
| 601 | 2183 | psotfx | $poll_options = array(); |
| 602 | 2183 | psotfx | if ( !empty($HTTP_POST_VARS['poll_option_text']) ) |
| 603 | 987 | psotfx | {
|
| 604 | 2183 | psotfx | while( list($option_id, $option_text) = @each($HTTP_POST_VARS['poll_option_text']) ) |
| 605 | 987 | psotfx | {
|
| 606 | 2183 | psotfx | if( isset($HTTP_POST_VARS['del_poll_option'][$option_id]) ) |
| 607 | 987 | psotfx | {
|
| 608 | 2183 | psotfx | unset($poll_options[$option_id]); |
| 609 | 582 | psotfx | } |
| 610 | 2183 | psotfx | else if ( !empty($option_text) ) |
| 611 | 987 | psotfx | {
|
| 612 | 2183 | psotfx | $poll_options[$option_id] = htmlspecialchars(trim(stripslashes($option_text))); |
| 613 | 987 | psotfx | } |
| 614 | 987 | psotfx | } |
| 615 | 582 | psotfx | } |
| 616 | 326 | thefinn | |
| 617 | 2183 | psotfx | if ( isset($poll_add) && !empty($HTTP_POST_VARS['add_poll_option_text']) ) |
| 618 | 987 | psotfx | {
|
| 619 | 2183 | psotfx | $poll_options[] = htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['add_poll_option_text']))); |
| 620 | 2183 | psotfx | } |
| 621 | 824 | psotfx | |
| 622 | 2183 | psotfx | if ( $mode == 'newtopic' || $mode == 'reply') |
| 623 | 2183 | psotfx | {
|
| 624 | 2566 | psotfx | $user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : ''; |
| 625 | 987 | psotfx | } |
| 626 | 2183 | psotfx | else if ( $mode == 'editpost' ) |
| 627 | 987 | psotfx | {
|
| 628 | 2566 | psotfx | $user_sig = ( $post_info['user_sig'] != '' && $board_config['allow_sig'] ) ? $post_info['user_sig'] : ''; |
| 629 | 987 | psotfx | } |
| 630 | 2183 | psotfx | |
| 631 | 2183 | psotfx | if( $preview ) |
| 632 | 987 | psotfx | {
|
| 633 | 2183 | psotfx | $orig_word = array(); |
| 634 | 2183 | psotfx | $replacement_word = array(); |
| 635 | 2183 | psotfx | obtain_word_list($orig_word, $replacement_word); |
| 636 | 987 | psotfx | |
| 637 | 2305 | psotfx | $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; |
| 638 | 2305 | psotfx | $preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid)); |
| 639 | 2183 | psotfx | $preview_subject = $subject; |
| 640 | 2183 | psotfx | $preview_username = $username; |
| 641 | 987 | psotfx | |
| 642 | 2183 | psotfx | //
|
| 643 | 2183 | psotfx | // Finalise processing as per viewtopic
|
| 644 | 2183 | psotfx | //
|
| 645 | 2183 | psotfx | if( !$html_on ) |
| 646 | 2183 | psotfx | {
|
| 647 | 2305 | psotfx | if( $user_sig != '' || !$userdata['user_allowhtml'] ) |
| 648 | 987 | psotfx | {
|
| 649 | 2305 | psotfx | $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', '<\2>', $user_sig); |
| 650 | 987 | psotfx | } |
| 651 | 2183 | psotfx | } |
| 652 | 987 | psotfx | |
| 653 | 2305 | psotfx | if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] ) |
| 654 | 2183 | psotfx | {
|
| 655 | 2183 | psotfx | $user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']); |
| 656 | 987 | psotfx | } |
| 657 | 2183 | psotfx | |
| 658 | 2183 | psotfx | if( $bbcode_on ) |
| 659 | 987 | psotfx | {
|
| 660 | 2183 | psotfx | $preview_message = bbencode_second_pass($preview_message, $bbcode_uid); |
| 661 | 987 | psotfx | } |
| 662 | 987 | psotfx | |
| 663 | 2183 | psotfx | if( !empty($orig_word) ) |
| 664 | 987 | psotfx | {
|
| 665 | 2305 | psotfx | $preview_username = ( !empty($username) ) ? preg_replace($orig_word, $replacement_word, $preview_username) : ''; |
| 666 | 2305 | psotfx | $preview_subject = ( !empty($subject) ) ? preg_replace($orig_word, $replacement_word, $preview_subject) : ''; |
| 667 | 2305 | psotfx | $preview_message = ( !empty($preview_message) ) ? preg_replace($orig_word, $replacement_word, $preview_message) : ''; |
| 668 | 987 | psotfx | } |
| 669 | 2183 | psotfx | |
| 670 | 2305 | psotfx | if( $user_sig != '' ) |
| 671 | 987 | psotfx | {
|
| 672 | 2183 | psotfx | $user_sig = make_clickable($user_sig); |
| 673 | 987 | psotfx | } |
| 674 | 2183 | psotfx | $preview_message = make_clickable($preview_message); |
| 675 | 2183 | psotfx | |
| 676 | 2183 | psotfx | if( $smilies_on ) |
| 677 | 2183 | psotfx | {
|
| 678 | 2305 | psotfx | if( $userdata['user_allowsmile'] && $user_sig != '' ) |
| 679 | 2183 | psotfx | {
|
| 680 | 2183 | psotfx | $user_sig = smilies_pass($user_sig); |
| 681 | 2183 | psotfx | } |
| 682 | 2183 | psotfx | |
| 683 | 2183 | psotfx | $preview_message = smilies_pass($preview_message); |
| 684 | 2183 | psotfx | } |
| 685 | 2183 | psotfx | |
| 686 | 2305 | psotfx | if( $attach_sig && $user_sig != '' ) |
| 687 | 2183 | psotfx | {
|
| 688 | 2305 | psotfx | $preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig; |
| 689 | 2183 | psotfx | } |
| 690 | 2183 | psotfx | |
| 691 | 2305 | psotfx | $preview_message = str_replace("\n", '<br />', $preview_message); |
| 692 | 2183 | psotfx | |
| 693 | 2183 | psotfx | $template->set_filenames(array( |
| 694 | 2305 | psotfx | 'preview' => 'posting_preview.tpl') |
| 695 | 2183 | psotfx | ); |
| 696 | 2183 | psotfx | |
| 697 | 2183 | psotfx | $template->assign_vars(array( |
| 698 | 2305 | psotfx | 'TOPIC_TITLE' => $preview_subject, |
| 699 | 2305 | psotfx | 'POST_SUBJECT' => $preview_subject, |
| 700 | 2305 | psotfx | 'POSTER_NAME' => $preview_username, |
| 701 | 2305 | psotfx | 'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']), |
| 702 | 2305 | psotfx | 'MESSAGE' => $preview_message, |
| 703 | 2183 | psotfx | |
| 704 | 2305 | psotfx | 'L_POST_SUBJECT' => $lang['Post_subject'], |
| 705 | 2305 | psotfx | 'L_PREVIEW' => $lang['Preview'], |
| 706 | 2448 | psotfx | 'L_POSTED' => $lang['Posted'], |
| 707 | 2448 | psotfx | 'L_POST' => $lang['Post']) |
| 708 | 2183 | psotfx | ); |
| 709 | 2305 | psotfx | $template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview'); |
| 710 | 987 | psotfx | } |
| 711 | 2305 | psotfx | else if( $error_msg != '' ) |
| 712 | 2183 | psotfx | {
|
| 713 | 2183 | psotfx | $template->set_filenames(array( |
| 714 | 2305 | psotfx | 'reg_header' => 'error_body.tpl') |
| 715 | 2183 | psotfx | ); |
| 716 | 2183 | psotfx | $template->assign_vars(array( |
| 717 | 2305 | psotfx | 'ERROR_MESSAGE' => $error_msg) |
| 718 | 2183 | psotfx | ); |
| 719 | 2305 | psotfx | $template->assign_var_from_handle('ERROR_BOX', 'reg_header'); |
| 720 | 2183 | psotfx | } |
| 721 | 837 | psotfx | } |
| 722 | 837 | psotfx | else
|
| 723 | 837 | psotfx | {
|
| 724 | 987 | psotfx | //
|
| 725 | 2183 | psotfx | // User default entry point
|
| 726 | 987 | psotfx | //
|
| 727 | 2183 | psotfx | if ( $mode == 'newtopic' ) |
| 728 | 549 | psotfx | {
|
| 729 | 2305 | psotfx | $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : ''; |
| 730 | 987 | psotfx | |
| 731 | 2305 | psotfx | $username = ($userdata['session_logged_in']) ? $userdata['username'] : ''; |
| 732 | 2305 | psotfx | $poll_title = ''; |
| 733 | 2305 | psotfx | $poll_length = ''; |
| 734 | 2305 | psotfx | $subject = ''; |
| 735 | 2305 | psotfx | $message = ''; |
| 736 | 549 | psotfx | } |
| 737 | 2183 | psotfx | else if ( $mode == 'reply' ) |
| 738 | 987 | psotfx | {
|
| 739 | 2305 | psotfx | $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : ''; |
| 740 | 987 | psotfx | |
| 741 | 2305 | psotfx | $username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : ''; |
| 742 | 2305 | psotfx | $subject = ''; |
| 743 | 2305 | psotfx | $message = ''; |
| 744 | 987 | psotfx | |
| 745 | 888 | psotfx | } |
| 746 | 2183 | psotfx | else if ( $mode == 'quote' || $mode == 'editpost' ) |
| 747 | 888 | psotfx | {
|
| 748 | 2183 | psotfx | $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject']; |
| 749 | 2183 | psotfx | $message = $post_info['post_text']; |
| 750 | 888 | psotfx | |
| 751 | 2305 | psotfx | if ( $mode == 'editpost' ) |
| 752 | 888 | psotfx | {
|
| 753 | 2305 | psotfx | $attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0; |
| 754 | 2183 | psotfx | $user_sig = $post_info['user_sig']; |
| 755 | 2258 | psotfx | |
| 756 | 2258 | psotfx | $html_on = ( $post_info['enable_html'] ) ? true : false; |
| 757 | 2258 | psotfx | $bbcode_on = ( $post_info['enable_bbcode'] ) ? true : false; |
| 758 | 2258 | psotfx | $smilies_on = ( $post_info['enable_smilies'] ) ? true : false; |
| 759 | 2183 | psotfx | } |
| 760 | 2183 | psotfx | else
|
| 761 | 2183 | psotfx | {
|
| 762 | 2183 | psotfx | $attach_sig = ( $userdata['user_attachsig'] ) ? TRUE : 0; |
| 763 | 2183 | psotfx | $user_sig = $userdata['user_sig']; |
| 764 | 2183 | psotfx | } |
| 765 | 888 | psotfx | |
| 766 | 2305 | psotfx | if ( $post_info['bbcode_uid'] != '' ) |
| 767 | 2183 | psotfx | {
|
| 768 | 2305 | psotfx | $message = preg_replace('/\:(([a-z0-9]:)?)' . $post_info['bbcode_uid'] . '/s', '', $message); |
| 769 | 2183 | psotfx | } |
| 770 | 987 | psotfx | |
| 771 | 2305 | psotfx | $message = str_replace('<', '<', $message); |
| 772 | 2305 | psotfx | $message = str_replace('>', '>', $message); |
| 773 | 2305 | psotfx | $message = str_replace('<br />', "\n", $message); |
| 774 | 2305 | psotfx | |
| 775 | 2183 | psotfx | if ( $mode == 'quote' ) |
| 776 | 2183 | psotfx | {
|
| 777 | 2183 | psotfx | $orig_word = array(); |
| 778 | 2183 | psotfx | $replacement_word = array(); |
| 779 | 2183 | psotfx | obtain_word_list($orig_word, $replace_word); |
| 780 | 987 | psotfx | |
| 781 | 2183 | psotfx | $msg_date = create_date($board_config['default_dateformat'], $postrow['post_time'], $board_config['board_timezone']); |
| 782 | 987 | psotfx | |
| 783 | 2415 | psotfx | $quote_username = ( !empty($post_info['post_username']) ) ? $post_info['post_username'] : $post_info['username']; |
| 784 | 2415 | psotfx | $message = '[quote="' . $quote_username . '"]' . $message . '[/quote]'; |
| 785 | 987 | psotfx | |
| 786 | 2183 | psotfx | if ( !empty($orig_word) ) |
| 787 | 987 | psotfx | {
|
| 788 | 2305 | psotfx | $subject = ( !empty($subject) ) ? preg_replace($orig_word, $replace_word, $subject) : ''; |
| 789 | 2305 | psotfx | $message = ( !empty($message) ) ? preg_replace($orig_word, $replace_word, $message) : ''; |
| 790 | 987 | psotfx | } |
| 791 | 987 | psotfx | |
| 792 | 2305 | psotfx | if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 ) |
| 793 | 987 | psotfx | {
|
| 794 | 2183 | psotfx | $subject = 'Re: ' . $subject; |
| 795 | 987 | psotfx | } |
| 796 | 888 | psotfx | |
| 797 | 2183 | psotfx | $mode = 'reply'; |
| 798 | 836 | psotfx | } |
| 799 | 2200 | psotfx | else
|
| 800 | 2200 | psotfx | {
|
| 801 | 2305 | psotfx | $username = ( $post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username']) ) ? $post_info['post_username'] : ''; |
| 802 | 2200 | psotfx | } |
| 803 | 824 | psotfx | } |
| 804 | 463 | thefinn | } |
| 805 | 463 | thefinn | |
| 806 | 463 | thefinn | //
|
| 807 | 2183 | psotfx | // Signature toggle selection
|
| 808 | 328 | thefinn | //
|
| 809 | 2258 | psotfx | if( $user_sig != '' ) |
| 810 | 470 | thefinn | {
|
| 811 | 2448 | psotfx | $template->assign_block_vars('switch_signature_checkbox', array()); |
| 812 | 470 | thefinn | } |
| 813 | 470 | thefinn | |
| 814 | 987 | psotfx | //
|
| 815 | 836 | psotfx | // HTML toggle selection
|
| 816 | 836 | psotfx | //
|
| 817 | 2183 | psotfx | if ( $board_config['allow_html'] ) |
| 818 | 487 | psotfx | {
|
| 819 | 1316 | psotfx | $html_status = $lang['HTML_is_ON']; |
| 820 | 2448 | psotfx | $template->assign_block_vars('switch_html_checkbox', array()); |
| 821 | 487 | psotfx | } |
| 822 | 487 | psotfx | else
|
| 823 | 487 | psotfx | {
|
| 824 | 1316 | psotfx | $html_status = $lang['HTML_is_OFF']; |
| 825 | 487 | psotfx | } |
| 826 | 347 | psotfx | |
| 827 | 836 | psotfx | //
|
| 828 | 836 | psotfx | // BBCode toggle selection
|
| 829 | 836 | psotfx | //
|
| 830 | 2183 | psotfx | if ( $board_config['allow_bbcode'] ) |
| 831 | 487 | psotfx | {
|
| 832 | 1316 | psotfx | $bbcode_status = $lang['BBCode_is_ON']; |
| 833 | 2448 | psotfx | $template->assign_block_vars('switch_bbcode_checkbox', array()); |
| 834 | 487 | psotfx | } |
| 835 | 487 | psotfx | else
|
| 836 | 487 | psotfx | {
|
| 837 | 1316 | psotfx | $bbcode_status = $lang['BBCode_is_OFF']; |
| 838 | 487 | psotfx | } |
| 839 | 487 | psotfx | |
| 840 | 836 | psotfx | //
|
| 841 | 836 | psotfx | // Smilies toggle selection
|
| 842 | 836 | psotfx | //
|
| 843 | 2183 | psotfx | if ( $board_config['allow_smilies'] ) |
| 844 | 487 | psotfx | {
|
| 845 | 1316 | psotfx | $smilies_status = $lang['Smilies_are_ON']; |
| 846 | 2448 | psotfx | $template->assign_block_vars('switch_smilies_checkbox', array()); |
| 847 | 487 | psotfx | } |
| 848 | 733 | psotfx | else
|
| 849 | 733 | psotfx | {
|
| 850 | 1316 | psotfx | $smilies_status = $lang['Smilies_are_OFF']; |
| 851 | 733 | psotfx | } |
| 852 | 487 | psotfx | |
| 853 | 2305 | psotfx | if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) ) |
| 854 | 487 | psotfx | {
|
| 855 | 2448 | psotfx | $template->assign_block_vars('switch_username_select', array()); |
| 856 | 487 | psotfx | } |
| 857 | 487 | psotfx | |
| 858 | 836 | psotfx | //
|
| 859 | 987 | psotfx | // Notify checkbox - only show if user is logged in
|
| 860 | 987 | psotfx | //
|
| 861 | 2183 | psotfx | if ( $userdata['session_logged_in'] ) |
| 862 | 987 | psotfx | {
|
| 863 | 2305 | psotfx | if ( $mode != 'editpost' || ( $mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS ) ) |
| 864 | 1061 | psotfx | {
|
| 865 | 2448 | psotfx | $template->assign_block_vars('switch_notify_checkbox', array()); |
| 866 | 1061 | psotfx | } |
| 867 | 987 | psotfx | } |
| 868 | 987 | psotfx | |
| 869 | 987 | psotfx | //
|
| 870 | 836 | psotfx | // Delete selection
|
| 871 | 836 | psotfx | //
|
| 872 | 2183 | psotfx | if ( $mode == 'editpost' && ( ( $is_auth['auth_delete'] && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $is_auth['auth_mod'] ) ) |
| 873 | 836 | psotfx | {
|
| 874 | 2448 | psotfx | $template->assign_block_vars('switch_delete_checkbox', array()); |
| 875 | 836 | psotfx | } |
| 876 | 836 | psotfx | |
| 877 | 836 | psotfx | //
|
| 878 | 836 | psotfx | // Topic type selection
|
| 879 | 836 | psotfx | //
|
| 880 | 2183 | psotfx | $topic_type_toggle = ''; |
| 881 | 2183 | psotfx | if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) |
| 882 | 487 | psotfx | {
|
| 883 | 2448 | psotfx | $template->assign_block_vars('switch_type_toggle', array()); |
| 884 | 836 | psotfx | |
| 885 | 2183 | psotfx | if( $is_auth['auth_sticky'] ) |
| 886 | 487 | psotfx | {
|
| 887 | 2183 | psotfx | $topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_STICKY . '"'; |
| 888 | 2496 | psotfx | if ( $post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY ) |
| 889 | 323 | thefinn | {
|
| 890 | 2183 | psotfx | $topic_type_toggle .= ' checked="checked"'; |
| 891 | 323 | thefinn | } |
| 892 | 2183 | psotfx | $topic_type_toggle .= ' /> ' . $lang['Post_Sticky'] . ' '; |
| 893 | 487 | psotfx | } |
| 894 | 169 | thefinn | |
| 895 | 2183 | psotfx | if( $is_auth['auth_announce'] ) |
| 896 | 487 | psotfx | {
|
| 897 | 2183 | psotfx | $topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"'; |
| 898 | 2496 | psotfx | if ( $post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE ) |
| 899 | 323 | thefinn | {
|
| 900 | 2183 | psotfx | $topic_type_toggle .= ' checked="checked"'; |
| 901 | 437 | thefinn | } |
| 902 | 2183 | psotfx | $topic_type_toggle .= ' /> ' . $lang['Post_Announcement'] . ' '; |
| 903 | 549 | psotfx | } |
| 904 | 549 | psotfx | |
| 905 | 2305 | psotfx | if ( $topic_type_toggle != '' ) |
| 906 | 549 | psotfx | {
|
| 907 | 2496 | psotfx | $topic_type_toggle = $lang['Post_topic_as'] . ': <input type="radio" name="topictype" value="' . POST_NORMAL .'"' . ( ( $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL ) ? ' checked="checked"' : '' ) . ' /> ' . $lang['Post_Normal'] . ' ' . $topic_type_toggle; |
| 908 | 487 | psotfx | } |
| 909 | 487 | psotfx | } |
| 910 | 323 | thefinn | |
| 911 | 987 | psotfx | $hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />'; |
| 912 | 487 | psotfx | |
| 913 | 2183 | psotfx | switch( $mode ) |
| 914 | 836 | psotfx | {
|
| 915 | 987 | psotfx | case 'newtopic': |
| 916 | 2183 | psotfx | $page_title = $lang['Post_a_new_topic']; |
| 917 | 987 | psotfx | $hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; |
| 918 | 987 | psotfx | break;
|
| 919 | 824 | psotfx | |
| 920 | 987 | psotfx | case 'reply': |
| 921 | 2183 | psotfx | $page_title = $lang['Post_a_reply']; |
| 922 | 987 | psotfx | $hidden_form_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; |
| 923 | 987 | psotfx | break;
|
| 924 | 987 | psotfx | |
| 925 | 987 | psotfx | case 'editpost': |
| 926 | 2183 | psotfx | $page_title = $lang['Edit_Post']; |
| 927 | 987 | psotfx | $hidden_form_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />'; |
| 928 | 987 | psotfx | break;
|
| 929 | 836 | psotfx | } |
| 930 | 824 | psotfx | |
| 931 | 2183 | psotfx | // Generate smilies listing for page output
|
| 932 | 2448 | psotfx | generate_smilies('inline', PAGE_POSTING); |
| 933 | 2183 | psotfx | |
| 934 | 836 | psotfx | //
|
| 935 | 2183 | psotfx | // Include page header
|
| 936 | 1508 | psotfx | //
|
| 937 | 2183 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 938 | 1508 | psotfx | |
| 939 | 2183 | psotfx | $template->set_filenames(array( |
| 940 | 2305 | psotfx | 'body' => 'posting_body.tpl', |
| 941 | 2305 | psotfx | 'pollbody' => 'posting_poll_body.tpl', |
| 942 | 2305 | psotfx | 'reviewbody' => 'posting_topic_review.tpl') |
| 943 | 2183 | psotfx | ); |
| 944 | 2448 | psotfx | make_jumpbox('viewforum.'.$phpEx); |
| 945 | 2183 | psotfx | |
| 946 | 2183 | psotfx | $template->assign_vars(array( |
| 947 | 2305 | psotfx | 'FORUM_NAME' => $forum_name, |
| 948 | 2305 | psotfx | 'L_POST_A' => $page_title, |
| 949 | 2305 | psotfx | 'L_POST_SUBJECT' => $lang['Post_subject'], |
| 950 | 2183 | psotfx | |
| 951 | 2305 | psotfx | 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")) |
| 952 | 2183 | psotfx | ); |
| 953 | 2183 | psotfx | |
| 954 | 1508 | psotfx | //
|
| 955 | 1609 | psotfx | // This enables the forum/topic title to be output for posting
|
| 956 | 1609 | psotfx | // but not for privmsg (where it makes no sense)
|
| 957 | 1609 | psotfx | //
|
| 958 | 2305 | psotfx | $template->assign_block_vars('switch_not_privmsg', array()); |
| 959 | 1609 | psotfx | |
| 960 | 1609 | psotfx | //
|
| 961 | 836 | psotfx | // Output the data to the template
|
| 962 | 836 | psotfx | //
|
| 963 | 824 | psotfx | $template->assign_vars(array( |
| 964 | 2305 | psotfx | 'USERNAME' => $username, |
| 965 | 2305 | psotfx | 'SUBJECT' => $subject, |
| 966 | 2305 | psotfx | 'MESSAGE' => $message, |
| 967 | 2305 | psotfx | 'HTML_STATUS' => $html_status, |
| 968 | 2305 | psotfx | 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'), |
| 969 | 2305 | psotfx | 'SMILIES_STATUS' => $smilies_status, |
| 970 | 326 | thefinn | |
| 971 | 2305 | psotfx | 'L_SUBJECT' => $lang['Subject'], |
| 972 | 2305 | psotfx | 'L_MESSAGE_BODY' => $lang['Message_body'], |
| 973 | 2305 | psotfx | 'L_OPTIONS' => $lang['Options'], |
| 974 | 2305 | psotfx | 'L_PREVIEW' => $lang['Preview'], |
| 975 | 2305 | psotfx | 'L_SPELLCHECK' => $lang['Spellcheck'], |
| 976 | 2305 | psotfx | 'L_SUBMIT' => $lang['Submit'], |
| 977 | 2305 | psotfx | 'L_CANCEL' => $lang['Cancel'], |
| 978 | 2305 | psotfx | 'L_CONFIRM_DELETE' => $lang['Confirm_delete'], |
| 979 | 2305 | psotfx | 'L_DISABLE_HTML' => $lang['Disable_HTML_post'], |
| 980 | 2305 | psotfx | 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'], |
| 981 | 2305 | psotfx | 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'], |
| 982 | 2305 | psotfx | 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], |
| 983 | 2305 | psotfx | 'L_NOTIFY_ON_REPLY' => $lang['Notify'], |
| 984 | 2305 | psotfx | 'L_DELETE_POST' => $lang['Delete_post'], |
| 985 | 836 | psotfx | |
| 986 | 2305 | psotfx | 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], |
| 987 | 2305 | psotfx | 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], |
| 988 | 2305 | psotfx | 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], |
| 989 | 2305 | psotfx | 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], |
| 990 | 2305 | psotfx | 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], |
| 991 | 2305 | psotfx | 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], |
| 992 | 2305 | psotfx | 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], |
| 993 | 2305 | psotfx | 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], |
| 994 | 2305 | psotfx | 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], |
| 995 | 2305 | psotfx | 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], |
| 996 | 2305 | psotfx | 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], |
| 997 | 2305 | psotfx | 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], |
| 998 | 2305 | psotfx | 'L_EMPTY_MESSAGE' => $lang['Empty_message'], |
| 999 | 1609 | psotfx | |
| 1000 | 2305 | psotfx | 'L_FONT_COLOR' => $lang['Font_color'], |
| 1001 | 2305 | psotfx | 'L_COLOR_DEFAULT' => $lang['color_default'], |
| 1002 | 2305 | psotfx | 'L_COLOR_DARK_RED' => $lang['color_dark_red'], |
| 1003 | 2305 | psotfx | 'L_COLOR_RED' => $lang['color_red'], |
| 1004 | 2305 | psotfx | 'L_COLOR_ORANGE' => $lang['color_orange'], |
| 1005 | 2305 | psotfx | 'L_COLOR_BROWN' => $lang['color_brown'], |
| 1006 | 2305 | psotfx | 'L_COLOR_YELLOW' => $lang['color_yellow'], |
| 1007 | 2305 | psotfx | 'L_COLOR_GREEN' => $lang['color_green'], |
| 1008 | 2305 | psotfx | 'L_COLOR_OLIVE' => $lang['color_olive'], |
| 1009 | 2305 | psotfx | 'L_COLOR_CYAN' => $lang['color_cyan'], |
| 1010 | 2305 | psotfx | 'L_COLOR_BLUE' => $lang['color_blue'], |
| 1011 | 2305 | psotfx | 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], |
| 1012 | 2305 | psotfx | 'L_COLOR_INDIGO' => $lang['color_indigo'], |
| 1013 | 2305 | psotfx | 'L_COLOR_VIOLET' => $lang['color_violet'], |
| 1014 | 2305 | psotfx | 'L_COLOR_WHITE' => $lang['color_white'], |
| 1015 | 2305 | psotfx | 'L_COLOR_BLACK' => $lang['color_black'], |
| 1016 | 1609 | psotfx | |
| 1017 | 2305 | psotfx | 'L_FONT_SIZE' => $lang['Font_size'], |
| 1018 | 2305 | psotfx | 'L_FONT_TINY' => $lang['font_tiny'], |
| 1019 | 2305 | psotfx | 'L_FONT_SMALL' => $lang['font_small'], |
| 1020 | 2305 | psotfx | 'L_FONT_NORMAL' => $lang['font_normal'], |
| 1021 | 2305 | psotfx | 'L_FONT_LARGE' => $lang['font_large'], |
| 1022 | 2305 | psotfx | 'L_FONT_HUGE' => $lang['font_huge'], |
| 1023 | 1609 | psotfx | |
| 1024 | 2305 | psotfx | 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], |
| 1025 | 2305 | psotfx | 'L_STYLES_TIP' => $lang['Styles_tip'], |
| 1026 | 1609 | psotfx | |
| 1027 | 2305 | psotfx | 'U_VIEWTOPIC' => ( $mode == 'reply' ) ? append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postorder=desc") : '', |
| 1028 | 2305 | psotfx | 'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? append_sid("posting.$phpEx?mode=topicreview&" . POST_TOPIC_URL . "=$topic_id") : '', |
| 1029 | 1183 | psotfx | |
| 1030 | 2305 | psotfx | 'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '', |
| 1031 | 2305 | psotfx | 'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '', |
| 1032 | 2305 | psotfx | 'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '', |
| 1033 | 2305 | psotfx | 'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '', |
| 1034 | 2305 | psotfx | 'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '', |
| 1035 | 2305 | psotfx | 'S_TYPE_TOGGLE' => $topic_type_toggle, |
| 1036 | 2305 | psotfx | 'S_TOPIC_ID' => $topic_id, |
| 1037 | 2305 | psotfx | 'S_POST_ACTION' => append_sid("posting.$phpEx"), |
| 1038 | 2305 | psotfx | 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields) |
| 1039 | 487 | psotfx | ); |
| 1040 | 347 | psotfx | |
| 1041 | 987 | psotfx | //
|
| 1042 | 987 | psotfx | // Poll entry switch/output
|
| 1043 | 987 | psotfx | //
|
| 1044 | 2305 | psotfx | if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $is_auth['auth_pollcreate'] ) |
| 1045 | 987 | psotfx | {
|
| 1046 | 987 | psotfx | $template->assign_vars(array( |
| 1047 | 2305 | psotfx | 'L_ADD_A_POLL' => $lang['Add_poll'], |
| 1048 | 2305 | psotfx | 'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'], |
| 1049 | 2305 | psotfx | 'L_POLL_QUESTION' => $lang['Poll_question'], |
| 1050 | 2305 | psotfx | 'L_POLL_OPTION' => $lang['Poll_option'], |
| 1051 | 2305 | psotfx | 'L_ADD_OPTION' => $lang['Add_option'], |
| 1052 | 2305 | psotfx | 'L_UPDATE_OPTION' => $lang['Update'], |
| 1053 | 2305 | psotfx | 'L_DELETE_OPTION' => $lang['Delete'], |
| 1054 | 2305 | psotfx | 'L_POLL_LENGTH' => $lang['Poll_for'], |
| 1055 | 2305 | psotfx | 'L_DAYS' => $lang['Days'], |
| 1056 | 2305 | psotfx | 'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'], |
| 1057 | 2305 | psotfx | 'L_POLL_DELETE' => $lang['Delete_poll'], |
| 1058 | 987 | psotfx | |
| 1059 | 2305 | psotfx | 'POLL_TITLE' => $poll_title, |
| 1060 | 2305 | psotfx | 'POLL_LENGTH' => $poll_length) |
| 1061 | 987 | psotfx | ); |
| 1062 | 987 | psotfx | |
| 1063 | 2183 | psotfx | if( $mode == 'editpost' && $post_data['edit_poll'] ) |
| 1064 | 987 | psotfx | {
|
| 1065 | 2448 | psotfx | $template->assign_block_vars('switch_poll_delete_toggle', array()); |
| 1066 | 987 | psotfx | } |
| 1067 | 987 | psotfx | |
| 1068 | 2183 | psotfx | if( !empty($poll_options) ) |
| 1069 | 987 | psotfx | {
|
| 1070 | 2183 | psotfx | while( list($option_id, $option_text) = each($poll_options) ) |
| 1071 | 987 | psotfx | {
|
| 1072 | 2305 | psotfx | $template->assign_block_vars('poll_option_rows', array( |
| 1073 | 2448 | psotfx | 'POLL_OPTION' => str_replace('"', '"', $option_text), |
| 1074 | 987 | psotfx | |
| 1075 | 2305 | psotfx | 'S_POLL_OPTION_NUM' => $option_id) |
| 1076 | 987 | psotfx | ); |
| 1077 | 987 | psotfx | } |
| 1078 | 987 | psotfx | } |
| 1079 | 987 | psotfx | |
| 1080 | 2305 | psotfx | $template->assign_var_from_handle('POLLBOX', 'pollbody'); |
| 1081 | 987 | psotfx | } |
| 1082 | 987 | psotfx | |
| 1083 | 987 | psotfx | //
|
| 1084 | 1220 | psotfx | // Topic review
|
| 1085 | 1220 | psotfx | //
|
| 1086 | 2183 | psotfx | if( $mode == 'reply' ) |
| 1087 | 1220 | psotfx | {
|
| 1088 | 2183 | psotfx | require($phpbb_root_path . 'includes/topic_review.'.$phpEx); |
| 1089 | 1220 | psotfx | topic_review($topic_id, true); |
| 1090 | 1220 | psotfx | |
| 1091 | 2305 | psotfx | $template->assign_block_vars('switch_inline_mode', array()); |
| 1092 | 2305 | psotfx | $template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody'); |
| 1093 | 1220 | psotfx | } |
| 1094 | 1220 | psotfx | |
| 1095 | 2305 | psotfx | $template->pparse('body'); |
| 1096 | 347 | psotfx | |
| 1097 | 646 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 1098 | 487 | psotfx | |
| 1099 | 2496 | psotfx | ?> |

