Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 159 lines (123 sloc) 5.589 kB
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
1 <?php
2
e5f7b2a @reines Updating copyright notices in all files
reines authored
3 /**
7c5edc2 @reines Updating copyright notices for 2012
reines authored
4 * Copyright (C) 2008-2012 FluxBB
e5f7b2a @reines Updating copyright notices in all files
reines authored
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 */
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
8
f5ee836 @reines Changing PUN_ROOT to use absolute paths, this solves some issues with…
reines authored
9 define('PUN_ROOT', dirname(__FILE__).'/');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
10 require PUN_ROOT.'include/common.php';
11
12
13 if ($pun_user['g_read_board'] == '0')
664cb8b @franzliedke #367: Add Gettext file common.po (and .mo, too) and use that in all t…
franzliedke authored
14 message($lang->t('No view'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
15
16
17 $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
18 if ($id < 1)
664cb8b @franzliedke #367: Add Gettext file common.po (and .mo, too) and use that in all t…
franzliedke authored
19 message($lang->t('Bad request'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
20
21 // Fetch some info about the post, the topic and the forum
7c97871 @daris Updating to use new db layer
daris authored
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');
1d5d5f6 @reines Fixing some trailing whitespace
reines authored
23
861460d @daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoi…
daris authored
24 $query->innerJoin('t', 'topics AS t', 't.id = p.topic_id');
1d5d5f6 @reines Fixing some trailing whitespace
reines authored
25
861460d @daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoi…
daris authored
26 $query->innerJoin('f', 'forums AS f', 'f.id = t.forum_id');
1d5d5f6 @reines Fixing some trailing whitespace
reines authored
27
861460d @daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoi…
daris authored
28 $query->leftJoin('fp', 'forum_perms AS fp', 'fp.forum_id = f.id AND fp.group_id = :group_id');
1d5d5f6 @reines Fixing some trailing whitespace
reines authored
29
eb8ee92 @franzliedke Finish converting queries in admin_ranks.php and delete.php.
franzliedke authored
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
7c97871 @daris Updating to use new db layer
daris authored
34 $result = $query->run($params);
eb8ee92 @franzliedke Finish converting queries in admin_ranks.php and delete.php.
franzliedke authored
35 if (empty($result))
664cb8b @franzliedke #367: Add Gettext file common.po (and .mo, too) and use that in all t…
franzliedke authored
36 message($lang->t('Bad request'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
37
eb8ee92 @franzliedke Finish converting queries in admin_ranks.php and delete.php.
franzliedke authored
38 $cur_post = $result[0];
39 unset($query, $params, $result);
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
40
d2c7e7e @reines Censoring post subject on the report and delete pages
reines authored
41 if ($pun_config['o_censoring'] == '1')
42 $cur_post['subject'] = censor_words($cur_post['subject']);
43
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
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();
5ca8498 @reines Updating trunk to version 1.4. These changes have all kindly been don…
reines authored
46 $is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
47
5ca8498 @reines Updating trunk to version 1.4. These changes have all kindly been don…
reines authored
48 $is_topic_post = ($id == $cur_post['first_post_id']) ? true : false;
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
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)
664cb8b @franzliedke #367: Add Gettext file common.po (and .mo, too) and use that in all t…
franzliedke authored
56 message($lang->t('No permission'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
57
58 // Load the delete.php language file
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
59 $lang->load('delete');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
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
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
75 redirect('viewforum.php?id='.$cur_post['fid'], $lang->t('Topic del redirect'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
76 }
77 else
78 {
79 // Delete just this one post
80 delete_post($id, $cur_post['tid']);
81 update_forum($cur_post['fid']);
82
ba02891 @reines When deleting a post redirect to the previous post rather than the st…
reines authored
83 // Redirect towards the previous post
7c97871 @daris Updating to use new db layer
daris authored
84 $query = $db->select(array('id' => 'p.id'), 'posts AS p');
eb8ee92 @franzliedke Finish converting queries in admin_ranks.php and delete.php.
franzliedke authored
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;
1d5d5f6 @reines Fixing some trailing whitespace
reines authored
88
eb8ee92 @franzliedke Finish converting queries in admin_ranks.php and delete.php.
franzliedke authored
89 $params = array(':topic_id' => $cur_post['tid'], ':post_id' => $id);
1d5d5f6 @reines Fixing some trailing whitespace
reines authored
90
7c97871 @daris Updating to use new db layer
daris authored
91 $result = $query->run($params);
eb8ee92 @franzliedke Finish converting queries in admin_ranks.php and delete.php.
franzliedke authored
92 $post_id = $result[0]['id'];
93 unset($query, $params, $result);
ba02891 @reines When deleting a post redirect to the previous post rather than the st…
reines authored
94
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
95 redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang->t('Post del redirect'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
96 }
97 }
98
99
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
100 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang->t('Delete post'));
a43f248 @Quy Changed prefix to PUN for consistency.
Quy authored
101 define ('PUN_ACTIVE_PAGE', 'index');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
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">
a66809c Added class .crumbs to the breadcrumbs lists to avoid having to style…
Paul Sullivan authored
110 <ul class="crumbs">
664cb8b @franzliedke #367: Add Gettext file common.po (and .mo, too) and use that in all t…
franzliedke authored
111 <li><a href="index.php"><?php echo $lang->t('Index') ?></a></li>
8d5b6c0 @reines Replacing some entities with their UTF-8 character equivalent.
reines authored
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>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
114 <li><span&#160;</span><strong><?php echo $lang->t('Delete post') ?></strong></li>
4c725ea Tidying up the last of the breadcrumb markup.
Paul Sullivan authored
115 </ul>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
116 </div>
117 </div>
118
119 <div class="blockform">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
120 <h2><span><?php echo $lang->t('Delete post') ?></span></h2>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
121 <div class="box">
122 <form method="post" action="delete.php?id=<?php echo $id ?>">
236d72c Fixed delete post dialogue which wasn't showing parsed posts correctl…
Paul Sullivan authored
123 <div class="inform">
1d2e53c I couldn't put up with the delete.php file anymore. It was ugly, inc…
Paul authored
124 <div class="forminfo">
2ff5163 @daris Missed printf calls in delete.php and admin_bans.php
daris authored
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>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
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>
fe32df5 Fixed the error with the overflowing code box that was reported by Koos.
Tyler Brown authored
127 </div>
236d72c Fixed delete post dialogue which wasn't showing parsed posts correctl…
Paul Sullivan authored
128 </div>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
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>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
130 </form>
131 </div>
132 </div>
1d2e53c I couldn't put up with the delete.php file anymore. It was ugly, inc…
Paul authored
133
134 <div id="postreview">
135 <div class="blockpost">
2e444ca @Quy Fixed undefined variable in delete.php.
Quy authored
136 <div class="box">
1d2e53c I couldn't put up with the delete.php file anymore. It was ugly, inc…
Paul authored
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>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
156 <?php
157
158 require PUN_ROOT.'footer.php';
Something went wrong with that request. Please try again.