PUN_MOD) message($lang_common['No permission']); // 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']); $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE id='.$get_host) or error('Impossible de retrouver l\'adresse IP', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); $ip = $db->result($result); } message('L\'adresse IP est : '.$ip.'
Le nom de l\'hôte est : '.@gethostbyaddr($ip).'

Voir plus d\'utilisateurs pour cette IP'); } // All other functions require moderator/admin access $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; if ($fid < 1) message($lang_common['Bad request']); $result = $db->query('SELECT moderators FROM '.$db->prefix.'forums WHERE id='.$fid) or error('UImpossible de retrouver les informations des forums', __FILE__, __LINE__, $db->error()); $moderators = $db->result($result); $mods_array = ($moderators != '') ? unserialize($moderators) : array(); if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_id'] != PUN_MOD || !array_key_exists($pun_user['username'], $mods_array))) message($lang_common['No permission']); // Load the misc.php language file require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php'; // All other topic moderation features require a topic id in GET if (isset($_GET['tid'])) { $tid = intval($_GET['tid']); if ($tid < 1) message($lang_common['Bad request']); // Fetch some info about the topic $result = $db->query('SELECT t.subject, t.num_replies, f.id AS forum_id, forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'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.' AND t.id='.$tid.' AND t.moved_to IS NULL') or error('UImpossible de retrouver les informations des discussions', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); $cur_topic = $db->fetch_assoc($result); // Delete one or more posts if (isset($_POST['delete_posts']) || isset($_POST['delete_posts_comply'])) { $posts = $_POST['posts']; if (empty($posts)) message($lang_misc['No posts selected']); if (isset($_POST['delete_posts_comply'])) { confirm_referrer('moderate.php'); if (preg_match('/[^0-9,]/', $posts)) message($lang_common['Bad request']); // Delete the posts $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$posts.')') or error('Impossible de supprimer les messages', __FILE__, __LINE__, $db->error()); 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 $result = $db->query('SELECT id, poster, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1') or error('Impossible de retrouver les informations du message', __FILE__, __LINE__, $db->error()); $last_post = $db->fetch_assoc($result); // How many posts did we just delete? $num_posts_deleted = substr_count($posts, ',') + 1; // Update the topic $db->query('UPDATE '.$db->prefix.'topics SET last_post='.$last_post['posted'].', last_post_id='.$last_post['id'].', last_poster=\''.$db->escape($last_post['poster']).'\', num_replies=num_replies-'.$num_posts_deleted.' WHERE id='.$tid) or error('Impossible de modifier la discussion', __FILE__, __LINE__, $db->error()); update_forum($fid); redirect('viewtopic.php?id='.$tid, $lang_misc['Delete posts redirect']); } $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Moderate']; require PUN_ROOT.'header.php'; ?>

$num_pages) ? 1 : $_GET['p']; $start_from = $pun_user['disp_posts'] * ($p - 1); // Generate paging links $paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'moderate.php?fid='.$fid.'&tid='.$tid); if ($pun_config['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$cur_topic['subject']; require PUN_ROOT.'header.php'; ?>
query('SELECT u.title, u.num_posts, g.g_id, g.g_user_title, p.id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE p.topic_id='.$tid.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Impossible de retrouver les informations du message', __FILE__, __LINE__, $db->error()); while ($cur_post = $db->fetch_assoc($result)) { $post_count++; // If the poster is a registered user. if ($cur_post['poster_id'] > 1) { $poster = ''.pun_htmlspecialchars($cur_post['poster']).''; // get_title() requires that an element 'username' be present in the array $cur_post['username'] = $cur_post['poster']; $user_title = get_title($cur_post); if ($pun_config['o_censoring'] == '1') $user_title = censor_words($user_title); } // If the poster is a guest (or a user that has been deleted) else { $poster = pun_htmlspecialchars($cur_post['poster']); $user_title = $lang_topic['Guest']; } // Switch the background color for every message. $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true; $vtbg = ($bg_switch) ? ' roweven' : ' rowodd'; // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); ?>

# 

'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')

'."\n"; ?>
1) echo '

'."\n" ?>

/>

query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Impossible de supprimer les redirections', __FILE__, __LINE__, $db->error()); // Move the topic(s) $db->query('UPDATE '.$db->prefix.'topics SET forum_id='.$move_to_forum.' WHERE id IN('.implode(',',$topics).')') or error('Impossible de déplacer la discussion', __FILE__, __LINE__, $db->error()); // Should we create redirect topics? if (isset($_POST['with_redirect'])) { while (list(, $cur_topic) = @each($topics)) { // Fetch info for the redirect topic $result = $db->query('SELECT poster, subject, posted, last_post FROM '.$db->prefix.'topics WHERE id='.$cur_topic) or error('Impossible de retrouver les informations de la discussions', __FILE__, __LINE__, $db->error()); $moved_to = $db->fetch_assoc($result); // Create the redirect topic $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, moved_to, forum_id) VALUES(\''.$db->escape($moved_to['poster']).'\', \''.$db->escape($moved_to['subject']).'\', '.$moved_to['posted'].', '.$moved_to['last_post'].', '.$cur_topic.', '.$fid.')') or error('Impossible de créer une redirection', __FILE__, __LINE__, $db->error()); } } update_forum($fid); // Update the forum FROM which the topic was moved update_forum($move_to_forum); // Update the forum TO which the topic was moved $redirect_msg = (count($topics) > 1) ? $lang_misc['Move topics redirect'] : $lang_misc['Move topic redirect']; redirect('viewforum.php?id='.$move_to_forum, $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'; } $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Moderate']; require PUN_ROOT.'header.php'; ?>

query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topics.') OR moved_to IN('.$topics.')') or error('Impossible de supprimer la discussion', __FILE__, __LINE__, $db->error()); // Delete any subscriptions $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topics.')') or error('Impossible de supprimer l\'abonnement', __FILE__, __LINE__, $db->error()); // Create a list of the post ID's in this topic and then strip the search index $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topics.')') or error('Impossible de retrouver les messages', __FILE__, __LINE__, $db->error()); $post_ids = ''; while ($row = $db->fetch_row($result)) $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0]; // We have to check that we actually have a list of post ID's since we could be deleting just a redirect topic if ($post_ids != '') strip_search_index($post_ids); // Delete posts $db->query('DELETE FROM '.$db->prefix.'posts WHERE topic_id IN('.$topics.')') or error('Impossible de supprimer les messages', __FILE__, __LINE__, $db->error()); update_forum($fid); redirect('viewforum.php?id='.$fid, $lang_misc['Delete topics redirect']); } $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Moderate']; require PUN_ROOT.'header.php'; ?>

query('UPDATE '.$db->prefix.'topics SET closed='.$action.' WHERE id IN('.implode(',', $topics).')') or error('Impossible de fermer les discussions', __FILE__, __LINE__, $db->error()); $redirect_msg = ($action) ? $lang_misc['Close topics redirect'] : $lang_misc['Open topics redirect']; redirect('moderate.php?fid='.$fid, $redirect_msg); } // Or just one in $_GET else { confirm_referrer('viewtopic.php'); $topic_id = ($action) ? intval($_GET['close']) : intval($_GET['open']); if ($topic_id < 1) message($lang_common['Bad request']); $db->query('UPDATE '.$db->prefix.'topics SET closed='.$action.' WHERE id='.$topic_id) or error('Impossible de fermer la discussion', __FILE__, __LINE__, $db->error()); $redirect_msg = ($action) ? $lang_misc['Close topic redirect'] : $lang_misc['Open topic redirect']; redirect('viewtopic.php?id='.$topic_id, $redirect_msg); } } // Stick a topic else if (isset($_GET['stick'])) { confirm_referrer('viewtopic.php'); $stick = intval($_GET['stick']); if ($stick < 1) message($lang_common['Bad request']); $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'1\' WHERE id='.$stick) or error('Impossible d\'épingler la discussion', __FILE__, __LINE__, $db->error()); redirect('viewtopic.php?id='.$stick, $lang_misc['Stick topic redirect']); } // Unstick a topic else if (isset($_GET['unstick'])) { confirm_referrer('viewtopic.php'); $unstick = intval($_GET['unstick']); if ($unstick < 1) message($lang_common['Bad request']); $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'0\' WHERE id='.$unstick) or error('Impossible de détacher la discussion', __FILE__, __LINE__, $db->error()); redirect('viewtopic.php?id='.$unstick, $lang_misc['Unstick topic redirect']); } // No specific forum moderation action was specified in the query string, so we'll display the moderator forum // Load the viewforum.php language file require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php'; // Fetch some info about the forum $result = $db->query('SELECT f.forum_name, f.redirect_url, f.num_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'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) or error('Impossible de retrouver les informations de forums', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); $cur_forum = $db->fetch_assoc($result); // Is this a redirect forum? In that case, abort! if ($cur_forum['redirect_url'] != '') message($lang_common['Bad request']); $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.pun_htmlspecialchars($cur_forum['forum_name']); require PUN_ROOT.'header.php'; // Determine the topic offset (based on $_GET['p']) $num_pages = ceil($cur_forum['num_topics'] / $pun_user['disp_topics']); $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p']; $start_from = $pun_user['disp_topics'] * ($p - 1); // Generate paging links $paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'moderate.php?fid='.$fid) ?>

query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$fid.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Impossible de retrouver la liste des discussions du forum', __FILE__, __LINE__, $db->error()); // If there are topics in this forum. if ($db->num_rows($result)) { $button_status = ''; while ($cur_topic = $db->fetch_assoc($result)) { $icon_text = $lang_common['Normal icon']; $item_status = ''; $icon_type = 'icon'; if ($cur_topic['moved_to'] == null) { $last_post = ''.format_time($cur_topic['last_post']).' '.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']); $ghost_topic = false; } else { $last_post = ' '; $ghost_topic = true; } if ($pun_config['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); if ($cur_topic['moved_to'] != 0) $subject = $lang_forum['Moved'].': '.pun_htmlspecialchars($cur_topic['subject']).''.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).''; else if ($cur_topic['closed'] == '0') $subject = ''.pun_htmlspecialchars($cur_topic['subject']).''.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).''; else { $subject = ''.pun_htmlspecialchars($cur_topic['subject']).''.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).''; $icon_text = $lang_common['Closed icon']; $item_status = 'iclosed'; } if ($cur_topic['last_post'] > $pun_user['last_visit'] && !$ghost_topic) { $icon_text .= ' '.$lang_common['New icon']; $item_status .= ' inew'; $icon_type = 'icon inew'; $subject = ''.$subject.''; $subject_new_posts = ''.$lang_common['New posts'].' ]'; } else $subject_new_posts = null; // We won't display "the dot", but we add the spaces anyway if ($pun_config['o_show_dot'] == '1') $subject = '  '.$subject; if ($cur_topic['sticky'] == '1') { $subject = ''.$lang_forum['Sticky'].': '.$subject; $item_status .= ' isticky'; $icon_text .= ' '.$lang_forum['Sticky']; } $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']); if ($num_pages_topic > 1) $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]'; else $subject_multipage = null; // Should we show the "New posts" and/or the multipage links? if (!empty($subject_new_posts) || !empty($subject_multipage)) { $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : ''); $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : ''; } ?> > '."\n"; } ?>
'.$lang_forum['Empty forum'].'

/>   />   />   />