diff -r 5e1f1e916419 -r 98bbc533541c punbb/moderate.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/punbb/moderate.php Sun Apr 06 00:28:50 2008 -0400
@@ -0,0 +1,1206 @@
+ $_ )
+{
+ $$key =& $GLOBALS[$key];
+}
+
+($hook = get_hook('mr_start')) ? eval($hook) : null;
+
+
+// This particular function doesn't require forum-based moderator access. It can be used
+// by all moderators and admins.
+if (isset($_GET['get_host']))
+{
+ if (!$pun_user['is_admmod'])
+ message($lang_common['No permission']);
+
+ ($hook = get_hook('mr_view_ip_selected')) ? eval($hook) : null;
+
+ // Is get_host an IP address or a post ID?
+ if (@preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host']))
+ $ip = $_GET['get_host'];
+ else
+ {
+ $get_host = intval($_GET['get_host']);
+ if ($get_host < 1)
+ message($lang_common['Bad request']);
+
+ $query = array(
+ 'SELECT' => 'p.poster_ip',
+ 'FROM' => 'posts AS p',
+ 'WHERE' => 'p.id='.$get_host
+ );
+
+ ($hook = get_hook('mr_qr_get_poster_ip')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ if (!$pun_db->num_rows($result))
+ message($lang_common['Bad request']);
+
+ $ip = $pun_db->result($result);
+ }
+
+ message('The IP address is: '.$ip.'
The host name is: '.@gethostbyaddr($ip).'
Show more users for this IP');
+}
+
+
+// All other functions require moderator/admin access
+$fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
+if ($fid < 1)
+ message($lang_common['Bad request']);
+
+// Get some info about the forum we're moderating
+$query = array(
+ 'SELECT' => 'f.forum_name, f.redirect_url, f.num_topics, f.moderators',
+ 'FROM' => 'forums AS f',
+ 'JOINS' => array(
+ array(
+ 'LEFT JOIN' => 'forum_perms AS fp',
+ 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].')'
+ )
+ ),
+ 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid
+);
+
+($hook = get_hook('mr_qr_get_forum_data')) ? eval($hook) : null;
+$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+if (!$pun_db->num_rows($result))
+ message($lang_common['Bad request']);
+
+$cur_forum = $pun_db->fetch_assoc($result);
+
+// Make sure we're not trying to moderate a redirect forum
+if ($cur_forum['redirect_url'] != '')
+ message($lang_common['Bad request']);
+
+// Setup the array of moderators
+$mods_array = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array();
+
+if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || !array_key_exists($pun_user['username'], $mods_array)))
+ message($lang_common['No permission']);
+
+// Get topic/forum tracking data
+if (!$pun_user['is_guest'])
+ $tracked_topics = get_tracked_topics();
+
+// Load the misc.php language file
+require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php';
+
+
+// Did someone click a cancel button?
+if (isset($_POST['cancel']))
+ pun_redirect(pun_link($pun_url['forum'], $fid), $lang_common['Cancel redirect']);
+
+
+// All other topic moderation features require a topic id in GET
+if (isset($_GET['tid']))
+{
+ ($hook = get_hook('mr_post_actions_selected')) ? eval($hook) : null;
+
+ $tid = intval($_GET['tid']);
+ if ($tid < 1)
+ message($lang_common['Bad request']);
+
+ // User pressed the cancel button
+ if (isset($_POST['delete_posts_cancel']))
+ pun_redirect(pun_link($pun_url['topic'], $tid), $lang_common['Cancel redirect']);
+
+ // Fetch some info about the topic
+ $query = array(
+ 'SELECT' => 't.subject, t.poster, t.first_post_id, t.posted, t.num_replies',
+ 'FROM' => 'topics AS t',
+ 'WHERE' => 't.id='.$tid.' AND t.moved_to IS NULL'
+ );
+
+ ($hook = get_hook('mr_qr_get_topic_info')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ if (!$pun_db->num_rows($result))
+ message($lang_common['Bad request']);
+
+ $cur_topic = $pun_db->fetch_assoc($result);
+
+ // Delete one or more posts
+ if (isset($_POST['delete_posts']) || isset($_POST['delete_posts_comply']))
+ {
+ ($hook = get_hook('mr_delete_posts_form_submitted')) ? eval($hook) : null;
+
+ $posts = $_POST['posts'];
+ if (empty($posts))
+ message($lang_misc['No posts selected']);
+
+ if (isset($_POST['delete_posts_comply']))
+ {
+ if (!isset($_POST['req_confirm']))
+ pun_redirect(pun_link($pun_url['topic'], $tid), $lang_common['No confirm redirect']);
+
+ ($hook = get_hook('mr_confirm_delete_posts_form_submitted')) ? eval($hook) : null;
+
+ if (@preg_match('/[^0-9,]/', $posts))
+ message($lang_common['Bad request']);
+
+ // Verify that the post IDs are valid
+ $query = array(
+ 'SELECT' => '1',
+ 'FROM' => 'posts AS p',
+ 'WHERE' => 'p.id IN('.$posts.') AND p.id!='.$cur_topic['first_post_id'].' AND p.topic_id='.$tid
+ );
+
+ ($hook = get_hook('mr_qr_verify_post_ids')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ if ($pun_db->num_rows($result) != substr_count($posts, ',') + 1)
+ message($lang_common['Bad request']);
+
+ // Delete the posts
+ $query = array(
+ 'DELETE' => 'posts',
+ 'WHERE' => 'id IN('.$posts.')'
+ );
+
+ ($hook = get_hook('mr_qr_delete_topics')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ if ($db_type != 'mysql' && $db_type != 'mysqli')
+ {
+ require PUN_ROOT.'include/search_idx.php';
+ strip_search_index($posts);
+ }
+
+ // Get last_post, last_post_id, and last_poster for the topic after deletion
+ $query = array(
+ 'SELECT' => 'p.id, p.poster, p.posted',
+ 'FROM' => 'posts AS p',
+ 'WHERE' => 'p.topic_id='.$tid,
+ 'ORDER BY' => 'p.id',
+ 'LIMIT' => '1'
+ );
+
+ ($hook = get_hook('mr_qr_get_topic_last_post_data')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ $last_post = $pun_db->fetch_assoc($result);
+
+ // How many posts did we just delete?
+ $num_posts_deleted = substr_count($posts, ',') + 1;
+
+ // Update the topic
+ $query = array(
+ 'UPDATE' => 'topics',
+ 'SET' => 'last_post='.$last_post['posted'].', last_post_id='.$last_post['id'].', last_poster=\''.$pun_db->escape($last_post['poster']).'\', num_replies=num_replies-'.$num_posts_deleted,
+ 'WHERE' => 'id='.$tid
+ );
+
+ ($hook = get_hook('mr_qr_update_topic')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ sync_forum($fid);
+
+ pun_redirect(pun_link($pun_url['topic'], $tid), $lang_misc['Delete posts redirect']);
+ }
+
+ // Setup form
+ $pun_page['set_count'] = $pun_page['fld_count'] = 0;
+ $pun_page['form_action'] = pun_link($pun_url['delete_multiple'], array($fid, $tid));
+
+ $pun_page['hidden_fields'] = array(
+ '',
+ ''
+ );
+
+ // Setup breadcrumbs
+ $pun_page['crumbs'] = array(
+ array($pun_config['o_board_title'], pun_link($pun_url['index'])),
+ array($cur_forum['forum_name'], pun_link($pun_url['forum'], $fid)),
+ array($cur_topic['subject'], pun_link($pun_url['topic'], $tid)),
+ $lang_misc['Delete posts']
+ );
+
+ ($hook = get_hook('mr_confirm_delete_posts_pre_header_load')) ? eval($hook) : null;
+
+ define('PUN_PAGE', 'dialogue');
+ require PUN_ROOT.'header.php';
+
+?>
+
+ $pun_page['num_pages']) ? 1 : $_GET['p'];
+ $pun_page['start_from'] = $pun_user['disp_posts'] * ($pun_page['page'] - 1);
+ $pun_page['finish_at'] = min(($pun_page['start_from'] + $pun_user['disp_posts']), ($cur_topic['num_replies'] + 1));
+
+ // Generate paging links
+ $pun_page['page_post'] = ''.$lang_common['Pages'].' '.pun_paginate($pun_page['num_pages'], $pun_page['page'], $pun_url['delete_multiple'], array($fid, $tid)).'
';
+
+ // Navigation links for header and page numbering for title/meta description
+ if ($pun_page['page'] < $pun_page['num_pages'])
+ {
+ $pun_page['nav'][] = '';
+ $pun_page['nav'][] = '';
+ }
+ if ($pun_page['page'] > 1)
+ {
+ $pun_page['nav'][] = '';
+ $pun_page['nav'][] = '';
+ }
+
+ // Generate page information
+ if ($pun_page['num_pages'] > 1)
+ $pun_page['main_info'] = ''.sprintf($lang_common['Page number'], $pun_page['page'], $pun_page['num_pages']).' '.sprintf($lang_common['Paged info'], $lang_common['Posts'], $pun_page['start_from'] + 1, $pun_page['finish_at'], $cur_topic['num_replies'] + 1);
+ else
+ $pun_page['main_info'] = sprintf($lang_common['Page info'], $lang_common['Posts'], ($cur_topic['num_replies'] + 1));
+
+ if ($pun_config['o_censoring'] == '1')
+ $cur_topic['subject'] = censor_words($cur_topic['subject']);
+
+ // Setup form
+ $pun_page['form_action'] = pun_link($pun_url['delete_multiple'], array($fid, $tid));
+
+ // Setup breadcrumbs
+ $pun_page['crumbs'] = array(
+ array($pun_config['o_board_title'], pun_link($pun_url['index'])),
+ array($cur_forum['forum_name'], pun_link($pun_url['forum'], $fid)),
+ array($cur_topic['subject'], pun_link($pun_url['topic'], $tid)),
+ $lang_topic['Delete posts']
+ );
+
+ ($hook = get_hook('mr_post_actions_pre_header_load')) ? eval($hook) : null;
+
+ define('PUN_PAGE', 'modtopic');
+ require PUN_ROOT.'header.php';
+
+?>
+
+
+
+
+ '1',
+ 'FROM' => 'topics AS t',
+ 'WHERE' => 't.id IN('.implode(',', $topics).') AND t.forum_id='.$fid
+ );
+
+ ($hook = get_hook('mr_qr_verify_topic_ids')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ if ($pun_db->num_rows($result) != count($topics))
+ message($lang_common['Bad request']);
+
+ // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it where it was once moved from)
+ $query = array(
+ 'DELETE' => 'topics',
+ 'WHERE' => 'forum_id='.$move_to_forum.' AND moved_to IN('.implode(',', $topics).')'
+ );
+
+ ($hook = get_hook('mr_qr_delete_redirect_topics')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ // Move the topic(s)
+ $query = array(
+ 'UPDATE' => 'topics',
+ 'SET' => 'forum_id='.$move_to_forum,
+ 'WHERE' => 'id IN('.implode(',', $topics).')'
+ );
+
+ ($hook = get_hook('mr_qr_move_topics')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ // Should we create redirect topics?
+ if (isset($_POST['with_redirect']))
+ {
+ while (list(, $cur_topic) = @each($topics))
+ {
+ // Fetch info for the redirect topic
+ $query = array(
+ 'SELECT' => 't.poster, t.subject, t.posted, t.last_post',
+ 'FROM' => 'topics AS t',
+ 'WHERE' => 't.id='.$cur_topic
+ );
+
+ ($hook = get_hook('mr_qr_get_redirect_topic_data')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ $moved_to = $pun_db->fetch_assoc($result);
+
+ // Create the redirect topic
+ $query = array(
+ 'INSERT' => 'poster, subject, posted, last_post, moved_to, forum_id',
+ 'INTO' => 'topics',
+ 'VALUES' => '\''.$pun_db->escape($moved_to['poster']).'\', \''.$pun_db->escape($moved_to['subject']).'\', '.$moved_to['posted'].', '.$moved_to['last_post'].', '.$cur_topic.', '.$fid
+ );
+
+ ($hook = get_hook('mr_qr_add_redirect_topic')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ }
+ }
+
+ sync_forum($fid); // Synchronize the forum FROM which the topic was moved
+ sync_forum($move_to_forum); // Synchronize the forum TO which the topic was moved
+
+ $pun_page['redirect_msg'] = (count($topics) > 1) ? $lang_misc['Move topics redirect'] : $lang_misc['Move topic redirect'];
+ pun_redirect(pun_link($pun_url['forum'], $move_to_forum), $pun_page['redirect_msg']);
+ }
+
+ if (isset($_POST['move_topics']))
+ {
+ $topics = isset($_POST['topics']) ? $_POST['topics'] : array();
+ if (empty($topics))
+ message($lang_misc['No topics selected']);
+
+ $topics = implode(',', array_keys($topics));
+ $action = 'multi';
+ }
+ else
+ {
+ $topics = intval($_GET['move_topics']);
+ if ($topics < 1)
+ message($lang_common['Bad request']);
+
+ $action = 'single';
+
+ // Fetch the topic subject
+ $query = array(
+ 'SELECT' => 't.subject',
+ 'FROM' => 'topics AS t',
+ 'WHERE' => 't.id='.$topics
+ );
+
+ ($hook = get_hook('mr_qr_get_topic_subject')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ $subject = $pun_db->result($result);
+ }
+
+ // Get forums we can move the post into
+ $query = array(
+ 'SELECT' => 'c.id AS cid, c.cat_name, f.id AS fid, f.forum_name',
+ 'FROM' => 'categories AS c',
+ 'JOINS' => array(
+ array(
+ 'INNER JOIN' => 'forums AS f',
+ 'ON' => 'c.id=f.cat_id'
+ ),
+ array(
+ 'LEFT JOIN' => 'forum_perms AS fp',
+ 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].')'
+ )
+ ),
+ 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL AND f.id!='.$fid,
+ 'ORDER BY' => 'c.disp_position, c.id, f.disp_position'
+ );
+
+ ($hook = get_hook('mr_qr_get_target_forums')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ $num_forums = $pun_db->num_rows($result);
+
+ if (!$num_forums)
+ message($lang_misc['Nowhere to move']);
+
+ $forum_list = array();
+ for ($i = 0; $i < $num_forums; ++$i)
+ $forum_list[] = $pun_db->fetch_assoc($result);
+
+ // Setup form
+ $pun_page['fld_count'] = $pun_page['set_count'] = 0;
+ $pun_page['form_action'] = pun_link($pun_url['moderate_forum'], $fid);
+
+ $pun_page['hidden_fields'] = array(
+ '',
+ ''
+ );
+
+ // Setup breadcrumbs
+ $pun_page['crumbs'][] = array($pun_config['o_board_title'], pun_link($pun_url['index']));
+ $pun_page['crumbs'][] = array($cur_forum['forum_name'], pun_link($pun_url['forum'], $fid));
+ if ($action == 'single')
+ $pun_page['crumbs'][] = array($subject, pun_link($pun_url['topic'], $topics));
+ else
+ $pun_page['crumbs'][] = array($lang_misc['Moderate forum'], pun_link($pun_url['moderate_forum'], $fid));
+ $pun_page['crumbs'][] = ($action == 'single') ? $lang_misc['Move topic'] : $lang_misc['Move topics'];
+
+ ($hook = get_hook('mr_move_topics_pre_header_load')) ? eval($hook) : null;
+
+ define('PUN_PAGE', 'dialogue');
+ require PUN_ROOT.'header.php';
+
+?>
+
+ '1',
+ 'FROM' => 'topics AS t',
+ 'WHERE' => 't.id IN('.implode(',', $topics).') AND t.forum_id='.$fid
+ );
+
+ ($hook = get_hook('mr_qr_verify_topic_ids2')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+ if ($pun_db->num_rows($result) != substr_count($topics, ',') + 1)
+ message($lang_common['Bad request']);
+
+ // Delete the topics and any redirect topics
+ $query = array(
+ 'DELETE' => 'topics',
+ 'WHERE' => 'id IN('.$topics.') OR moved_to IN('.$topics.')'
+ );
+
+ ($hook = get_hook('mr_qr_delete_topics')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ // Delete any subscriptions
+ $query = array(
+ 'DELETE' => 'subscriptions',
+ 'WHERE' => 'topic_id IN('.$topics.')'
+ );
+
+ ($hook = get_hook('mr_qr_delete_subscriptions')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ if ($db_type != 'mysql' && $db_type != 'mysqli')
+ {
+ // Create a list of the post ID's in the deleted topic and strip the search index
+ $query = array(
+ 'SELECT' => 'p.id',
+ 'FROM' => 'posts AS p',
+ 'WHERE' => 'p.topic_id IN('.$topics.')'
+ );
+
+ ($hook = get_hook('mr_qr_get_deleted_posts')) ? eval($hook) : null;
+ $result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ $post_ids = '';
+ while ($row = $pun_db->fetch_row($result))
+ $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];
+
+ // Strip the search index provided we're not just deleting redirect topics
+ if ($post_ids != '')
+ {
+ require PUN_ROOT.'include/search_idx.php';
+ strip_search_index($post_ids);
+ }
+ }
+
+ // Delete posts
+ $query = array(
+ 'DELETE' => 'posts',
+ 'WHERE' => 'topic_id IN('.$topics.')'
+ );
+
+ ($hook = get_hook('mr_qr_delete_posts')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ sync_forum($fid);
+
+ pun_redirect(pun_link($pun_url['forum'], $fid), $lang_misc['Delete topics redirect']);
+ }
+
+
+ // Setup form
+ $pun_page['fld_count'] = $pun_page['set_count'] = 0;
+ $pun_page['form_action'] = pun_link($pun_url['moderate_forum'], $fid);
+
+ $pun_page['hidden_fields'] = array(
+ '',
+ ''
+ );
+
+ // Setup breadcrumbs
+ $pun_page['crumbs'] = array(
+ array($pun_config['o_board_title'], pun_link($pun_url['index'])),
+ array($cur_forum['forum_name'], pun_link($pun_url['forum'], $fid)),
+ array($lang_misc['Moderate forum'], pun_link($pun_url['moderate_forum'], $fid)),
+ $lang_misc['Delete topics']
+ );
+
+ ($hook = get_hook('mr_delete_topics_pre_header_load')) ? eval($hook) : null;
+
+ define('PUN_PAGE', 'dialogue');
+ require PUN_ROOT.'header.php';
+
+?>
+
+ 'topics',
+ 'SET' => 'closed='.$action,
+ 'WHERE' => 'id IN('.implode(',', $topics).') AND forum_id='.$fid
+ );
+
+ ($hook = get_hook('mr_qr_open_close_topics')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ $pun_page['redirect_msg'] = ($action) ? $lang_misc['Close topics redirect'] : $lang_misc['Open topics redirect'];
+ pun_redirect(pun_link($pun_url['moderate_forum'], $fid), $pun_page['redirect_msg']);
+ }
+ // Or just one in $_GET
+ else
+ {
+ $topic_id = ($action) ? intval($_GET['close']) : intval($_GET['open']);
+ if ($topic_id < 1)
+ message($lang_common['Bad request']);
+
+ // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
+ // If it's in GET, we need to make sure it's valid.
+ if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token(($action ? 'close' : 'open').$topic_id)))
+ csrf_confirm_form();
+
+ $query = array(
+ 'UPDATE' => 'topics',
+ 'SET' => 'closed='.$action,
+ 'WHERE' => 'id='.$topic_id.' AND forum_id='.$fid
+ );
+
+ ($hook = get_hook('mr_qr_open_close_topic')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ $pun_page['redirect_msg'] = ($action) ? $lang_misc['Close topic redirect'] : $lang_misc['Open topic redirect'];
+ pun_redirect(pun_link($pun_url['topic'], $topic_id), $pun_page['redirect_msg']);
+ }
+}
+
+
+// Stick a topic
+else if (isset($_GET['stick']))
+{
+ $stick = intval($_GET['stick']);
+ if ($stick < 1)
+ message($lang_common['Bad request']);
+
+ // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
+ // If it's in GET, we need to make sure it's valid.
+ if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('stick'.$stick)))
+ csrf_confirm_form();
+
+ ($hook = get_hook('mr_stick_topic_selected')) ? eval($hook) : null;
+
+ $query = array(
+ 'UPDATE' => 'topics',
+ 'SET' => 'sticky=1',
+ 'WHERE' => 'id='.$stick.' AND forum_id='.$fid
+ );
+
+ ($hook = get_hook('mr_qr_stick_topic')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ pun_redirect(pun_link($pun_url['topic'], $stick), $lang_misc['Stick topic redirect']);
+}
+
+
+// Unstick a topic
+else if (isset($_GET['unstick']))
+{
+ $unstick = intval($_GET['unstick']);
+ if ($unstick < 1)
+ message($lang_common['Bad request']);
+
+ // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
+ // If it's in GET, we need to make sure it's valid.
+ if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('unstick'.$unstick)))
+ csrf_confirm_form();
+
+ ($hook = get_hook('mr_unstick_topic_selected')) ? eval($hook) : null;
+
+ $query = array(
+ 'UPDATE' => 'topics',
+ 'SET' => 'sticky=0',
+ 'WHERE' => 'id='.$unstick.' AND forum_id='.$fid
+ );
+
+ ($hook = get_hook('mr_qr_unstick_topic')) ? eval($hook) : null;
+ $pun_db->query_build($query) or error(__FILE__, __LINE__);
+
+ pun_redirect(pun_link($pun_url['topic'], $unstick), $lang_misc['Unstick topic redirect']);
+}
+
+
+($hook = get_hook('mr_new_action')) ? eval($hook) : null;
+
+
+// No specific forum moderation action was specified in the query string, so we'll display the moderate forum view
+
+// Load the viewforum.php language file
+require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
+
+// Determine the topic offset (based on $_GET['p'])
+$pun_page['num_pages'] = ceil($cur_forum['num_topics'] / $pun_user['disp_topics']);
+
+$pun_page['page'] = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $pun_page['num_pages']) ? 1 : $_GET['p'];
+$pun_page['start_from'] = $pun_user['disp_topics'] * ($pun_page['page'] - 1);
+$pun_page['finish_at'] = min(($pun_page['start_from'] + $pun_user['disp_topics']), ($cur_forum['num_topics']));
+
+// Generate paging links
+$pun_page['page_post'] = ''.$lang_common['Pages'].' '.pun_paginate($pun_page['num_pages'], $pun_page['page'], $pun_url['moderate_forum'], $fid).'
';
+
+// Navigation links for header and page numbering for title/meta description
+if ($pun_page['page'] < $pun_page['num_pages'])
+{
+ $pun_page['nav'][] = '';
+ $pun_page['nav'][] = '';
+}
+if ($pun_page['page'] > 1)
+{
+ $pun_page['nav'][] = '';
+ $pun_page['nav'][] = '';
+}
+
+// Generate page information
+if ($pun_page['num_pages'] > 1)
+ $pun_page['main_info'] = ''.sprintf($lang_common['Page number'], $pun_page['page'], $pun_page['num_pages']).' '.sprintf($lang_common['Paged info'], $lang_common['Topics'], $pun_page['start_from'] + 1, $pun_page['finish_at'], $cur_forum['num_topics']);
+else
+ $pun_page['main_info'] = (($pun_db->num_rows($result)) ? sprintf($lang_common['Page info'], $lang_common['Topics'], $cur_forum['num_topics']) : $lang_forum['No topics']);
+
+// Setup form
+$pun_page['fld_count'] = 0;
+$pun_page['form_action'] = pun_link($pun_url['moderate_forum'], $fid);
+
+// Setup breadcrumbs
+$pun_page['crumbs'] = array(
+ array($pun_config['o_board_title'], pun_link($pun_url['index'])),
+ array($cur_forum['forum_name'], pun_link($pun_url['forum'], $fid)),
+ $lang_forum['Moderate forum']
+);
+
+($hook = get_hook('mr_topic_actions_pre_header_load')) ? eval($hook) : null;
+
+define('PUN_PAGE', 'modforum');
+require PUN_ROOT.'header.php';
+
+?>
+
+
+
+