root / branches / phpBB-3_0_0 / phpBB / includes / acp / acp_forums.php
History | View | Annotate | Download (61.2 kB)
| 1 | 5330 | acydburn | <?php
|
|---|---|---|---|
| 2 | 7736 | acydburn | /**
|
| 3 | 5330 | acydburn | * |
| 4 | 5330 | acydburn | * @package acp |
| 5 | 5330 | acydburn | * @version $Id$ |
| 6 | 7736 | acydburn | * @copyright (c) 2005 phpBB Group |
| 7 | 7736 | acydburn | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | 5330 | acydburn | * |
| 9 | 5330 | acydburn | */ |
| 10 | 5330 | acydburn | |
| 11 | 5330 | acydburn | /**
|
| 12 | 8147 | acydburn | * @ignore |
| 13 | 8147 | acydburn | */ |
| 14 | 8147 | acydburn | if (!defined('IN_PHPBB')) |
| 15 | 8147 | acydburn | {
|
| 16 | 8147 | acydburn | exit;
|
| 17 | 8147 | acydburn | } |
| 18 | 8147 | acydburn | |
| 19 | 8147 | acydburn | /**
|
| 20 | 5330 | acydburn | * @package acp |
| 21 | 5330 | acydburn | */ |
| 22 | 5330 | acydburn | class acp_forums |
| 23 | 5330 | acydburn | {
|
| 24 | 5558 | acydburn | var $u_action; |
| 25 | 5330 | acydburn | var $parent_id = 0; |
| 26 | 6015 | acydburn | |
| 27 | 5330 | acydburn | function main($id, $mode) |
| 28 | 5330 | acydburn | {
|
| 29 | 5643 | acydburn | global $db, $user, $auth, $template, $cache; |
| 30 | 6015 | acydburn | global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; |
| 31 | 5330 | acydburn | |
| 32 | 5330 | acydburn | $user->add_lang('acp/forums'); |
| 33 | 5330 | acydburn | $this->tpl_name = 'acp_forums'; |
| 34 | 5330 | acydburn | $this->page_title = 'ACP_MANAGE_FORUMS'; |
| 35 | 5330 | acydburn | |
| 36 | 8120 | kellanved | $form_key = 'acp_forums'; |
| 37 | 8120 | kellanved | add_form_key($form_key);
|
| 38 | 8120 | kellanved | |
| 39 | 5330 | acydburn | $action = request_var('action', ''); |
| 40 | 5330 | acydburn | $update = (isset($_POST['update'])) ? true : false; |
| 41 | 5330 | acydburn | $forum_id = request_var('f', 0); |
| 42 | 5330 | acydburn | |
| 43 | 5330 | acydburn | $this->parent_id = request_var('parent_id', 0); |
| 44 | 5330 | acydburn | $forum_data = $errors = array(); |
| 45 | 8120 | kellanved | if ($update && !check_form_key($form_key)) |
| 46 | 8120 | kellanved | {
|
| 47 | 8120 | kellanved | $update = false; |
| 48 | 8197 | kellanved | $errors[] = $user->lang['FORM_INVALID']; |
| 49 | 8120 | kellanved | } |
| 50 | 8120 | kellanved | |
| 51 | 5330 | acydburn | // Check additional permissions
|
| 52 | 5330 | acydburn | switch ($action) |
| 53 | 5330 | acydburn | {
|
| 54 | 6419 | acydburn | case 'progress_bar': |
| 55 | 6419 | acydburn | $start = request_var('start', 0); |
| 56 | 6419 | acydburn | $total = request_var('total', 0); |
| 57 | 6419 | acydburn | |
| 58 | 6419 | acydburn | $this->display_progress_bar($start, $total); |
| 59 | 8655 | acydburn | exit;
|
| 60 | 6419 | acydburn | break;
|
| 61 | 6419 | acydburn | |
| 62 | 5330 | acydburn | case 'delete': |
| 63 | 5330 | acydburn | |
| 64 | 5330 | acydburn | if (!$auth->acl_get('a_forumdel')) |
| 65 | 5330 | acydburn | {
|
| 66 | 6320 | acydburn | trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 67 | 5330 | acydburn | } |
| 68 | 5330 | acydburn | |
| 69 | 5330 | acydburn | break;
|
| 70 | 5330 | acydburn | |
| 71 | 5330 | acydburn | case 'add': |
| 72 | 5330 | acydburn | |
| 73 | 5330 | acydburn | if (!$auth->acl_get('a_forumadd')) |
| 74 | 5330 | acydburn | {
|
| 75 | 6320 | acydburn | trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 76 | 5330 | acydburn | } |
| 77 | 9978 | bantu | |
| 78 | 5330 | acydburn | break;
|
| 79 | 5330 | acydburn | } |
| 80 | 5330 | acydburn | |
| 81 | 5330 | acydburn | // Major routines
|
| 82 | 5330 | acydburn | if ($update) |
| 83 | 5330 | acydburn | {
|
| 84 | 5330 | acydburn | switch ($action) |
| 85 | 5330 | acydburn | {
|
| 86 | 5330 | acydburn | case 'delete': |
| 87 | 5330 | acydburn | $action_subforums = request_var('action_subforums', ''); |
| 88 | 5330 | acydburn | $subforums_to_id = request_var('subforums_to_id', 0); |
| 89 | 5330 | acydburn | $action_posts = request_var('action_posts', ''); |
| 90 | 5330 | acydburn | $posts_to_id = request_var('posts_to_id', 0); |
| 91 | 5330 | acydburn | |
| 92 | 5330 | acydburn | $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); |
| 93 | 5330 | acydburn | |
| 94 | 5330 | acydburn | if (sizeof($errors)) |
| 95 | 5330 | acydburn | {
|
| 96 | 5330 | acydburn | break;
|
| 97 | 5330 | acydburn | } |
| 98 | 5330 | acydburn | |
| 99 | 5330 | acydburn | $auth->acl_clear_prefetch();
|
| 100 | 5633 | acydburn | $cache->destroy('sql', FORUMS_TABLE); |
| 101 | 5633 | acydburn | |
| 102 | 5330 | acydburn | trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
| 103 | 8655 | acydburn | |
| 104 | 5330 | acydburn | break;
|
| 105 | 5330 | acydburn | |
| 106 | 5330 | acydburn | case 'edit': |
| 107 | 5330 | acydburn | $forum_data = array( |
| 108 | 5330 | acydburn | 'forum_id' => $forum_id |
| 109 | 5330 | acydburn | ); |
| 110 | 5330 | acydburn | |
| 111 | 5995 | acydburn | // No break here
|
| 112 | 5330 | acydburn | |
| 113 | 5330 | acydburn | case 'add': |
| 114 | 5330 | acydburn | |
| 115 | 5330 | acydburn | $forum_data += array( |
| 116 | 5603 | acydburn | 'parent_id' => request_var('forum_parent_id', $this->parent_id), |
| 117 | 5330 | acydburn | 'forum_type' => request_var('forum_type', FORUM_POST), |
| 118 | 5330 | acydburn | 'type_action' => request_var('type_action', ''), |
| 119 | 5330 | acydburn | 'forum_status' => request_var('forum_status', ITEM_UNLOCKED), |
| 120 | 6524 | davidmj | 'forum_parents' => '', |
| 121 | 7920 | acydburn | 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), |
| 122 | 5330 | acydburn | 'forum_link' => request_var('forum_link', ''), |
| 123 | 5330 | acydburn | 'forum_link_track' => request_var('forum_link_track', false), |
| 124 | 7920 | acydburn | 'forum_desc' => utf8_normalize_nfc(request_var('forum_desc', '', true)), |
| 125 | 5709 | acydburn | 'forum_desc_uid' => '', |
| 126 | 6383 | acydburn | 'forum_desc_options' => 7, |
| 127 | 6239 | davidmj | 'forum_desc_bitfield' => '', |
| 128 | 7920 | acydburn | 'forum_rules' => utf8_normalize_nfc(request_var('forum_rules', '', true)), |
| 129 | 5709 | acydburn | 'forum_rules_uid' => '', |
| 130 | 6383 | acydburn | 'forum_rules_options' => 7, |
| 131 | 6209 | davidmj | 'forum_rules_bitfield' => '', |
| 132 | 5330 | acydburn | 'forum_rules_link' => request_var('forum_rules_link', ''), |
| 133 | 5330 | acydburn | 'forum_image' => request_var('forum_image', ''), |
| 134 | 5330 | acydburn | 'forum_style' => request_var('forum_style', 0), |
| 135 | 8374 | naderman | 'display_subforum_list' => request_var('display_subforum_list', false), |
| 136 | 5330 | acydburn | 'display_on_index' => request_var('display_on_index', false), |
| 137 | 8147 | acydburn | 'forum_topics_per_page' => request_var('topics_per_page', 0), |
| 138 | 8147 | acydburn | 'enable_indexing' => request_var('enable_indexing', true), |
| 139 | 5330 | acydburn | 'enable_icons' => request_var('enable_icons', false), |
| 140 | 5330 | acydburn | 'enable_prune' => request_var('enable_prune', false), |
| 141 | 6161 | acydburn | 'enable_post_review' => request_var('enable_post_review', true), |
| 142 | 9656 | acydburn | 'enable_quick_reply' => request_var('enable_quick_reply', false), |
| 143 | 5330 | acydburn | 'prune_days' => request_var('prune_days', 7), |
| 144 | 5330 | acydburn | 'prune_viewed' => request_var('prune_viewed', 7), |
| 145 | 5330 | acydburn | 'prune_freq' => request_var('prune_freq', 1), |
| 146 | 5330 | acydburn | 'prune_old_polls' => request_var('prune_old_polls', false), |
| 147 | 5330 | acydburn | 'prune_announce' => request_var('prune_announce', false), |
| 148 | 5330 | acydburn | 'prune_sticky' => request_var('prune_sticky', false), |
| 149 | 7581 | acydburn | 'forum_password' => request_var('forum_password', '', true), |
| 150 | 7581 | acydburn | 'forum_password_confirm'=> request_var('forum_password_confirm', '', true), |
| 151 | 8143 | kellanved | 'forum_password_unset' => request_var('forum_password_unset', false), |
| 152 | 5330 | acydburn | ); |
| 153 | 5330 | acydburn | |
| 154 | 10233 | acydburn | // On add, add empty forum_options... else do not consider it (not updating it)
|
| 155 | 10233 | acydburn | if ($action == 'add') |
| 156 | 10233 | acydburn | {
|
| 157 | 10233 | acydburn | $forum_data['forum_options'] = 0; |
| 158 | 10233 | acydburn | } |
| 159 | 10233 | acydburn | |
| 160 | 6829 | acydburn | // Use link_display_on_index setting if forum type is link
|
| 161 | 6829 | acydburn | if ($forum_data['forum_type'] == FORUM_LINK) |
| 162 | 6829 | acydburn | {
|
| 163 | 6829 | acydburn | $forum_data['display_on_index'] = request_var('link_display_on_index', false); |
| 164 | 8898 | acydburn | } |
| 165 | 7652 | acydburn | |
| 166 | 8898 | acydburn | // Linked forums and categories are not able to be locked...
|
| 167 | 8898 | acydburn | if ($forum_data['forum_type'] == FORUM_LINK || $forum_data['forum_type'] == FORUM_CAT) |
| 168 | 8898 | acydburn | {
|
| 169 | 7652 | acydburn | $forum_data['forum_status'] = ITEM_UNLOCKED; |
| 170 | 6829 | acydburn | } |
| 171 | 6829 | acydburn | |
| 172 | 10658 | git-gate | $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', true) : request_var('display_active', false); |
| 173 | 5330 | acydburn | |
| 174 | 5709 | acydburn | // Get data for forum rules if specified...
|
| 175 | 5330 | acydburn | if ($forum_data['forum_rules']) |
| 176 | 5330 | acydburn | {
|
| 177 | 6188 | davidmj | generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_parse_bbcode', false), request_var('rules_parse_urls', false), request_var('rules_parse_smilies', false)); |
| 178 | 5709 | acydburn | } |
| 179 | 5330 | acydburn | |
| 180 | 5709 | acydburn | // Get data for forum description if specified
|
| 181 | 5709 | acydburn | if ($forum_data['forum_desc']) |
| 182 | 5709 | acydburn | {
|
| 183 | 6188 | davidmj | generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_parse_bbcode', false), request_var('desc_parse_urls', false), request_var('desc_parse_smilies', false)); |
| 184 | 5330 | acydburn | } |
| 185 | 5330 | acydburn | |
| 186 | 5330 | acydburn | $errors = $this->update_forum_data($forum_data); |
| 187 | 6015 | acydburn | |
| 188 | 5330 | acydburn | if (!sizeof($errors)) |
| 189 | 5330 | acydburn | {
|
| 190 | 5574 | acydburn | $forum_perm_from = request_var('forum_perm_from', 0); |
| 191 | 9977 | nickvergessen | $cache->destroy('sql', FORUMS_TABLE); |
| 192 | 5574 | acydburn | |
| 193 | 10667 | git-gate | $copied_permissions = false; |
| 194 | 5574 | acydburn | // Copy permissions?
|
| 195 | 10198 | acydburn | if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && |
| 196 | 10198 | acydburn | ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) |
| 197 | 5574 | acydburn | {
|
| 198 | 9887 | bantu | copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); |
| 199 | 8253 | kellanved | cache_moderators(); |
| 200 | 10667 | git-gate | $copied_permissions = true; |
| 201 | 5574 | acydburn | } |
| 202 | 10198 | acydburn | /* Commented out because of questionable UI workflow - re-visit for 3.0.7
|
| 203 | 10198 | acydburn | else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))
|
| 204 | 9896 | Kellanved | {
|
| 205 | 9896 | Kellanved | $this->copy_permission_page($forum_data); |
| 206 | 9896 | Kellanved | return; |
| 207 | 9896 | Kellanved | } |
| 208 | 10198 | acydburn | */ |
| 209 | 5330 | acydburn | $auth->acl_clear_prefetch();
|
| 210 | 8655 | acydburn | |
| 211 | 6905 | acydburn | $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; |
| 212 | 5553 | acydburn | |
| 213 | 5330 | acydburn | $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; |
| 214 | 5330 | acydburn | |
| 215 | 6048 | acydburn | // redirect directly to permission settings screen if authed
|
| 216 | 10667 | git-gate | if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth')) |
| 217 | 6048 | acydburn | {
|
| 218 | 11525 | git-gate | $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>'); |
| 219 | 11525 | git-gate | |
| 220 | 6015 | acydburn | meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); |
| 221 | 5709 | acydburn | } |
| 222 | 5709 | acydburn | |
| 223 | 5330 | acydburn | trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
| 224 | 5330 | acydburn | } |
| 225 | 5330 | acydburn | |
| 226 | 5330 | acydburn | break;
|
| 227 | 5330 | acydburn | } |
| 228 | 5330 | acydburn | } |
| 229 | 5330 | acydburn | |
| 230 | 5330 | acydburn | switch ($action) |
| 231 | 5330 | acydburn | {
|
| 232 | 5330 | acydburn | case 'move_up': |
| 233 | 5330 | acydburn | case 'move_down': |
| 234 | 6015 | acydburn | |
| 235 | 5330 | acydburn | if (!$forum_id) |
| 236 | 5330 | acydburn | {
|
| 237 | 6320 | acydburn | trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 238 | 5330 | acydburn | } |
| 239 | 6015 | acydburn | |
| 240 | 6073 | acydburn | $sql = 'SELECT * |
| 241 | 5330 | acydburn | FROM ' . FORUMS_TABLE . " |
| 242 | 5330 | acydburn | WHERE forum_id = $forum_id"; |
| 243 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 244 | 5330 | acydburn | $row = $db->sql_fetchrow($result); |
| 245 | 5330 | acydburn | $db->sql_freeresult($result); |
| 246 | 5330 | acydburn | |
| 247 | 5330 | acydburn | if (!$row) |
| 248 | 5330 | acydburn | {
|
| 249 | 6320 | acydburn | trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 250 | 5330 | acydburn | } |
| 251 | 5330 | acydburn | |
| 252 | 6073 | acydburn | $move_forum_name = $this->move_forum_by($row, $action, 1); |
| 253 | 5330 | acydburn | |
| 254 | 6073 | acydburn | if ($move_forum_name !== false) |
| 255 | 5330 | acydburn | {
|
| 256 | 6073 | acydburn | add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name); |
| 257 | 6073 | acydburn | $cache->destroy('sql', FORUMS_TABLE); |
| 258 | 5330 | acydburn | } |
| 259 | 5330 | acydburn | |
| 260 | 5330 | acydburn | break;
|
| 261 | 5330 | acydburn | |
| 262 | 5330 | acydburn | case 'sync': |
| 263 | 5330 | acydburn | if (!$forum_id) |
| 264 | 5330 | acydburn | {
|
| 265 | 6320 | acydburn | trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 266 | 5330 | acydburn | } |
| 267 | 5330 | acydburn | |
| 268 | 7517 | acydburn | @set_time_limit(0); |
| 269 | 7517 | acydburn | |
| 270 | 7517 | acydburn | $sql = 'SELECT forum_name, forum_topics_real |
| 271 | 5330 | acydburn | FROM ' . FORUMS_TABLE . " |
| 272 | 5330 | acydburn | WHERE forum_id = $forum_id"; |
| 273 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 274 | 5330 | acydburn | $row = $db->sql_fetchrow($result); |
| 275 | 5330 | acydburn | $db->sql_freeresult($result); |
| 276 | 5330 | acydburn | |
| 277 | 5330 | acydburn | if (!$row) |
| 278 | 5330 | acydburn | {
|
| 279 | 6320 | acydburn | trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 280 | 5330 | acydburn | } |
| 281 | 5330 | acydburn | |
| 282 | 6419 | acydburn | if ($row['forum_topics_real']) |
| 283 | 6419 | acydburn | {
|
| 284 | 7188 | acydburn | $sql = 'SELECT MIN(topic_id) as min_topic_id, MAX(topic_id) as max_topic_id |
| 285 | 7188 | acydburn | FROM ' . TOPICS_TABLE . ' |
| 286 | 7188 | acydburn | WHERE forum_id = ' . $forum_id; |
| 287 | 7188 | acydburn | $result = $db->sql_query($sql); |
| 288 | 7188 | acydburn | $row2 = $db->sql_fetchrow($result); |
| 289 | 7188 | acydburn | $db->sql_freeresult($result); |
| 290 | 6419 | acydburn | |
| 291 | 7517 | acydburn | // Typecast to int if there is no data available
|
| 292 | 7517 | acydburn | $row2['min_topic_id'] = (int) $row2['min_topic_id']; |
| 293 | 7517 | acydburn | $row2['max_topic_id'] = (int) $row2['max_topic_id']; |
| 294 | 7517 | acydburn | |
| 295 | 7188 | acydburn | $start = request_var('start', $row2['min_topic_id']); |
| 296 | 7188 | acydburn | |
| 297 | 7456 | acydburn | $batch_size = 2000; |
| 298 | 6419 | acydburn | $end = $start + $batch_size; |
| 299 | 6419 | acydburn | |
| 300 | 6419 | acydburn | // Sync all topics in batch mode...
|
| 301 | 6419 | acydburn | sync('topic_approved', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, false); |
| 302 | 6419 | acydburn | sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true); |
| 303 | 6419 | acydburn | |
| 304 | 7188 | acydburn | if ($end < $row2['max_topic_id']) |
| 305 | 6419 | acydburn | {
|
| 306 | 7188 | acydburn | // We really need to find a way of showing statistics... no progress here
|
| 307 | 7188 | acydburn | $sql = 'SELECT COUNT(topic_id) as num_topics |
| 308 | 7188 | acydburn | FROM ' . TOPICS_TABLE . ' |
| 309 | 7188 | acydburn | WHERE forum_id = ' . $forum_id . ' |
| 310 | 7188 | acydburn | AND topic_id BETWEEN ' . $start . ' AND ' . $end; |
| 311 | 7188 | acydburn | $result = $db->sql_query($sql); |
| 312 | 7188 | acydburn | $topics_done = request_var('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); |
| 313 | 7188 | acydburn | $db->sql_freeresult($result); |
| 314 | 7188 | acydburn | |
| 315 | 6419 | acydburn | $start += $batch_size; |
| 316 | 6419 | acydburn | |
| 317 | 7517 | acydburn | $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync&start=$start&topics_done=$topics_done&total={$row['forum_topics_real']}"; |
| 318 | 6419 | acydburn | |
| 319 | 6419 | acydburn | meta_refresh(0, $url); |
| 320 | 6419 | acydburn | |
| 321 | 6419 | acydburn | $template->assign_vars(array( |
| 322 | 7456 | acydburn | 'U_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$topics_done&total={$row['forum_topics_real']}", |
| 323 | 8099 | acydburn | 'UA_PROGRESS_BAR' => addslashes($this->u_action . "&action=progress_bar&start=$topics_done&total={$row['forum_topics_real']}"), |
| 324 | 6419 | acydburn | 'S_CONTINUE_SYNC' => true, |
| 325 | 7188 | acydburn | 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['forum_topics_real'])) |
| 326 | 6419 | acydburn | ); |
| 327 | 6419 | acydburn | |
| 328 | 6419 | acydburn | return;
|
| 329 | 6419 | acydburn | } |
| 330 | 6419 | acydburn | } |
| 331 | 6419 | acydburn | |
| 332 | 7517 | acydburn | $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync_forum"; |
| 333 | 7517 | acydburn | meta_refresh(0, $url); |
| 334 | 7517 | acydburn | |
| 335 | 7517 | acydburn | $template->assign_vars(array( |
| 336 | 7517 | acydburn | 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
| 337 | 8099 | acydburn | 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), |
| 338 | 7517 | acydburn | 'S_CONTINUE_SYNC' => true, |
| 339 | 7517 | acydburn | 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['forum_topics_real'])) |
| 340 | 7517 | acydburn | ); |
| 341 | 7517 | acydburn | |
| 342 | 7517 | acydburn | return;
|
| 343 | 7517 | acydburn | |
| 344 | 7517 | acydburn | break;
|
| 345 | 7517 | acydburn | |
| 346 | 7517 | acydburn | case 'sync_forum': |
| 347 | 7517 | acydburn | |
| 348 | 7517 | acydburn | $sql = 'SELECT forum_name, forum_type |
| 349 | 7517 | acydburn | FROM ' . FORUMS_TABLE . " |
| 350 | 7517 | acydburn | WHERE forum_id = $forum_id"; |
| 351 | 7517 | acydburn | $result = $db->sql_query($sql); |
| 352 | 7517 | acydburn | $row = $db->sql_fetchrow($result); |
| 353 | 7517 | acydburn | $db->sql_freeresult($result); |
| 354 | 7517 | acydburn | |
| 355 | 7517 | acydburn | if (!$row) |
| 356 | 7517 | acydburn | {
|
| 357 | 7517 | acydburn | trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 358 | 7517 | acydburn | } |
| 359 | 7517 | acydburn | |
| 360 | 7517 | acydburn | sync('forum', 'forum_id', $forum_id, false, true); |
| 361 | 7517 | acydburn | |
| 362 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']); |
| 363 | 5633 | acydburn | $cache->destroy('sql', FORUMS_TABLE); |
| 364 | 5330 | acydburn | |
| 365 | 5330 | acydburn | $template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name'])); |
| 366 | 5330 | acydburn | |
| 367 | 5330 | acydburn | break;
|
| 368 | 5330 | acydburn | |
| 369 | 5330 | acydburn | case 'add': |
| 370 | 5330 | acydburn | case 'edit': |
| 371 | 5330 | acydburn | |
| 372 | 5330 | acydburn | if ($update) |
| 373 | 5330 | acydburn | {
|
| 374 | 6161 | acydburn | $forum_data['forum_flags'] = 0; |
| 375 | 6365 | acydburn | $forum_data['forum_flags'] += (request_var('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; |
| 376 | 6365 | acydburn | $forum_data['forum_flags'] += (request_var('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; |
| 377 | 6365 | acydburn | $forum_data['forum_flags'] += (request_var('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; |
| 378 | 6365 | acydburn | $forum_data['forum_flags'] += (request_var('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; |
| 379 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; |
| 380 | 6365 | acydburn | $forum_data['forum_flags'] += (request_var('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; |
| 381 | 9656 | acydburn | $forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; |
| 382 | 5330 | acydburn | } |
| 383 | 5330 | acydburn | |
| 384 | 5330 | acydburn | // Show form to create/modify a forum
|
| 385 | 5330 | acydburn | if ($action == 'edit') |
| 386 | 5330 | acydburn | {
|
| 387 | 5330 | acydburn | $this->page_title = 'EDIT_FORUM'; |
| 388 | 5330 | acydburn | $row = $this->get_forum_info($forum_id); |
| 389 | 5330 | acydburn | $old_forum_type = $row['forum_type']; |
| 390 | 5330 | acydburn | |
| 391 | 5330 | acydburn | if (!$update) |
| 392 | 5330 | acydburn | {
|
| 393 | 5330 | acydburn | $forum_data = $row; |
| 394 | 5330 | acydburn | } |
| 395 | 6818 | acydburn | else
|
| 396 | 6818 | acydburn | {
|
| 397 | 6818 | acydburn | $forum_data['left_id'] = $row['left_id']; |
| 398 | 6818 | acydburn | $forum_data['right_id'] = $row['right_id']; |
| 399 | 6818 | acydburn | } |
| 400 | 5330 | acydburn | |
| 401 | 6829 | acydburn | // Make sure no direct child forums are able to be selected as parents.
|
| 402 | 6829 | acydburn | $exclude_forums = array(); |
| 403 | 6915 | acydburn | foreach (get_forum_branch($forum_id, 'children') as $row) |
| 404 | 6198 | acydburn | {
|
| 405 | 6198 | acydburn | $exclude_forums[] = $row['forum_id']; |
| 406 | 6198 | acydburn | } |
| 407 | 6198 | acydburn | |
| 408 | 10624 | git-gate | $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); |
| 409 | 6198 | acydburn | |
| 410 | 5330 | acydburn | $forum_data['forum_password_confirm'] = $forum_data['forum_password']; |
| 411 | 5330 | acydburn | } |
| 412 | 5330 | acydburn | else
|
| 413 | 5330 | acydburn | {
|
| 414 | 5330 | acydburn | $this->page_title = 'CREATE_FORUM'; |
| 415 | 5330 | acydburn | |
| 416 | 5330 | acydburn | $forum_id = $this->parent_id; |
| 417 | 10624 | git-gate | $parents_list = make_forum_select($this->parent_id, false, false, false, false); |
| 418 | 5330 | acydburn | |
| 419 | 5330 | acydburn | // Fill forum data with default values
|
| 420 | 5330 | acydburn | if (!$update) |
| 421 | 5330 | acydburn | {
|
| 422 | 5330 | acydburn | $forum_data = array( |
| 423 | 5330 | acydburn | 'parent_id' => $this->parent_id, |
| 424 | 5995 | acydburn | 'forum_type' => FORUM_POST, |
| 425 | 5330 | acydburn | 'forum_status' => ITEM_UNLOCKED, |
| 426 | 7920 | acydburn | 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), |
| 427 | 5330 | acydburn | 'forum_link' => '', |
| 428 | 5330 | acydburn | 'forum_link_track' => false, |
| 429 | 5330 | acydburn | 'forum_desc' => '', |
| 430 | 5330 | acydburn | 'forum_rules' => '', |
| 431 | 5330 | acydburn | 'forum_rules_link' => '', |
| 432 | 5330 | acydburn | 'forum_image' => '', |
| 433 | 5330 | acydburn | 'forum_style' => 0, |
| 434 | 8374 | naderman | 'display_subforum_list' => true, |
| 435 | 5330 | acydburn | 'display_on_index' => false, |
| 436 | 8147 | acydburn | 'forum_topics_per_page' => 0, |
| 437 | 8147 | acydburn | 'enable_indexing' => true, |
| 438 | 5330 | acydburn | 'enable_icons' => false, |
| 439 | 5330 | acydburn | 'enable_prune' => false, |
| 440 | 5330 | acydburn | 'prune_days' => 7, |
| 441 | 5330 | acydburn | 'prune_viewed' => 7, |
| 442 | 5330 | acydburn | 'prune_freq' => 1, |
| 443 | 10171 | acydburn | 'forum_flags' => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS, |
| 444 | 10024 | acydburn | 'forum_options' => 0, |
| 445 | 5330 | acydburn | 'forum_password' => '', |
| 446 | 5330 | acydburn | 'forum_password_confirm'=> '', |
| 447 | 5330 | acydburn | ); |
| 448 | 5330 | acydburn | } |
| 449 | 5330 | acydburn | } |
| 450 | 5330 | acydburn | |
| 451 | 5709 | acydburn | $forum_rules_data = array( |
| 452 | 5709 | acydburn | 'text' => $forum_data['forum_rules'], |
| 453 | 5709 | acydburn | 'allow_bbcode' => true, |
| 454 | 5709 | acydburn | 'allow_smilies' => true, |
| 455 | 5709 | acydburn | 'allow_urls' => true |
| 456 | 5709 | acydburn | ); |
| 457 | 5330 | acydburn | |
| 458 | 5709 | acydburn | $forum_desc_data = array( |
| 459 | 5709 | acydburn | 'text' => $forum_data['forum_desc'], |
| 460 | 5709 | acydburn | 'allow_bbcode' => true, |
| 461 | 5709 | acydburn | 'allow_smilies' => true, |
| 462 | 5709 | acydburn | 'allow_urls' => true |
| 463 | 5709 | acydburn | ); |
| 464 | 5709 | acydburn | |
| 465 | 5709 | acydburn | $forum_rules_preview = ''; |
| 466 | 5709 | acydburn | |
| 467 | 5709 | acydburn | // Parse rules if specified
|
| 468 | 5330 | acydburn | if ($forum_data['forum_rules']) |
| 469 | 5330 | acydburn | {
|
| 470 | 5709 | acydburn | if (!isset($forum_data['forum_rules_uid'])) |
| 471 | 5709 | acydburn | {
|
| 472 | 5709 | acydburn | // Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
|
| 473 | 5709 | acydburn | $forum_data['forum_rules_uid'] = ''; |
| 474 | 6209 | davidmj | $forum_data['forum_rules_bitfield'] = ''; |
| 475 | 6188 | davidmj | $forum_data['forum_rules_options'] = 0; |
| 476 | 5330 | acydburn | |
| 477 | 6894 | acydburn | generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false)); |
| 478 | 5330 | acydburn | } |
| 479 | 5709 | acydburn | |
| 480 | 5709 | acydburn | // Generate preview content
|
| 481 | 6188 | davidmj | $forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); |
| 482 | 5709 | acydburn | |
| 483 | 5709 | acydburn | // decode...
|
| 484 | 6188 | davidmj | $forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']); |
| 485 | 5709 | acydburn | } |
| 486 | 5709 | acydburn | |
| 487 | 5709 | acydburn | // Parse desciption if specified
|
| 488 | 5709 | acydburn | if ($forum_data['forum_desc']) |
| 489 | 5709 | acydburn | {
|
| 490 | 5709 | acydburn | if (!isset($forum_data['forum_desc_uid'])) |
| 491 | 5330 | acydburn | {
|
| 492 | 5709 | acydburn | // Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
|
| 493 | 5709 | acydburn | $forum_data['forum_desc_uid'] = ''; |
| 494 | 6209 | davidmj | $forum_data['forum_desc_bitfield'] = ''; |
| 495 | 6188 | davidmj | $forum_data['forum_desc_options'] = 0; |
| 496 | 5709 | acydburn | |
| 497 | 6894 | acydburn | generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smilies', false)); |
| 498 | 5330 | acydburn | } |
| 499 | 5330 | acydburn | |
| 500 | 5709 | acydburn | // decode...
|
| 501 | 6188 | davidmj | $forum_desc_data = generate_text_for_edit($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_options']); |
| 502 | 5330 | acydburn | } |
| 503 | 5330 | acydburn | |
| 504 | 5330 | acydburn | $forum_type_options = ''; |
| 505 | 5330 | acydburn | $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'); |
| 506 | 8655 | acydburn | |
| 507 | 5330 | acydburn | foreach ($forum_type_ary as $value => $lang) |
| 508 | 5330 | acydburn | {
|
| 509 | 5330 | acydburn | $forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_data['forum_type']) ? ' selected="selected"' : '') . '>' . $user->lang['TYPE_' . $lang] . '</option>'; |
| 510 | 5330 | acydburn | } |
| 511 | 5330 | acydburn | |
| 512 | 5330 | acydburn | $styles_list = style_select($forum_data['forum_style'], true); |
| 513 | 5330 | acydburn | |
| 514 | 5330 | acydburn | $statuslist = '<option value="' . ITEM_UNLOCKED . '"' . (($forum_data['forum_status'] == ITEM_UNLOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . ITEM_LOCKED . '"' . (($forum_data['forum_status'] == ITEM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>'; |
| 515 | 5330 | acydburn | |
| 516 | 5330 | acydburn | $sql = 'SELECT forum_id |
| 517 | 5330 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 518 | 5330 | acydburn | WHERE forum_type = ' . FORUM_POST . " |
| 519 | 5330 | acydburn | AND forum_id <> $forum_id"; |
| 520 | 9344 | toonarmy | $result = $db->sql_query_limit($sql, 1); |
| 521 | 5330 | acydburn | |
| 522 | 9344 | toonarmy | $postable_forum_exists = false; |
| 523 | 5330 | acydburn | if ($db->sql_fetchrow($result)) |
| 524 | 5330 | acydburn | {
|
| 525 | 9344 | toonarmy | $postable_forum_exists = true; |
| 526 | 5330 | acydburn | } |
| 527 | 5330 | acydburn | $db->sql_freeresult($result); |
| 528 | 5330 | acydburn | |
| 529 | 6601 | acydburn | // Subforum move options
|
| 530 | 6601 | acydburn | if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT) |
| 531 | 6601 | acydburn | {
|
| 532 | 6601 | acydburn | $subforums_id = array(); |
| 533 | 6601 | acydburn | $subforums = get_forum_branch($forum_id, 'children'); |
| 534 | 6601 | acydburn | |
| 535 | 6601 | acydburn | foreach ($subforums as $row) |
| 536 | 6601 | acydburn | {
|
| 537 | 6601 | acydburn | $subforums_id[] = $row['forum_id']; |
| 538 | 6601 | acydburn | } |
| 539 | 6601 | acydburn | |
| 540 | 6601 | acydburn | $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); |
| 541 | 6601 | acydburn | |
| 542 | 9344 | toonarmy | if ($postable_forum_exists) |
| 543 | 6601 | acydburn | {
|
| 544 | 6601 | acydburn | $template->assign_vars(array( |
| 545 | 6601 | acydburn | 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false??? |
| 546 | 6601 | acydburn | ); |
| 547 | 6601 | acydburn | } |
| 548 | 6601 | acydburn | |
| 549 | 6601 | acydburn | $template->assign_vars(array( |
| 550 | 6601 | acydburn | 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, |
| 551 | 6601 | acydburn | 'S_FORUMS_LIST' => $forums_list) |
| 552 | 6601 | acydburn | ); |
| 553 | 6601 | acydburn | } |
| 554 | 9344 | toonarmy | else if ($postable_forum_exists) |
| 555 | 9344 | toonarmy | {
|
| 556 | 9344 | toonarmy | $template->assign_vars(array( |
| 557 | 9344 | toonarmy | 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)) |
| 558 | 9344 | toonarmy | ); |
| 559 | 9344 | toonarmy | } |
| 560 | 6601 | acydburn | |
| 561 | 5330 | acydburn | $s_show_display_on_index = false; |
| 562 | 6015 | acydburn | |
| 563 | 5784 | acydburn | if ($forum_data['parent_id'] > 0) |
| 564 | 5330 | acydburn | {
|
| 565 | 5330 | acydburn | // if this forum is a subforum put the "display on index" checkbox
|
| 566 | 5603 | acydburn | if ($parent_info = $this->get_forum_info($forum_data['parent_id'])) |
| 567 | 5330 | acydburn | {
|
| 568 | 5330 | acydburn | if ($parent_info['parent_id'] > 0 || $parent_info['forum_type'] == FORUM_CAT) |
| 569 | 5330 | acydburn | {
|
| 570 | 5330 | acydburn | $s_show_display_on_index = true; |
| 571 | 5330 | acydburn | } |
| 572 | 5330 | acydburn | } |
| 573 | 5330 | acydburn | } |
| 574 | 8655 | acydburn | |
| 575 | 8143 | kellanved | if (strlen($forum_data['forum_password']) == 32) |
| 576 | 8143 | kellanved | {
|
| 577 | 8186 | acydburn | $errors[] = $user->lang['FORUM_PASSWORD_OLD']; |
| 578 | 8143 | kellanved | } |
| 579 | 5330 | acydburn | |
| 580 | 5330 | acydburn | $template->assign_vars(array( |
| 581 | 5603 | acydburn | 'S_EDIT_FORUM' => true, |
| 582 | 5603 | acydburn | 'S_ERROR' => (sizeof($errors)) ? true : false, |
| 583 | 5603 | acydburn | 'S_PARENT_ID' => $this->parent_id, |
| 584 | 5603 | acydburn | 'S_FORUM_PARENT_ID' => $forum_data['parent_id'], |
| 585 | 5603 | acydburn | 'S_ADD_ACTION' => ($action == 'add') ? true : false, |
| 586 | 5330 | acydburn | |
| 587 | 5330 | acydburn | 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
| 588 | 5330 | acydburn | 'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$action&f=$forum_id", |
| 589 | 5330 | acydburn | |
| 590 | 6107 | naderman | 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], |
| 591 | 6107 | naderman | 'L_TITLE' => $user->lang[$this->page_title], |
| 592 | 6107 | naderman | 'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', |
| 593 | 5330 | acydburn | |
| 594 | 5330 | acydburn | 'FORUM_NAME' => $forum_data['forum_name'], |
| 595 | 5330 | acydburn | 'FORUM_DATA_LINK' => $forum_data['forum_link'], |
| 596 | 5330 | acydburn | 'FORUM_IMAGE' => $forum_data['forum_image'], |
| 597 | 5330 | acydburn | 'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? $phpbb_root_path . $forum_data['forum_image'] : '', |
| 598 | 5330 | acydburn | 'FORUM_POST' => FORUM_POST, |
| 599 | 5330 | acydburn | 'FORUM_LINK' => FORUM_LINK, |
| 600 | 5330 | acydburn | 'FORUM_CAT' => FORUM_CAT, |
| 601 | 5330 | acydburn | 'PRUNE_FREQ' => $forum_data['prune_freq'], |
| 602 | 5330 | acydburn | 'PRUNE_DAYS' => $forum_data['prune_days'], |
| 603 | 5330 | acydburn | 'PRUNE_VIEWED' => $forum_data['prune_viewed'], |
| 604 | 5330 | acydburn | 'TOPICS_PER_PAGE' => $forum_data['forum_topics_per_page'], |
| 605 | 5330 | acydburn | 'FORUM_RULES_LINK' => $forum_data['forum_rules_link'], |
| 606 | 5330 | acydburn | 'FORUM_RULES' => $forum_data['forum_rules'], |
| 607 | 5330 | acydburn | 'FORUM_RULES_PREVIEW' => $forum_rules_preview, |
| 608 | 5709 | acydburn | 'FORUM_RULES_PLAIN' => $forum_rules_data['text'], |
| 609 | 5709 | acydburn | 'S_BBCODE_CHECKED' => ($forum_rules_data['allow_bbcode']) ? true : false, |
| 610 | 5709 | acydburn | 'S_SMILIES_CHECKED' => ($forum_rules_data['allow_smilies']) ? true : false, |
| 611 | 5709 | acydburn | 'S_URLS_CHECKED' => ($forum_rules_data['allow_urls']) ? true : false, |
| 612 | 8143 | kellanved | 'S_FORUM_PASSWORD_SET' => (empty($forum_data['forum_password'])) ? false : true, |
| 613 | 5330 | acydburn | |
| 614 | 5709 | acydburn | 'FORUM_DESC' => $forum_desc_data['text'], |
| 615 | 5709 | acydburn | 'S_DESC_BBCODE_CHECKED' => ($forum_desc_data['allow_bbcode']) ? true : false, |
| 616 | 5709 | acydburn | 'S_DESC_SMILIES_CHECKED' => ($forum_desc_data['allow_smilies']) ? true : false, |
| 617 | 5709 | acydburn | 'S_DESC_URLS_CHECKED' => ($forum_desc_data['allow_urls']) ? true : false, |
| 618 | 5709 | acydburn | |
| 619 | 5330 | acydburn | 'S_FORUM_TYPE_OPTIONS' => $forum_type_options, |
| 620 | 5330 | acydburn | 'S_STATUS_OPTIONS' => $statuslist, |
| 621 | 5330 | acydburn | 'S_PARENT_OPTIONS' => $parents_list, |
| 622 | 5330 | acydburn | 'S_STYLES_OPTIONS' => $styles_list, |
| 623 | 7915 | kellanved | 'S_FORUM_OPTIONS' => make_forum_select(($action == 'add') ? $forum_data['parent_id'] : false, ($action == 'edit') ? $forum_data['forum_id'] : false, false, false, false), |
| 624 | 5330 | acydburn | 'S_SHOW_DISPLAY_ON_INDEX' => $s_show_display_on_index, |
| 625 | 5330 | acydburn | 'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, |
| 626 | 5330 | acydburn | 'S_FORUM_ORIG_POST' => (isset($old_forum_type) && $old_forum_type == FORUM_POST) ? true : false, |
| 627 | 6601 | acydburn | 'S_FORUM_ORIG_CAT' => (isset($old_forum_type) && $old_forum_type == FORUM_CAT) ? true : false, |
| 628 | 6601 | acydburn | 'S_FORUM_ORIG_LINK' => (isset($old_forum_type) && $old_forum_type == FORUM_LINK) ? true : false, |
| 629 | 5330 | acydburn | 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, |
| 630 | 5330 | acydburn | 'S_FORUM_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false, |
| 631 | 5330 | acydburn | 'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false, |
| 632 | 5330 | acydburn | 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, |
| 633 | 8374 | naderman | 'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false, |
| 634 | 5330 | acydburn | 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, |
| 635 | 5330 | acydburn | 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, |
| 636 | 6364 | acydburn | 'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false, |
| 637 | 6364 | acydburn | 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false, |
| 638 | 6364 | acydburn | 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false, |
| 639 | 6364 | acydburn | 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false, |
| 640 | 10658 | git-gate | 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_POST) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : true, |
| 641 | 10658 | git-gate | 'S_ENABLE_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_CAT) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : false, |
| 642 | 6364 | acydburn | 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, |
| 643 | 9656 | acydburn | 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false, |
| 644 | 8172 | acydburn | 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, |
| 645 | 8172 | acydburn | )); |
| 646 | 5330 | acydburn | |
| 647 | 8171 | kellanved | return;
|
| 648 | 8171 | kellanved | |
| 649 | 5330 | acydburn | break;
|
| 650 | 5330 | acydburn | |
| 651 | 5330 | acydburn | case 'delete': |
| 652 | 5330 | acydburn | |
| 653 | 5330 | acydburn | if (!$forum_id) |
| 654 | 5330 | acydburn | {
|
| 655 | 6320 | acydburn | trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 656 | 5330 | acydburn | } |
| 657 | 6015 | acydburn | |
| 658 | 5330 | acydburn | $forum_data = $this->get_forum_info($forum_id); |
| 659 | 5330 | acydburn | |
| 660 | 5330 | acydburn | $subforums_id = array(); |
| 661 | 6584 | acydburn | $subforums = get_forum_branch($forum_id, 'children'); |
| 662 | 5330 | acydburn | |
| 663 | 5330 | acydburn | foreach ($subforums as $row) |
| 664 | 5330 | acydburn | {
|
| 665 | 5330 | acydburn | $subforums_id[] = $row['forum_id']; |
| 666 | 5330 | acydburn | } |
| 667 | 5330 | acydburn | |
| 668 | 5603 | acydburn | $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); |
| 669 | 5330 | acydburn | |
| 670 | 5330 | acydburn | $sql = 'SELECT forum_id |
| 671 | 5330 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 672 | 5330 | acydburn | WHERE forum_type = ' . FORUM_POST . " |
| 673 | 5330 | acydburn | AND forum_id <> $forum_id"; |
| 674 | 9344 | toonarmy | $result = $db->sql_query_limit($sql, 1); |
| 675 | 5330 | acydburn | |
| 676 | 5330 | acydburn | if ($db->sql_fetchrow($result)) |
| 677 | 5330 | acydburn | {
|
| 678 | 5330 | acydburn | $template->assign_vars(array( |
| 679 | 6816 | acydburn | 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id, false, true)) // , false, true, false??? |
| 680 | 5330 | acydburn | ); |
| 681 | 5330 | acydburn | } |
| 682 | 5330 | acydburn | $db->sql_freeresult($result); |
| 683 | 5330 | acydburn | |
| 684 | 5603 | acydburn | $parent_id = ($this->parent_id == $forum_id) ? 0 : $this->parent_id; |
| 685 | 5603 | acydburn | |
| 686 | 5330 | acydburn | $template->assign_vars(array( |
| 687 | 5330 | acydburn | 'S_DELETE_FORUM' => true, |
| 688 | 5603 | acydburn | 'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&f=$forum_id", |
| 689 | 5330 | acydburn | 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
| 690 | 5330 | acydburn | |
| 691 | 5330 | acydburn | 'FORUM_NAME' => $forum_data['forum_name'], |
| 692 | 5330 | acydburn | 'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, |
| 693 | 6584 | acydburn | 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, |
| 694 | 5330 | acydburn | 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, |
| 695 | 5330 | acydburn | 'S_FORUMS_LIST' => $forums_list, |
| 696 | 5330 | acydburn | 'S_ERROR' => (sizeof($errors)) ? true : false, |
| 697 | 5330 | acydburn | 'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '') |
| 698 | 5330 | acydburn | ); |
| 699 | 5330 | acydburn | |
| 700 | 5330 | acydburn | return;
|
| 701 | 5330 | acydburn | break;
|
| 702 | 10024 | acydburn | |
| 703 | 10024 | acydburn | case 'copy_perm': |
| 704 | 9896 | Kellanved | $forum_perm_from = request_var('forum_perm_from', 0); |
| 705 | 9896 | Kellanved | |
| 706 | 9896 | Kellanved | // Copy permissions?
|
| 707 | 9896 | Kellanved | if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) |
| 708 | 9896 | Kellanved | {
|
| 709 | 9896 | Kellanved | copy_forum_permissions($forum_perm_from, $forum_id, true); |
| 710 | 9896 | Kellanved | cache_moderators(); |
| 711 | 9896 | Kellanved | $auth->acl_clear_prefetch();
|
| 712 | 9896 | Kellanved | $cache->destroy('sql', FORUMS_TABLE); |
| 713 | 9896 | Kellanved | |
| 714 | 9896 | Kellanved | $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_id; |
| 715 | 9896 | Kellanved | |
| 716 | 9896 | Kellanved | $message = $user->lang['FORUM_UPDATED']; |
| 717 | 9896 | Kellanved | |
| 718 | 9896 | Kellanved | // Redirect to permissions
|
| 719 | 9896 | Kellanved | if ($auth->acl_get('a_fauth')) |
| 720 | 9896 | Kellanved | {
|
| 721 | 9896 | Kellanved | $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>'); |
| 722 | 9896 | Kellanved | } |
| 723 | 9896 | Kellanved | |
| 724 | 9896 | Kellanved | trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
| 725 | 9896 | Kellanved | } |
| 726 | 9978 | bantu | |
| 727 | 9978 | bantu | break;
|
| 728 | 5330 | acydburn | } |
| 729 | 5330 | acydburn | |
| 730 | 5330 | acydburn | // Default management page
|
| 731 | 5330 | acydburn | if (!$this->parent_id) |
| 732 | 5330 | acydburn | {
|
| 733 | 5330 | acydburn | $navigation = $user->lang['FORUM_INDEX']; |
| 734 | 5330 | acydburn | } |
| 735 | 5330 | acydburn | else
|
| 736 | 5330 | acydburn | {
|
| 737 | 5330 | acydburn | $navigation = '<a href="' . $this->u_action . '">' . $user->lang['FORUM_INDEX'] . '</a>'; |
| 738 | 5330 | acydburn | |
| 739 | 5330 | acydburn | $forums_nav = get_forum_branch($this->parent_id, 'parents', 'descending'); |
| 740 | 5330 | acydburn | foreach ($forums_nav as $row) |
| 741 | 5330 | acydburn | {
|
| 742 | 5330 | acydburn | if ($row['forum_id'] == $this->parent_id) |
| 743 | 5330 | acydburn | {
|
| 744 | 5330 | acydburn | $navigation .= ' -> ' . $row['forum_name']; |
| 745 | 5330 | acydburn | } |
| 746 | 5330 | acydburn | else
|
| 747 | 5330 | acydburn | {
|
| 748 | 5330 | acydburn | $navigation .= ' -> <a href="' . $this->u_action . '&parent_id=' . $row['forum_id'] . '">' . $row['forum_name'] . '</a>'; |
| 749 | 5330 | acydburn | } |
| 750 | 5330 | acydburn | } |
| 751 | 5330 | acydburn | } |
| 752 | 5330 | acydburn | |
| 753 | 5330 | acydburn | // Jumpbox
|
| 754 | 5330 | acydburn | $forum_box = make_forum_select($this->parent_id, false, false, false, false); //make_forum_select($this->parent_id); |
| 755 | 5330 | acydburn | |
| 756 | 7517 | acydburn | if ($action == 'sync' || $action == 'sync_forum') |
| 757 | 5330 | acydburn | {
|
| 758 | 5330 | acydburn | $template->assign_var('S_RESYNCED', true); |
| 759 | 5330 | acydburn | } |
| 760 | 5330 | acydburn | |
| 761 | 5330 | acydburn | $sql = 'SELECT * |
| 762 | 5330 | acydburn | FROM ' . FORUMS_TABLE . " |
| 763 | 5330 | acydburn | WHERE parent_id = $this->parent_id |
| 764 | 5330 | acydburn | ORDER BY left_id";
|
| 765 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 766 | 5330 | acydburn | |
| 767 | 5330 | acydburn | if ($row = $db->sql_fetchrow($result)) |
| 768 | 5330 | acydburn | {
|
| 769 | 5330 | acydburn | do
|
| 770 | 5330 | acydburn | {
|
| 771 | 5330 | acydburn | $forum_type = $row['forum_type']; |
| 772 | 5330 | acydburn | |
| 773 | 5330 | acydburn | if ($row['forum_status'] == ITEM_LOCKED) |
| 774 | 5330 | acydburn | {
|
| 775 | 7137 | dhn2 | $folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />'; |
| 776 | 5330 | acydburn | } |
| 777 | 5330 | acydburn | else
|
| 778 | 5330 | acydburn | {
|
| 779 | 5330 | acydburn | switch ($forum_type) |
| 780 | 5330 | acydburn | {
|
| 781 | 5330 | acydburn | case FORUM_LINK: |
| 782 | 7137 | dhn2 | $folder_image = '<img src="images/icon_folder_link.gif" alt="' . $user->lang['LINK'] . '" />'; |
| 783 | 5330 | acydburn | break;
|
| 784 | 5330 | acydburn | |
| 785 | 5330 | acydburn | default:
|
| 786 | 7137 | dhn2 | $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['FOLDER'] . '" />'; |
| 787 | 6015 | acydburn | break;
|
| 788 | 5330 | acydburn | } |
| 789 | 5330 | acydburn | } |
| 790 | 5330 | acydburn | |
| 791 | 5330 | acydburn | $url = $this->u_action . "&parent_id=$this->parent_id&f={$row['forum_id']}"; |
| 792 | 6015 | acydburn | |
| 793 | 5330 | acydburn | $template->assign_block_vars('forums', array( |
| 794 | 5330 | acydburn | 'FOLDER_IMAGE' => $folder_image, |
| 795 | 6470 | acydburn | 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="" />' : '', |
| 796 | 6470 | acydburn | 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', |
| 797 | 5330 | acydburn | 'FORUM_NAME' => $row['forum_name'], |
| 798 | 6188 | davidmj | 'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), |
| 799 | 5330 | acydburn | 'FORUM_TOPICS' => $row['forum_topics'], |
| 800 | 5330 | acydburn | 'FORUM_POSTS' => $row['forum_posts'], |
| 801 | 6015 | acydburn | |
| 802 | 5330 | acydburn | 'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false, |
| 803 | 5330 | acydburn | 'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false, |
| 804 | 6015 | acydburn | |
| 805 | 5330 | acydburn | 'U_FORUM' => $this->u_action . '&parent_id=' . $row['forum_id'], |
| 806 | 5330 | acydburn | 'U_MOVE_UP' => $url . '&action=move_up', |
| 807 | 5330 | acydburn | 'U_MOVE_DOWN' => $url . '&action=move_down', |
| 808 | 5330 | acydburn | 'U_EDIT' => $url . '&action=edit', |
| 809 | 5330 | acydburn | 'U_DELETE' => $url . '&action=delete', |
| 810 | 6015 | acydburn | 'U_SYNC' => $url . '&action=sync') |
| 811 | 5330 | acydburn | ); |
| 812 | 5330 | acydburn | } |
| 813 | 5330 | acydburn | while ($row = $db->sql_fetchrow($result)); |
| 814 | 5330 | acydburn | } |
| 815 | 5330 | acydburn | else if ($this->parent_id) |
| 816 | 5330 | acydburn | {
|
| 817 | 5330 | acydburn | $row = $this->get_forum_info($this->parent_id); |
| 818 | 5330 | acydburn | |
| 819 | 5330 | acydburn | $url = $this->u_action . '&parent_id=' . $this->parent_id . '&f=' . $row['forum_id']; |
| 820 | 5330 | acydburn | |
| 821 | 5330 | acydburn | $template->assign_vars(array( |
| 822 | 5330 | acydburn | 'S_NO_FORUMS' => true, |
| 823 | 5330 | acydburn | |
| 824 | 5330 | acydburn | 'U_EDIT' => $url . '&action=edit', |
| 825 | 5330 | acydburn | 'U_DELETE' => $url . '&action=delete', |
| 826 | 5330 | acydburn | 'U_SYNC' => $url . '&action=sync') |
| 827 | 5330 | acydburn | ); |
| 828 | 5330 | acydburn | } |
| 829 | 5330 | acydburn | $db->sql_freeresult($result); |
| 830 | 5330 | acydburn | |
| 831 | 5330 | acydburn | $template->assign_vars(array( |
| 832 | 5330 | acydburn | 'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', |
| 833 | 5330 | acydburn | 'NAVIGATION' => $navigation, |
| 834 | 5330 | acydburn | 'FORUM_BOX' => $forum_box, |
| 835 | 5330 | acydburn | 'U_SEL_ACTION' => $this->u_action, |
| 836 | 6419 | acydburn | 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, |
| 837 | 6419 | acydburn | |
| 838 | 6419 | acydburn | 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
| 839 | 8099 | acydburn | 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), |
| 840 | 8099 | acydburn | )); |
| 841 | 5330 | acydburn | } |
| 842 | 5330 | acydburn | |
| 843 | 5330 | acydburn | /**
|
| 844 | 5330 | acydburn | * Get forum details |
| 845 | 5330 | acydburn | */ |
| 846 | 5330 | acydburn | function get_forum_info($forum_id) |
| 847 | 5330 | acydburn | {
|
| 848 | 5330 | acydburn | global $db; |
| 849 | 5330 | acydburn | |
| 850 | 5330 | acydburn | $sql = 'SELECT * |
| 851 | 5330 | acydburn | FROM ' . FORUMS_TABLE . " |
| 852 | 5330 | acydburn | WHERE forum_id = $forum_id"; |
| 853 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 854 | 5330 | acydburn | $row = $db->sql_fetchrow($result); |
| 855 | 5330 | acydburn | $db->sql_freeresult($result); |
| 856 | 5330 | acydburn | |
| 857 | 5330 | acydburn | if (!$row) |
| 858 | 5330 | acydburn | {
|
| 859 | 6015 | acydburn | trigger_error("Forum #$forum_id does not exist", E_USER_ERROR); |
| 860 | 5330 | acydburn | } |
| 861 | 5330 | acydburn | |
| 862 | 5330 | acydburn | return $row; |
| 863 | 5330 | acydburn | } |
| 864 | 5330 | acydburn | |
| 865 | 5330 | acydburn | /**
|
| 866 | 5330 | acydburn | * Update forum data |
| 867 | 5330 | acydburn | */ |
| 868 | 5330 | acydburn | function update_forum_data(&$forum_data) |
| 869 | 5330 | acydburn | {
|
| 870 | 9309 | terrafrost | global $db, $user, $cache, $phpbb_root_path; |
| 871 | 5330 | acydburn | |
| 872 | 5330 | acydburn | $errors = array(); |
| 873 | 6015 | acydburn | |
| 874 | 11448 | git-gate | if ($forum_data['forum_name'] == '') |
| 875 | 5330 | acydburn | {
|
| 876 | 5330 | acydburn | $errors[] = $user->lang['FORUM_NAME_EMPTY']; |
| 877 | 5330 | acydburn | } |
| 878 | 5330 | acydburn | |
| 879 | 6880 | davidmj | if (utf8_strlen($forum_data['forum_desc']) > 4000) |
| 880 | 6880 | davidmj | {
|
| 881 | 6880 | davidmj | $errors[] = $user->lang['FORUM_DESC_TOO_LONG']; |
| 882 | 6880 | davidmj | } |
| 883 | 6880 | davidmj | |
| 884 | 6880 | davidmj | if (utf8_strlen($forum_data['forum_rules']) > 4000) |
| 885 | 6880 | davidmj | {
|
| 886 | 6880 | davidmj | $errors[] = $user->lang['FORUM_RULES_TOO_LONG']; |
| 887 | 6880 | davidmj | } |
| 888 | 6880 | davidmj | |
| 889 | 5330 | acydburn | if ($forum_data['forum_password'] || $forum_data['forum_password_confirm']) |
| 890 | 5330 | acydburn | {
|
| 891 | 5330 | acydburn | if ($forum_data['forum_password'] != $forum_data['forum_password_confirm']) |
| 892 | 5330 | acydburn | {
|
| 893 | 5330 | acydburn | $forum_data['forum_password'] = $forum_data['forum_password_confirm'] = ''; |
| 894 | 5330 | acydburn | $errors[] = $user->lang['FORUM_PASSWORD_MISMATCH']; |
| 895 | 5330 | acydburn | } |
| 896 | 5330 | acydburn | } |
| 897 | 5330 | acydburn | |
| 898 | 5330 | acydburn | if ($forum_data['prune_days'] < 0 || $forum_data['prune_viewed'] < 0 || $forum_data['prune_freq'] < 0) |
| 899 | 5330 | acydburn | {
|
| 900 | 5330 | acydburn | $forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0; |
| 901 | 5330 | acydburn | $errors[] = $user->lang['FORUM_DATA_NEGATIVE']; |
| 902 | 5330 | acydburn | } |
| 903 | 8655 | acydburn | |
| 904 | 8407 | Kellanved | $range_test_ary = array( |
| 905 | 8407 | Kellanved | array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), |
| 906 | 8407 | Kellanved | ); |
| 907 | 8870 | acydburn | |
| 908 | 10184 | bantu | if (!empty($forum_data['forum_image']) && !file_exists($phpbb_root_path . $forum_data['forum_image'])) |
| 909 | 9309 | terrafrost | {
|
| 910 | 9309 | terrafrost | $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST']; |
| 911 | 9309 | terrafrost | } |
| 912 | 9309 | terrafrost | |
| 913 | 8407 | Kellanved | validate_range($range_test_ary, $errors); |
| 914 | 5330 | acydburn | |
| 915 | 5330 | acydburn | // Set forum flags
|
| 916 | 5330 | acydburn | // 1 = link tracking
|
| 917 | 5330 | acydburn | // 2 = prune old polls
|
| 918 | 5330 | acydburn | // 4 = prune announcements
|
| 919 | 5330 | acydburn | // 8 = prune stickies
|
| 920 | 5330 | acydburn | // 16 = show active topics
|
| 921 | 6161 | acydburn | // 32 = enable post review
|
| 922 | 5330 | acydburn | $forum_data['forum_flags'] = 0; |
| 923 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; |
| 924 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; |
| 925 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; |
| 926 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; |
| 927 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; |
| 928 | 6365 | acydburn | $forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; |
| 929 | 9656 | acydburn | $forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; |
| 930 | 5330 | acydburn | |
| 931 | 5330 | acydburn | // Unset data that are not database fields
|
| 932 | 6022 | acydburn | $forum_data_sql = $forum_data; |
| 933 | 5330 | acydburn | |
| 934 | 6022 | acydburn | unset($forum_data_sql['forum_link_track']); |
| 935 | 6022 | acydburn | unset($forum_data_sql['prune_old_polls']); |
| 936 | 6022 | acydburn | unset($forum_data_sql['prune_announce']); |
| 937 | 6022 | acydburn | unset($forum_data_sql['prune_sticky']); |
| 938 | 6022 | acydburn | unset($forum_data_sql['show_active']); |
| 939 | 6161 | acydburn | unset($forum_data_sql['enable_post_review']); |
| 940 | 9656 | acydburn | unset($forum_data_sql['enable_quick_reply']); |
| 941 | 6022 | acydburn | unset($forum_data_sql['forum_password_confirm']); |
| 942 | 6022 | acydburn | |
| 943 | 5330 | acydburn | // What are we going to do tonight Brain? The same thing we do everynight,
|
| 944 | 5330 | acydburn | // try to take over the world ... or decide whether to continue update
|
| 945 | 5330 | acydburn | // and if so, whether it's a new forum/cat/link or an existing one
|
| 946 | 5330 | acydburn | if (sizeof($errors)) |
| 947 | 5330 | acydburn | {
|
| 948 | 5330 | acydburn | return $errors; |
| 949 | 5330 | acydburn | } |
| 950 | 8194 | acydburn | |
| 951 | 8194 | acydburn | // As we don't know the old password, it's kinda tricky to detect changes
|
| 952 | 8143 | kellanved | if ($forum_data_sql['forum_password_unset']) |
| 953 | 8143 | kellanved | {
|
| 954 | 8143 | kellanved | $forum_data_sql['forum_password'] = ''; |
| 955 | 8143 | kellanved | } |
| 956 | 8143 | kellanved | else if (empty($forum_data_sql['forum_password'])) |
| 957 | 8143 | kellanved | {
|
| 958 | 8143 | kellanved | unset($forum_data_sql['forum_password']); |
| 959 | 8143 | kellanved | } |
| 960 | 8143 | kellanved | else
|
| 961 | 8143 | kellanved | {
|
| 962 | 8143 | kellanved | $forum_data_sql['forum_password'] = phpbb_hash($forum_data_sql['forum_password']); |
| 963 | 8143 | kellanved | } |
| 964 | 8143 | kellanved | unset($forum_data_sql['forum_password_unset']); |
| 965 | 8655 | acydburn | |
| 966 | 6022 | acydburn | if (!isset($forum_data_sql['forum_id'])) |
| 967 | 5330 | acydburn | {
|
| 968 | 5330 | acydburn | // no forum_id means we're creating a new forum
|
| 969 | 6022 | acydburn | unset($forum_data_sql['type_action']); |
| 970 | 5330 | acydburn | |
| 971 | 6022 | acydburn | if ($forum_data_sql['parent_id']) |
| 972 | 5330 | acydburn | {
|
| 973 | 7456 | acydburn | $sql = 'SELECT left_id, right_id, forum_type |
| 974 | 5330 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 975 | 6022 | acydburn | WHERE forum_id = ' . $forum_data_sql['parent_id']; |
| 976 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 977 | 6015 | acydburn | $row = $db->sql_fetchrow($result); |
| 978 | 6015 | acydburn | $db->sql_freeresult($result); |
| 979 | 5330 | acydburn | |
| 980 | 6015 | acydburn | if (!$row) |
| 981 | 5330 | acydburn | {
|
| 982 | 10690 | git-gate | trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
| 983 | 5330 | acydburn | } |
| 984 | 5330 | acydburn | |
| 985 | 7456 | acydburn | if ($row['forum_type'] == FORUM_LINK) |
| 986 | 7456 | acydburn | {
|
| 987 | 7456 | acydburn | $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; |
| 988 | 7456 | acydburn | return $errors; |
| 989 | 7456 | acydburn | } |
| 990 | 7456 | acydburn | |
| 991 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
| 992 | 5330 | acydburn | SET left_id = left_id + 2, right_id = right_id + 2 |
| 993 | 5330 | acydburn | WHERE left_id > ' . $row['right_id']; |
| 994 | 5330 | acydburn | $db->sql_query($sql); |
| 995 | 5330 | acydburn | |
| 996 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
| 997 | 5330 | acydburn | SET right_id = right_id + 2 |
| 998 | 5330 | acydburn | WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id'; |
| 999 | 5330 | acydburn | $db->sql_query($sql); |
| 1000 | 5330 | acydburn | |
| 1001 | 6022 | acydburn | $forum_data_sql['left_id'] = $row['right_id']; |
| 1002 | 6022 | acydburn | $forum_data_sql['right_id'] = $row['right_id'] + 1; |
| 1003 | 5330 | acydburn | } |
| 1004 | 5330 | acydburn | else
|
| 1005 | 5330 | acydburn | {
|
| 1006 | 5330 | acydburn | $sql = 'SELECT MAX(right_id) AS right_id |
| 1007 | 5330 | acydburn | FROM ' . FORUMS_TABLE; |
| 1008 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 1009 | 5330 | acydburn | $row = $db->sql_fetchrow($result); |
| 1010 | 5330 | acydburn | $db->sql_freeresult($result); |
| 1011 | 5330 | acydburn | |
| 1012 | 6022 | acydburn | $forum_data_sql['left_id'] = $row['right_id'] + 1; |
| 1013 | 6022 | acydburn | $forum_data_sql['right_id'] = $row['right_id'] + 2; |
| 1014 | 5330 | acydburn | } |
| 1015 | 5330 | acydburn | |
| 1016 | 6022 | acydburn | $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql); |
| 1017 | 5330 | acydburn | $db->sql_query($sql); |
| 1018 | 5330 | acydburn | |
| 1019 | 5330 | acydburn | $forum_data['forum_id'] = $db->sql_nextid(); |
| 1020 | 6015 | acydburn | |
| 1021 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_ADD', $forum_data['forum_name']); |
| 1022 | 5330 | acydburn | } |
| 1023 | 5330 | acydburn | else
|
| 1024 | 5330 | acydburn | {
|
| 1025 | 6022 | acydburn | $row = $this->get_forum_info($forum_data_sql['forum_id']); |
| 1026 | 5330 | acydburn | |
| 1027 | 6022 | acydburn | if ($row['forum_type'] == FORUM_POST && $row['forum_type'] != $forum_data_sql['forum_type']) |
| 1028 | 5330 | acydburn | {
|
| 1029 | 7895 | acydburn | // Has subforums and want to change into a link?
|
| 1030 | 7895 | acydburn | if ($row['right_id'] - $row['left_id'] > 1 && $forum_data_sql['forum_type'] == FORUM_LINK) |
| 1031 | 7895 | acydburn | {
|
| 1032 | 7895 | acydburn | $errors[] = $user->lang['FORUM_WITH_SUBFORUMS_NOT_TO_LINK']; |
| 1033 | 7895 | acydburn | return $errors; |
| 1034 | 7895 | acydburn | } |
| 1035 | 7895 | acydburn | |
| 1036 | 5330 | acydburn | // we're turning a postable forum into a non-postable forum
|
| 1037 | 6022 | acydburn | if ($forum_data_sql['type_action'] == 'move') |
| 1038 | 5330 | acydburn | {
|
| 1039 | 6022 | acydburn | $to_forum_id = request_var('to_forum_id', 0); |
| 1040 | 6022 | acydburn | |
| 1041 | 6022 | acydburn | if ($to_forum_id) |
| 1042 | 5330 | acydburn | {
|
| 1043 | 6022 | acydburn | $errors = $this->move_forum_content($forum_data_sql['forum_id'], $to_forum_id); |
| 1044 | 5330 | acydburn | } |
| 1045 | 5330 | acydburn | else
|
| 1046 | 5330 | acydburn | {
|
| 1047 | 5330 | acydburn | return array($user->lang['NO_DESTINATION_FORUM']); |
| 1048 | 5330 | acydburn | } |
| 1049 | 5330 | acydburn | } |
| 1050 | 6022 | acydburn | else if ($forum_data_sql['type_action'] == 'delete') |
| 1051 | 5330 | acydburn | {
|
| 1052 | 6022 | acydburn | $errors = $this->delete_forum_content($forum_data_sql['forum_id']); |
| 1053 | 5330 | acydburn | } |
| 1054 | 5330 | acydburn | else
|
| 1055 | 5330 | acydburn | {
|
| 1056 | 5330 | acydburn | return array($user->lang['NO_FORUM_ACTION']); |
| 1057 | 5330 | acydburn | } |
| 1058 | 5330 | acydburn | |
| 1059 | 6320 | acydburn | $forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; |
| 1060 | 6320 | acydburn | $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = ''; |
| 1061 | 5330 | acydburn | } |
| 1062 | 6601 | acydburn | else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_LINK) |
| 1063 | 6601 | acydburn | {
|
| 1064 | 6601 | acydburn | // Has subforums?
|
| 1065 | 6601 | acydburn | if ($row['right_id'] - $row['left_id'] > 1) |
| 1066 | 6601 | acydburn | {
|
| 1067 | 6601 | acydburn | // We are turning a category into a link - but need to decide what to do with the subforums.
|
| 1068 | 6601 | acydburn | $action_subforums = request_var('action_subforums', ''); |
| 1069 | 6601 | acydburn | $subforums_to_id = request_var('subforums_to_id', 0); |
| 1070 | 5330 | acydburn | |
| 1071 | 6601 | acydburn | if ($action_subforums == 'delete') |
| 1072 | 6601 | acydburn | {
|
| 1073 | 6601 | acydburn | $rows = get_forum_branch($row['forum_id'], 'children', 'descending', false); |
| 1074 | 6601 | acydburn | |
| 1075 | 6601 | acydburn | foreach ($rows as $_row) |
| 1076 | 6601 | acydburn | {
|
| 1077 | 6601 | acydburn | // Do not remove the forum id we are about to change. ;)
|
| 1078 | 6601 | acydburn | if ($_row['forum_id'] == $row['forum_id']) |
| 1079 | 6601 | acydburn | {
|
| 1080 | 6601 | acydburn | continue;
|
| 1081 | 6601 | acydburn | } |
| 1082 | 6601 | acydburn | |
| 1083 | 6601 | acydburn | $forum_ids[] = $_row['forum_id']; |
| 1084 | 6601 | acydburn | $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id'])); |
| 1085 | 6601 | acydburn | } |
| 1086 | 6601 | acydburn | |
| 1087 | 6601 | acydburn | if (sizeof($errors)) |
| 1088 | 6601 | acydburn | {
|
| 1089 | 6601 | acydburn | return $errors; |
| 1090 | 6601 | acydburn | } |
| 1091 | 6601 | acydburn | |
| 1092 | 6601 | acydburn | if (sizeof($forum_ids)) |
| 1093 | 6601 | acydburn | {
|
| 1094 | 6601 | acydburn | $sql = 'DELETE FROM ' . FORUMS_TABLE . ' |
| 1095 | 6601 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $forum_ids); |
| 1096 | 6601 | acydburn | $db->sql_query($sql); |
| 1097 | 6601 | acydburn | |
| 1098 | 6601 | acydburn | $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' |
| 1099 | 6601 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $forum_ids); |
| 1100 | 6601 | acydburn | $db->sql_query($sql); |
| 1101 | 6601 | acydburn | |
| 1102 | 6601 | acydburn | $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' |
| 1103 | 6601 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $forum_ids); |
| 1104 | 6601 | acydburn | $db->sql_query($sql); |
| 1105 | 6601 | acydburn | |
| 1106 | 6601 | acydburn | // Delete forum ids from extension groups table
|
| 1107 | 8147 | acydburn | $sql = 'SELECT group_id, allowed_forums |
| 1108 | 6601 | acydburn | FROM ' . EXTENSION_GROUPS_TABLE; |
| 1109 | 6601 | acydburn | $result = $db->sql_query($sql); |
| 1110 | 6601 | acydburn | |
| 1111 | 6601 | acydburn | while ($_row = $db->sql_fetchrow($result)) |
| 1112 | 6601 | acydburn | {
|
| 1113 | 6601 | acydburn | if (!$_row['allowed_forums']) |
| 1114 | 6601 | acydburn | {
|
| 1115 | 6601 | acydburn | continue;
|
| 1116 | 6601 | acydburn | } |
| 1117 | 6601 | acydburn | |
| 1118 | 6601 | acydburn | $allowed_forums = unserialize(trim($_row['allowed_forums'])); |
| 1119 | 6601 | acydburn | $allowed_forums = array_diff($allowed_forums, $forum_ids); |
| 1120 | 6601 | acydburn | |
| 1121 | 8147 | acydburn | $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " |
| 1122 | 6601 | acydburn | SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' |
| 1123 | 6601 | acydburn | WHERE group_id = {$_row['group_id']}"; |
| 1124 | 6601 | acydburn | $db->sql_query($sql); |
| 1125 | 6601 | acydburn | } |
| 1126 | 6601 | acydburn | $db->sql_freeresult($result); |
| 1127 | 6601 | acydburn | |
| 1128 | 6601 | acydburn | $cache->destroy('_extensions'); |
| 1129 | 6601 | acydburn | } |
| 1130 | 6601 | acydburn | } |
| 1131 | 6601 | acydburn | else if ($action_subforums == 'move') |
| 1132 | 6601 | acydburn | {
|
| 1133 | 6601 | acydburn | if (!$subforums_to_id) |
| 1134 | 6601 | acydburn | {
|
| 1135 | 6601 | acydburn | return array($user->lang['NO_DESTINATION_FORUM']); |
| 1136 | 6601 | acydburn | } |
| 1137 | 6601 | acydburn | |
| 1138 | 8147 | acydburn | $sql = 'SELECT forum_name |
| 1139 | 6601 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 1140 | 6601 | acydburn | WHERE forum_id = ' . $subforums_to_id; |
| 1141 | 6601 | acydburn | $result = $db->sql_query($sql); |
| 1142 | 6601 | acydburn | $_row = $db->sql_fetchrow($result); |
| 1143 | 6601 | acydburn | $db->sql_freeresult($result); |
| 1144 | 6601 | acydburn | |
| 1145 | 6601 | acydburn | if (!$_row) |
| 1146 | 6601 | acydburn | {
|
| 1147 | 6601 | acydburn | return array($user->lang['NO_FORUM']); |
| 1148 | 6601 | acydburn | } |
| 1149 | 6601 | acydburn | |
| 1150 | 6601 | acydburn | $subforums_to_name = $_row['forum_name']; |
| 1151 | 6601 | acydburn | |
| 1152 | 6601 | acydburn | $sql = 'SELECT forum_id |
| 1153 | 6601 | acydburn | FROM ' . FORUMS_TABLE . " |
| 1154 | 6601 | acydburn | WHERE parent_id = {$row['forum_id']}"; |
| 1155 | 6601 | acydburn | $result = $db->sql_query($sql); |
| 1156 | 6601 | acydburn | |
| 1157 | 6601 | acydburn | while ($_row = $db->sql_fetchrow($result)) |
| 1158 | 6601 | acydburn | {
|
| 1159 | 6601 | acydburn | $this->move_forum($_row['forum_id'], $subforums_to_id); |
| 1160 | 6601 | acydburn | } |
| 1161 | 6601 | acydburn | $db->sql_freeresult($result); |
| 1162 | 6601 | acydburn | |
| 1163 | 6601 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1164 | 6601 | acydburn | SET parent_id = $subforums_to_id |
| 1165 | 6601 | acydburn | WHERE parent_id = {$row['forum_id']}"; |
| 1166 | 6601 | acydburn | $db->sql_query($sql); |
| 1167 | 6601 | acydburn | } |
| 1168 | 6601 | acydburn | |
| 1169 | 6601 | acydburn | // Adjust the left/right id
|
| 1170 | 6601 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
| 1171 | 6601 | acydburn | SET right_id = left_id + 1 |
| 1172 | 6601 | acydburn | WHERE forum_id = ' . $row['forum_id']; |
| 1173 | 6601 | acydburn | $db->sql_query($sql); |
| 1174 | 6601 | acydburn | } |
| 1175 | 6601 | acydburn | } |
| 1176 | 7318 | davidmj | else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST) |
| 1177 | 7318 | davidmj | {
|
| 1178 | 7318 | davidmj | // Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum)
|
| 1179 | 7318 | davidmj | $forum_data_sql['forum_posts'] = 0; |
| 1180 | 7318 | davidmj | $forum_data_sql['forum_topics'] = 0; |
| 1181 | 7318 | davidmj | $forum_data_sql['forum_topics_real'] = 0; |
| 1182 | 7318 | davidmj | $forum_data_sql['forum_last_post_id'] = 0; |
| 1183 | 7318 | davidmj | $forum_data_sql['forum_last_post_subject'] = ''; |
| 1184 | 7318 | davidmj | $forum_data_sql['forum_last_post_time'] = 0; |
| 1185 | 7318 | davidmj | $forum_data_sql['forum_last_poster_id'] = 0; |
| 1186 | 7318 | davidmj | $forum_data_sql['forum_last_poster_name'] = ''; |
| 1187 | 7318 | davidmj | $forum_data_sql['forum_last_poster_colour'] = ''; |
| 1188 | 7318 | davidmj | } |
| 1189 | 6601 | acydburn | |
| 1190 | 5330 | acydburn | if (sizeof($errors)) |
| 1191 | 5330 | acydburn | {
|
| 1192 | 5330 | acydburn | return $errors; |
| 1193 | 5330 | acydburn | } |
| 1194 | 6015 | acydburn | |
| 1195 | 6022 | acydburn | if ($row['parent_id'] != $forum_data_sql['parent_id']) |
| 1196 | 5330 | acydburn | {
|
| 1197 | 8870 | acydburn | if ($row['forum_id'] != $forum_data_sql['parent_id']) |
| 1198 | 8870 | acydburn | {
|
| 1199 | 8870 | acydburn | $errors = $this->move_forum($forum_data_sql['forum_id'], $forum_data_sql['parent_id']); |
| 1200 | 8870 | acydburn | } |
| 1201 | 8870 | acydburn | else
|
| 1202 | 8870 | acydburn | {
|
| 1203 | 8870 | acydburn | $forum_data_sql['parent_id'] = $row['parent_id']; |
| 1204 | 8870 | acydburn | } |
| 1205 | 5330 | acydburn | } |
| 1206 | 6015 | acydburn | |
| 1207 | 5330 | acydburn | if (sizeof($errors)) |
| 1208 | 5330 | acydburn | {
|
| 1209 | 5330 | acydburn | return $errors; |
| 1210 | 5330 | acydburn | } |
| 1211 | 5330 | acydburn | |
| 1212 | 6022 | acydburn | unset($forum_data_sql['type_action']); |
| 1213 | 6015 | acydburn | |
| 1214 | 6022 | acydburn | if ($row['forum_name'] != $forum_data_sql['forum_name']) |
| 1215 | 5330 | acydburn | {
|
| 1216 | 6816 | acydburn | // the forum name has changed, clear the parents list of all forums (for safety)
|
| 1217 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1218 | 6816 | acydburn | SET forum_parents = ''";
|
| 1219 | 5330 | acydburn | $db->sql_query($sql); |
| 1220 | 5330 | acydburn | } |
| 1221 | 5330 | acydburn | |
| 1222 | 5940 | acydburn | // Setting the forum id to the forum id is not really received well by some dbs. ;)
|
| 1223 | 6022 | acydburn | $forum_id = $forum_data_sql['forum_id']; |
| 1224 | 6022 | acydburn | unset($forum_data_sql['forum_id']); |
| 1225 | 5940 | acydburn | |
| 1226 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
| 1227 | 6238 | davidmj | SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . ' |
| 1228 | 5940 | acydburn | WHERE forum_id = ' . $forum_id; |
| 1229 | 5330 | acydburn | $db->sql_query($sql); |
| 1230 | 5330 | acydburn | |
| 1231 | 5940 | acydburn | // Add it back
|
| 1232 | 5940 | acydburn | $forum_data['forum_id'] = $forum_id; |
| 1233 | 5940 | acydburn | |
| 1234 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_EDIT', $forum_data['forum_name']); |
| 1235 | 5330 | acydburn | } |
| 1236 | 5967 | acydburn | |
| 1237 | 5967 | acydburn | return $errors; |
| 1238 | 5330 | acydburn | } |
| 1239 | 5330 | acydburn | |
| 1240 | 5330 | acydburn | /**
|
| 1241 | 5330 | acydburn | * Move forum |
| 1242 | 5330 | acydburn | */ |
| 1243 | 5330 | acydburn | function move_forum($from_id, $to_id) |
| 1244 | 5330 | acydburn | {
|
| 1245 | 7456 | acydburn | global $db, $user; |
| 1246 | 5330 | acydburn | |
| 1247 | 7456 | acydburn | $to_data = $moved_ids = $errors = array(); |
| 1248 | 7456 | acydburn | |
| 1249 | 7456 | acydburn | // Check if we want to move to a parent with link type
|
| 1250 | 7456 | acydburn | if ($to_id > 0) |
| 1251 | 7456 | acydburn | {
|
| 1252 | 7456 | acydburn | $to_data = $this->get_forum_info($to_id); |
| 1253 | 7456 | acydburn | |
| 1254 | 7456 | acydburn | if ($to_data['forum_type'] == FORUM_LINK) |
| 1255 | 7456 | acydburn | {
|
| 1256 | 7456 | acydburn | $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; |
| 1257 | 7456 | acydburn | return $errors; |
| 1258 | 7456 | acydburn | } |
| 1259 | 7456 | acydburn | } |
| 1260 | 7456 | acydburn | |
| 1261 | 5330 | acydburn | $moved_forums = get_forum_branch($from_id, 'children', 'descending'); |
| 1262 | 5330 | acydburn | $from_data = $moved_forums[0]; |
| 1263 | 5330 | acydburn | $diff = sizeof($moved_forums) * 2; |
| 1264 | 5330 | acydburn | |
| 1265 | 5330 | acydburn | $moved_ids = array(); |
| 1266 | 5330 | acydburn | for ($i = 0; $i < sizeof($moved_forums); ++$i) |
| 1267 | 5330 | acydburn | {
|
| 1268 | 5330 | acydburn | $moved_ids[] = $moved_forums[$i]['forum_id']; |
| 1269 | 5330 | acydburn | } |
| 1270 | 5330 | acydburn | |
| 1271 | 5330 | acydburn | // Resync parents
|
| 1272 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1273 | 5330 | acydburn | SET right_id = right_id - $diff, forum_parents = '' |
| 1274 | 5330 | acydburn | WHERE left_id < " . $from_data['right_id'] . " |
| 1275 | 5330 | acydburn | AND right_id > " . $from_data['right_id']; |
| 1276 | 5330 | acydburn | $db->sql_query($sql); |
| 1277 | 5330 | acydburn | |
| 1278 | 5330 | acydburn | // Resync righthand side of tree
|
| 1279 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1280 | 5330 | acydburn | SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = '' |
| 1281 | 5330 | acydburn | WHERE left_id > " . $from_data['right_id']; |
| 1282 | 5330 | acydburn | $db->sql_query($sql); |
| 1283 | 5330 | acydburn | |
| 1284 | 5330 | acydburn | if ($to_id > 0) |
| 1285 | 5330 | acydburn | {
|
| 1286 | 7498 | acydburn | // Retrieve $to_data again, it may have been changed...
|
| 1287 | 7498 | acydburn | $to_data = $this->get_forum_info($to_id); |
| 1288 | 7498 | acydburn | |
| 1289 | 5330 | acydburn | // Resync new parents
|
| 1290 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1291 | 5330 | acydburn | SET right_id = right_id + $diff, forum_parents = '' |
| 1292 | 5330 | acydburn | WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id |
| 1293 | 6271 | acydburn | AND ' . $db->sql_in_set('forum_id', $moved_ids, true); |
| 1294 | 5330 | acydburn | $db->sql_query($sql); |
| 1295 | 5330 | acydburn | |
| 1296 | 5330 | acydburn | // Resync the righthand side of the tree
|
| 1297 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1298 | 5330 | acydburn | SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = '' |
| 1299 | 5330 | acydburn | WHERE left_id > " . $to_data['right_id'] . ' |
| 1300 | 6271 | acydburn | AND ' . $db->sql_in_set('forum_id', $moved_ids, true); |
| 1301 | 5330 | acydburn | $db->sql_query($sql); |
| 1302 | 5330 | acydburn | |
| 1303 | 5330 | acydburn | // Resync moved branch
|
| 1304 | 5330 | acydburn | $to_data['right_id'] += $diff; |
| 1305 | 6015 | acydburn | |
| 1306 | 5330 | acydburn | if ($to_data['right_id'] > $from_data['right_id']) |
| 1307 | 5330 | acydburn | {
|
| 1308 | 5330 | acydburn | $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); |
| 1309 | 5330 | acydburn | } |
| 1310 | 5330 | acydburn | else
|
| 1311 | 5330 | acydburn | {
|
| 1312 | 5330 | acydburn | $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); |
| 1313 | 5330 | acydburn | } |
| 1314 | 5330 | acydburn | } |
| 1315 | 5330 | acydburn | else
|
| 1316 | 5330 | acydburn | {
|
| 1317 | 5330 | acydburn | $sql = 'SELECT MAX(right_id) AS right_id |
| 1318 | 5330 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 1319 | 6271 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $moved_ids, true); |
| 1320 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 1321 | 5330 | acydburn | $row = $db->sql_fetchrow($result); |
| 1322 | 5330 | acydburn | $db->sql_freeresult($result); |
| 1323 | 5330 | acydburn | |
| 1324 | 5330 | acydburn | $diff = '+ ' . ($row['right_id'] - $from_data['left_id'] + 1); |
| 1325 | 5330 | acydburn | } |
| 1326 | 5330 | acydburn | |
| 1327 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1328 | 5330 | acydburn | SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = '' |
| 1329 | 6271 | acydburn | WHERE " . $db->sql_in_set('forum_id', $moved_ids); |
| 1330 | 5330 | acydburn | $db->sql_query($sql); |
| 1331 | 7456 | acydburn | |
| 1332 | 7456 | acydburn | return $errors; |
| 1333 | 5330 | acydburn | } |
| 1334 | 5330 | acydburn | |
| 1335 | 5330 | acydburn | /**
|
| 1336 | 5330 | acydburn | * Move forum content from one to another forum |
| 1337 | 5330 | acydburn | */ |
| 1338 | 5330 | acydburn | function move_forum_content($from_id, $to_id, $sync = true) |
| 1339 | 5330 | acydburn | {
|
| 1340 | 5330 | acydburn | global $db; |
| 1341 | 5330 | acydburn | |
| 1342 | 6320 | acydburn | $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); |
| 1343 | 6015 | acydburn | |
| 1344 | 5330 | acydburn | foreach ($table_ary as $table) |
| 1345 | 5330 | acydburn | {
|
| 1346 | 5330 | acydburn | $sql = "UPDATE $table |
| 1347 | 5330 | acydburn | SET forum_id = $to_id |
| 1348 | 5330 | acydburn | WHERE forum_id = $from_id"; |
| 1349 | 5330 | acydburn | $db->sql_query($sql); |
| 1350 | 5330 | acydburn | } |
| 1351 | 5330 | acydburn | unset($table_ary); |
| 1352 | 5330 | acydburn | |
| 1353 | 6021 | acydburn | $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, MODERATOR_CACHE_TABLE); |
| 1354 | 5330 | acydburn | |
| 1355 | 5330 | acydburn | foreach ($table_ary as $table) |
| 1356 | 5330 | acydburn | {
|
| 1357 | 5330 | acydburn | $sql = "DELETE FROM $table |
| 1358 | 5330 | acydburn | WHERE forum_id = $from_id"; |
| 1359 | 5330 | acydburn | $db->sql_query($sql); |
| 1360 | 5330 | acydburn | } |
| 1361 | 5330 | acydburn | |
| 1362 | 5330 | acydburn | if ($sync) |
| 1363 | 5330 | acydburn | {
|
| 1364 | 6015 | acydburn | // Delete ghost topics that link back to the same forum then resync counters
|
| 1365 | 5330 | acydburn | sync('topic_moved');
|
| 1366 | 7466 | davidmj | sync('forum', 'forum_id', $to_id, false, true); |
| 1367 | 5330 | acydburn | } |
| 1368 | 5330 | acydburn | |
| 1369 | 5330 | acydburn | return array(); |
| 1370 | 5330 | acydburn | } |
| 1371 | 5330 | acydburn | |
| 1372 | 5330 | acydburn | /**
|
| 1373 | 5330 | acydburn | * Remove complete forum |
| 1374 | 5330 | acydburn | */ |
| 1375 | 5330 | acydburn | function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) |
| 1376 | 5330 | acydburn | {
|
| 1377 | 5330 | acydburn | global $db, $user, $cache; |
| 1378 | 5330 | acydburn | |
| 1379 | 5330 | acydburn | $forum_data = $this->get_forum_info($forum_id); |
| 1380 | 5330 | acydburn | |
| 1381 | 5330 | acydburn | $errors = array(); |
| 1382 | 5330 | acydburn | $log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = ''; |
| 1383 | 6232 | acydburn | $forum_ids = array($forum_id); |
| 1384 | 5330 | acydburn | |
| 1385 | 5330 | acydburn | if ($action_posts == 'delete') |
| 1386 | 5330 | acydburn | {
|
| 1387 | 5330 | acydburn | $log_action_posts = 'POSTS'; |
| 1388 | 5330 | acydburn | $errors = array_merge($errors, $this->delete_forum_content($forum_id)); |
| 1389 | 5330 | acydburn | } |
| 1390 | 5330 | acydburn | else if ($action_posts == 'move') |
| 1391 | 5330 | acydburn | {
|
| 1392 | 5330 | acydburn | if (!$posts_to_id) |
| 1393 | 5330 | acydburn | {
|
| 1394 | 5330 | acydburn | $errors[] = $user->lang['NO_DESTINATION_FORUM']; |
| 1395 | 5330 | acydburn | } |
| 1396 | 5330 | acydburn | else
|
| 1397 | 5330 | acydburn | {
|
| 1398 | 5330 | acydburn | $log_action_posts = 'MOVE_POSTS'; |
| 1399 | 5330 | acydburn | |
| 1400 | 8147 | acydburn | $sql = 'SELECT forum_name |
| 1401 | 5330 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 1402 | 5330 | acydburn | WHERE forum_id = ' . $posts_to_id; |
| 1403 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 1404 | 6015 | acydburn | $row = $db->sql_fetchrow($result); |
| 1405 | 6015 | acydburn | $db->sql_freeresult($result); |
| 1406 | 5330 | acydburn | |
| 1407 | 6015 | acydburn | if (!$row) |
| 1408 | 5330 | acydburn | {
|
| 1409 | 5330 | acydburn | $errors[] = $user->lang['NO_FORUM']; |
| 1410 | 5330 | acydburn | } |
| 1411 | 5330 | acydburn | else
|
| 1412 | 5330 | acydburn | {
|
| 1413 | 5330 | acydburn | $posts_to_name = $row['forum_name']; |
| 1414 | 6015 | acydburn | $errors = array_merge($errors, $this->move_forum_content($forum_id, $posts_to_id)); |
| 1415 | 5330 | acydburn | } |
| 1416 | 5330 | acydburn | } |
| 1417 | 5330 | acydburn | } |
| 1418 | 5330 | acydburn | |
| 1419 | 5330 | acydburn | if (sizeof($errors)) |
| 1420 | 5330 | acydburn | {
|
| 1421 | 5330 | acydburn | return $errors; |
| 1422 | 5330 | acydburn | } |
| 1423 | 5330 | acydburn | |
| 1424 | 5330 | acydburn | if ($action_subforums == 'delete') |
| 1425 | 5330 | acydburn | {
|
| 1426 | 5330 | acydburn | $log_action_forums = 'FORUMS'; |
| 1427 | 5330 | acydburn | $rows = get_forum_branch($forum_id, 'children', 'descending', false); |
| 1428 | 5330 | acydburn | |
| 1429 | 5330 | acydburn | foreach ($rows as $row) |
| 1430 | 5330 | acydburn | {
|
| 1431 | 5330 | acydburn | $forum_ids[] = $row['forum_id']; |
| 1432 | 5330 | acydburn | $errors = array_merge($errors, $this->delete_forum_content($row['forum_id'])); |
| 1433 | 5330 | acydburn | } |
| 1434 | 5330 | acydburn | |
| 1435 | 5330 | acydburn | if (sizeof($errors)) |
| 1436 | 5330 | acydburn | {
|
| 1437 | 5330 | acydburn | return $errors; |
| 1438 | 5330 | acydburn | } |
| 1439 | 5330 | acydburn | |
| 1440 | 5330 | acydburn | $diff = sizeof($forum_ids) * 2; |
| 1441 | 5330 | acydburn | |
| 1442 | 5330 | acydburn | $sql = 'DELETE FROM ' . FORUMS_TABLE . ' |
| 1443 | 6271 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $forum_ids); |
| 1444 | 5330 | acydburn | $db->sql_query($sql); |
| 1445 | 6320 | acydburn | |
| 1446 | 6320 | acydburn | $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' |
| 1447 | 6320 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $forum_ids); |
| 1448 | 6320 | acydburn | $db->sql_query($sql); |
| 1449 | 6320 | acydburn | |
| 1450 | 6320 | acydburn | $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' |
| 1451 | 6320 | acydburn | WHERE ' . $db->sql_in_set('forum_id', $forum_ids); |
| 1452 | 6320 | acydburn | $db->sql_query($sql); |
| 1453 | 5330 | acydburn | } |
| 1454 | 5330 | acydburn | else if ($action_subforums == 'move') |
| 1455 | 5330 | acydburn | {
|
| 1456 | 5330 | acydburn | if (!$subforums_to_id) |
| 1457 | 5330 | acydburn | {
|
| 1458 | 5330 | acydburn | $errors[] = $user->lang['NO_DESTINATION_FORUM']; |
| 1459 | 5330 | acydburn | } |
| 1460 | 5330 | acydburn | else
|
| 1461 | 5330 | acydburn | {
|
| 1462 | 5330 | acydburn | $log_action_forums = 'MOVE_FORUMS'; |
| 1463 | 5330 | acydburn | |
| 1464 | 8147 | acydburn | $sql = 'SELECT forum_name |
| 1465 | 5330 | acydburn | FROM ' . FORUMS_TABLE . ' |
| 1466 | 5330 | acydburn | WHERE forum_id = ' . $subforums_to_id; |
| 1467 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 1468 | 6015 | acydburn | $row = $db->sql_fetchrow($result); |
| 1469 | 6015 | acydburn | $db->sql_freeresult($result); |
| 1470 | 5330 | acydburn | |
| 1471 | 6015 | acydburn | if (!$row) |
| 1472 | 5330 | acydburn | {
|
| 1473 | 5330 | acydburn | $errors[] = $user->lang['NO_FORUM']; |
| 1474 | 5330 | acydburn | } |
| 1475 | 5330 | acydburn | else
|
| 1476 | 5330 | acydburn | {
|
| 1477 | 5330 | acydburn | $subforums_to_name = $row['forum_name']; |
| 1478 | 5330 | acydburn | |
| 1479 | 5330 | acydburn | $sql = 'SELECT forum_id |
| 1480 | 5330 | acydburn | FROM ' . FORUMS_TABLE . " |
| 1481 | 5330 | acydburn | WHERE parent_id = $forum_id"; |
| 1482 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 1483 | 5330 | acydburn | |
| 1484 | 5330 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 1485 | 5330 | acydburn | {
|
| 1486 | 5330 | acydburn | $this->move_forum($row['forum_id'], $subforums_to_id); |
| 1487 | 5330 | acydburn | } |
| 1488 | 5330 | acydburn | $db->sql_freeresult($result); |
| 1489 | 5330 | acydburn | |
| 1490 | 6816 | acydburn | // Grab new forum data for correct tree updating later
|
| 1491 | 6816 | acydburn | $forum_data = $this->get_forum_info($forum_id); |
| 1492 | 6816 | acydburn | |
| 1493 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1494 | 5330 | acydburn | SET parent_id = $subforums_to_id |
| 1495 | 5330 | acydburn | WHERE parent_id = $forum_id"; |
| 1496 | 5330 | acydburn | $db->sql_query($sql); |
| 1497 | 5330 | acydburn | |
| 1498 | 5330 | acydburn | $diff = 2; |
| 1499 | 5330 | acydburn | $sql = 'DELETE FROM ' . FORUMS_TABLE . " |
| 1500 | 5330 | acydburn | WHERE forum_id = $forum_id"; |
| 1501 | 5330 | acydburn | $db->sql_query($sql); |
| 1502 | 6320 | acydburn | |
| 1503 | 6320 | acydburn | $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " |
| 1504 | 6320 | acydburn | WHERE forum_id = $forum_id"; |
| 1505 | 6320 | acydburn | $db->sql_query($sql); |
| 1506 | 6320 | acydburn | |
| 1507 | 6320 | acydburn | $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " |
| 1508 | 6320 | acydburn | WHERE forum_id = $forum_id"; |
| 1509 | 6320 | acydburn | $db->sql_query($sql); |
| 1510 | 5330 | acydburn | } |
| 1511 | 5330 | acydburn | } |
| 1512 | 5330 | acydburn | |
| 1513 | 5330 | acydburn | if (sizeof($errors)) |
| 1514 | 5330 | acydburn | {
|
| 1515 | 5330 | acydburn | return $errors; |
| 1516 | 5330 | acydburn | } |
| 1517 | 5330 | acydburn | } |
| 1518 | 5330 | acydburn | else
|
| 1519 | 5330 | acydburn | {
|
| 1520 | 5330 | acydburn | $diff = 2; |
| 1521 | 5330 | acydburn | $sql = 'DELETE FROM ' . FORUMS_TABLE . " |
| 1522 | 5330 | acydburn | WHERE forum_id = $forum_id"; |
| 1523 | 5330 | acydburn | $db->sql_query($sql); |
| 1524 | 6320 | acydburn | |
| 1525 | 6320 | acydburn | $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " |
| 1526 | 6320 | acydburn | WHERE forum_id = $forum_id"; |
| 1527 | 6320 | acydburn | $db->sql_query($sql); |
| 1528 | 6320 | acydburn | |
| 1529 | 6320 | acydburn | $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " |
| 1530 | 6320 | acydburn | WHERE forum_id = $forum_id"; |
| 1531 | 6320 | acydburn | $db->sql_query($sql); |
| 1532 | 5330 | acydburn | } |
| 1533 | 5330 | acydburn | |
| 1534 | 5330 | acydburn | // Resync tree
|
| 1535 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1536 | 5330 | acydburn | SET right_id = right_id - $diff |
| 1537 | 5330 | acydburn | WHERE left_id < {$forum_data['right_id']} AND right_id > {$forum_data['right_id']}"; |
| 1538 | 5330 | acydburn | $db->sql_query($sql); |
| 1539 | 5330 | acydburn | |
| 1540 | 5330 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1541 | 5330 | acydburn | SET left_id = left_id - $diff, right_id = right_id - $diff |
| 1542 | 5330 | acydburn | WHERE left_id > {$forum_data['right_id']}"; |
| 1543 | 5330 | acydburn | $db->sql_query($sql); |
| 1544 | 5330 | acydburn | |
| 1545 | 5330 | acydburn | // Delete forum ids from extension groups table
|
| 1546 | 8147 | acydburn | $sql = 'SELECT group_id, allowed_forums |
| 1547 | 6015 | acydburn | FROM ' . EXTENSION_GROUPS_TABLE; |
| 1548 | 5330 | acydburn | $result = $db->sql_query($sql); |
| 1549 | 5330 | acydburn | |
| 1550 | 5330 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 1551 | 5330 | acydburn | {
|
| 1552 | 6015 | acydburn | if (!$row['allowed_forums']) |
| 1553 | 6015 | acydburn | {
|
| 1554 | 6015 | acydburn | continue;
|
| 1555 | 6015 | acydburn | } |
| 1556 | 6015 | acydburn | |
| 1557 | 5330 | acydburn | $allowed_forums = unserialize(trim($row['allowed_forums'])); |
| 1558 | 5330 | acydburn | $allowed_forums = array_diff($allowed_forums, $forum_ids); |
| 1559 | 5330 | acydburn | |
| 1560 | 8147 | acydburn | $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " |
| 1561 | 5330 | acydburn | SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' |
| 1562 | 5330 | acydburn | WHERE group_id = {$row['group_id']}"; |
| 1563 | 5330 | acydburn | $db->sql_query($sql); |
| 1564 | 5330 | acydburn | } |
| 1565 | 6015 | acydburn | $db->sql_freeresult($result); |
| 1566 | 6015 | acydburn | |
| 1567 | 5494 | acydburn | $cache->destroy('_extensions'); |
| 1568 | 5330 | acydburn | |
| 1569 | 5330 | acydburn | $log_action = implode('_', array($log_action_posts, $log_action_forums)); |
| 1570 | 5330 | acydburn | |
| 1571 | 5330 | acydburn | switch ($log_action) |
| 1572 | 5330 | acydburn | {
|
| 1573 | 5330 | acydburn | case 'MOVE_POSTS_MOVE_FORUMS': |
| 1574 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', $posts_to_name, $subforums_to_name, $forum_data['forum_name']); |
| 1575 | 5330 | acydburn | break;
|
| 1576 | 6015 | acydburn | |
| 1577 | 5330 | acydburn | case 'MOVE_POSTS_FORUMS': |
| 1578 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', $posts_to_name, $forum_data['forum_name']); |
| 1579 | 5330 | acydburn | break;
|
| 1580 | 6015 | acydburn | |
| 1581 | 5330 | acydburn | case 'POSTS_MOVE_FORUMS': |
| 1582 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', $subforums_to_name, $forum_data['forum_name']); |
| 1583 | 5330 | acydburn | break;
|
| 1584 | 6015 | acydburn | |
| 1585 | 5330 | acydburn | case '_MOVE_FORUMS': |
| 1586 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_MOVE_FORUMS', $subforums_to_name, $forum_data['forum_name']); |
| 1587 | 5330 | acydburn | break;
|
| 1588 | 6015 | acydburn | |
| 1589 | 5330 | acydburn | case 'MOVE_POSTS_': |
| 1590 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS', $posts_to_name, $forum_data['forum_name']); |
| 1591 | 5330 | acydburn | break;
|
| 1592 | 5330 | acydburn | |
| 1593 | 5330 | acydburn | case 'POSTS_FORUMS': |
| 1594 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_POSTS_FORUMS', $forum_data['forum_name']); |
| 1595 | 5330 | acydburn | break;
|
| 1596 | 6015 | acydburn | |
| 1597 | 5330 | acydburn | case '_FORUMS': |
| 1598 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_FORUMS', $forum_data['forum_name']); |
| 1599 | 5330 | acydburn | break;
|
| 1600 | 6015 | acydburn | |
| 1601 | 5330 | acydburn | case 'POSTS_': |
| 1602 | 5330 | acydburn | add_log('admin', 'LOG_FORUM_DEL_POSTS', $forum_data['forum_name']); |
| 1603 | 5330 | acydburn | break;
|
| 1604 | 5603 | acydburn | |
| 1605 | 5603 | acydburn | default:
|
| 1606 | 5603 | acydburn | add_log('admin', 'LOG_FORUM_DEL_FORUM', $forum_data['forum_name']); |
| 1607 | 5603 | acydburn | break;
|
| 1608 | 5330 | acydburn | } |
| 1609 | 5330 | acydburn | |
| 1610 | 5330 | acydburn | return $errors; |
| 1611 | 5330 | acydburn | } |
| 1612 | 5330 | acydburn | |
| 1613 | 5330 | acydburn | /**
|
| 1614 | 5330 | acydburn | * Delete forum content |
| 1615 | 5330 | acydburn | */ |
| 1616 | 5330 | acydburn | function delete_forum_content($forum_id) |
| 1617 | 5330 | acydburn | {
|
| 1618 | 5330 | acydburn | global $db, $config, $phpbb_root_path, $phpEx; |
| 1619 | 5330 | acydburn | |
| 1620 | 5330 | acydburn | include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); |
| 1621 | 5330 | acydburn | |
| 1622 | 5330 | acydburn | $db->sql_transaction('begin'); |
| 1623 | 5330 | acydburn | |
| 1624 | 5330 | acydburn | // Select then delete all attachments
|
| 1625 | 5330 | acydburn | $sql = 'SELECT a.topic_id |
| 1626 | 5330 | acydburn | FROM ' . POSTS_TABLE . ' p, ' . ATTACHMENTS_TABLE . " a |
| 1627 | 5330 | acydburn | WHERE p.forum_id = $forum_id |
| 1628 | 5330 | acydburn | AND a.in_message = 0 |
| 1629 | 5330 | acydburn | AND a.topic_id = p.topic_id";
|
| 1630 | 8655 | acydburn | $result = $db->sql_query($sql); |
| 1631 | 6015 | acydburn | |
| 1632 | 5330 | acydburn | $topic_ids = array(); |
| 1633 | 5330 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 1634 | 5330 | acydburn | {
|
| 1635 | 5330 | acydburn | $topic_ids[] = $row['topic_id']; |
| 1636 | 5330 | acydburn | } |
| 1637 | 5330 | acydburn | $db->sql_freeresult($result); |
| 1638 | 6015 | acydburn | |
| 1639 | 5330 | acydburn | delete_attachments('topic', $topic_ids, false); |
| 1640 | 5330 | acydburn | |
| 1641 | 10734 | git-gate | // Delete shadow topics pointing to topics in this forum
|
| 1642 | 10734 | git-gate | delete_topic_shadows($forum_id);
|
| 1643 | 10734 | git-gate | |
| 1644 | 6342 | acydburn | // Before we remove anything we make sure we are able to adjust the post counts later. ;)
|
| 1645 | 6342 | acydburn | $sql = 'SELECT poster_id |
| 1646 | 6342 | acydburn | FROM ' . POSTS_TABLE . ' |
| 1647 | 6342 | acydburn | WHERE forum_id = ' . $forum_id . ' |
| 1648 | 8805 | acydburn | AND post_postcount = 1 |
| 1649 | 8805 | acydburn | AND post_approved = 1';
|
| 1650 | 6342 | acydburn | $result = $db->sql_query($sql); |
| 1651 | 6342 | acydburn | |
| 1652 | 6342 | acydburn | $post_counts = array(); |
| 1653 | 6342 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 1654 | 6342 | acydburn | {
|
| 1655 | 6342 | acydburn | $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; |
| 1656 | 6342 | acydburn | } |
| 1657 | 6342 | acydburn | $db->sql_freeresult($result); |
| 1658 | 6342 | acydburn | |
| 1659 | 6497 | acydburn | switch ($db->sql_layer) |
| 1660 | 5330 | acydburn | {
|
| 1661 | 5330 | acydburn | case 'mysql4': |
| 1662 | 5330 | acydburn | case 'mysqli': |
| 1663 | 5330 | acydburn | |
| 1664 | 5330 | acydburn | // Delete everything else and thank MySQL for offering multi-table deletion
|
| 1665 | 5330 | acydburn | $tables_ary = array( |
| 1666 | 6021 | acydburn | SEARCH_WORDMATCH_TABLE => 'post_id', |
| 1667 | 5728 | acydburn | REPORTS_TABLE => 'post_id', |
| 1668 | 5728 | acydburn | WARNINGS_TABLE => 'post_id', |
| 1669 | 5728 | acydburn | BOOKMARKS_TABLE => 'topic_id', |
| 1670 | 5728 | acydburn | TOPICS_WATCH_TABLE => 'topic_id', |
| 1671 | 5728 | acydburn | TOPICS_POSTED_TABLE => 'topic_id', |
| 1672 | 5728 | acydburn | POLL_OPTIONS_TABLE => 'topic_id', |
| 1673 | 5728 | acydburn | POLL_VOTES_TABLE => 'topic_id', |
| 1674 | 5330 | acydburn | ); |
| 1675 | 5330 | acydburn | |
| 1676 | 5728 | acydburn | $sql = 'DELETE ' . POSTS_TABLE; |
| 1677 | 5728 | acydburn | $sql_using = "\nFROM " . POSTS_TABLE; |
| 1678 | 5728 | acydburn | $sql_where = "\nWHERE " . POSTS_TABLE . ".forum_id = $forum_id\n"; |
| 1679 | 5330 | acydburn | |
| 1680 | 5330 | acydburn | foreach ($tables_ary as $table => $field) |
| 1681 | 5330 | acydburn | {
|
| 1682 | 5728 | acydburn | $sql .= ", $table "; |
| 1683 | 5728 | acydburn | $sql_using .= ", $table "; |
| 1684 | 5728 | acydburn | $sql_where .= "\nAND $table.$field = " . POSTS_TABLE . ".$field"; |
| 1685 | 5330 | acydburn | } |
| 1686 | 5330 | acydburn | |
| 1687 | 5330 | acydburn | $db->sql_query($sql . $sql_using . $sql_where); |
| 1688 | 5330 | acydburn | |
| 1689 | 5330 | acydburn | break;
|
| 1690 | 5330 | acydburn | |
| 1691 | 5330 | acydburn | default:
|
| 1692 | 8655 | acydburn | |
| 1693 | 5330 | acydburn | // Delete everything else and curse your DB for not offering multi-table deletion
|
| 1694 | 5330 | acydburn | $tables_ary = array( |
| 1695 | 5330 | acydburn | 'post_id' => array( |
| 1696 | 6021 | acydburn | SEARCH_WORDMATCH_TABLE,
|
| 1697 | 5330 | acydburn | REPORTS_TABLE,
|
| 1698 | 5330 | acydburn | WARNINGS_TABLE,
|
| 1699 | 5330 | acydburn | ), |
| 1700 | 6015 | acydburn | |
| 1701 | 5330 | acydburn | 'topic_id' => array( |
| 1702 | 5330 | acydburn | BOOKMARKS_TABLE,
|
| 1703 | 5330 | acydburn | TOPICS_WATCH_TABLE,
|
| 1704 | 5330 | acydburn | TOPICS_POSTED_TABLE,
|
| 1705 | 5330 | acydburn | POLL_OPTIONS_TABLE,
|
| 1706 | 5330 | acydburn | POLL_VOTES_TABLE,
|
| 1707 | 5330 | acydburn | ) |
| 1708 | 5330 | acydburn | ); |
| 1709 | 5330 | acydburn | |
| 1710 | 10608 | git-gate | // Amount of rows we select and delete in one iteration.
|
| 1711 | 10608 | git-gate | $batch_size = 500; |
| 1712 | 10608 | git-gate | |
| 1713 | 5330 | acydburn | foreach ($tables_ary as $field => $tables) |
| 1714 | 5330 | acydburn | {
|
| 1715 | 5330 | acydburn | $start = 0; |
| 1716 | 6015 | acydburn | |
| 1717 | 5330 | acydburn | do
|
| 1718 | 5330 | acydburn | {
|
| 1719 | 5330 | acydburn | $sql = "SELECT $field |
| 1720 | 5330 | acydburn | FROM " . POSTS_TABLE . ' |
| 1721 | 5330 | acydburn | WHERE forum_id = ' . $forum_id; |
| 1722 | 10608 | git-gate | $result = $db->sql_query_limit($sql, $batch_size, $start); |
| 1723 | 5330 | acydburn | |
| 1724 | 5330 | acydburn | $ids = array(); |
| 1725 | 5330 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 1726 | 5330 | acydburn | {
|
| 1727 | 5330 | acydburn | $ids[] = $row[$field]; |
| 1728 | 5330 | acydburn | } |
| 1729 | 5330 | acydburn | $db->sql_freeresult($result); |
| 1730 | 5330 | acydburn | |
| 1731 | 5330 | acydburn | if (sizeof($ids)) |
| 1732 | 5330 | acydburn | {
|
| 1733 | 5330 | acydburn | $start += sizeof($ids); |
| 1734 | 5330 | acydburn | |
| 1735 | 5330 | acydburn | foreach ($tables as $table) |
| 1736 | 5330 | acydburn | {
|
| 1737 | 6320 | acydburn | $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $ids)); |
| 1738 | 5330 | acydburn | } |
| 1739 | 5330 | acydburn | } |
| 1740 | 5330 | acydburn | } |
| 1741 | 10608 | git-gate | while (sizeof($ids) == $batch_size); |
| 1742 | 5330 | acydburn | } |
| 1743 | 6320 | acydburn | unset($ids); |
| 1744 | 5330 | acydburn | |
| 1745 | 5330 | acydburn | break;
|
| 1746 | 5330 | acydburn | } |
| 1747 | 5330 | acydburn | |
| 1748 | 6320 | acydburn | $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); |
| 1749 | 5330 | acydburn | |
| 1750 | 5330 | acydburn | foreach ($table_ary as $table) |
| 1751 | 5330 | acydburn | {
|
| 1752 | 5330 | acydburn | $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); |
| 1753 | 5330 | acydburn | } |
| 1754 | 5330 | acydburn | |
| 1755 | 5330 | acydburn | // Set forum ids to 0
|
| 1756 | 5330 | acydburn | $table_ary = array(DRAFTS_TABLE); |
| 1757 | 5330 | acydburn | |
| 1758 | 5574 | acydburn | foreach ($table_ary as $table) |
| 1759 | 5330 | acydburn | {
|
| 1760 | 5330 | acydburn | $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); |
| 1761 | 5330 | acydburn | } |
| 1762 | 5330 | acydburn | |
| 1763 | 6342 | acydburn | // Adjust users post counts
|
| 1764 | 6342 | acydburn | if (sizeof($post_counts)) |
| 1765 | 6342 | acydburn | {
|
| 1766 | 6342 | acydburn | foreach ($post_counts as $poster_id => $substract) |
| 1767 | 6342 | acydburn | {
|
| 1768 | 6342 | acydburn | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 1769 | 7677 | kellanved | SET user_posts = 0 |
| 1770 | 8147 | acydburn | WHERE user_id = ' . $poster_id . ' |
| 1771 | 7677 | kellanved | AND user_posts < ' . $substract; |
| 1772 | 7677 | kellanved | $db->sql_query($sql); |
| 1773 | 8805 | acydburn | |
| 1774 | 7677 | kellanved | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 1775 | 6342 | acydburn | SET user_posts = user_posts - ' . $substract . ' |
| 1776 | 8147 | acydburn | WHERE user_id = ' . $poster_id . ' |
| 1777 | 7677 | kellanved | AND user_posts >= ' . $substract; |
| 1778 | 6342 | acydburn | $db->sql_query($sql); |
| 1779 | 6342 | acydburn | } |
| 1780 | 6342 | acydburn | } |
| 1781 | 6342 | acydburn | |
| 1782 | 5330 | acydburn | $db->sql_transaction('commit'); |
| 1783 | 5330 | acydburn | |
| 1784 | 6114 | acydburn | // Make sure the overall post/topic count is correct...
|
| 1785 | 8147 | acydburn | $sql = 'SELECT COUNT(post_id) AS stat |
| 1786 | 6114 | acydburn | FROM ' . POSTS_TABLE . ' |
| 1787 | 6114 | acydburn | WHERE post_approved = 1';
|
| 1788 | 6114 | acydburn | $result = $db->sql_query($sql); |
| 1789 | 6114 | acydburn | $row = $db->sql_fetchrow($result); |
| 1790 | 6114 | acydburn | $db->sql_freeresult($result); |
| 1791 | 6114 | acydburn | |
| 1792 | 6114 | acydburn | set_config('num_posts', (int) $row['stat'], true); |
| 1793 | 6114 | acydburn | |
| 1794 | 6114 | acydburn | $sql = 'SELECT COUNT(topic_id) AS stat |
| 1795 | 6114 | acydburn | FROM ' . TOPICS_TABLE . ' |
| 1796 | 6114 | acydburn | WHERE topic_approved = 1';
|
| 1797 | 6114 | acydburn | $result = $db->sql_query($sql); |
| 1798 | 6114 | acydburn | $row = $db->sql_fetchrow($result); |
| 1799 | 6114 | acydburn | $db->sql_freeresult($result); |
| 1800 | 6114 | acydburn | |
| 1801 | 6114 | acydburn | set_config('num_topics', (int) $row['stat'], true); |
| 1802 | 6114 | acydburn | |
| 1803 | 6114 | acydburn | $sql = 'SELECT COUNT(attach_id) as stat |
| 1804 | 6114 | acydburn | FROM ' . ATTACHMENTS_TABLE; |
| 1805 | 6114 | acydburn | $result = $db->sql_query($sql); |
| 1806 | 6114 | acydburn | $row = $db->sql_fetchrow($result); |
| 1807 | 6114 | acydburn | $db->sql_freeresult($result); |
| 1808 | 6114 | acydburn | |
| 1809 | 6114 | acydburn | set_config('num_files', (int) $row['stat'], true); |
| 1810 | 6114 | acydburn | |
| 1811 | 6114 | acydburn | $sql = 'SELECT SUM(filesize) as stat |
| 1812 | 6114 | acydburn | FROM ' . ATTACHMENTS_TABLE; |
| 1813 | 6114 | acydburn | $result = $db->sql_query($sql); |
| 1814 | 6114 | acydburn | $row = $db->sql_fetchrow($result); |
| 1815 | 6114 | acydburn | $db->sql_freeresult($result); |
| 1816 | 6114 | acydburn | |
| 1817 | 8876 | acydburn | set_config('upload_dir_size', (float) $row['stat'], true); |
| 1818 | 6114 | acydburn | |
| 1819 | 5330 | acydburn | return array(); |
| 1820 | 5330 | acydburn | } |
| 1821 | 5330 | acydburn | |
| 1822 | 6073 | acydburn | /**
|
| 1823 | 6073 | acydburn | * Move forum position by $steps up/down |
| 1824 | 6073 | acydburn | */ |
| 1825 | 6073 | acydburn | function move_forum_by($forum_row, $action = 'move_up', $steps = 1) |
| 1826 | 6073 | acydburn | {
|
| 1827 | 6073 | acydburn | global $db; |
| 1828 | 6073 | acydburn | |
| 1829 | 6073 | acydburn | /**
|
| 1830 | 6073 | acydburn | * Fetch all the siblings between the module's current spot |
| 1831 | 6073 | acydburn | * and where we want to move it to. If there are less than $steps |
| 1832 | 6073 | acydburn | * siblings between the current spot and the target then the |
| 1833 | 6073 | acydburn | * module will move as far as possible |
| 1834 | 6073 | acydburn | */ |
| 1835 | 6073 | acydburn | $sql = 'SELECT forum_id, forum_name, left_id, right_id |
| 1836 | 6073 | acydburn | FROM ' . FORUMS_TABLE . " |
| 1837 | 6073 | acydburn | WHERE parent_id = {$forum_row['parent_id']} |
| 1838 | 6073 | acydburn | AND " . (($action == 'move_up') ? "right_id < {$forum_row['right_id']} ORDER BY right_id DESC" : "left_id > {$forum_row['left_id']} ORDER BY left_id ASC"); |
| 1839 | 6073 | acydburn | $result = $db->sql_query_limit($sql, $steps); |
| 1840 | 6073 | acydburn | |
| 1841 | 6073 | acydburn | $target = array(); |
| 1842 | 6073 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 1843 | 6073 | acydburn | {
|
| 1844 | 6073 | acydburn | $target = $row; |
| 1845 | 6073 | acydburn | } |
| 1846 | 6073 | acydburn | $db->sql_freeresult($result); |
| 1847 | 6073 | acydburn | |
| 1848 | 6073 | acydburn | if (!sizeof($target)) |
| 1849 | 6073 | acydburn | {
|
| 1850 | 6073 | acydburn | // The forum is already on top or bottom
|
| 1851 | 6073 | acydburn | return false; |
| 1852 | 6073 | acydburn | } |
| 1853 | 6073 | acydburn | |
| 1854 | 6073 | acydburn | /**
|
| 1855 | 6073 | acydburn | * $left_id and $right_id define the scope of the nodes that are affected by the move. |
| 1856 | 6073 | acydburn | * $diff_up and $diff_down are the values to substract or add to each node's left_id |
| 1857 | 6073 | acydburn | * and right_id in order to move them up or down. |
| 1858 | 6073 | acydburn | * $move_up_left and $move_up_right define the scope of the nodes that are moving |
| 1859 | 6073 | acydburn | * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. |
| 1860 | 6073 | acydburn | */ |
| 1861 | 6073 | acydburn | if ($action == 'move_up') |
| 1862 | 6073 | acydburn | {
|
| 1863 | 6073 | acydburn | $left_id = $target['left_id']; |
| 1864 | 6073 | acydburn | $right_id = $forum_row['right_id']; |
| 1865 | 6073 | acydburn | |
| 1866 | 6073 | acydburn | $diff_up = $forum_row['left_id'] - $target['left_id']; |
| 1867 | 6073 | acydburn | $diff_down = $forum_row['right_id'] + 1 - $forum_row['left_id']; |
| 1868 | 6073 | acydburn | |
| 1869 | 6073 | acydburn | $move_up_left = $forum_row['left_id']; |
| 1870 | 6073 | acydburn | $move_up_right = $forum_row['right_id']; |
| 1871 | 6073 | acydburn | } |
| 1872 | 6073 | acydburn | else
|
| 1873 | 6073 | acydburn | {
|
| 1874 | 6073 | acydburn | $left_id = $forum_row['left_id']; |
| 1875 | 6073 | acydburn | $right_id = $target['right_id']; |
| 1876 | 6073 | acydburn | |
| 1877 | 6073 | acydburn | $diff_up = $forum_row['right_id'] + 1 - $forum_row['left_id']; |
| 1878 | 6073 | acydburn | $diff_down = $target['right_id'] - $forum_row['right_id']; |
| 1879 | 6073 | acydburn | |
| 1880 | 6073 | acydburn | $move_up_left = $forum_row['right_id'] + 1; |
| 1881 | 6073 | acydburn | $move_up_right = $target['right_id']; |
| 1882 | 6073 | acydburn | } |
| 1883 | 6073 | acydburn | |
| 1884 | 6073 | acydburn | // Now do the dirty job
|
| 1885 | 6073 | acydburn | $sql = 'UPDATE ' . FORUMS_TABLE . " |
| 1886 | 6073 | acydburn | SET left_id = left_id + CASE |
| 1887 | 6073 | acydburn | WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} |
| 1888 | 6073 | acydburn | ELSE {$diff_down} |
| 1889 | 6073 | acydburn | END, |
| 1890 | 6073 | acydburn | right_id = right_id + CASE |
| 1891 | 6073 | acydburn | WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} |
| 1892 | 6073 | acydburn | ELSE {$diff_down} |
| 1893 | 6073 | acydburn | END, |
| 1894 | 6073 | acydburn | forum_parents = '' |
| 1895 | 8147 | acydburn | WHERE |
| 1896 | 6073 | acydburn | left_id BETWEEN {$left_id} AND {$right_id} |
| 1897 | 6073 | acydburn | AND right_id BETWEEN {$left_id} AND {$right_id}"; |
| 1898 | 6073 | acydburn | $db->sql_query($sql); |
| 1899 | 6073 | acydburn | |
| 1900 | 6073 | acydburn | return $target['forum_name']; |
| 1901 | 6073 | acydburn | } |
| 1902 | 6419 | acydburn | |
| 1903 | 6419 | acydburn | /**
|
| 1904 | 6419 | acydburn | * Display progress bar for syncinc forums |
| 1905 | 6419 | acydburn | */ |
| 1906 | 6419 | acydburn | function display_progress_bar($start, $total) |
| 1907 | 6419 | acydburn | {
|
| 1908 | 6419 | acydburn | global $template, $user; |
| 1909 | 6419 | acydburn | |
| 1910 | 6419 | acydburn | adm_page_header($user->lang['SYNC_IN_PROGRESS']); |
| 1911 | 6419 | acydburn | |
| 1912 | 6419 | acydburn | $template->set_filenames(array( |
| 1913 | 6419 | acydburn | 'body' => 'progress_bar.html') |
| 1914 | 6419 | acydburn | ); |
| 1915 | 6419 | acydburn | |
| 1916 | 6419 | acydburn | $template->assign_vars(array( |
| 1917 | 6419 | acydburn | 'L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], |
| 1918 | 6419 | acydburn | 'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS']) |
| 1919 | 6419 | acydburn | ); |
| 1920 | 6419 | acydburn | |
| 1921 | 6419 | acydburn | adm_page_footer(); |
| 1922 | 6419 | acydburn | } |
| 1923 | 9978 | bantu | |
| 1924 | 9978 | bantu | /**
|
| 1925 | 9978 | bantu | * Display copy permission page |
| 1926 | 10198 | acydburn | * Not used at the moment - we will have a look at it for 3.0.7 |
| 1927 | 9978 | bantu | */ |
| 1928 | 9896 | Kellanved | function copy_permission_page($forum_data) |
| 1929 | 9896 | Kellanved | {
|
| 1930 | 9896 | Kellanved | global $phpEx, $phpbb_admin_path, $template, $user; |
| 1931 | 10024 | acydburn | |
| 1932 | 9896 | Kellanved | $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; |
| 1933 | 9896 | Kellanved | $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm"); |
| 1934 | 9896 | Kellanved | |
| 1935 | 9896 | Kellanved | $l_acl = sprintf($user->lang['COPY_TO_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>'); |
| 1936 | 9896 | Kellanved | |
| 1937 | 9896 | Kellanved | $this->tpl_name = 'acp_forums_copy_perm'; |
| 1938 | 9896 | Kellanved | |
| 1939 | 9896 | Kellanved | $template->assign_vars(array( |
| 1940 | 9896 | Kellanved | 'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url), |
| 1941 | 9896 | Kellanved | 'L_ACL_LINK' => $l_acl, |
| 1942 | 9896 | Kellanved | 'L_BACK_LINK' => adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), |
| 1943 | 9896 | Kellanved | 'S_COPY_ACTION' => $action, |
| 1944 | 10135 | bantu | 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false), |
| 1945 | 9896 | Kellanved | )); |
| 1946 | 9896 | Kellanved | } |
| 1947 | 9896 | Kellanved | |
| 1948 | 5330 | acydburn | } |
| 1949 | 5330 | acydburn | |
| 1950 | 5330 | acydburn | ?> |

