'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.first_post_id, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies', 'FROM' => 'posts AS p', 'JOINS' => array( array( 'INNER JOIN' => 'topics AS t', 'ON' => 't.id=p.topic_id' ), array( 'INNER JOIN' => 'forums AS f', 'ON' => 'f.id=t.forum_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 p.id='.$id ); ($hook = get_hook('dl_qr_get_post_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_post = $pun_db->fetch_assoc($result); // Sort out who the moderators are and if we are currently a moderator (or an admin) $mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array(); $pun_page['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; $cur_post['is_topic'] = ($id == $cur_post['first_post_id']) ? true : false; // Do we have permission to delete this post? if (($pun_user['g_delete_posts'] == '0' || ($pun_user['g_delete_topics'] == '0' && $cur_post['is_topic']) || $cur_post['poster_id'] != $pun_user['id'] || $cur_post['closed'] == '1') && !$pun_page['is_admmod']) message($lang_common['No permission']); // User pressed the cancel button if (isset($_POST['cancel'])) redirect(pun_link($pun_url['post'], $id), $lang_common['Cancel redirect']); // User pressed the delete button else if (isset($_POST['delete'])) { ($hook = get_hook('dl_form_submitted')) ? eval($hook) : null; if (isset($_POST['req_confirm'])) { if ($cur_post['is_topic']) { // Delete the topic and all of it's posts delete_topic($cur_post['tid'], $cur_post['fid']); redirect(pun_link($pun_url['forum'], array($cur_post['fid'], sef_friendly($cur_post['forum_name']))), $lang_delete['Topic del redirect']); } else { // Delete just this one post delete_post($id, $cur_post['tid'], $cur_post['fid']); redirect(pun_link($pun_url['topic'], array($cur_post['tid'], sef_friendly($cur_post['subject']))), $lang_delete['Post del redirect']); } } else redirect(pun_link($pun_url['post'], $id), $lang_common['No confirm redirect']); } // Run the post through the parser require PUN_ROOT.'include/parser.php'; $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); // Setup form $pun_page['set_count'] = $pun_page['fld_count'] = 0; $pun_page['form_action'] = pun_link($pun_url['delete'], $id); $pun_page['hidden_fields'][] = ''; if ($pun_user['is_admmod']) $pun_page['hidden_fields'][] = ''; // Setup form information $pun_page['frm_info'] = array( '