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

