diff --git a/phpBB/adm/admin_ban.php b/phpBB/adm/admin_ban.php
index 27143e2749..5afade6ff8 100644
--- a/phpBB/adm/admin_ban.php
+++ b/phpBB/adm/admin_ban.php
@@ -272,7 +272,7 @@ if (isset($_REQUEST['bansubmit']))
{
$sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason)
VALUES $sql";
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
}
if (!$ban_exclude)
diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php
index 670a65a3db..45b3b7f01a 100644
--- a/phpBB/adm/admin_board.php
+++ b/phpBB/adm/admin_board.php
@@ -439,17 +439,17 @@ switch ($mode)
/> lang['ENABLED']; ?> /> lang['DISABLED']; ?> |
- lang['ADMIN_EMAIL']; ?>: |
+ lang['CONTACT_EMAIL']; ?>: lang['CONTACT_EMAIL_EXPLAIN']; ?> |
+ |
+
+
+ lang['ADMIN_EMAIL']; ?>: lang['ADMIN_EMAIL_EXPLAIN']; ?> |
|
lang['EMAIL_SIG']; ?>: lang['EMAIL_SIG_EXPLAIN']; ?> |
|
-
- lang['CONTACT_EMAIL']; ?>: lang['CONTACT_EMAIL_EXPLAIN']; ?> |
- |
-
lang['USE_SMTP']; ?>: lang['USE_SMTP_EXPLAIN']; ?> |
/> lang['YES']; ?> /> lang['NO']; ?> |
diff --git a/phpBB/adm/admin_forums.php b/phpBB/adm/admin_forums.php
index 528c124649..4e4c92fa47 100644
--- a/phpBB/adm/admin_forums.php
+++ b/phpBB/adm/admin_forums.php
@@ -37,35 +37,707 @@ require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
// Get mode
-$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : '';
+$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
// Do we have permissions?
switch ($mode)
{
case 'add':
- if (!$auth->acl_get('a_forumadd'))
- {
- trigger_error($user->lang['NO_ADMIN']);
- }
- case 'del':
- if (!$auth->acl_get('a_forumdel'))
- {
- trigger_error($user->lang['NO_ADMIN']);
- }
-
+ $acl = 'a_forumadd';
+ break;
+ case 'delete':
+ $acl = 'a_forumdel';
+ break;
default:
- if (!$auth->acl_get('a_forum'))
- {
- trigger_error($user->lang['NO_ADMIN']);
- }
+ $acl = 'a_forum';
}
+if (!$auth->acl_get($acl))
+{
+ trigger_error($user->lang['NO_ADMIN']);
+}
+
+
// Major routines
switch ($mode)
{
+ case 'add':
+ case 'edit':
+
+ $action = (isset($_POST['action'])) ? htmlspecialchars($_POST['action']) : '';
+ $forum_id = (isset($_REQUEST['this_f'])) ? intval($_REQUEST['this_f']) : ((isset($_REQUEST['f'])) ? intval($_REQUEST['f']) : 0);
+ $parent_id = (isset($_REQUEST['parent_id'])) ? intval($_REQUEST['parent_id']) : 0;
+
+ $forum_type = (isset($_POST['forum_type'])) ? intval($_POST['forum_type']) : FORUM_POST;
+ $forum_status = (isset($_POST['forum_status'])) ? intval($_POST['forum_status']) : ITEM_UNLOCKED;
+ $forum_name = (isset($_POST['forum_name'])) ? htmlspecialchars($_POST['forum_name']) : '';
+ $forum_link = (isset($_POST['forum_link'])) ? htmlspecialchars($_POST['forum_link']) : '';
+ $forum_link_track = (!empty($_POST['forum_link_track'])) ? 1 : 0;
+ $forum_desc = (isset($_POST['forum_desc'])) ? str_replace("\n", '
', $_POST['forum_desc']) : '';
+ $forum_image = (isset($_POST['forum_image'])) ? htmlspecialchars($_POST['forum_image']) : '';
+ $forum_style = (isset($_POST['forum_style'])) ? intval($_POST['forum_style']) : 0;
+ $display_on_index = (!empty($_POST['display_on_index'])) ? 1 : 0;
+ $forum_topics_per_page = (isset($_POST['topics_per_page'])) ? intval($_POST['topics_per_page']) : 0;
+ $enable_icons = (!empty($_POST['enable_icons'])) ? 1 : 0;
+ $enable_prune = (!empty($_POST['enable_prune'])) ? 1 : 0;
+ $prune_days = (isset($_POST['prune_days'])) ? intval($_POST['prune_days']) : 7;
+ $prune_freq = (isset($_POST['prune_freq'])) ? intval($_POST['prune_freq']) : 1;
+ $forum_password = (isset($_POST['forum_password'])) ? intval($_POST['forum_password']) : '';
+ $forum_password_confirm = (isset($_POST['forum_password_confirm'])) ? intval($_POST['forum_password_confirm']) : '';
+
+ if (isset($_POST['update']))
+ {
+ $error = array();
+ if (!trim($_POST['forum_name']))
+ {
+ $error[] = $user->lang['FORUM_NAME_EMPTY'];
+ }
+
+ if (!empty($password) || !empty($password_confirm))
+ {
+ if ($password != $password_confirm)
+ {
+ $error[] = $user->lang['FORUM_PASSWORD_MISMATCH'];
+ }
+ }
+
+ if ($prune_days < 0 || $prune_freq < 0)
+ {
+ $error[] = $user->lang['FORUM_DATA_NEGATIVE'];
+ }
+
+ // What are we going to do tonight Brain? The same thing we do everynight,
+ // try to take over the world ... or decide whether to continue update
+ // and if so, whether it's a new forum/cat/link or an existing one
+ if (sizeof($error))
+ {
+ $error = implode('
', $error);
+ }
+ else if (!$forum_id)
+ {
+ if ($parent_id)
+ {
+ $sql = 'SELECT left_id, right_id
+ FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = $parent_id";
+ $result = $db->sql_query($sql);
+
+ if (!($row = $db->sql_fetchrow($result)))
+ {
+ trigger_error('Parent does not exist', E_USER_ERROR);
+ }
+ $db->sql_freeresult($result);
+
+ extract($row);
+ unset($row);
+
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET left_id = left_id + 2, right_id = right_id + 2
+ WHERE left_id > $right_id";
+ $db->sql_query($sql);
+
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET right_id = right_id + 2
+ WHERE $left_id BETWEEN left_id AND right_id";
+ $db->sql_query($sql);
+
+ $left_id = $right_id;
+ ++$right_id;
+ }
+ else
+ {
+ $sql = 'SELECT MAX(right_id) AS right_id
+ FROM ' . FORUMS_TABLE;
+ $result = $db->sql_query($sql);
+
+ $left_id = $db->sql_fetchfield('right_id', 0, $result) + 1;
+ $db->sql_freeresult($result);
+
+ $right_id = $left_id + 1;
+ }
+
+ $sql = array(
+ 'parent_id' => $parent_id,
+ 'left_id' => $left_id,
+ 'right_id' => $right_id,
+
+ 'forum_name' => $forum_name,
+ 'forum_desc' => $forum_desc,
+ 'forum_type' => $forum_type,
+ 'forum_status' => $forum_status,
+ 'forum_link' => $forum_link,
+ 'forum_link_track' => $forum_link_track,
+ 'forum_password' => $forum_password,
+ 'forum_topics_per_page' => $forum_topics_per_page,
+ 'forum_style' => $forum_style,
+ 'forum_image' => $forum_image,
+ 'display_on_index' => $display_on_index,
+ 'enable_icons' => $enable_icons,
+ 'enable_prune' => $enable_prune,
+ 'prune_days' => $prune_days,
+ 'prune_freq' => $prune_freq,
+ );
+
+ $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql);
+ $db->sql_query($sql);
+
+ $forum_id = $db->sql_nextid();
+
+ add_log('admin', 'LOG_FORUM_ADD', $forum_name);
+
+ // Redirect to permissions
+ $message = $user->lang['FORUM_UPDATED'] . '
' . sprintf($user->lang['REDIRECT_ACL'], "", '');
+ trigger_error($message);
+
+ }
+ else
+ {
+ $row = get_forum_info($forum_id);
+
+ if ($row['forum_type'] != $forum_type && $action)
+ {
+ if ($action == 'move' && $_POST['to_forum_id'])
+ {
+ move_forum_content($forum_id, $_POST['to_forum_id']);
+ }
+ elseif ($action == 'delete')
+ {
+ delete_forum_content($forum_id);
+ }
+
+ $sql['forum_posts'] = 0;
+ $sql['forum_topics'] = 0;
+ }
+
+ if ($row['parent_id'] != $parent_id)
+ {
+ move_forum($forum_id, $parent_id);
+ }
+ elseif ($row['forum_name'] != $forum_name)
+ {
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET forum_parents = ''
+ WHERE left_id > " . $row['left_id'] . '
+ AND right_id < ' . $row['right_id'];
+ $db->sql_query($sql);
+ }
+
+ $sql = array(
+ 'parent_id' => $parent_id,
+
+ 'forum_name' => $forum_name,
+ 'forum_desc' => $forum_desc,
+ 'forum_type' => $forum_type,
+ 'forum_status' => $forum_status,
+ 'forum_link' => $forum_link,
+ 'forum_link_track' => $forum_link_track,
+ 'forum_topics_per_page' => $forum_topics_per_page,
+ 'forum_password' => $forum_password,
+ 'forum_style' => $forum_style,
+ 'forum_image' => $forum_image,
+ 'display_on_index' => $display_on_index,
+ 'enable_icons' => $enable_icons,
+ 'enable_prune' => $enable_prune,
+ 'prune_days' => $prune_days,
+ 'prune_freq' => $prune_freq,
+ );
+
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET ' . $db->sql_build_array('UPDATE', $sql) . "
+ WHERE forum_id = $forum_id";
+ $db->sql_query($sql);
+
+ add_log('admin', 'LOG_FORUM_EDIT', $forum_name);
+
+ trigger_error($user->lang['FORUM_UPDATED']);
+ }
+ }
+
+ // Show form to create/modify a forum
+ if ($mode == 'edit')
+ {
+ $l_title = $user->lang['EDIT_FORUM'];
+
+ $forum_data = get_forum_info($forum_id);
+ if (!isset($_POST['forum_type']))
+ {
+ extract($forum_data);
+ }
+ else
+ {
+ $old_forum_type = $forum_data['forum_type'];
+ }
+ unset($forum_data);
+
+ $parents_list = make_forum_select($parent_id, $forum_id, false, false, false);
+ $forums_list = make_forum_select($parent_id, $forum_id, false, true, false);
+
+ }
+ else
+ {
+ $l_title = $user->lang['CREATE_FORUM'];
+
+ $forum_id = $parent_id;
+ $parents_list = make_forum_select($parent_id);
+ }
+
+ $forum_type_options = '';
+ $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK');
+ foreach ($forum_type_ary as $value => $lang)
+ {
+ $forum_type_options .= '';
+ }
+
+ $styles_list = style_select($forum_style);
+
+ $statuslist = '';
+
+ $topic_icons_yes = ($enable_icons) ? 'checked="checked"' : '';
+ $topic_icons_no = (!$enable_icons) ? 'checked="checked"' : '';
+
+ $display_index_yes = ($display_on_index) ? 'checked="checked"' : '';
+ $display_index_no = (!$display_on_index) ? 'checked="checked"' : '';
+
+ $prune_enable_yes = ($prune_enabled) ? 'checked="checked"' : '';
+ $prune_enable_no = (!$prune_enabled) ? 'checked="checked"' : '';
+
+ $forum_link_track_yes = ($forum_link_track) ? 'checked="checked"' : '';
+ $forum_link_track_no = (!$forum_link_track) ? 'checked="checked"' : '';
+
+ $navigation = '' . $user->lang['FORUM_INDEX'] . '';
+
+ $forums_nav = get_forum_branch($forum_id, 'parents', 'descending');
+ foreach ($forums_nav as $row)
+ {
+ $navigation .= ($row['forum_id'] == $forum_id) ? ' -> ' . $row['forum_name'] : ' -> ' . $row['forum_name'] . '';
+ }
+
+ page_header($l_title);
+
+?>
+
+lang['FORUM_ADMIN_EXPLAIN'] ?>
+
+
+
+lang['FORUM_EDIT_EXPLAIN'] ?>
+
+
+
+
+
+lang['NO_DESTINATION_FORUM']);
+ }
+
+ $log_action_posts = 'MOVE_POSTS';
+
+ $sql = 'SELECT forum_name
+ FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = " . intval($_POST['posts_to_id']);
+ $result = $db->sql_query($sql);
+
+ if (!($row = $db->sql_fetchrow($result)))
+ {
+ trigger_error($user->lang['NO_FORUM']);
+ }
+ $db->sql_freeresult($result);
+
+ $posts_to_name = $row['forum_name'];
+ unset($row);
+
+ move_forum_content($forum_id, intval($_POST['posts_to_id']));
+ }
+
+ if ($action_subforums == 'delete')
+ {
+ $log_action_forums = 'FORUMS';
+
+ $forum_ids = array($forum_id);
+ $rows = get_forum_branch($forum_id, 'children', 'descending', FALSE);
+
+ foreach ($rows as $row)
+ {
+ $forum_ids[] = $row['forum_id'];
+ delete_forum_content($row['forum_id']);
+ }
+
+ $diff = count($forum_ids) * 2;
+
+ $sql = 'DELETE FROM ' . FORUMS_TABLE . '
+ WHERE forum_id IN (' . implode(', ', $forum_ids) . ')';
+ $db->sql_query($sql);
+ }
+ elseif ($action_subforums == 'move')
+ {
+ if (empty($_POST['subforums_to_id']))
+ {
+ trigger_error($user->lang['NO_DESTINATION_FORUM']);
+ }
+
+ $log_action_forums = 'MOVE_FORUMS';
+
+ $sql = 'SELECT forum_name
+ FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = " . intval($_POST['subforums_to_id']);
+ $result = $db->sql_query($sql);
+
+ if (!($row = $db->sql_fetchrow($result)))
+ {
+ trigger_error($user->lang['NO_FORUM']);
+ }
+ $db->sql_freeresult($result);
+
+ $subforums_to_name = $row['forum_name'];
+ unset($row);
+
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . "
+ WHERE parent_id = $forum_id";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ move_forum($row['forum_id'], intval($_POST['subforums_to_id']));
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET parent_id = ' . $_POST['subforums_to_id'] . "
+ WHERE parent_id = $forum_id";
+ $db->sql_query($sql);
+
+ $diff = 2;
+
+ $sql = 'DELETE FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = $forum_id";
+ $db->sql_query($sql);
+ }
+ else
+ {
+ $diff = 2;
+ $sql = 'DELETE FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = $forum_id";
+ $db->sql_query($sql);
+ }
+
+ // Resync tree
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET right_id = right_id - $diff
+ WHERE left_id < $right_id AND right_id > $right_id";
+ $db->sql_query($sql);
+
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET left_id = left_id - $diff, right_id = right_id - $diff
+ WHERE left_id > $right_id";
+ $db->sql_query($sql);
+
+ $log_action = implode('_', array($log_action_posts, $log_action_forums));
+
+ switch ($log_action)
+ {
+ case 'MOVE_POSTS_MOVE_FORUMS':
+ add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', $posts_to_name, $subforums_to_name, $forum_name);
+ break;
+ case 'MOVE_POSTS_FORUMS':
+ add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', $posts_to_name, $forum_name);
+ break;
+ case 'POSTS_MOVE_FORUMS':
+ add_log('admin', 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS',$subforums_to_name, $forum_name);
+ break;
+ case '_MOVE_FORUMS':
+ add_log('admin', 'LOG_FORUM_DEL_MOVE_FORUMS', $subforums_to_name, $forum_name);
+ break;
+ case 'MOVE_POSTS_':
+ add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS', $posts_to_name, $forum_name);
+ break;
+ case 'POSTS_FORUMS':
+ add_log('admin', 'LOG_FORUM_DEL_POSTS_FORUMS', $forum_name);
+ break;
+ case '_FORUMS':
+ add_log('admin', 'LOG_FORUM_DEL_FORUMS', $forum_name);
+ break;
+ case 'POSTS_':
+ add_log('admin', 'LOG_FORUM_DEL_POSTS', $forum_name);
+ break;
+ }
+
+ trigger_error($user->lang['FORUM_DELETED']);
+ }
+
+
+ page_header($user->lang['MANAGE']);
+ extract(get_forum_info($forum_id));
+
+ $subforums_id = array();
+ $subforums = get_forum_branch($forum_id, 'children');
+ foreach ($subforums as $row)
+ {
+ $subforums_id[] = $row['forum_id'];
+ }
+
+ $forums_list = make_forum_select($parent_id, $subforums_id);
+ $move_posts_list = make_forum_select($parent_id, $subforums_id);
+
+?>
+
+lang['FORUM_ADMIN_EXPLAIN']; ?>
+
+lang['FORUM_DELETE'] ?>
+
+lang['FORUM_DELETE_EXPLAIN'] ?>
+
+
+ $row);
// Get the adjacent forum
- $sql = 'SELECT forum_id, left_id, right_id
+ $sql = 'SELECT forum_id, forum_name, left_id, right_id
FROM ' . FORUMS_TABLE . "
- WHERE parent_id = $parent_id";
- $sql .= ($mode == 'move_up') ? " AND right_id < $right_id ORDER BY right_id DESC" : " AND left_id > $left_id ORDER BY left_id ASC";
+ WHERE parent_id = $parent_id
+ AND " . (($mode == 'move_up') ? "right_id < $right_id ORDER BY right_id DESC" : "left_id > $left_id ORDER BY left_id ASC");
$result = $db->sql_query_limit($sql, 1);
if (!($row = $db->sql_fetchrow($result)))
@@ -99,15 +771,18 @@ switch ($mode)
if ($mode == 'move_up')
{
+ $log_action = 'UP';
$up_id = $forum_id;
$down_id = $row['forum_id'];
}
else
{
+ $log_action = 'DOWN';
$up_id = $row['forum_id'];
$down_id = $forum_id;
}
+ $move_forum_name = $row['forum_name'];
$forum_info[$row['forum_id']] = $row;
$diff_up = $forum_info[$up_id]['right_id'] - $forum_info[$up_id]['left_id'];
$diff_down = $forum_info[$down_id]['right_id'] - $forum_info[$down_id]['left_id'];
@@ -153,522 +828,48 @@ switch ($mode)
$db->sql_query($sql);
$db->sql_transaction('commit');
- break;
- case 'create':
- if (!trim($_POST['forum_name']))
- {
- trigger_error('Cannot create a forum without a name'); // Needs to be a lang string
- }
-
- $parent_id = (!empty($_POST['parent_id'])) ? intval($_POST['parent_id']) : 0;
-
- if ($parent_id)
- {
- $sql = 'SELECT left_id, right_id
- FROM ' . FORUMS_TABLE . "
- WHERE forum_id = $parent_id";
- $result = $db->sql_query($sql);
-
- if (!($row = $db->sql_fetchrow($result)))
- {
- trigger_error('Parent does not exist', E_USER_ERROR);
- }
- $db->sql_freeresult($result);
-
- extract($row);
-
- $db->sql_query('UPDATE ' . FORUMS_TABLE . "
- SET left_id = left_id + 2, right_id = right_id + 2
- WHERE left_id > $right_id");
-
- $db->sql_query('UPDATE ' . FORUMS_TABLE . "
- SET right_id = right_id + 2
- WHERE $left_id BETWEEN left_id AND right_id");
-
- $left_id = $right_id;
- ++$right_id;
- }
- else
- {
- $sql = 'SELECT MAX(right_id) AS right_id
- FROM ' . FORUMS_TABLE;
- $result = $db->sql_query($sql);
-
- $left_id = $db->sql_fetchfield('right_id', 0, $result) + 1;
- $db->sql_freeresult($result);
-
- $right_id = $left_id + 1;
- }
-
- $sql = array(
- 'parent_id' => $parent_id,
- 'left_id' => $left_id,
- 'right_id' => $right_id,
- 'forum_status' => intval($_POST['forum_status']),
- 'forum_postable' => (!empty($_POST['forum_postable'])) ? 1 : 0,
- 'forum_name' => $_POST['forum_name'],
- 'forum_desc' => $_POST['forum_desc'],
- 'forum_style' => (!empty($_POST['forum_style'])) ? intval($_POST['forum_style']) : 'NULL',
- 'enable_icons' => (!empty($_POST['enable_icons'])) ? 1 : 0,
- 'enable_prune' => (!empty($_POST['prune_enable'])) ? 1 : 0,
- 'prune_days' => intval($_POST['prune_days']),
- 'prune_freq' => intval($_POST['prune_freq'])
- );
- $db->sql_query('INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql));
-
- $forum_id = $db->sql_nextid();
-
- // Redirect to permissions
- redirect('adm/admin_permissions.' . $phpEx . $SID . '&mode=forums&f=' . $forum_id);
-
- break;
-
- case 'modify':
- if (!($forum_id = intval($_POST['f'])))
- {
- trigger_error('No forum specified'); // lang string
- }
-
- $row = get_forum_info($forum_id);
- $parent_id = intval($_POST['parent_id']);
- $action = (!empty($_POST['action'])) ? $_POST['action'] : '';
-
- if (($row['parent_id'] != $parent_id) && ($parent_id != -1))
- {
- move_forum($forum_id, $parent_id);
- }
- elseif ($row['forum_name'] != $_POST['forum_name'])
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . "
- SET forum_parents = ''
- WHERE left_id > " . $row['left_id'] . '
- AND right_id < ' . $row['right_id'];
- $db->sql_query($sql);
- }
-
- $sql = array(
- 'parent_id' => $parent_id,
- 'forum_name' => (!empty($_POST['forum_name'])) ? $_POST['forum_name'] : $row['forum_name'],
- 'forum_desc' => (!empty($_POST['forum_desc'])) ? $_POST['forum_desc'] : $row['forum_desc'],
- 'forum_status' => intval($_POST['forum_status']),
- 'forum_postable' => (!empty($_POST['is_postable'])) ? 1 : 0,
- 'forum_style' => (!empty($_POST['forum_style'])) ? $_POST['forum_style'] : NULL,
- 'forum_image' => (!empty($_POST['forum_image'])) ? $_POST['forum_image'] : '',
- 'display_on_index' => (!empty($_POST['display_on_index'])) ? 1 : 0,
- 'enable_icons' => (!empty($_POST['enable_icons'])) ? 1 : 0,
- 'enable_prune' => (!empty($_POST['prune_enable'])) ? 1 : 0,
- 'prune_days' => intval($_POST['prune_days']),
- 'prune_freq' => intval($_POST['prune_freq']),
- );
-
- if (!empty($_POST['set_nonpostable']) && $action)
- {
- if ($action == 'move' && $_POST['to_forum_id'])
- {
- move_forum_content($forum_id, $_POST['to_forum_id']);
- }
- elseif ($action == 'delete')
- {
- delete_forum_content($forum_id);
- }
-
- $sql['forum_posts'] = 0;
- $sql['forum_topics'] = 0;
- }
-
- $db->sql_query('UPDATE ' . FORUMS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql) . "
- WHERE forum_id = $forum_id");
-
- trigger_error($user->lang['FORUM_UPDATED']);
-
- break;
-
- case 'remove':
-
- $action_subforums = (!empty($_POST['action_subforums'])) ? $_POST['action_subforums'] : '';
- $action_posts = (!empty($_POST['action_posts'])) ? $_POST['action_posts'] : '';
-
- $row = get_forum_info(intval($_GET['f']));
- extract($row);
-
- if ($action_posts == 'delete')
- {
- delete_forum_content($forum_id);
- }
- elseif ($action_posts == 'move')
- {
- if (empty($_POST['posts_to_id']))
- {
- trigger_error($user->lang['No_destination_forum']);
- }
-
- move_forum_content($forum_id, $_POST['posts_to_id']);
- }
-
- if ($action_subforums == 'delete')
- {
- $forum_ids = array($forum_id);
- $rows = get_forum_branch($forum_id, 'children', 'descending', FALSE);
-
- foreach ($rows as $row)
- {
- $forum_ids[] = $row['forum_id'];
- delete_forum_content($row['forum_id']);
- }
-
- $diff = count($forum_ids) * 2;
-
- $sql = 'DELETE FROM ' . FORUMS_TABLE . '
- WHERE forum_id IN (' . implode(', ', $forum_ids) . ')';
- $db->sql_query($sql);
- }
- elseif ($action_subforums == 'move')
- {
- if (empty($_POST['subforums_to_id']))
- {
- trigger_error($user->lang['No_destination_forum']);
- }
-
- $sql = 'SELECT forum_id
- FROM ' . FORUMS_TABLE . "
- WHERE parent_id = $forum_id";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- move_forum($row['forum_id'], $_POST['subforums_to_id']);
- }
- $db->sql_freeresult($result);
-
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET parent_id = ' . $_POST['subforums_to_id'] . "
- WHERE parent_id = $forum_id";
- $db->sql_query($sql);
-
- $diff = 2;
-
- $sql = 'DELETE FROM ' . FORUMS_TABLE . "
- WHERE forum_id = $forum_id";
- $db->sql_query($sql);
- }
- else
- {
- $diff = 2;
- $db->sql_query('DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id");
- }
-
- // Resync tree
- $sql = 'UPDATE ' . FORUMS_TABLE . "
- SET right_id = right_id - $diff
- WHERE left_id < $right_id AND right_id > $right_id";
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . FORUMS_TABLE . "
- SET left_id = left_id - $diff, right_id = right_id - $diff
- WHERE left_id > $right_id";
- $db->sql_query($sql);
-
- trigger_error($user->lang['Forum_deleted']);
+ $forum_data = get_forum_info($forum_id);
+ add_log('admin', 'LOG_FORUM_MOVE_' . $log_action, $forum_data['forum_name'], $move_forum_name);
+ unset($forum_data);
break;
case 'sync':
- sync('forum', 'forum_id', intval($_GET['this_f']));
+ $forum_id = (isset($_REQUEST['this_f'])) ? intval($_REQUEST['this_f']) : ((isset($_REQUEST['f'])) ? intval($_REQUEST['f']) : 0);
+
+ if (!$forum_id)
+ {
+ trigger_error($user->lang['NO_FORUM']);
+ }
+
+ $sql = "SELECT forum_name
+ FROM " . FORUMS_TABLE . "
+ WHERE forum_id = $forum_id";
+ $result = $db->sql_query($sql);
+
+ if (!($row = $db->sql_fetchrow($result)))
+ {
+ trigger_error($user->lang['NO_FORUM']);
+ }
+ $db->sql_freeresult($result);
+
+ add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']);
+
+ sync('forum', 'forum_id', $forum_id);
break;
-
- case 'add':
- case 'edit':
- // Show form to create/modify a forum
- if ($mode == 'edit')
- {
- $forum_id = intval($_GET['this_f']);
-
- $row = get_forum_info($forum_id);
- extract($row);
-
- $subforums_id = array();
- $subforums = get_forum_branch($forum_id, 'children');
- foreach ($subforums as $row)
- {
- $subforums_id[] = $row['forum_id'];
- }
-
- $parents_list = make_forums_list('all', $parent_id, $subforums_id);
-
- $l_title = $user->lang['Edit_forum'];
- $newmode = 'modify';
- $buttonvalue = $user->lang['Update'];
- $prune_enabled = ($prune_enable) ? 'checked="checked" ' : '';
-
- $forums_list = make_forums_list('forums', 0, $forum_id);
- }
- else
- {
- $parent_id = (!empty($_POST['parent_id'])) ? $_POST['parent_id'] : 0;
- $parents_list = make_forums_list('all', $parent_id);
-
- $l_title = $user->lang['Create_forum'];
- $newmode = 'create';
- $buttonvalue = $user->lang['Create_forum'];
-
- $forum_id = $parent_id;
- $forum_desc = '';
- $forum_style = '';
- $forum_status = ITEM_UNLOCKED;
- $forum_name = (!empty($_POST['forum_name'])) ? htmlspecialchars($_POST['forum_name']) : '';
-
- $enable_icons = TRUE;
-
- $prune_enabled = '';
- $prune_days = 7;
- $prune_freq = 1;
- }
-
- $styles_list = make_styles_list($forum_style);
-
- $forumlocked = ($forum_status == ITEM_LOCKED) ? ' selected="selected"' : '';
- $forumunlocked = ($forum_status == ITEM_UNLOCKED) ? ' selected="selected"' : '';
-
- $postable_checked = ($forum_postable) ? 'checked="checked" ' : '';
- $nonpostable_checked = (!$forum_postable) ? 'checked="checked" ' : '';
-
- $statuslist = '\n";
- $statuslist .= '\n";
-
- page_header($l_title);
-
-?>
-
-
-lang['Forum_edit_delete_explain'] ?>
-
-
-
-
-
-lang['Forum_delete']);
- extract(get_forum_info(intval($_GET['this_f'])));
-
- $subforums_id = array();
- $subforums = get_forum_branch($forum_id, 'children');
- foreach ($subforums as $row)
- {
- $subforums_id[] = $row['forum_id'];
- }
-
- $forums_list = make_forums_list('all', $parent_id, $subforums_id);
- $move_posts_list = make_forums_list('forums', $parent_id, $subforums_id);
-
-?>
-lang['Forum_delete'] ?>
-
-lang['Forum_delete_explain'] ?>
-
-
-lang['INDEX'];
+ $navigation = $user->lang['FORUM_INDEX'];
}
else
{
- $navigation = '' . $user->lang['INDEX'] . '';
+ $navigation = '' . $user->lang['FORUM_INDEX'] . '';
$forums_nav = get_forum_branch($forum_id, 'parents', 'descending');
foreach ($forums_nav as $row)
@@ -694,60 +895,87 @@ page_header($user->lang['MANAGE']);
lang['MANAGE']; ?>
-lang['Forum_admin_explain']; ?>
+lang['FORUM_ADMIN_EXPLAIN']; ?>
-