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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

reply.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 10.80 KiB


001  <?php
002  /***************************************************************************
003                              reply.php  -  description
004                               -------------------
005      begin                : Sat June 17 2000
006      copyright            : (C) 2000 by James Atkinson
007      email                : james@totalgeek.org
008   
009      $Id: reply.php,v 1.43 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  if($cancel) {
023      header("Location: viewtopic.$phpEx?topic=$topic&forum=$forum");
024  }
025   
026  include('functions.'.$phpEx);
027  include('config.'.$phpEx);
028  require('auth.'.$phpEx);
029  $pagetitle = "Post Reply";
030  $pagetype = "reply";
031  $sql = "SELECT forum_name, forum_access FROM forums WHERE (forum_id = '$forum')";
032  if(!$result = mysql_query($sql, $db)) {
033      die("<font size=+1>An Error Occured</font><hr>Could not connect to the forums database.");
034  }
035  $myrow = mysql_fetch_array($result);
036  $forum_name = $myrow[forum_name];
037  $forum_access = $myrow[forum_access];
038  $forum_id = $forum;
039   
040  if(is_locked($topic, $db)) {
041      echo "You cannot post a reply to this topic, it has been locked. Contact the administrator if you have any questions.";
042      require('page_tail.'.$phpEx);
043      exit();
044  }
045      
046  if(!does_exists($forum, $db, "forum") || !does_exists($topic, $db, "topic")) {
047      die("Error - The forum or topic you are attempting to post to does not exist. Please try again.");
048  }
049   
050  if($submit) {
051      if($message == '') 
052          die("You must type a message to post. You cannot post an empty message, go back and enter a message");
053      
054     if (!$user_logged_in) {
055        if($username == '' && $password == '' && $forum_access == 2) {
056       // Not logged in, and username and password are empty and forum_access is 2 (anon posting allowed)
057       $userdata = array("user_id" => -1);
058        }
059        else {
060       // no valid session, need to check user/pass.
061       if($username == '' || $password == '') {
062          include('page_header.'.$phpEx);
063          die("You must enter your username and password. Go back and do so.");
064       }
065       $md_pass = md5($password);
066       $userdata = get_userdata($username, $db);
067       if($userdata[user_level] == -1) {
068          include('page_header.'.$phpEx);
069          die("User, $userdata[username], has been removed.");
070       }
071       if($md_pass != $userdata["user_password"]) {
072          include('page_header.'.$phpEx);
073          die("You have entered an incorrect password. Go back and try again.");
074       }    
075       if($forum_access == 3 && $userdata[user_level] < 2) {
076          include('page_header.'.$phpEx);
077          die("You do not have access to post to this forum");
078       }
079       if(is_banned($userdata[user_id], "username", $db))
080         die("You have been banned from this forum. Contact the system administrator if you have any quesions.");
081        }
082        if($userdata[user_id] != -1) {
083       // You've entered your username and password, so we log you in.
084       $sessid = new_session($userdata[user_id], $REMOTE_ADDR, $sesscookietime, $db);
085       set_session_cookie($sessid, $sesscookietime, $sesscookiename, $cookiepath, $cookiedomain, $cookiesecure);
086        }
087     }
088     else {            
089        if($forum_access == 3 && $userdata[user_level] < 2) {
090       include('page_header.'.$phpEx);
091       die("You do not have access to post to this forum");
092        }
093     }
094     // Either valid user/pass, or valid session. continue with post.
095     // 
096     $poster_ip = $REMOTE_ADDR;
097     if($allow_html == 0 || isset($html)) {
098        $message = htmlspecialchars($message);
099     }
100     if($sig && $userdata[user_id] != -1) {
101        $message .= "[addsig]";
102     }
103     if($allow_bbcode == 1 && !isset($bbcode)) {
104        $message = bbencode($message);
105     }
106     $message = str_replace("\n", "<BR>", $message);
107     if(!$smile) {
108        $message = smile($message);
109     }
110     $message = make_clickable($message);
111     $message = censor_string($message, $db);
112     $message = addslashes($message);
113     $time = date("Y-m-d H:i");
114     $sql = "INSERT INTO posts (topic_id, forum_id, poster_id, post_text, post_time, poster_ip) VALUES ('$topic', '$forum', '$userdata[user_id]', '$message', '$time', '$poster_ip')";
115     if(!$result = mysql_query($sql, $db)) {
116        die("Error - Could not enter data into the database. Please go back and try again");
117     }
118     $sql = "UPDATE topics SET topic_time = '$time' WHERE topic_id = '$topic'";
119     if(!$result = mysql_query($sql, $db)) {
120        die("Error - Could not enter data into the database. Please go back and try again");
121     }
122     if($userdata["user_id"] != -1) {
123        $sql = "UPDATE users SET user_posts=user_posts+1 WHERE (user_id = $userdata[user_id])";
124        $result = mysql_query($sql, $db);
125        if (!$result) {
126       echo mysql_error() . "<br>\n";
127       die("Error updating post count.");
128        }
129     }
130     $sql = "SELECT t.topic_notify, u.user_email, u.username, u.user_id FROM topics t, users u WHERE t.topic_id = '$topic' AND t.topic_poster = u.user_id";
131     if(!$result = mysql_query($sql, $db)) {
132        die("Error - Could not query the database.");
133     }
134     $m = mysql_fetch_array($result);
135     if($m[topic_notify] == 1 && $m[user_id] != $userdata[user_id]) {
136        $subject = "A reply to your topic has been posted.";
137        $message = "Dear $m[username]\r\nYou are reciveing this email because a message you posted on $sitename forums has been replied to, and you selected";
138        $message .= " to be notified on this event.\r\n\r\nYou may view the topic at: ";
139        $message .= "$url_phpbb/viewtopic.$phpEx?topic=$topic&forum=$forum\r\nOr view the $sitename forum index at $url_phpbb/index.$phpEx";
140        $message .= "\r\n\r\nThank you for using $sitename forums. \r\nHave a nice day.\r\n$email_sig";
141        mail($m[user_email], $subject, $message, "From: $email_from\r\nX-Mailer: phpBB $phpbbversion");
142     }
143     $forward = 1;
144     include('page_header.'.$phpEx);
145     echo "Reply Posted, you will automaticly be forwarded to the topic in 3 seconds, or you can click <a href=\"viewtopic.$phpEx?topic=$topic&forum=$forum\">here</a> to view your topic";
146     
147  } else {
148     include('page_header.'.$phpEx);
149  ?>
150      <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="POST">
151      <TABLE BORDER="0" CELLPADDING="1" CELLSPACEING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="<?php echo $tablewidth?>"><TR><TD  BGCOLOR="<?php echo $table_bgcolor?>">
152      <TABLE BORDER="0" CALLPADDING="1" CELLSPACEING="1" WIDTH="100%">
153      <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
154          <TD width=25%><b>About Posting:</b></TD>
155  <?php
156          if($forum_access == 1) {
157  ?>
158                  <TD>All <b><a href="bb_register.<?php echo $phpEx?>?mode=agreement">registered</a></b> users can post new topics and replies to this forum</TD>
159  <?php
160      }
161          else if($forum_access == 2) {
162  ?>
163                  <TD><b>Anonymous users</b> can post new topics and replies in this forum. (To post anonymously simply do not enter a username or password)</TD>
164  <?php
165      }
166          else if($forum_access == 3) {
167  ?>
168                  <TD>Only <B>Moderators and Administrators</b> can post new topics and replies in this forum.</TD>
169  <?php
170      }
171  ?>
172      </TR>
173      <TR ALIGN="LEFT">
174          <TD  BGCOLOR="<?php echo $color1?>"  width=25%><b>Username:<b></TD>
175          <TD  BGCOLOR="<?php echo $color2?>">
176   
177  <?PHP
178      if ($user_logged_in) {
179          echo $userdata[username] . " \n";
180      } else {
181          echo "<INPUT TYPE=\"TEXT\" NAME=\"username\" SIZE=\"25\" MAXLENGTH=\"40\" VALUE=\"$userdata[username]\"> \n";
182      }
183  ?>
184   
185          </TD>
186      </TR>
187   
188  <?PHP
189      if (!$user_logged_in) { 
190          // no session, need a password.
191          echo "    <TR ALIGN=\"LEFT\"> \n";
192          echo "        <TD BGCOLOR=\"$color1\" width=25%><b>Password:</b><BR><font size=\"$FontSize3\"><i>(Lost your password? <a href=\"sendpassword.$phpEx\" target=\"_blank\">Click Here</a>)</i></font></TD> \n";
193          echo "        <TD BGCOLOR=\"$color2\"><INPUT TYPE=\"PASSWORD\" NAME=\"password\" SIZE=\"25\" MAXLENGTH=\"25\"></TD> \n";
194          echo "    </TR> \n";
195      }
196  ?>
197   
198      <TR ALIGN="LEFT">
199          <TD  BGCOLOR="<?php echo $color1?>" width=25%><b>Message:</b><br><br>
200          <font size=-1>
201          <?php
202          echo "HTML is: ";
203          if($allow_html == 1)
204              echo "On<BR>\n";
205          else
206              echo "Off<BR>\n";
207          echo "<a href=\"bbcode_ref.$phpEx\" TARGET=\"blank\">BBCode</a> is: ";
208          if($allow_bbcode == 1)
209              echo "On<br>\n";
210          else
211              echo "Off<BR>\n";
212   
213          if($quote) {
214              $sql = "SELECT p.post_text, p.post_time, u.username FROM posts p, users u WHERE post_id = '$post' AND p.poster_id = u.user_id";
215              if($r = mysql_query($sql, $db)) {
216                  $m = mysql_fetch_array($r);
217                  $text = desmile($m[post_text]);
218                  $text = str_replace("<BR>", "\n", $text);
219                  $text = stripslashes($text);
220                  $text = bbdecode($text);
221                  $text = str_replace("[addsig]", "", $text);
222                  $reply = "[quote]\nOn $m[post_time]$m[username] wrote:\n$text\n[/quote]";
223              }
224              else {
225                  $reply = "Error Contacting database. Please try again.\n";
226              }
227          }                
228          ?>        
229          </font></TD>
230          <TD  BGCOLOR="<?php echo $color2?>"><TEXTAREA NAME="message" ROWS=10 COLS=45 WRAP="VIRTUAL"><?php echo $reply?></TEXTAREA></TD>
231      </TR>
232      <TR ALIGN="LEFT">
233          <TD  BGCOLOR="<?php echo $color1?>" width=25%><b>Options:</b></TD>
234          <TD  BGCOLOR="<?php echo $color2?>" >
235          <?php
236              if($allow_html == 1) {
237                 if($userdata[user_html] == 1)
238                   $h = "CHECKED";
239                 
240          ?>    
241                  <INPUT TYPE="CHECKBOX" NAME="html" <?php echo $h?>>Disable HTML on this Post<BR>
242          <?php
243              }
244          ?>
245          <?php
246              if($allow_bbcode == 1) {
247                 if($userdata[user_bbcode] == 1)
248                   $b = "CHECKED";
249          ?>    
250                  <INPUT TYPE="CHECKBOX" NAME="bbcode" <?php echo $b?>>Disable <a href="bbcode_ref.<?php echo $phpEx?>" target="_blank"><i>BBCode</i></a> on this Post<BR>
251          <?php
252              }
253                          if($userdata[user_desmile] == 1)
254                             $ds = "CHECKED";
255          ?>
256   
257          <INPUT TYPE="CHECKBOX" NAME="smile" <?php echo $ds?>>Disable <a href="bb_smilies.<?php echo $phpEx?>" target="_blank"><i>smilies</i></a> on this post.<BR>
258          <?php
259              if($allow_sig == 1) {
260                  if($userdata[user_attachsig] == 1)
261                      $s = "CHECKED";
262          ?>
263                  <INPUT TYPE="CHECKBOX" NAME="sig" <?php echo $s?>>Show signature <font size=-2>(This can be altered or added in your profile)</font><BR>
264          <?php
265              }
266          ?>
267          </TD>
268      </TR>
269      <TR>
270          <TD  BGCOLOR="<?php echo $color1?>" colspan=2 ALIGN="CENTER">
271          <INPUT TYPE="HIDDEN" NAME="forum" VALUE="<?php echo $forum?>">
272          <INPUT TYPE="HIDDEN" NAME="topic" VALUE="<?php echo $topic?>">
273          <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit">&nbsp;<INPUT TYPE="RESET" VALUE="Clear">
274          &nbsp;<INPUT TYPE="SUBMIT" NAME="cancel" VALUE="Cancel Post">
275      </TR>
276      </TABLE></TD></TR></TABLE>
277      </FORM>
278      <BR>
279      <CENTER>
280  <?php     
281      echo "<a href=\"viewtopic.$phpEx?topic=$topic&forum=$forum\" target=\"_blank\"><b>Topic Review</b></a></CENTER><BR>";
282   
283  }
284  require('page_tail.'.$phpEx);
285  ?>
286