Verzeichnisstruktur phpBB-1.0.0
- Veröffentlicht
- 15.12.2000
So funktioniert es
|
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
editpost.php
001 <?php
002 /***************************************************************************
003 editpost.php - description
004 -------------------
005 begin : Sat June 17 2000
006 copyright : (C) 2000 by James Atkinson
007 email : james@totalgeek.org
008
009 $Id: editpost.php,v 1.42 2000/12/06 22:33:11 thefinn Exp $
010
011 ***************************************************************************/
012
013 /***************************************************************************
014 *
015 * This program is free software; you can redistribute it and/or modify
016 * it under the terms of the GNU General Public License as published by
017 * the Free Software Foundation; either version 2 of the License, or
018 * (at your option) any later version.
019 *
020 ***************************************************************************/
021 include('extention.inc');
022 include('functions.'.$phpEx);
023 include('config.'.$phpEx);
024 require('auth.'.$phpEx);
025 $pagetitle = "Edit Post";
026 $pagetype = "index";
027
028 if($submit) {
029 $posterdata = get_userdata_from_id($poster_id, $db);
030 $date = date("Y-m-d H:i");
031 if ($user_logged_in) {
032 // valid session.. just check it's the right user.
033 if($userdata[user_id] != $posterdata[user_id]) {
034 if ($userdata[user_level] == 1) {
035 include('page_header.'.$phpEx);
036 $die = 1;
037 }
038 else if($userdata[user_level] == 2 && !is_moderator($forum_id, $userdata[user_id], $db)) {
039 include('page_header.'.$phpEx);
040 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>You can't edit a post that's not yours.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
041 }
042 }
043 }
044 else {
045 $userdata = get_userdata($username, $db);
046 if(is_banned($userdata[user_id], "username", $db))
047 die("You have been banned from this forum. Contact the system administrator if you have any quesions.");
048
049 $md_passwd = md5($passwd);
050 if($posterdata[user_id] == $userdata[user_id]) {
051 if($md_passwd != $posterdata[user_password]) {
052 $die = 1;
053 }
054 }
055 else if($userdata[user_level] == 2 && is_moderator($forum_id, $userdata[user_id], $db)) {
056 if($md_passwd != $userdata[user_password]) {
057 $die = 1;
058 }
059 }
060 else if($userdata[user_level] > 2) {
061 if($md_passwd != $userdata[user_password]) {
062 $die = 1;
063 }
064 }
065 else {
066 $die = 1;
067 }
068 if($die != 1) {
069 // You've entered your username and password, and no problems have been found, log you in!
070 $sessid = new_session($userdata[user_id], $REMOTE_ADDR, $sesscookietime, $db);
071 set_session_cookie($sessid, $sesscookietime, $sesscookiename, $cookiepath, $cookiedomain, $cookiesecure);
072 }
073 }
074 if($die == 1) {
075 include("page_header.$phpEx");
076 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>You did not supply the correct password or do not have permission to edit this post. Please go back and try again.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
077 }
078 // IF we made it this far we are allowed to edit this message, yay!
079
080 if($allow_html == 0 || isset($html) )
081 $message = htmlspecialchars($message);
082 if($allow_bbcode == 1 && !isset($bbcode))
083 $message = bbencode($message);
084 if(!$smile)
085 $message = smile($message);
086
087 $message = str_replace("\n", "<BR>", $message);
088
089 $message .= "<BR><BR><font size=-1>[ This message was edited by: $username on $date ]</font>";
090 $message = censor_string($message, $db);
091
092 $message = addslashes($message);
093 if(!$delete) {
094 $forward = 1;
095 $topic = $topic_id;
096 $forum = $forum_id;
097 include("page_header.$phpEx");
098 $sql = "UPDATE posts SET post_text = '$message' WHERE (post_id = '$post_id')";
099 if(!$result = mysql_query($sql, $db))
100 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewdith\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>Could not connect to the database. Please check your config file.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
101 if(isset($subject)) {
102 if(!isset($notify))
103 $notify = 0;
104 else
105 $notify = 1;
106 $subject = censor_string($subject, $db);
107 $subject = addslashes($subject);
108 $sql = "UPDATE topics SET topic_title = '$subject', topic_notify = '$notify' WHERE topic_id = '$topic_id'";
109 if(!$result = mysql_query($sql, $db))
110 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>Could not connect to the database. Please check your config file.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
111 }
112 echo "<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\">";
113 echo "<TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\">";
114 echo "<TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><font face=\"Verdana\" size=\"2\"><P>";
115 echo "<P><BR><center>Your post has been updated.<ul>Click <a href=\"viewtopic.$phpEx?topic=$topic_id&forum=$forum_id\">here</a> to view the update.<P>Or click <a href=\"viewforum.$phpEx?forum=$forum_id\">here</a> to return to the forum topic listing.</ul></center><P></font>";
116 echo "</TD></TR></TABLE></TD></TR></TABLE><br>";
117 }
118 else {
119 $sql = "DELETE FROM posts WHERE post_id = '$post_id'";
120 if(!$r = mysql_query($sql, $db))
121 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>Could not connect to the database. Please check your config file.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
122 if(get_total_posts($topic_id, $db, "topic") == 0) {
123 $sql = "DELETE FROM topics WHERE topic_id = '$topic_id'";
124 if(!$r = mysql_query($sql, $db))
125 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>Could not connect to the database. Please check your config file.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
126 }
127 echo "<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\">";
128 echo "<TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\">";
129 echo "<TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><font face=\"Verdana\" size=\"2\"><P>";
130 echo "<P><BR><center>Your post has been deleted. Click <a href=\"viewforum.$phpEx?forum=$forum_id\">here</a> to return to the forum topic listing. Or click <a href=\"index.$phpEx\">here</a> to return to the forum index</center><P></font>";
131 echo "</TD></TR></TABLE></TD></TR></TABLE><br>";
132 }
133 }
134 else {
135 include('page_header.'.$phpEx);
136 $sql = "SELECT p.*, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_notify FROM posts p, users u, topics t WHERE (p.post_id = '$post_id') AND (p.topic_id = t.topic_id) AND (p.poster_id = u.user_id)";
137 if(!$result = mysql_query($sql, $db))
138 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>Could not connect to the database. Please check your config file.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
139 $myrow = mysql_fetch_array($result);
140 // Freekin' ugly but I couldn't get it to work right as 1 big if
141 // - James
142 if ($user_logged_in) {
143 if($userdata[user_level] <= 2) {
144 if($userdata[user_level] == 2 && !is_moderator($forum, $userdata[user_id], $db)) {
145 if($userdata[user_level] < 2 && ($userdata[user_id] != $myrow[user_id]))
146 die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\"><TR><TD BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\"><TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><p><br><font face=\"Verdana\" size=\"+1\">Error:</font><font face=\"Verdana\" size=\"2\"><ul>You can't edit a post that's not yours.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
147 }
148 }
149 }
150
151 $message = $myrow[post_text];
152 if(eregi("\[addsig]$", $message))
153 $addsig = 1;
154 else
155 $addsig = 0;
156 $message = eregi_replace("\[addsig]$", "\n-----------------\n" . $myrow[user_sig], $message);
157 $message = str_replace("<BR>", "\n", $message);
158 $message = stripslashes($message);
159 $message = desmile($message);
160 $message = bbdecode($message);
161 $message = undo_htmlspecialchars($message);
162 list($day, $time) = split(" ", $myrow[post_time]);
163 ?>
164 <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="POST">
165 <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="<?php echo $tablewidth?>"><TR><TD BGCOLOR="<?php echo $table_bgcolor?>">
166 <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1" WIDTH="100%">
167 <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
168 <TD ALIGN="CENTER" COLSPAN="2">Editing Post</TD>
169 </TR>
170 <?php
171 if(!$user_logged_in) {
172 ?>
173 <TR>
174 <TD BGCOLOR="<?php echo $color1?>">Username:</TD>
175 <TD BGCOLOR="<?php echo $color2?>"><input type="text" name="username" value="<?php echo $userdata[username]?>"></TD>
176 </TR>
177 <?PHP
178 }
179 else {
180 ?>
181 <TD BGCOLOR="<?php echo $color1?>">Username:</TD>
182 <TD BGCOLOR="<?php echo $color2?>"><?php echo $userdata[username]?></TD>
183 <?php
184 }
185 if (!$user_logged_in) {
186 // ask for a password..
187 echo "<TR> \n";
188 echo "<TD BGCOLOR=\"$color1\">Password:<BR><font size=\"$FontSize3\"><i>(Lost your password? <a href=\"sendpassword.$phpEx\" target=\"_blank\">Click Here</a>)</i></font></TD>";
189 echo "<TD BGCOLOR=\"$color2\"><INPUT TYPE=\"PASSWORD\" NAME=\"passwd\" SIZE=\"25\" MAXLENGTH=\"25\"></TD> \n";
190 echo "</TR> \n";
191 }
192 $first_post = is_first_post($topic, $post_id, $db);
193 if($first_post) {
194 ?>
195 <TR>
196 <TD BGCOLOR="<?php echo $color1?>" width=25%><b>Subject:</b></TD>
197 <TD BGCOLOR="<?php echo $color2?>"><INPUT TYPE="TEXT" NAME="subject" SIZE="50" MAXLENGTH="100" VALUE="<?php echo stripslashes($myrow[topic_title])?>"></TD>
198 </TR>
199 <?php
200 }
201 ?>
202 <TR>
203 <TD BGCOLOR="<?php echo $color1?>" width=25%><b>Message:</b><br><br>
204 <font size=-1>
205 <?php
206 echo "HTML is: ";
207 if($allow_html == 1)
208 echo "On<BR>\n";
209 else
210 echo "Off<BR>\n";
211 echo "<a href=\"bbcode_ref.$phpEx\" TARGET=\"blank\">BBCode</a> is: ";
212 if($allow_bbcode == 1)
213 echo "On<br>\n";
214 else
215 echo "Off<BR>\n";
216 ?>
217 </font></TD>
218 <TD BGCOLOR="<?php echo $color2?>"><TEXTAREA NAME="message" ROWS=10 COLS=45 WRAP="VIRTUAL"><?php echo $message?></TEXTAREA></TD>
219 </TR>
220 <TR ALIGN="LEFT">
221 <TD BGCOLOR="<?php echo $color1?>" width=25%><b>Options:</b></TD>
222 <TD BGCOLOR="<?php echo $color2?>" >
223 <?php
224 $now_hour = date("H");
225 $now_min = date("i");
226 list($hour, $min) = split(":", $time);
227 if((($now_hour == $hour && $min_now - 30 < $min) || ($now_hour == $hour +1 && $now_min - 30 > 0)) || ($userdata[user_level] > 2 || is_moderator($forum, $userdata[user_id], $db))) {
228 ?>
229 <INPUT TYPE="CHECKBOX" NAME="delete">Delete this Post<BR>
230 <?php
231 }
232
233 if($allow_html == 1) {
234 if($userdata[user_html] == 1)
235 $h = "CHECKED";
236 ?>
237 <INPUT TYPE="CHECKBOX" NAME="html" <?php echo $h?>>Disable HTML on this Post<BR>
238 <?php
239 }
240
241 if($allow_bbcode == 1) {
242 if($userdata[user_bbcode] == 1)
243 $b = "CHECKED";
244 ?>
245 <INPUT TYPE="CHECKBOX" NAME="bbcode" <?php echo $b?>>Disable BBCode on this Post<BR>
246 <?php
247 }
248 if($userdata[user_desmile] == 1)
249 $ds = "CHECKED";
250 ?>
251
252 <INPUT TYPE="CHECKBOX" NAME="smile" <?php echo $ds?>>Disable smilies on this post.<BR>
253 <?php
254 if($first_post) {
255 if($myrow[topic_notify] == 1)
256 $chk = "CHECKED";
257 ?>
258 <INPUT TYPE="CHECKBOX" NAME="notify" <?php echo $chk?>>Notify by email when replies are posted
259 <?php
260 }
261 ?>
262 </TD>
263 </TR>
264 <TR>
265 <TD BGCOLOR="<?php echo $color1?>" colspan=2 ALIGN="CENTER">
266 <?php if($user_logged_in) {
267 ?>
268 <INPUT TYPE="HIDDEN" NAME="username" VALUE="<?php echo $userdata[username]?>">
269 <?php
270 }
271 ?>
272 <INPUT TYPE="HIDDEN" NAME="post_id" VALUE="<?php echo $post_id?>">
273 <INPUT TYPE="HIDDEN" NAME="forum_id" VALUE="<?php echo $forum?>">
274 <INPUT TYPE="HIDDEN" NAME="topic_id" VALUE="<?php echo $topic?>">
275 <INPUT TYPE="HIDDEN" NAME="poster_id" VALUE="<?php echo $myrow[poster_id]?>">
276 <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit"> <INPUT TYPE="RESET" VALUE="Clear">
277 </TR>
278 </TABLE></TD></TR></TABLE>
279 <?php
280 }
281 include('page_tail.'.$phpEx);
282 ?>
283