root / tags / release_2_0_1 / phpBB / modcp.php
History | View | Annotate | Download (32.9 kB)
| 1 | 561 | uid29890 | <?php
|
|---|---|---|---|
| 2 | 877 | thefinn | /***************************************************************************
|
| 3 | 932 | psotfx | * modcp.php |
| 4 | 877 | thefinn | * ------------------- |
| 5 | 572 | thefinn | * begin : July 4, 2001 |
| 6 | 877 | thefinn | * copyright : (C) 2001 The phpBB Group |
| 7 | 877 | thefinn | * email : support@phpbb.com |
| 8 | 877 | thefinn | * |
| 9 | 877 | thefinn | * $Id$ |
| 10 | 877 | thefinn | * |
| 11 | 877 | thefinn | * |
| 12 | 877 | thefinn | ***************************************************************************/ |
| 13 | 561 | uid29890 | |
| 14 | 976 | thefinn | /***************************************************************************
|
| 15 | 976 | thefinn | * |
| 16 | 976 | thefinn | * This program is free software; you can redistribute it and/or modify |
| 17 | 976 | thefinn | * it under the terms of the GNU General Public License as published by |
| 18 | 976 | thefinn | * the Free Software Foundation; either version 2 of the License, or |
| 19 | 976 | thefinn | * (at your option) any later version. |
| 20 | 976 | thefinn | * |
| 21 | 976 | thefinn | ***************************************************************************/ |
| 22 | 976 | thefinn | |
| 23 | 561 | uid29890 | /**
|
| 24 | 561 | uid29890 | * Moderator Control Panel |
| 25 | 561 | uid29890 | * |
| 26 | 561 | uid29890 | * From this 'Control Panel' the moderator of a forum will be able to do |
| 27 | 561 | uid29890 | * mass topic operations (locking/unlocking/moving/deleteing), and it will |
| 28 | 877 | thefinn | * provide an interface to do quick locking/unlocking/moving/deleting of |
| 29 | 561 | uid29890 | * topics via the moderator operations buttons on all of the viewtopic pages. |
| 30 | 561 | uid29890 | */ |
| 31 | 877 | thefinn | |
| 32 | 2305 | psotfx | define('IN_PHPBB', true); |
| 33 | 2350 | psotfx | $phpbb_root_path = './'; |
| 34 | 646 | psotfx | include($phpbb_root_path . 'extension.inc'); |
| 35 | 646 | psotfx | include($phpbb_root_path . 'common.'.$phpEx); |
| 36 | 646 | psotfx | include($phpbb_root_path . 'includes/bbcode.'.$phpEx); |
| 37 | 2305 | psotfx | include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); |
| 38 | 561 | uid29890 | |
| 39 | 1043 | psotfx | //
|
| 40 | 1043 | psotfx | // Obtain initial var settings
|
| 41 | 1043 | psotfx | //
|
| 42 | 2350 | psotfx | if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) ) |
| 43 | 1043 | psotfx | {
|
| 44 | 1307 | psotfx | $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]); |
| 45 | 1043 | psotfx | } |
| 46 | 1043 | psotfx | else
|
| 47 | 1043 | psotfx | {
|
| 48 | 2350 | psotfx | $forum_id = ''; |
| 49 | 1043 | psotfx | } |
| 50 | 561 | uid29890 | |
| 51 | 2350 | psotfx | if ( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]) ) |
| 52 | 1043 | psotfx | {
|
| 53 | 1307 | psotfx | $post_id = (isset($HTTP_POST_VARS[POST_POST_URL])) ? intval($HTTP_POST_VARS[POST_POST_URL]) : intval($HTTP_GET_VARS[POST_POST_URL]); |
| 54 | 1043 | psotfx | } |
| 55 | 1043 | psotfx | else
|
| 56 | 1043 | psotfx | {
|
| 57 | 2350 | psotfx | $post_id = ''; |
| 58 | 1043 | psotfx | } |
| 59 | 561 | uid29890 | |
| 60 | 2350 | psotfx | if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) || isset($HTTP_POST_VARS[POST_TOPIC_URL]) ) |
| 61 | 561 | uid29890 | {
|
| 62 | 1307 | psotfx | $topic_id = (isset($HTTP_POST_VARS[POST_TOPIC_URL])) ? intval($HTTP_POST_VARS[POST_TOPIC_URL]) : intval($HTTP_GET_VARS[POST_TOPIC_URL]); |
| 63 | 1043 | psotfx | } |
| 64 | 1043 | psotfx | else
|
| 65 | 1043 | psotfx | {
|
| 66 | 2350 | psotfx | $topic_id = ''; |
| 67 | 1043 | psotfx | } |
| 68 | 1043 | psotfx | |
| 69 | 1307 | psotfx | $confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0; |
| 70 | 1043 | psotfx | |
| 71 | 1043 | psotfx | //
|
| 72 | 1043 | psotfx | // Continue var definitions
|
| 73 | 1043 | psotfx | //
|
| 74 | 2599 | psotfx | $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; |
| 75 | 1043 | psotfx | |
| 76 | 2350 | psotfx | $delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : FALSE; |
| 77 | 2350 | psotfx | $move = ( isset($HTTP_POST_VARS['move']) ) ? TRUE : FALSE; |
| 78 | 2350 | psotfx | $lock = ( isset($HTTP_POST_VARS['lock']) ) ? TRUE : FALSE; |
| 79 | 2350 | psotfx | $unlock = ( isset($HTTP_POST_VARS['unlock']) ) ? TRUE : FALSE; |
| 80 | 1043 | psotfx | |
| 81 | 2350 | psotfx | if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) |
| 82 | 1043 | psotfx | {
|
| 83 | 1043 | psotfx | $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; |
| 84 | 1043 | psotfx | } |
| 85 | 1043 | psotfx | else
|
| 86 | 1043 | psotfx | {
|
| 87 | 2350 | psotfx | if ( $delete ) |
| 88 | 1043 | psotfx | {
|
| 89 | 1043 | psotfx | $mode = 'delete'; |
| 90 | 1043 | psotfx | } |
| 91 | 2350 | psotfx | else if ( $move ) |
| 92 | 1043 | psotfx | {
|
| 93 | 1043 | psotfx | $mode = 'move'; |
| 94 | 1043 | psotfx | } |
| 95 | 2350 | psotfx | else if ( $lock ) |
| 96 | 1043 | psotfx | {
|
| 97 | 1043 | psotfx | $mode = 'lock'; |
| 98 | 1043 | psotfx | } |
| 99 | 2350 | psotfx | else if ( $unlock ) |
| 100 | 1043 | psotfx | {
|
| 101 | 1043 | psotfx | $mode = 'unlock'; |
| 102 | 1043 | psotfx | } |
| 103 | 1043 | psotfx | else
|
| 104 | 1043 | psotfx | {
|
| 105 | 2350 | psotfx | $mode = ''; |
| 106 | 1043 | psotfx | } |
| 107 | 1043 | psotfx | } |
| 108 | 1043 | psotfx | |
| 109 | 1043 | psotfx | //
|
| 110 | 1043 | psotfx | // Obtain relevant data
|
| 111 | 1043 | psotfx | //
|
| 112 | 2347 | psotfx | if ( !empty($topic_id) ) |
| 113 | 1043 | psotfx | {
|
| 114 | 877 | thefinn | $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics |
| 115 | 877 | thefinn | FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f |
| 116 | 877 | thefinn | WHERE t.topic_id = " . $topic_id . " |
| 117 | 686 | psotfx | AND f.forum_id = t.forum_id";
|
| 118 | 2347 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 119 | 561 | uid29890 | {
|
| 120 | 2347 | psotfx | message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); |
| 121 | 561 | uid29890 | } |
| 122 | 1043 | psotfx | $topic_row = $db->sql_fetchrow($result); |
| 123 | 686 | psotfx | |
| 124 | 2476 | psotfx | $forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics']; |
| 125 | 1043 | psotfx | $forum_id = $topic_row['forum_id']; |
| 126 | 1043 | psotfx | $forum_name = $topic_row['forum_name']; |
| 127 | 561 | uid29890 | } |
| 128 | 2347 | psotfx | else if ( !empty($forum_id) ) |
| 129 | 561 | uid29890 | {
|
| 130 | 877 | thefinn | $sql = "SELECT forum_name, forum_topics |
| 131 | 877 | thefinn | FROM " . FORUMS_TABLE . " |
| 132 | 686 | psotfx | WHERE forum_id = " . $forum_id; |
| 133 | 2347 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 134 | 561 | uid29890 | {
|
| 135 | 2347 | psotfx | message_die(GENERAL_MESSAGE, 'Forum_not_exist'); |
| 136 | 561 | uid29890 | } |
| 137 | 1043 | psotfx | $topic_row = $db->sql_fetchrow($result); |
| 138 | 686 | psotfx | |
| 139 | 2476 | psotfx | $forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics']; |
| 140 | 1043 | psotfx | $forum_name = $topic_row['forum_name']; |
| 141 | 561 | uid29890 | } |
| 142 | 2347 | psotfx | else
|
| 143 | 2347 | psotfx | {
|
| 144 | 2347 | psotfx | message_die(GENERAL_MESSAGE, 'Forum_not_exist'); |
| 145 | 2347 | psotfx | } |
| 146 | 561 | uid29890 | |
| 147 | 561 | uid29890 | //
|
| 148 | 561 | uid29890 | // Start session management
|
| 149 | 561 | uid29890 | //
|
| 150 | 2260 | psotfx | $userdata = session_pagestart($user_ip, $forum_id); |
| 151 | 561 | uid29890 | init_userprefs($userdata);
|
| 152 | 561 | uid29890 | //
|
| 153 | 561 | uid29890 | // End session management
|
| 154 | 561 | uid29890 | //
|
| 155 | 561 | uid29890 | |
| 156 | 561 | uid29890 | //
|
| 157 | 2570 | psotfx | // Check if user did or did not confirm
|
| 158 | 2570 | psotfx | // If they did not, forward them to the last page they were on
|
| 159 | 2570 | psotfx | //
|
| 160 | 2570 | psotfx | if ( isset($HTTP_POST_VARS['cancel']) ) |
| 161 | 2570 | psotfx | {
|
| 162 | 2570 | psotfx | if ( $topic_id ) |
| 163 | 2570 | psotfx | {
|
| 164 | 2570 | psotfx | $redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"; |
| 165 | 2570 | psotfx | } |
| 166 | 2570 | psotfx | else if ( $forum_id ) |
| 167 | 2570 | psotfx | {
|
| 168 | 2570 | psotfx | $redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"; |
| 169 | 2570 | psotfx | } |
| 170 | 2570 | psotfx | else
|
| 171 | 2570 | psotfx | {
|
| 172 | 2570 | psotfx | $redirect = "index.$phpEx"; |
| 173 | 2570 | psotfx | } |
| 174 | 2570 | psotfx | |
| 175 | 2570 | psotfx | $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; |
| 176 | 2570 | psotfx | header($header_location . append_sid($redirect, true)); |
| 177 | 2575 | psotfx | exit;
|
| 178 | 2570 | psotfx | } |
| 179 | 2570 | psotfx | |
| 180 | 2570 | psotfx | //
|
| 181 | 561 | uid29890 | // Start auth check
|
| 182 | 561 | uid29890 | //
|
| 183 | 561 | uid29890 | $is_auth = auth(AUTH_ALL, $forum_id, $userdata); |
| 184 | 561 | uid29890 | |
| 185 | 2448 | psotfx | if ( !$is_auth['auth_mod'] ) |
| 186 | 561 | uid29890 | {
|
| 187 | 676 | psotfx | message_die(GENERAL_MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised']); |
| 188 | 561 | uid29890 | } |
| 189 | 1043 | psotfx | //
|
| 190 | 1043 | psotfx | // End Auth Check
|
| 191 | 1043 | psotfx | //
|
| 192 | 561 | uid29890 | |
| 193 | 619 | thefinn | //
|
| 194 | 1043 | psotfx | // Do major work ...
|
| 195 | 1043 | psotfx | //
|
| 196 | 2462 | psotfx | switch( $mode ) |
| 197 | 561 | uid29890 | {
|
| 198 | 561 | uid29890 | case 'delete': |
| 199 | 1440 | psotfx | $page_title = $lang['Mod_CP']; |
| 200 | 1440 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 201 | 1440 | psotfx | |
| 202 | 2104 | psotfx | if ( $confirm ) |
| 203 | 572 | thefinn | {
|
| 204 | 2347 | psotfx | include($phpbb_root_path . 'includes/functions_search.'.$phpEx); |
| 205 | 2347 | psotfx | |
| 206 | 1043 | psotfx | $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); |
| 207 | 1043 | psotfx | |
| 208 | 2350 | psotfx | $topic_id_sql = ''; |
| 209 | 1043 | psotfx | for($i = 0; $i < count($topics); $i++) |
| 210 | 619 | thefinn | {
|
| 211 | 2350 | psotfx | $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i]; |
| 212 | 619 | thefinn | } |
| 213 | 1043 | psotfx | |
| 214 | 1043 | psotfx | $sql = "SELECT post_id |
| 215 | 1043 | psotfx | FROM " . POSTS_TABLE . " |
| 216 | 1043 | psotfx | WHERE topic_id IN ($topic_id_sql)"; |
| 217 | 2350 | psotfx | if ( !$result = $db->sql_query($sql) ) |
| 218 | 619 | thefinn | {
|
| 219 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql); |
| 220 | 619 | thefinn | } |
| 221 | 877 | thefinn | |
| 222 | 2350 | psotfx | $post_id_sql = ''; |
| 223 | 2462 | psotfx | while ( $row = $db->sql_fetchrow($result) ) |
| 224 | 572 | thefinn | {
|
| 225 | 2462 | psotfx | $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $row['post_id']; |
| 226 | 572 | thefinn | } |
| 227 | 2462 | psotfx | $db->sql_freeresult($result); |
| 228 | 877 | thefinn | |
| 229 | 1043 | psotfx | $sql = "SELECT vote_id |
| 230 | 1043 | psotfx | FROM " . VOTE_DESC_TABLE . " |
| 231 | 1043 | psotfx | WHERE topic_id IN ($topic_id_sql)"; |
| 232 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 233 | 572 | thefinn | {
|
| 234 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get vote id information', '', __LINE__, __FILE__, $sql); |
| 235 | 572 | thefinn | } |
| 236 | 1043 | psotfx | |
| 237 | 2350 | psotfx | $vote_id_sql = ''; |
| 238 | 2462 | psotfx | while ( $row = $db->sql_fetchrow($result) ) |
| 239 | 619 | thefinn | {
|
| 240 | 2462 | psotfx | $vote_id_sql .= ( ( $vote_id_sql != '' ) ? ', ' : '' ) . $row['vote_id']; |
| 241 | 619 | thefinn | } |
| 242 | 2462 | psotfx | $db->sql_freeresult($result); |
| 243 | 877 | thefinn | |
| 244 | 1043 | psotfx | //
|
| 245 | 1043 | psotfx | // Got all required info so go ahead and start deleting everything
|
| 246 | 1043 | psotfx | //
|
| 247 | 1043 | psotfx | $sql = "DELETE |
| 248 | 1043 | psotfx | FROM " . TOPICS_TABLE . " |
| 249 | 1071 | psotfx | WHERE topic_id IN ($topic_id_sql) |
| 250 | 1071 | psotfx | OR topic_moved_id IN ($topic_id_sql)"; |
| 251 | 2462 | psotfx | if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) |
| 252 | 877 | thefinn | {
|
| 253 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql); |
| 254 | 619 | thefinn | } |
| 255 | 877 | thefinn | |
| 256 | 2350 | psotfx | if ( $post_id_sql != '' ) |
| 257 | 619 | thefinn | {
|
| 258 | 1314 | bartvb | $sql = "DELETE |
| 259 | 1314 | bartvb | FROM " . POSTS_TABLE . " |
| 260 | 1314 | bartvb | WHERE post_id IN ($post_id_sql)"; |
| 261 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 262 | 1314 | bartvb | {
|
| 263 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete posts', '', __LINE__, __FILE__, $sql); |
| 264 | 1314 | bartvb | } |
| 265 | 877 | thefinn | |
| 266 | 1314 | bartvb | $sql = "DELETE |
| 267 | 1314 | bartvb | FROM " . POSTS_TEXT_TABLE . " |
| 268 | 1314 | bartvb | WHERE post_id IN ($post_id_sql)"; |
| 269 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 270 | 1314 | bartvb | {
|
| 271 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql); |
| 272 | 1314 | bartvb | } |
| 273 | 1439 | psotfx | |
| 274 | 2337 | psotfx | remove_search_post($post_id_sql);
|
| 275 | 619 | thefinn | } |
| 276 | 877 | thefinn | |
| 277 | 2350 | psotfx | if ( $vote_id_sql != '' ) |
| 278 | 890 | gpolins | {
|
| 279 | 1071 | psotfx | $sql = "DELETE |
| 280 | 1071 | psotfx | FROM " . VOTE_DESC_TABLE . " |
| 281 | 1071 | psotfx | WHERE vote_id IN ($vote_id_sql)"; |
| 282 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 283 | 1071 | psotfx | {
|
| 284 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete vote descriptions', '', __LINE__, __FILE__, $sql); |
| 285 | 1071 | psotfx | } |
| 286 | 892 | thefinn | |
| 287 | 1071 | psotfx | $sql = "DELETE |
| 288 | 1071 | psotfx | FROM " . VOTE_RESULTS_TABLE . " |
| 289 | 1071 | psotfx | WHERE vote_id IN ($vote_id_sql)"; |
| 290 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 291 | 1071 | psotfx | {
|
| 292 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete vote results', '', __LINE__, __FILE__, $sql); |
| 293 | 1071 | psotfx | } |
| 294 | 1043 | psotfx | |
| 295 | 1071 | psotfx | $sql = "DELETE |
| 296 | 1071 | psotfx | FROM " . VOTE_USERS_TABLE . " |
| 297 | 1071 | psotfx | WHERE vote_id IN ($vote_id_sql)"; |
| 298 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 299 | 1071 | psotfx | {
|
| 300 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete vote users', '', __LINE__, __FILE__, $sql); |
| 301 | 1071 | psotfx | } |
| 302 | 1043 | psotfx | } |
| 303 | 1043 | psotfx | |
| 304 | 1073 | psotfx | $sql = "DELETE |
| 305 | 1073 | psotfx | FROM " . TOPICS_WATCH_TABLE . " |
| 306 | 1073 | psotfx | WHERE topic_id IN ($topic_id_sql)"; |
| 307 | 2462 | psotfx | if ( !$db->sql_query($sql, END_TRANSACTION) ) |
| 308 | 1073 | psotfx | {
|
| 309 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not delete watched post list', '', __LINE__, __FILE__, $sql); |
| 310 | 1073 | psotfx | } |
| 311 | 1073 | psotfx | |
| 312 | 2350 | psotfx | sync('forum', $forum_id); |
| 313 | 877 | thefinn | |
| 314 | 2350 | psotfx | if ( !empty($topic_id) ) |
| 315 | 625 | thefinn | {
|
| 316 | 1307 | psotfx | $redirect_page = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"); |
| 317 | 2104 | psotfx | $l_redirect = sprintf($lang['Click_return_forum'], '<a href="' . $redirect_page . '">', '</a>'); |
| 318 | 625 | thefinn | } |
| 319 | 625 | thefinn | else
|
| 320 | 625 | thefinn | {
|
| 321 | 2104 | psotfx | $redirect_page = append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id"); |
| 322 | 2104 | psotfx | $l_redirect = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); |
| 323 | 625 | thefinn | } |
| 324 | 877 | thefinn | |
| 325 | 1307 | psotfx | $template->assign_vars(array( |
| 326 | 2350 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') |
| 327 | 1307 | psotfx | ); |
| 328 | 1307 | psotfx | |
| 329 | 2350 | psotfx | message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . '<br /><br />' . $l_redirect); |
| 330 | 609 | thefinn | } |
| 331 | 609 | thefinn | else
|
| 332 | 609 | thefinn | {
|
| 333 | 2104 | psotfx | // Not confirmed, show confirmation message
|
| 334 | 2350 | psotfx | if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) |
| 335 | 976 | thefinn | {
|
| 336 | 2350 | psotfx | message_die(GENERAL_MESSAGE, $lang['None_selected']); |
| 337 | 976 | thefinn | } |
| 338 | 1043 | psotfx | |
| 339 | 2129 | psotfx | $hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; |
| 340 | 1043 | psotfx | |
| 341 | 2350 | psotfx | if ( isset($HTTP_POST_VARS['topic_id_list']) ) |
| 342 | 572 | thefinn | {
|
| 343 | 1043 | psotfx | $topics = $HTTP_POST_VARS['topic_id_list']; |
| 344 | 1043 | psotfx | for($i = 0; $i < count($topics); $i++) |
| 345 | 619 | thefinn | {
|
| 346 | 2503 | psotfx | $hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />'; |
| 347 | 619 | thefinn | } |
| 348 | 572 | thefinn | } |
| 349 | 619 | thefinn | else
|
| 350 | 572 | thefinn | {
|
| 351 | 2129 | psotfx | $hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; |
| 352 | 572 | thefinn | } |
| 353 | 619 | thefinn | |
| 354 | 1043 | psotfx | //
|
| 355 | 1043 | psotfx | // Set template files
|
| 356 | 1043 | psotfx | //
|
| 357 | 1043 | psotfx | $template->set_filenames(array( |
| 358 | 2350 | psotfx | 'confirm' => 'confirm_body.tpl') |
| 359 | 1043 | psotfx | ); |
| 360 | 1043 | psotfx | |
| 361 | 1043 | psotfx | $template->assign_vars(array( |
| 362 | 2350 | psotfx | 'MESSAGE_TITLE' => $lang['Confirm'], |
| 363 | 2350 | psotfx | 'MESSAGE_TEXT' => $lang['Confirm_delete_topic'], |
| 364 | 1043 | psotfx | |
| 365 | 2350 | psotfx | 'L_YES' => $lang['Yes'], |
| 366 | 2350 | psotfx | 'L_NO' => $lang['No'], |
| 367 | 1043 | psotfx | |
| 368 | 2350 | psotfx | 'S_CONFIRM_ACTION' => append_sid("modcp.$phpEx"), |
| 369 | 2350 | psotfx | 'S_HIDDEN_FIELDS' => $hidden_fields) |
| 370 | 1043 | psotfx | ); |
| 371 | 1043 | psotfx | |
| 372 | 2350 | psotfx | $template->pparse('confirm'); |
| 373 | 1043 | psotfx | |
| 374 | 646 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 375 | 572 | thefinn | } |
| 376 | 646 | psotfx | break;
|
| 377 | 646 | psotfx | |
| 378 | 561 | uid29890 | case 'move': |
| 379 | 1440 | psotfx | $page_title = $lang['Mod_CP']; |
| 380 | 1440 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 381 | 1440 | psotfx | |
| 382 | 2350 | psotfx | if ( $confirm ) |
| 383 | 877 | thefinn | {
|
| 384 | 2564 | psotfx | if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) |
| 385 | 2564 | psotfx | {
|
| 386 | 2564 | psotfx | message_die(GENERAL_MESSAGE, $lang['None_selected']); |
| 387 | 2564 | psotfx | } |
| 388 | 2564 | psotfx | |
| 389 | 1043 | psotfx | $new_forum_id = $HTTP_POST_VARS['new_forum']; |
| 390 | 1043 | psotfx | $old_forum_id = $forum_id; |
| 391 | 1043 | psotfx | |
| 392 | 2350 | psotfx | if ( $new_forum_id != $old_forum_id ) |
| 393 | 877 | thefinn | {
|
| 394 | 1550 | psotfx | $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); |
| 395 | 1550 | psotfx | |
| 396 | 2350 | psotfx | $topic_list = ''; |
| 397 | 1550 | psotfx | for($i = 0; $i < count($topics); $i++) |
| 398 | 1043 | psotfx | {
|
| 399 | 2503 | psotfx | $topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . intval($topics[$i]); |
| 400 | 1043 | psotfx | } |
| 401 | 1043 | psotfx | |
| 402 | 2448 | psotfx | $sql = "SELECT * |
| 403 | 1550 | psotfx | FROM " . TOPICS_TABLE . " |
| 404 | 2104 | psotfx | WHERE topic_id IN ($topic_list) |
| 405 | 2462 | psotfx | AND topic_status <> " . TOPIC_MOVED; |
| 406 | 2448 | psotfx | if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) |
| 407 | 1550 | psotfx | {
|
| 408 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not select from topic table', '', __LINE__, __FILE__, $sql); |
| 409 | 1550 | psotfx | } |
| 410 | 1043 | psotfx | |
| 411 | 1550 | psotfx | $row = $db->sql_fetchrowset($result); |
| 412 | 2104 | psotfx | $db->sql_freeresult($result); |
| 413 | 1043 | psotfx | |
| 414 | 1550 | psotfx | for($i = 0; $i < count($row); $i++) |
| 415 | 877 | thefinn | {
|
| 416 | 1550 | psotfx | $topic_id = $row[$i]['topic_id']; |
| 417 | 1550 | psotfx | |
| 418 | 2350 | psotfx | if ( isset($HTTP_POST_VARS['move_leave_shadow']) ) |
| 419 | 1550 | psotfx | {
|
| 420 | 1550 | psotfx | // Insert topic in the old forum that indicates that the forum has moved.
|
| 421 | 2061 | psotfx | $sql = "INSERT INTO " . TOPICS_TABLE . " (forum_id, topic_title, topic_poster, topic_time, topic_status, topic_type, topic_vote, topic_views, topic_replies, topic_first_post_id, topic_last_post_id, topic_moved_id) |
| 422 | 2061 | psotfx | VALUES ($old_forum_id, '" . addslashes(str_replace("\'", "''", $row[$i]['topic_title'])) . "', '" . str_replace("\'", "''", $row[$i]['topic_poster']) . "', " . $row[$i]['topic_time'] . ", " . TOPIC_MOVED . ", " . POST_NORMAL . ", " . $row[$i]['topic_vote'] . ", " . $row[$i]['topic_views'] . ", " . $row[$i]['topic_replies'] . ", " . $row[$i]['topic_first_post_id'] . ", " . $row[$i]['topic_last_post_id'] . ", $topic_id)"; |
| 423 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 424 | 1550 | psotfx | {
|
| 425 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not insert shadow topic', '', __LINE__, __FILE__, $sql); |
| 426 | 1550 | psotfx | } |
| 427 | 1550 | psotfx | } |
| 428 | 1550 | psotfx | |
| 429 | 1550 | psotfx | $sql = "UPDATE " . TOPICS_TABLE . " |
| 430 | 1550 | psotfx | SET forum_id = $new_forum_id |
| 431 | 1550 | psotfx | WHERE topic_id = $topic_id"; |
| 432 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 433 | 1314 | bartvb | {
|
| 434 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql); |
| 435 | 1314 | bartvb | } |
| 436 | 1043 | psotfx | |
| 437 | 1550 | psotfx | $sql = "UPDATE " . POSTS_TABLE . " |
| 438 | 1550 | psotfx | SET forum_id = $new_forum_id |
| 439 | 1550 | psotfx | WHERE topic_id = $topic_id"; |
| 440 | 2462 | psotfx | if ( !$db->sql_query($sql) ) |
| 441 | 1550 | psotfx | {
|
| 442 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not update post topic ids', '', __LINE__, __FILE__, $sql); |
| 443 | 1550 | psotfx | } |
| 444 | 877 | thefinn | } |
| 445 | 1043 | psotfx | |
| 446 | 1550 | psotfx | // Sync the forum indexes
|
| 447 | 2350 | psotfx | sync('forum', $new_forum_id); |
| 448 | 2350 | psotfx | sync('forum', $old_forum_id); |
| 449 | 1550 | psotfx | |
| 450 | 2350 | psotfx | $message = $lang['Topics_Moved'] . '<br /><br />'; |
| 451 | 1550 | psotfx | |
| 452 | 877 | thefinn | } |
| 453 | 1550 | psotfx | else
|
| 454 | 1550 | psotfx | {
|
| 455 | 2350 | psotfx | $message = $lang['No_Topics_Moved'] . '<br /><br />'; |
| 456 | 1550 | psotfx | } |
| 457 | 851 | gpolins | |
| 458 | 2350 | psotfx | if ( !empty($topic_id) ) |
| 459 | 877 | thefinn | {
|
| 460 | 1307 | psotfx | $redirect_page = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); |
| 461 | 2104 | psotfx | $message .= sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>'); |
| 462 | 877 | thefinn | } |
| 463 | 877 | thefinn | else
|
| 464 | 877 | thefinn | {
|
| 465 | 1307 | psotfx | $redirect_page = append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id"); |
| 466 | 2104 | psotfx | $message .= sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); |
| 467 | 877 | thefinn | } |
| 468 | 1043 | psotfx | |
| 469 | 2350 | psotfx | $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$old_forum_id") . '">', '</a>'); |
| 470 | 1314 | bartvb | |
| 471 | 1307 | psotfx | $template->assign_vars(array( |
| 472 | 2350 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') |
| 473 | 1307 | psotfx | ); |
| 474 | 1043 | psotfx | |
| 475 | 1550 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 476 | 877 | thefinn | } |
| 477 | 877 | thefinn | else
|
| 478 | 877 | thefinn | {
|
| 479 | 2350 | psotfx | if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) |
| 480 | 976 | thefinn | {
|
| 481 | 1047 | psotfx | message_die(GENERAL_MESSAGE, $lang['None_selected']); |
| 482 | 976 | thefinn | } |
| 483 | 1043 | psotfx | |
| 484 | 2129 | psotfx | $hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; |
| 485 | 1043 | psotfx | |
| 486 | 2350 | psotfx | if ( isset($HTTP_POST_VARS['topic_id_list']) ) |
| 487 | 877 | thefinn | {
|
| 488 | 1043 | psotfx | $topics = $HTTP_POST_VARS['topic_id_list']; |
| 489 | 1307 | psotfx | |
| 490 | 1043 | psotfx | for($i = 0; $i < count($topics); $i++) |
| 491 | 877 | thefinn | {
|
| 492 | 2129 | psotfx | $hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />'; |
| 493 | 877 | thefinn | } |
| 494 | 877 | thefinn | } |
| 495 | 877 | thefinn | else
|
| 496 | 877 | thefinn | {
|
| 497 | 2132 | the_systech | $hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; |
| 498 | 877 | thefinn | } |
| 499 | 1043 | psotfx | |
| 500 | 1043 | psotfx | //
|
| 501 | 1043 | psotfx | // Set template files
|
| 502 | 1043 | psotfx | //
|
| 503 | 1043 | psotfx | $template->set_filenames(array( |
| 504 | 2350 | psotfx | 'movetopic' => 'modcp_move.tpl') |
| 505 | 1043 | psotfx | ); |
| 506 | 1043 | psotfx | |
| 507 | 1043 | psotfx | $template->assign_vars(array( |
| 508 | 2350 | psotfx | 'MESSAGE_TITLE' => $lang['Confirm'], |
| 509 | 2350 | psotfx | 'MESSAGE_TEXT' => $lang['Confirm_move_topic'], |
| 510 | 1047 | psotfx | |
| 511 | 2350 | psotfx | 'L_MOVE_TO_FORUM' => $lang['Move_to_forum'], |
| 512 | 2350 | psotfx | 'L_LEAVESHADOW' => $lang['Leave_shadow_topic'], |
| 513 | 2350 | psotfx | 'L_YES' => $lang['Yes'], |
| 514 | 2350 | psotfx | 'L_NO' => $lang['No'], |
| 515 | 1043 | psotfx | |
| 516 | 2448 | psotfx | 'S_FORUM_SELECT' => make_forum_select('new_forum', $forum_id), |
| 517 | 2350 | psotfx | 'S_MODCP_ACTION' => append_sid("modcp.$phpEx"), |
| 518 | 2350 | psotfx | 'S_HIDDEN_FIELDS' => $hidden_fields) |
| 519 | 1047 | psotfx | ); |
| 520 | 1047 | psotfx | |
| 521 | 2448 | psotfx | $template->pparse('movetopic'); |
| 522 | 2448 | psotfx | |
| 523 | 877 | thefinn | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 524 | 877 | thefinn | } |
| 525 | 1043 | psotfx | break;
|
| 526 | 877 | thefinn | |
| 527 | 561 | uid29890 | case 'lock': |
| 528 | 2564 | psotfx | if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) |
| 529 | 2564 | psotfx | {
|
| 530 | 2564 | psotfx | message_die(GENERAL_MESSAGE, $lang['None_selected']); |
| 531 | 2564 | psotfx | } |
| 532 | 2564 | psotfx | |
| 533 | 1439 | psotfx | $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); |
| 534 | 1439 | psotfx | |
| 535 | 2350 | psotfx | $topic_id_sql = ''; |
| 536 | 1439 | psotfx | for($i = 0; $i < count($topics); $i++) |
| 537 | 589 | thefinn | {
|
| 538 | 2350 | psotfx | $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i]; |
| 539 | 1439 | psotfx | } |
| 540 | 877 | thefinn | |
| 541 | 1439 | psotfx | $sql = "UPDATE " . TOPICS_TABLE . " |
| 542 | 1439 | psotfx | SET topic_status = " . TOPIC_LOCKED . " |
| 543 | 2104 | psotfx | WHERE topic_id IN ($topic_id_sql) |
| 544 | 2104 | psotfx | AND topic_moved_id = 0";
|
| 545 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 546 | 1439 | psotfx | {
|
| 547 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql); |
| 548 | 1439 | psotfx | } |
| 549 | 1043 | psotfx | |
| 550 | 2350 | psotfx | if ( !empty($topic_id) ) |
| 551 | 1439 | psotfx | {
|
| 552 | 1439 | psotfx | $redirect_page = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); |
| 553 | 2104 | psotfx | $message = sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>'); |
| 554 | 609 | thefinn | } |
| 555 | 609 | thefinn | else
|
| 556 | 609 | thefinn | {
|
| 557 | 1439 | psotfx | $redirect_page = append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id"); |
| 558 | 2104 | psotfx | $message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); |
| 559 | 1439 | psotfx | } |
| 560 | 1043 | psotfx | |
| 561 | 2350 | psotfx | $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); |
| 562 | 2167 | bartvb | |
| 563 | 1439 | psotfx | $template->assign_vars(array( |
| 564 | 2350 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') |
| 565 | 1439 | psotfx | ); |
| 566 | 1043 | psotfx | |
| 567 | 2350 | psotfx | message_die(GENERAL_MESSAGE, $lang['Topics_Locked'] . '<br /><br />' . $message); |
| 568 | 620 | thefinn | |
| 569 | 1043 | psotfx | break;
|
| 570 | 609 | thefinn | |
| 571 | 561 | uid29890 | case 'unlock': |
| 572 | 2564 | psotfx | if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) |
| 573 | 2564 | psotfx | {
|
| 574 | 2564 | psotfx | message_die(GENERAL_MESSAGE, $lang['None_selected']); |
| 575 | 2564 | psotfx | } |
| 576 | 2564 | psotfx | |
| 577 | 1439 | psotfx | $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); |
| 578 | 1439 | psotfx | |
| 579 | 2350 | psotfx | $topic_id_sql = ''; |
| 580 | 1439 | psotfx | for($i = 0; $i < count($topics); $i++) |
| 581 | 589 | thefinn | {
|
| 582 | 2350 | psotfx | $topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . $topics[$i]; |
| 583 | 1439 | psotfx | } |
| 584 | 877 | thefinn | |
| 585 | 1439 | psotfx | $sql = "UPDATE " . TOPICS_TABLE . " |
| 586 | 1439 | psotfx | SET topic_status = " . TOPIC_UNLOCKED . " |
| 587 | 2104 | psotfx | WHERE topic_id IN ($topic_id_sql) |
| 588 | 2104 | psotfx | AND topic_moved_id = 0";
|
| 589 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 590 | 1439 | psotfx | {
|
| 591 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql); |
| 592 | 1439 | psotfx | } |
| 593 | 1043 | psotfx | |
| 594 | 2350 | psotfx | if ( !empty($topic_id) ) |
| 595 | 1439 | psotfx | {
|
| 596 | 1439 | psotfx | $redirect_page = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); |
| 597 | 2104 | psotfx | $message = sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>'); |
| 598 | 589 | thefinn | } |
| 599 | 609 | thefinn | else
|
| 600 | 609 | thefinn | {
|
| 601 | 1439 | psotfx | $redirect_page = append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id"); |
| 602 | 2104 | psotfx | $message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); |
| 603 | 1439 | psotfx | } |
| 604 | 976 | thefinn | |
| 605 | 2350 | psotfx | $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); |
| 606 | 2167 | bartvb | |
| 607 | 1439 | psotfx | $template->assign_vars(array( |
| 608 | 2350 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') |
| 609 | 1439 | psotfx | ); |
| 610 | 686 | psotfx | |
| 611 | 2350 | psotfx | message_die(GENERAL_MESSAGE, $lang['Topics_Unlocked'] . '<br /><br />' . $message); |
| 612 | 620 | thefinn | |
| 613 | 1439 | psotfx | break;
|
| 614 | 1043 | psotfx | |
| 615 | 619 | thefinn | case 'split': |
| 616 | 1440 | psotfx | $page_title = $lang['Mod_CP']; |
| 617 | 1440 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 618 | 1440 | psotfx | |
| 619 | 2350 | psotfx | if ( isset($HTTP_POST_VARS['split_type_all']) || isset($HTTP_POST_VARS['split_type_beyond']) ) |
| 620 | 619 | thefinn | {
|
| 621 | 1043 | psotfx | $posts = $HTTP_POST_VARS['post_id_list']; |
| 622 | 877 | thefinn | |
| 623 | 877 | thefinn | $sql = "SELECT poster_id, topic_id, post_time |
| 624 | 877 | thefinn | FROM " . POSTS_TABLE . " |
| 625 | 1043 | psotfx | WHERE post_id = " . $posts[0]; |
| 626 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 627 | 627 | thefinn | {
|
| 628 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql); |
| 629 | 627 | thefinn | } |
| 630 | 877 | thefinn | |
| 631 | 1043 | psotfx | $post_rowset = $db->sql_fetchrow($result); |
| 632 | 1668 | psotfx | $first_poster = str_replace("\'", "''", $post_rowset['poster_id']); |
| 633 | 1043 | psotfx | $topic_id = $post_rowset['topic_id']; |
| 634 | 1043 | psotfx | $post_time = $post_rowset['post_time']; |
| 635 | 877 | thefinn | |
| 636 | 2462 | psotfx | $post_subject = trim(htmlspecialchars($HTTP_POST_VARS['subject'])); |
| 637 | 2350 | psotfx | if ( empty($post_subject) ) |
| 638 | 627 | thefinn | {
|
| 639 | 686 | psotfx | message_die(GENERAL_MESSAGE, $lang['Empty_subject']); |
| 640 | 654 | thefinn | } |
| 641 | 877 | thefinn | |
| 642 | 2503 | psotfx | $new_forum_id = intval($HTTP_POST_VARS['new_forum_id']); |
| 643 | 1043 | psotfx | $topic_time = time(); |
| 644 | 877 | thefinn | |
| 645 | 1755 | psotfx | $sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type) |
| 646 | 1668 | psotfx | VALUES ('" . str_replace("\'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ")";
|
| 647 | 2350 | psotfx | if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) |
| 648 | 654 | thefinn | {
|
| 649 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not insert new topic', '', __LINE__, __FILE__, $sql); |
| 650 | 654 | thefinn | } |
| 651 | 877 | thefinn | |
| 652 | 654 | thefinn | $new_topic_id = $db->sql_nextid(); |
| 653 | 686 | psotfx | |
| 654 | 2350 | psotfx | if( !empty($HTTP_POST_VARS['split_type_all']) ) |
| 655 | 654 | thefinn | {
|
| 656 | 2350 | psotfx | $post_id_sql = ''; |
| 657 | 1043 | psotfx | for($i = 0; $i < count($posts); $i++) |
| 658 | 654 | thefinn | {
|
| 659 | 2350 | psotfx | $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $posts[$i]; |
| 660 | 654 | thefinn | } |
| 661 | 1043 | psotfx | |
| 662 | 1043 | psotfx | $sql = "UPDATE " . POSTS_TABLE . " |
| 663 | 1755 | psotfx | SET topic_id = $new_topic_id, forum_id = $new_forum_id |
| 664 | 1043 | psotfx | WHERE post_id IN ($post_id_sql)"; |
| 665 | 654 | thefinn | } |
| 666 | 2350 | psotfx | else if( !empty($HTTP_POST_VARS['split_type_beyond']) ) |
| 667 | 654 | thefinn | {
|
| 668 | 877 | thefinn | $sql = "UPDATE " . POSTS_TABLE . " |
| 669 | 1755 | psotfx | SET topic_id = $new_topic_id, forum_id = $new_forum_id |
| 670 | 1411 | thefinn | WHERE post_time >= $post_time |
| 671 | 686 | psotfx | AND topic_id = $topic_id"; |
| 672 | 654 | thefinn | } |
| 673 | 877 | thefinn | |
| 674 | 2462 | psotfx | if( !$db->sql_query($sql, END_TRANSACTION) ) |
| 675 | 654 | thefinn | {
|
| 676 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql); |
| 677 | 627 | thefinn | } |
| 678 | 686 | psotfx | |
| 679 | 2350 | psotfx | sync('topic', $new_topic_id); |
| 680 | 2350 | psotfx | sync('topic', $topic_id); |
| 681 | 2350 | psotfx | sync('forum', $new_forum_id); |
| 682 | 2350 | psotfx | sync('forum', $forum_id); |
| 683 | 686 | psotfx | |
| 684 | 1307 | psotfx | $template->assign_vars(array( |
| 685 | 2350 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">') |
| 686 | 1307 | psotfx | ); |
| 687 | 1307 | psotfx | |
| 688 | 2350 | psotfx | $message = $lang['Topic_split'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>'); |
| 689 | 1043 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 690 | 619 | thefinn | } |
| 691 | 619 | thefinn | else
|
| 692 | 619 | thefinn | {
|
| 693 | 1043 | psotfx | //
|
| 694 | 1043 | psotfx | // Set template files
|
| 695 | 1043 | psotfx | //
|
| 696 | 1043 | psotfx | $template->set_filenames(array( |
| 697 | 2350 | psotfx | 'split_body' => 'modcp_split.tpl') |
| 698 | 1043 | psotfx | ); |
| 699 | 877 | thefinn | |
| 700 | 1499 | psotfx | $sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username |
| 701 | 686 | psotfx | FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt |
| 702 | 686 | psotfx | WHERE p.topic_id = $topic_id |
| 703 | 686 | psotfx | AND p.poster_id = u.user_id |
| 704 | 686 | psotfx | AND p.post_id = pt.post_id |
| 705 | 686 | psotfx | ORDER BY p.post_time ASC";
|
| 706 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 707 | 627 | thefinn | {
|
| 708 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get topic/post information', '', __LINE__, __FILE__, $sql); |
| 709 | 627 | thefinn | } |
| 710 | 877 | thefinn | |
| 711 | 2129 | psotfx | $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="mode" value="split" />'; |
| 712 | 686 | psotfx | |
| 713 | 686 | psotfx | if( ( $total_posts = $db->sql_numrows($result) ) > 0 ) |
| 714 | 627 | thefinn | {
|
| 715 | 627 | thefinn | $postrow = $db->sql_fetchrowset($result); |
| 716 | 877 | thefinn | |
| 717 | 686 | psotfx | $template->assign_vars(array( |
| 718 | 2350 | psotfx | 'L_SPLIT_TOPIC' => $lang['Split_Topic'], |
| 719 | 2350 | psotfx | 'L_SPLIT_TOPIC_EXPLAIN' => $lang['Split_Topic_explain'], |
| 720 | 2350 | psotfx | 'L_AUTHOR' => $lang['Author'], |
| 721 | 2350 | psotfx | 'L_MESSAGE' => $lang['Message'], |
| 722 | 2350 | psotfx | 'L_SELECT' => $lang['Select'], |
| 723 | 2350 | psotfx | 'L_SPLIT_SUBJECT' => $lang['Split_title'], |
| 724 | 2350 | psotfx | 'L_SPLIT_FORUM' => $lang['Split_forum'], |
| 725 | 2350 | psotfx | 'L_POSTED' => $lang['Posted'], |
| 726 | 2350 | psotfx | 'L_SPLIT_POSTS' => $lang['Split_posts'], |
| 727 | 2350 | psotfx | 'L_SUBMIT' => $lang['Submit'], |
| 728 | 2350 | psotfx | 'L_SPLIT_AFTER' => $lang['Split_after'], |
| 729 | 2350 | psotfx | 'L_POST_SUBJECT' => $lang['Post_subject'], |
| 730 | 2350 | psotfx | 'L_MARK_ALL' => $lang['Mark_all'], |
| 731 | 2350 | psotfx | 'L_UNMARK_ALL' => $lang['Unmark_all'], |
| 732 | 2448 | psotfx | 'L_POST' => $lang['Post'], |
| 733 | 686 | psotfx | |
| 734 | 2350 | psotfx | 'FORUM_NAME' => $forum_name, |
| 735 | 1550 | psotfx | |
| 736 | 2350 | psotfx | 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), |
| 737 | 1550 | psotfx | |
| 738 | 2350 | psotfx | 'S_SPLIT_ACTION' => append_sid("modcp.$phpEx"), |
| 739 | 2350 | psotfx | 'S_HIDDEN_FIELDS' => $s_hidden_fields, |
| 740 | 2350 | psotfx | 'S_FORUM_SELECT' => make_forum_select("new_forum_id")) |
| 741 | 686 | psotfx | ); |
| 742 | 877 | thefinn | |
| 743 | 627 | thefinn | for($i = 0; $i < $total_posts; $i++) |
| 744 | 627 | thefinn | {
|
| 745 | 686 | psotfx | $post_id = $postrow[$i]['post_id']; |
| 746 | 627 | thefinn | $poster_id = $postrow[$i]['user_id']; |
| 747 | 1043 | psotfx | $poster = $postrow[$i]['username']; |
| 748 | 686 | psotfx | |
| 749 | 1010 | bartvb | $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); |
| 750 | 877 | thefinn | |
| 751 | 627 | thefinn | $bbcode_uid = $postrow[$i]['bbcode_uid']; |
| 752 | 1043 | psotfx | $message = $postrow[$i]['post_text']; |
| 753 | 2350 | psotfx | $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : $topic_title; |
| 754 | 877 | thefinn | |
| 755 | 1043 | psotfx | //
|
| 756 | 1043 | psotfx | // If the board has HTML off but the post has HTML
|
| 757 | 1043 | psotfx | // on then we process it, else leave it alone
|
| 758 | 1043 | psotfx | //
|
| 759 | 2350 | psotfx | if ( !$board_config['allow_html'] ) |
| 760 | 627 | thefinn | {
|
| 761 | 2350 | psotfx | if ( $postrow[$i]['enable_html'] ) |
| 762 | 1043 | psotfx | {
|
| 763 | 2350 | psotfx | $message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\2>', $message); |
| 764 | 1043 | psotfx | } |
| 765 | 627 | thefinn | } |
| 766 | 877 | thefinn | |
| 767 | 2350 | psotfx | if ( $bbcode_uid != '' ) |
| 768 | 627 | thefinn | {
|
| 769 | 2350 | psotfx | $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); |
| 770 | 627 | thefinn | } |
| 771 | 877 | thefinn | |
| 772 | 1043 | psotfx | //
|
| 773 | 1043 | psotfx | // Define censored word matches
|
| 774 | 1043 | psotfx | //
|
| 775 | 1043 | psotfx | $orig_word = array(); |
| 776 | 1043 | psotfx | $replacement_word = array(); |
| 777 | 1043 | psotfx | obtain_word_list($orig_word, $replacement_word); |
| 778 | 877 | thefinn | |
| 779 | 2350 | psotfx | if ( count($orig_word) ) |
| 780 | 686 | psotfx | {
|
| 781 | 1043 | psotfx | $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); |
| 782 | 1043 | psotfx | $message = preg_replace($orig_word, $replacement_word, $message); |
| 783 | 686 | psotfx | } |
| 784 | 1043 | psotfx | |
| 785 | 1043 | psotfx | $message = make_clickable($message); |
| 786 | 1043 | psotfx | |
| 787 | 2350 | psotfx | if ( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] ) |
| 788 | 686 | psotfx | {
|
| 789 | 1043 | psotfx | $message = smilies_pass($message); |
| 790 | 686 | psotfx | } |
| 791 | 686 | psotfx | |
| 792 | 2350 | psotfx | $message = str_replace("\n", '<br />', $message); |
| 793 | 1043 | psotfx | |
| 794 | 1043 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 795 | 1043 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 796 | 1043 | psotfx | |
| 797 | 2439 | thefinn | $checkbox = ( $i > 0 ) ? '<input type="checkbox" name="post_id_list[]" value="' . $post_id . '" />' : ' '; |
| 798 | 2319 | thefinn | |
| 799 | 2350 | psotfx | $template->assign_block_vars('postrow', array( |
| 800 | 2350 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 801 | 2350 | psotfx | 'ROW_CLASS' => $row_class, |
| 802 | 2350 | psotfx | 'POSTER_NAME' => $poster, |
| 803 | 2350 | psotfx | 'POST_DATE' => $post_date, |
| 804 | 2350 | psotfx | 'POST_SUBJECT' => $post_subject, |
| 805 | 2350 | psotfx | 'MESSAGE' => $message, |
| 806 | 2448 | psotfx | 'POST_ID' => $post_id, |
| 807 | 2448 | psotfx | |
| 808 | 2448 | psotfx | 'S_SPLIT_CHECKBOX' => $checkbox) |
| 809 | 686 | psotfx | ); |
| 810 | 627 | thefinn | } |
| 811 | 686 | psotfx | |
| 812 | 2350 | psotfx | $template->pparse('split_body'); |
| 813 | 877 | thefinn | } |
| 814 | 619 | thefinn | } |
| 815 | 1043 | psotfx | break;
|
| 816 | 1043 | psotfx | |
| 817 | 976 | thefinn | case 'ip': |
| 818 | 1440 | psotfx | $page_title = $lang['Mod_CP']; |
| 819 | 1440 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 820 | 1440 | psotfx | |
| 821 | 1043 | psotfx | $rdns_ip_num = ( isset($HTTP_GET_VARS['rdns']) ) ? $HTTP_GET_VARS['rdns'] : ""; |
| 822 | 1009 | psotfx | |
| 823 | 2350 | psotfx | if ( !$post_id ) |
| 824 | 1043 | psotfx | {
|
| 825 | 2350 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_such_post']); |
| 826 | 1043 | psotfx | } |
| 827 | 590 | thefinn | |
| 828 | 1043 | psotfx | //
|
| 829 | 1043 | psotfx | // Set template files
|
| 830 | 1043 | psotfx | //
|
| 831 | 1043 | psotfx | $template->set_filenames(array( |
| 832 | 2350 | psotfx | 'viewip' => 'modcp_viewip.tpl') |
| 833 | 1043 | psotfx | ); |
| 834 | 976 | thefinn | |
| 835 | 1043 | psotfx | // Look up relevent data for this post
|
| 836 | 1043 | psotfx | $sql = "SELECT poster_ip, poster_id |
| 837 | 1043 | psotfx | FROM " . POSTS_TABLE . " |
| 838 | 1043 | psotfx | WHERE post_id = $post_id"; |
| 839 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 840 | 1043 | psotfx | {
|
| 841 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get poster IP information', '', __LINE__, __FILE__, $sql); |
| 842 | 1043 | psotfx | } |
| 843 | 1631 | bartvb | |
| 844 | 2350 | psotfx | if ( !($post_row = $db->sql_fetchrow($result)) ) |
| 845 | 1631 | bartvb | {
|
| 846 | 2350 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_such_post']); |
| 847 | 1631 | bartvb | } |
| 848 | 1009 | psotfx | |
| 849 | 1043 | psotfx | $ip_this_post = decode_ip($post_row['poster_ip']); |
| 850 | 1043 | psotfx | $ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? gethostbyaddr($ip_this_post) : $ip_this_post; |
| 851 | 976 | thefinn | |
| 852 | 1043 | psotfx | $poster_id = $post_row['poster_id']; |
| 853 | 1008 | thefinn | |
| 854 | 1043 | psotfx | $template->assign_vars(array( |
| 855 | 2350 | psotfx | 'L_IP_INFO' => $lang['IP_info'], |
| 856 | 2350 | psotfx | 'L_THIS_POST_IP' => $lang['This_posts_IP'], |
| 857 | 2350 | psotfx | 'L_OTHER_IPS' => $lang['Other_IP_this_user'], |
| 858 | 2350 | psotfx | 'L_OTHER_USERS' => $lang['Users_this_IP'], |
| 859 | 2350 | psotfx | 'L_LOOKUP_IP' => $lang['Lookup_IP'], |
| 860 | 2350 | psotfx | 'L_SEARCH' => $lang['Search'], |
| 861 | 1009 | psotfx | |
| 862 | 2350 | psotfx | 'SEARCH_IMG' => $images['icon_search'], |
| 863 | 1009 | psotfx | |
| 864 | 2350 | psotfx | 'IP' => $ip_this_post, |
| 865 | 1043 | psotfx | |
| 866 | 2350 | psotfx | 'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $ip_this_post)) |
| 867 | 1043 | psotfx | ); |
| 868 | 1008 | thefinn | |
| 869 | 1043 | psotfx | //
|
| 870 | 1043 | psotfx | // Get other IP's this user has posted under
|
| 871 | 1043 | psotfx | //
|
| 872 | 2350 | psotfx | $sql = "SELECT poster_ip, COUNT(*) AS postings |
| 873 | 1043 | psotfx | FROM " . POSTS_TABLE . " |
| 874 | 1043 | psotfx | WHERE poster_id = $poster_id |
| 875 | 2350 | psotfx | GROUP BY poster_ip |
| 876 | 2564 | psotfx | ORDER BY " . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC"; |
| 877 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 878 | 1043 | psotfx | {
|
| 879 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get IP information for this user', '', __LINE__, __FILE__, $sql); |
| 880 | 1043 | psotfx | } |
| 881 | 1009 | psotfx | |
| 882 | 2448 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 883 | 1043 | psotfx | {
|
| 884 | 2448 | psotfx | $i = 0; |
| 885 | 2448 | psotfx | do
|
| 886 | 2239 | bartvb | {
|
| 887 | 2448 | psotfx | if ( $row['poster_ip'] == $post_row['poster_ip'] ) |
| 888 | 2448 | psotfx | {
|
| 889 | 2448 | psotfx | $template->assign_vars(array( |
| 890 | 2448 | psotfx | 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] )) |
| 891 | 2448 | psotfx | ); |
| 892 | 2448 | psotfx | continue;
|
| 893 | 2448 | psotfx | } |
| 894 | 1009 | psotfx | |
| 895 | 2448 | psotfx | $ip = decode_ip($row['poster_ip']); |
| 896 | 2448 | psotfx | $ip = ( $rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; |
| 897 | 1009 | psotfx | |
| 898 | 2448 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 899 | 2448 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 900 | 1008 | thefinn | |
| 901 | 2448 | psotfx | $template->assign_block_vars('iprow', array( |
| 902 | 2448 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 903 | 2448 | psotfx | 'ROW_CLASS' => $row_class, |
| 904 | 2448 | psotfx | 'IP' => $ip, |
| 905 | 2448 | psotfx | 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ), |
| 906 | 2448 | psotfx | |
| 907 | 2448 | psotfx | 'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $row['poster_ip'])) |
| 908 | 2448 | psotfx | ); |
| 909 | 2448 | psotfx | |
| 910 | 2448 | psotfx | $i++;
|
| 911 | 2448 | psotfx | } |
| 912 | 2448 | psotfx | while ( $row = $db->sql_fetchrow($result) ); |
| 913 | 1043 | psotfx | } |
| 914 | 976 | thefinn | |
| 915 | 1043 | psotfx | //
|
| 916 | 1043 | psotfx | // Get other users who've posted under this IP
|
| 917 | 1043 | psotfx | //
|
| 918 | 2448 | psotfx | $sql = "SELECT u.user_id, u.username, COUNT(*) as postings |
| 919 | 1043 | psotfx | FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p |
| 920 | 1043 | psotfx | WHERE p.poster_id = u.user_id |
| 921 | 2239 | bartvb | AND p.poster_ip = '" . $post_row['poster_ip'] . "' |
| 922 | 2239 | bartvb | GROUP BY u.user_id, u.username |
| 923 | 2564 | psotfx | ORDER BY " . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC"; |
| 924 | 2350 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 925 | 1043 | psotfx | {
|
| 926 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not get posters information based on IP', '', __LINE__, __FILE__, $sql); |
| 927 | 1043 | psotfx | } |
| 928 | 976 | thefinn | |
| 929 | 2448 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 930 | 1043 | psotfx | {
|
| 931 | 2448 | psotfx | $i = 0; |
| 932 | 2448 | psotfx | do
|
| 933 | 2448 | psotfx | {
|
| 934 | 2448 | psotfx | $id = $row['user_id']; |
| 935 | 2448 | psotfx | $username = ( $id == ANONYMOUS ) ? $lang['Guest'] : $row['username']; |
| 936 | 1008 | thefinn | |
| 937 | 2448 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 938 | 2448 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 939 | 1009 | psotfx | |
| 940 | 2448 | psotfx | $template->assign_block_vars('userrow', array( |
| 941 | 2448 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 942 | 2448 | psotfx | 'ROW_CLASS' => $row_class, |
| 943 | 2448 | psotfx | 'USERNAME' => $username, |
| 944 | 2448 | psotfx | 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ), |
| 945 | 2448 | psotfx | 'L_SEARCH_POSTS' => sprintf($lang['Search_user_posts'], $username), |
| 946 | 976 | thefinn | |
| 947 | 2448 | psotfx | 'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$id"), |
| 948 | 2448 | psotfx | 'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . urlencode($username) . "&showresults=topics")) |
| 949 | 2448 | psotfx | ); |
| 950 | 2448 | psotfx | |
| 951 | 2448 | psotfx | $i++;
|
| 952 | 2448 | psotfx | } |
| 953 | 2448 | psotfx | while ( $row = $db->sql_fetchrow($result) ); |
| 954 | 1043 | psotfx | } |
| 955 | 976 | thefinn | |
| 956 | 2448 | psotfx | $template->pparse('viewip'); |
| 957 | 1043 | psotfx | |
| 958 | 1043 | psotfx | break;
|
| 959 | 1043 | psotfx | |
| 960 | 561 | uid29890 | default:
|
| 961 | 1439 | psotfx | $page_title = $lang['Mod_CP']; |
| 962 | 1439 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 963 | 1439 | psotfx | |
| 964 | 686 | psotfx | $template->assign_vars(array( |
| 965 | 2350 | psotfx | 'FORUM_NAME' => $forum_name, |
| 966 | 1439 | psotfx | |
| 967 | 2350 | psotfx | 'L_MOD_CP' => $lang['Mod_CP'], |
| 968 | 2350 | psotfx | 'L_MOD_CP_EXPLAIN' => $lang['Mod_CP_explain'], |
| 969 | 2350 | psotfx | 'L_SELECT' => $lang['Select'], |
| 970 | 2350 | psotfx | 'L_DELETE' => $lang['Delete'], |
| 971 | 2350 | psotfx | 'L_MOVE' => $lang['Move'], |
| 972 | 2350 | psotfx | 'L_LOCK' => $lang['Lock'], |
| 973 | 2350 | psotfx | 'L_UNLOCK' => $lang['Unlock'], |
| 974 | 2448 | psotfx | 'L_TOPICS' => $lang['Topics'], |
| 975 | 2448 | psotfx | 'L_REPLIES' => $lang['Replies'], |
| 976 | 2448 | psotfx | 'L_LASTPOST' => $lang['Last_Post'], |
| 977 | 2448 | psotfx | 'L_SELECT' => $lang['Select'], |
| 978 | 1439 | psotfx | |
| 979 | 2350 | psotfx | 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), |
| 980 | 2350 | psotfx | 'S_HIDDEN_FIELDS' => '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">', |
| 981 | 2350 | psotfx | 'S_MODCP_ACTION' => append_sid("modcp.$phpEx")) |
| 982 | 686 | psotfx | ); |
| 983 | 686 | psotfx | |
| 984 | 1043 | psotfx | $template->set_filenames(array( |
| 985 | 2350 | psotfx | 'body' => 'modcp_body.tpl') |
| 986 | 1043 | psotfx | ); |
| 987 | 1043 | psotfx | |
| 988 | 1043 | psotfx | //
|
| 989 | 1043 | psotfx | // Define censored word matches
|
| 990 | 1043 | psotfx | //
|
| 991 | 1043 | psotfx | $orig_word = array(); |
| 992 | 1043 | psotfx | $replacement_word = array(); |
| 993 | 1043 | psotfx | obtain_word_list($orig_word, $replacement_word); |
| 994 | 1043 | psotfx | |
| 995 | 2104 | psotfx | $sql = "SELECT t.*, u.username, u.user_id, p.post_time |
| 996 | 2104 | psotfx | FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p |
| 997 | 2104 | psotfx | WHERE t.forum_id = $forum_id |
| 998 | 2104 | psotfx | AND t.topic_poster = u.user_id |
| 999 | 2104 | psotfx | AND p.post_id = t.topic_last_post_id |
| 1000 | 2104 | psotfx | ORDER BY t.topic_type DESC, p.post_time DESC |
| 1001 | 2104 | psotfx | LIMIT $start, " . $board_config['topics_per_page']; |
| 1002 | 2104 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 1003 | 877 | thefinn | {
|
| 1004 | 2350 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql); |
| 1005 | 2104 | psotfx | } |
| 1006 | 2104 | psotfx | |
| 1007 | 2104 | psotfx | while ( $row = $db->sql_fetchrow($result) ) |
| 1008 | 2104 | psotfx | {
|
| 1009 | 2350 | psotfx | $topic_title = ''; |
| 1010 | 1043 | psotfx | |
| 1011 | 2104 | psotfx | if ( $row['topic_status'] == TOPIC_LOCKED ) |
| 1012 | 877 | thefinn | {
|
| 1013 | 2104 | psotfx | $folder_img = $images['folder_locked']; |
| 1014 | 2104 | psotfx | $folder_alt = $lang['Topic_locked']; |
| 1015 | 590 | thefinn | } |
| 1016 | 590 | thefinn | else
|
| 1017 | 590 | thefinn | {
|
| 1018 | 2104 | psotfx | if ( $row['topic_type'] == POST_ANNOUNCE ) |
| 1019 | 1259 | thefinn | {
|
| 1020 | 2104 | psotfx | $folder_img = $images['folder_announce']; |
| 1021 | 2564 | psotfx | $folder_alt = $lang['Topic_Announcement']; |
| 1022 | 1259 | thefinn | } |
| 1023 | 2104 | psotfx | else if ( $row['topic_type'] == POST_STICKY ) |
| 1024 | 1259 | thefinn | {
|
| 1025 | 2104 | psotfx | $folder_img = $images['folder_sticky']; |
| 1026 | 2564 | psotfx | $folder_alt = $lang['Topic_Sticky']; |
| 1027 | 1259 | thefinn | } |
| 1028 | 1259 | thefinn | else
|
| 1029 | 1259 | thefinn | {
|
| 1030 | 2104 | psotfx | $folder_img = $images['folder']; |
| 1031 | 2104 | psotfx | $folder_alt = $lang['No_new_posts']; |
| 1032 | 1259 | thefinn | } |
| 1033 | 590 | thefinn | } |
| 1034 | 877 | thefinn | |
| 1035 | 2104 | psotfx | $topic_id = $row['topic_id']; |
| 1036 | 2104 | psotfx | $topic_type = $row['topic_type']; |
| 1037 | 2104 | psotfx | $topic_status = $row['topic_status']; |
| 1038 | 1259 | thefinn | |
| 1039 | 2104 | psotfx | if ( $topic_type == POST_ANNOUNCE ) |
| 1040 | 590 | thefinn | {
|
| 1041 | 2350 | psotfx | $topic_type = $lang['Topic_Announcement'] . ' '; |
| 1042 | 590 | thefinn | } |
| 1043 | 2104 | psotfx | else if ( $topic_type == POST_STICKY ) |
| 1044 | 590 | thefinn | {
|
| 1045 | 2350 | psotfx | $topic_type = $lang['Topic_Sticky'] . ' '; |
| 1046 | 590 | thefinn | } |
| 1047 | 2104 | psotfx | else if ( $topic_status == TOPIC_MOVED ) |
| 1048 | 1314 | bartvb | {
|
| 1049 | 2350 | psotfx | $topic_type = $lang['Topic_Moved'] . ' '; |
| 1050 | 1314 | bartvb | } |
| 1051 | 1043 | psotfx | else
|
| 1052 | 1043 | psotfx | {
|
| 1053 | 2350 | psotfx | $topic_type = ''; |
| 1054 | 1043 | psotfx | } |
| 1055 | 1259 | thefinn | |
| 1056 | 2104 | psotfx | if ( $row['topic_vote'] ) |
| 1057 | 1043 | psotfx | {
|
| 1058 | 2350 | psotfx | $topic_type .= $lang['Topic_Poll'] . ' '; |
| 1059 | 1043 | psotfx | } |
| 1060 | 1259 | thefinn | |
| 1061 | 2104 | psotfx | $topic_title = $row['topic_title']; |
| 1062 | 2104 | psotfx | if ( count($orig_word) ) |
| 1063 | 1043 | psotfx | {
|
| 1064 | 1043 | psotfx | $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); |
| 1065 | 1043 | psotfx | } |
| 1066 | 561 | uid29890 | |
| 1067 | 1043 | psotfx | $u_view_topic = append_sid("modcp.$phpEx?mode=split&" . POST_TOPIC_URL . "=$topic_id"); |
| 1068 | 2104 | psotfx | $topic_replies = $row['topic_replies']; |
| 1069 | 877 | thefinn | |
| 1070 | 2104 | psotfx | $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']); |
| 1071 | 1043 | psotfx | |
| 1072 | 2350 | psotfx | $template->assign_block_vars('topicrow', array( |
| 1073 | 2350 | psotfx | 'U_VIEW_TOPIC' => $u_view_topic, |
| 1074 | 686 | psotfx | |
| 1075 | 2448 | psotfx | 'TOPIC_FOLDER_IMG' => $folder_img, |
| 1076 | 2350 | psotfx | 'TOPIC_TYPE' => $topic_type, |
| 1077 | 2350 | psotfx | 'TOPIC_TITLE' => $topic_title, |
| 1078 | 2350 | psotfx | 'REPLIES' => $topic_replies, |
| 1079 | 2448 | psotfx | 'LAST_POST_TIME' => $last_post_time, |
| 1080 | 2448 | psotfx | 'TOPIC_ID' => $topic_id, |
| 1081 | 2448 | psotfx | |
| 1082 | 2448 | psotfx | 'L_TOPIC_FOLDER_ALT' => $folder_alt) |
| 1083 | 686 | psotfx | ); |
| 1084 | 561 | uid29890 | } |
| 1085 | 877 | thefinn | |
| 1086 | 686 | psotfx | $template->assign_vars(array( |
| 1087 | 2350 | psotfx | 'PAGINATION' => generate_pagination("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id", $forum_topics, $board_config['topics_per_page'], $start), |
| 1088 | 2350 | psotfx | 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )), |
| 1089 | 2350 | psotfx | 'L_GOTO_PAGE' => $lang['Goto_page']) |
| 1090 | 646 | psotfx | ); |
| 1091 | 646 | psotfx | |
| 1092 | 2350 | psotfx | $template->pparse('body'); |
| 1093 | 646 | psotfx | |
| 1094 | 646 | psotfx | break;
|
| 1095 | 561 | uid29890 | } |
| 1096 | 561 | uid29890 | |
| 1097 | 646 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 1098 | 877 | thefinn | |
| 1099 | 2350 | psotfx | ?> |

