if (!$db->num_rows($result)) { message($lang_common['Bad request']); } $cur_posting = $db->fetch_assoc($result); $forum_id = $cur_posting['id']; // Is someone trying to post into a redirect forum? if ($cur_posting['redirect_url'] != '') { message($lang_common['Bad request']); } // Sort out who the moderators are and if we are currently a moderator (or an admin) list($is_admmod, $is_c2c_board) = get_is_admmod($forum_id, $cur_posting['moderators'], $pun_user); // Do we have permission to post? if (($tid && ($cur_posting['post_replies'] == '' && $pun_user['g_post_replies'] == '0' || $cur_posting['post_replies'] == '0') || $fid && (!isset($_GET['type']) && $ptype == '0') && ($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0' || $cur_posting['post_topics'] == '0') || $fid && (isset($_GET['type']) || $ptype != '0') && ($cur_posting['post_polls'] == '' && $pun_user['g_post_polls'] == '0' || $cur_posting['post_polls'] == '0') || isset($cur_posting['closed']) && $cur_posting['closed'] == '1') && !$is_admmod || !$is_c2c_board) { message($lang_common['No permission']); } $is_comment = get_is_comment($forum_id); $can_edit_subject = !$is_comment || $is_admmod; // Load the post.php language file require PUN_ROOT . 'lang/' . $pun_user['language'] . '/post.php'; require PUN_ROOT . 'lang/' . $pun_user['language'] . '/polls.php'; // Start with a clean slate $errors = array(); $new_posts_error = false; $show_new = false; $last_read = 0; // Did someone just hit "Submit" or "Preview"? if (isset($_POST['form_sent'])) { // Make sure form_user is correct if ($pun_user['is_guest'] && $_POST['form_user'] != 'Guest' || !$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']) { message($lang_common['Bad request']); }
if ($id < 1) { message($lang_common['Bad request']); } // Fetch some info about the post, the topic and the forum $result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.id=p.topic_id INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_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 p.id=' . $id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) { message($lang_common['Bad request']); } $cur_post = $db->fetch_assoc($result); // Sort out who the moderators are and if we are currently a moderator (or an admin) list($is_admmod, $is_c2c_board) = get_is_admmod($cur_post['fid'], $cur_post['moderators'], $pun_user); // Determine whether this post is the "topic post" or not $result = $db->query('SELECT id FROM ' . $db->prefix . 'posts WHERE topic_id=' . $cur_post['tid'] . ' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); $topic_post_id = $db->result($result); $is_topic_post = $id == $topic_post_id ? true : false; $is_comment = get_is_comment($cur_post['fid']); // Do we have permission to edit this post? if (($pun_user['g_delete_posts'] == '0' || $pun_user['g_delete_topics'] == '0' && $is_topic_post || $cur_post['poster_id'] != $pun_user['id'] || $cur_post['closed'] == '1') && !$is_admmod) { message($lang_common['No permission']); } // Load the delete.php language file require PUN_ROOT . 'lang/' . $pun_user['language'] . '/delete.php'; if (isset($_POST['delete'])) { if ($is_admmod) { confirm_referrer('delete.php'); } require PUN_ROOT . 'include/search_idx.php'; if ($is_topic_post) { // Delete the topic and all of it's posts delete_topic($cur_post['tid']); update_forum($cur_post['fid']);
$result = $db->query('SELECT pf.forum_name AS parent_forum, f.parent_forum_id, t.subject, t.closed, t.num_replies, t.sticky, t.last_post, t.question, t.yes, t.no, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed 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'] . ') LEFT JOIN ' . $db->prefix . 'forums AS pf ON f.parent_forum_id=pf.id WHERE (fp.read_forum IS NULL OR fp.read_forum=1 OR fp.forum_id=1) AND t.id=' . $id . ' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error()); } else { $result = $db->query('SELECT pf.forum_name AS parent_forum, f.parent_forum_id, t.subject, t.closed, t.num_replies, t.sticky, t.question, t.yes, t.no, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies FROM ' . $db->prefix . 'topics AS t INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $pun_user['g_id'] . ') LEFT JOIN ' . $db->prefix . 'forums AS pf ON f.parent_forum_id=pf.id WHERE (fp.read_forum IS NULL OR fp.read_forum=1 OR fp.forum_id=1) AND t.id=' . $id . ' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error()); } if (!$db->num_rows($result)) { message($lang_common['Bad request']); } $cur_topic = $db->fetch_assoc($result); // Sort out who the moderators are and if we are currently a moderator (or an admin) list($is_admmod, $is_c2c_board) = get_is_admmod($cur_topic['forum_id'], $cur_topic['moderators'], $pun_user); // c2c board topic if (!$is_c2c_board) { message($lang_common['No permission']); } // If it is a comment topic, we redirect to the document if (get_is_comment($cur_topic['forum_id']) && !isset($_GET['forum'])) { $doc_param = get_doc_param($cur_topic['subject']); header('Location: ' . $doc_param[2] . $doc_param[3], true, 301); exit; } // If it is a pub forum, we don't want thatsearch engine follow links $pub_forums = explode(', ', PUB_FORUMS . ', ' . LOVE_FORUMS); $is_no_index_forum = in_array($cur_topic['forum_id'], $pub_forums); if ($is_no_index_forum) { $rel = ' rel="nofollow"'; } else { $rel = ''; } // Can we or can we not post replies? if ($cur_topic['closed'] == '0') { if ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1' || $cur_topic['post_replies'] == '1' || $is_admmod) {
} } else { update_topic($old_topic_id); update_forum($old_fid); // Update the forum FROM which the topic was moved if ($new_forum) { update_forum($new_fid); // Update the forum TO which the topic was moved } } // clear symfony cache for the corresponding docs view, diff, history.. - in order to have number of comments properly displayed if (get_is_comment($old_fid)) { $doc_param = get_doc_param($subject); c2cTools::clearCommentCache($doc_param[0], $doc_param[1]); } if (get_is_comment($fid)) { $doc_param = get_doc_param($target_subject); c2cTools::clearCommentCache($doc_param[0], $doc_param[1]); } redirect('viewtopic.php?pid=' . $post_id . '#p' . $post_id, $lang_movepost['Mark move redirect']); } else { // If multiple most must be move, you can't move all the posts at the same time if (!isset($post_ids)) { // Count the number of posts in the topic $result = $db->query('SELECT count(id) FROM ' . $db->prefix . 'posts WHERE topic_id=' . $old_topic_id) or error('Unable to count posts', __FILE__, __LINE__, $db->error()); $num_post = $db->result($result); } //Count the topics to diplayed $result = $db->query('SELECT count(id) FROM ' . $db->prefix . 'topics WHERE forum_id =' . $fid . ' AND moved_to IS NULL') or error('Unable to count topics', __FILE__, __LINE__, $db->error()); $num_topics = $db->result($result); //Not add the original topic
require PUN_ROOT . 'include/common.php'; if ($pun_user['g_read_board'] == '0') { message($lang_common['No view']); } $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if ($id < 1) { message($lang_common['Bad request']); } define('FORUM_FEED', $id); // Load the viewforum.php language file require PUN_ROOT . 'lang/' . $pun_user['language'] . '/forum.php'; require PUN_ROOT . 'lang/' . $pun_user['language'] . '/index.php'; // Load poll language file require PUN_ROOT . 'lang/' . $pun_user['language'] . '/polls.php'; $show_link_to_forum = isset($_GET['forum']) ? '&forum' : ''; $is_comment_forum = get_is_comment($id); // Fetch some info about the forum $result = $db->query('SELECT f.forum_name, f.forum_desc, pf.forum_name AS parent_forum, f.redirect_url, f.moderators, f.num_topics, f.sort_by, f.parent_forum_id, fp.post_topics, fp.post_polls 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'] . ') LEFT JOIN ' . $db->prefix . 'forums AS pf ON f.parent_forum_id=pf.id WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id=' . $id) or error('Unable to fetch forum info', __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, redirect! if ($cur_forum['redirect_url'] != '') { header('Location: ' . $cur_forum['redirect_url']); exit; } // Sort out who the moderators are and if we are currently a moderator (or an admin) list($is_admmod, $is_c2c_board) = get_is_admmod($id, $cur_forum['moderators'], $pun_user); // c2c board topic if (!$is_c2c_board) {
list($subject, $forum_id) = $db->fetch_row($result); // Should we use the internal report handling? if ($pun_config['o_report_method'] == 0 || $pun_config['o_report_method'] == 2) { $db->query('INSERT INTO ' . $db->prefix . 'reports (post_id, topic_id, forum_id, reported_by, created, message) VALUES(' . $post_id . ', ' . $topic_id . ', ' . $forum_id . ', ' . $pun_user['id'] . ', ' . time() . ', \'' . $db->escape($reason) . '\')') or error('Unable to create report', __FILE__, __LINE__, $db->error()); } // Should we e-mail the report? if ($pun_config['o_report_method'] == 1 || $pun_config['o_report_method'] == 2) { // We send it to the complete mailing-list in one swoop if ($pun_config['o_mailing_list'] != '') { $mail_subject = 'Report(' . $forum_id . ') - \'' . $subject . '\''; $mail_message = 'User \'' . $pun_user['username'] . '\' has reported the following message:' . "\n" . $pun_config['o_base_url'] . '/viewtopic.php?pid=' . $post_id . '#p' . $post_id . "\n\n" . 'Reason:' . "\n" . $reason; require PUN_ROOT . 'include/email.php'; pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); } } if (get_is_comment($forum_id)) { $doc_param = get_doc_param($subject); redirect($doc_param[2], $lang_post['Report redirect']); } else { redirect('viewtopic.php?pid=' . $post_id . '#p' . $post_id, $lang_misc['Report redirect']); } } $page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $lang_misc['Report post']; $required_fields = array('req_reason' => $lang_misc['Reason']); $focus_element = array('report', 'req_reason'); require PUN_ROOT . 'header.php'; ?> <div class="blockform"> <h2><span><?php echo $lang_misc['Report post']; ?>