Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 158 lines (123 sloc) 5.589 kb
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
1 <?php
2
e5f7b2ab » reines
2010-02-20 Updating copyright notices in all files
3 /**
7c5edc26 » reines
2012-01-04 Updating copyright notices for 2012
4 * Copyright (C) 2008-2012 FluxBB
e5f7b2ab » reines
2010-02-20 Updating copyright notices in all files
5 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
6 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
7 */
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
8
f5ee8363 » reines
2010-12-07 Changing PUN_ROOT to use absolute paths, this solves some issues with…
9 define('PUN_ROOT', dirname(__FILE__).'/');
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
10 require PUN_ROOT.'include/common.php';
11
12
13 if ($pun_user['g_read_board'] == '0')
664cb8bb » franzliedke
2011-09-19 #367: Add Gettext file common.po (and .mo, too) and use that in all t…
14 message($lang->t('No view'));
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
15
16
17 $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
18 if ($id < 1)
664cb8bb » franzliedke
2011-09-19 #367: Add Gettext file common.po (and .mo, too) and use that in all t…
19 message($lang->t('Bad request'));
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
20
21 // Fetch some info about the post, the topic and the forum
7c978718 » daris
2011-10-27 Updating to use new db layer
22 $query = $db->select(array('fid' => 'f.id AS fid', 'forum_name' => 'f.forum_name', 'moderators' => 'f.moderators', 'redirect_url' => 'f.redirect_url', 'post_replies' => 'fp.post_replies', 'post_topics' => 'fp.post_topics', 'tid' => 't.id AS tid', 'subject' => 't.subject', 'first_post_id' => 't.first_post_id', 'closed' => 't.closed', 'posted' => 'p.posted', 'poster' => 'p.poster', 'poster_id' => 'p.poster_id', 'message' => 'p.message', 'hide_smilies' => 'p.hide_smilies'), 'posts AS p');
1d5d5f69 » reines
2011-04-04 Fixing some trailing whitespace
23
861460dd » daris
2011-11-06 PHP methods are not case sensitive, but replace InnerJoin and LeftJoi…
24 $query->innerJoin('t', 'topics AS t', 't.id = p.topic_id');
1d5d5f69 » reines
2011-04-04 Fixing some trailing whitespace
25
861460dd » daris
2011-11-06 PHP methods are not case sensitive, but replace InnerJoin and LeftJoi…
26 $query->innerJoin('f', 'forums AS f', 'f.id = t.forum_id');
1d5d5f69 » reines
2011-04-04 Fixing some trailing whitespace
27
861460dd » daris
2011-11-06 PHP methods are not case sensitive, but replace InnerJoin and LeftJoi…
28 $query->leftJoin('fp', 'forum_perms AS fp', 'fp.forum_id = f.id AND fp.group_id = :group_id');
1d5d5f69 » reines
2011-04-04 Fixing some trailing whitespace
29
eb8ee929 » franzliedke
2011-04-05 Finish converting queries in admin_ranks.php and delete.php.
30 $query->where = '(fp.read_forum IS NULL OR fp.read_forum=1) AND p.id = :post_id';
31
32 $params = array(':group_id' => $pun_user['g_id'], ':post_id' => $id);
33
7c978718 » daris
2011-10-27 Updating to use new db layer
34 $result = $query->run($params);
eb8ee929 » franzliedke
2011-04-05 Finish converting queries in admin_ranks.php and delete.php.
35 if (empty($result))
664cb8bb » franzliedke
2011-09-19 #367: Add Gettext file common.po (and .mo, too) and use that in all t…
36 message($lang->t('Bad request'));
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
37
eb8ee929 » franzliedke
2011-04-05 Finish converting queries in admin_ranks.php and delete.php.
38 $cur_post = $result[0];
39 unset($query, $params, $result);
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
40
d2c7e7ef » reines
2010-06-06 Censoring post subject on the report and delete pages
41 if ($pun_config['o_censoring'] == '1')
42 $cur_post['subject'] = censor_words($cur_post['subject']);
43
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
44 // Sort out who the moderators are and if we are currently a moderator (or an admin)
45 $mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
5ca84986 » reines
2009-01-30 Updating trunk to version 1.4. These changes have all kindly been don…
46 $is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
47
5ca84986 » reines
2009-01-30 Updating trunk to version 1.4. These changes have all kindly been don…
48 $is_topic_post = ($id == $cur_post['first_post_id']) ? true : false;
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
49
50 // Do we have permission to edit this post?
51 if (($pun_user['g_delete_posts'] == '0' ||
52 ($pun_user['g_delete_topics'] == '0' && $is_topic_post) ||
53 $cur_post['poster_id'] != $pun_user['id'] ||
54 $cur_post['closed'] == '1') &&
55 !$is_admmod)
664cb8bb » franzliedke
2011-09-19 #367: Add Gettext file common.po (and .mo, too) and use that in all t…
56 message($lang->t('No permission'));
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
57
58 // Load the delete.php language file
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
59 $lang->load('delete');
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
60
61
62 if (isset($_POST['delete']))
63 {
64 if ($is_admmod)
65 confirm_referrer('delete.php');
66
67 require PUN_ROOT.'include/search_idx.php';
68
69 if ($is_topic_post)
70 {
71 // Delete the topic and all of it's posts
72 delete_topic($cur_post['tid']);
73 update_forum($cur_post['fid']);
74
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
75 redirect('viewforum.php?id='.$cur_post['fid'], $lang->t('Topic del redirect'));
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
76 }
77 else
78 {
79 // Delete just this one post
80 delete_post($id, $cur_post['tid']);
81 update_forum($cur_post['fid']);
82
ba02891d » reines
2010-10-01 When deleting a post redirect to the previous post rather than the st…
83 // Redirect towards the previous post
7c978718 » daris
2011-10-27 Updating to use new db layer
84 $query = $db->select(array('id' => 'p.id'), 'posts AS p');
eb8ee929 » franzliedke
2011-04-05 Finish converting queries in admin_ranks.php and delete.php.
85 $query->where = 'p.topic_id = :topic_id AND p.id < :post_id';
86 $query->order = array('id' => 'p.id DESC');
87 $query->limit = 1;
1d5d5f69 » reines
2011-04-04 Fixing some trailing whitespace
88
eb8ee929 » franzliedke
2011-04-05 Finish converting queries in admin_ranks.php and delete.php.
89 $params = array(':topic_id' => $cur_post['tid'], ':post_id' => $id);
1d5d5f69 » reines
2011-04-04 Fixing some trailing whitespace
90
7c978718 » daris
2011-10-27 Updating to use new db layer
91 $result = $query->run($params);
eb8ee929 » franzliedke
2011-04-05 Finish converting queries in admin_ranks.php and delete.php.
92 $post_id = $result[0]['id'];
93 unset($query, $params, $result);
ba02891d » reines
2010-10-01 When deleting a post redirect to the previous post rather than the st…
94
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
95 redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang->t('Post del redirect'));
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
96 }
97 }
98
99
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
100 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang->t('Delete post'));
a43f248a » Quy
2010-02-07 Changed prefix to PUN for consistency.
101 define ('PUN_ACTIVE_PAGE', 'index');
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
102 require PUN_ROOT.'header.php';
103
104 require PUN_ROOT.'include/parser.php';
105 $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
106
107 ?>
108 <div class="linkst">
109 <div class="inbox">
a66809c5 » Paul Sullivan
2009-12-19 Added class .crumbs to the breadcrumbs lists to avoid having to style…
110 <ul class="crumbs">
664cb8bb » franzliedke
2011-09-19 #367: Add Gettext file common.po (and .mo, too) and use that in all t…
111 <li><a href="index.php"><?php echo $lang->t('Index') ?></a></li>
8d5b6c07 » reines
2010-05-15 Replacing some entities with their UTF-8 character equivalent.
112 <li><span>»&#160;</span><a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li>
113 <li><span>»&#160;</span><a href="viewtopic.php?pid=<?php echo $id ?>#p<?php echo $id ?>"><?php echo pun_htmlspecialchars($cur_post['subject']) ?></a></li>
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
114 <li><span>»&#160;</span><strong><?php echo $lang->t('Delete post') ?></strong></li>
4c725eac » Paul Sullivan
2009-12-05 Tidying up the last of the breadcrumb markup.
115 </ul>
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
116 </div>
117 </div>
118
119 <div class="blockform">
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
120 <h2><span><?php echo $lang->t('Delete post') ?></span></h2>
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
121 <div class="box">
122 <form method="post" action="delete.php?id=<?php echo $id ?>">
236d72cb » Paul Sullivan
2009-12-19 Fixed delete post dialogue which wasn't showing parsed posts correctl…
123 <div class="inform">
1d2e53c3 » Paul
2010-05-16 I couldn't put up with the delete.php file anymore. It was ugly, inco…
124 <div class="forminfo">
2ff5163b » daris
2011-10-30 Missed printf calls in delete.php and admin_bans.php
125 <h3><span><?php echo $lang->t($is_topic_post ? 'Topic by' : 'Reply by', '<strong>'.pun_htmlspecialchars($cur_post['poster']).'</strong>', format_time($cur_post['posted'])) ?></span></h3>
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
126 <p><?php echo ($is_topic_post) ? '<strong>'.$lang->t('Topic warning').'</strong>' : '<strong>'.$lang->t('Warning').'</strong>' ?><br /><?php echo $lang->t('Delete info') ?></p>
fe32df58 » Tyler Brown
2009-10-12 Fixed the error with the overflowing code box that was reported by Koos.
127 </div>
236d72cb » Paul Sullivan
2009-12-19 Fixed delete post dialogue which wasn't showing parsed posts correctl…
128 </div>
89d19d2c » franzliedke
2011-10-04 #498: Convert remaining front-end files to use the new language system.
129 <p class="buttons"><input type="submit" name="delete" value="<?php echo $lang->t('Delete') ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang->t('Go back') ?></a></p>
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
130 </form>
131 </div>
132 </div>
1d2e53c3 » Paul
2010-05-16 I couldn't put up with the delete.php file anymore. It was ugly, inco…
133
134 <div id="postreview">
135 <div class="blockpost">
2e444ca0 » Quy
2010-08-17 Fixed undefined variable in delete.php.
136 <div class="box">
1d2e53c3 » Paul
2010-05-16 I couldn't put up with the delete.php file anymore. It was ugly, inco…
137 <div class="inbox">
138 <div class="postbody">
139 <div class="postleft">
140 <dl>
141 <dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt>
142 <dd><span><?php echo format_time($cur_post['posted']) ?></span></dd>
143 </dl>
144 </div>
145 <div class="postright">
146 <div class="postmsg">
147 <?php echo $cur_post['message']."\n" ?>
148 </div>
149 </div>
150 </div>
151 <div class="clearer"></div>
152 </div>
153 </div>
154 </div>
155 </div>
9d653368 » Connor Dunn
2008-04-27 Initial import based on revision 1613 of PunBB.
156 <?php
157
158 require PUN_ROOT.'footer.php';
Something went wrong with that request. Please try again.