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

newtopic.php

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


001  <?php
002  /***************************************************************************
003                              newtopic.php  -  description
004                               -------------------
005      begin                : Sat June 17 2000
006      copyright            : (C) 2000 by James Atkinson
007      email                : james@totalgeek.org
008   
009      $Id: newtopic.php,v 1.36 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: viewforum.$phpEx?forum=$forum");
024  }
025   
026  include('functions.'.$phpEx);
027  include('config.'.$phpEx);
028  require('auth.'.$phpEx);
029  $pagetitle = "New Topic";
030  $pagetype = "newtopic";
031  $sql = "SELECT forum_name, forum_access FROM forums WHERE (forum_id = '$forum')";
032  if(!$result = mysql_query($sql, $db))
033      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 forums database.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
034  $myrow = mysql_fetch_array($result);
035  $forum_name = $myrow[forum_name];
036  $forum_access = $myrow[forum_access];
037  $forum_id = $forum;
038   
039  if(!does_exists($forum, $db, "forum")) {
040      die("<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"95%\"><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>The forum you are attempting to post to does not exist. Please try again.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
041  }
042   
043  if($submit) {
044     if($message == '') 
045       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 must type a message to post. You cannot post an empty topic, go back and enter a message</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
046     if($subject == '')
047       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>All Topics must have a subject. Go back and enter one.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
048     
049     if (!$user_logged_in) {
050        if($username == '' && $password == '' && $forum_access == 2) {
051       // Not logged in, and username and password are empty and forum_access is 2 (anon posting allowed)
052       $userdata = array("user_id" => -1); 
053        }
054        else {
055       // no valid session, need to check user/pass.
056       if($username == '' || $password == '') {
057          include('page_header.'.$phpEx);
058          die("You must enter your username and password. Go back and do so.");
059       }
060       $md_pass = md5($password);
061       $userdata = get_userdata($username, $db);
062       if($userdata[user_level] == -1) {
063          include('page_header.'.$phpEx);
064          die("User $userdata[username] has been removed.");
065       }
066       if($md_pass != $userdata["user_password"]) {
067          include('page_header.'.$phpEx);
068          die("You have entered an incorrect password. Go back and try again.");
069       }
070       if($forum_access == 3 && $userdata[user_level] < 2) {
071          include('page_header.'.$phpEx);
072          die("You do not have access to post to this forum");
073       }
074       if(is_banned($userdata[user_id], "username", $db))
075         die("You have been banned from this forum. Contact the system administrator if you have any quesions.");
076        }
077        if($userdata[user_id] != -1) {
078       // You've entered your password and username, we log you in.
079       $sessid = new_session($userdata[user_id], $REMOTE_ADDR, $sesscookietime, $db);
080       set_session_cookie($sessid, $sesscookietime, $sesscookiename, $cookiepath, $cookiedomain, $cookiesecure);
081        }
082     }
083     else {
084        if($forum_access == 3 && $userdata[user_level] < 2) {
085       include('page_header.'.$phpEx);
086       die("You do not have access to post to this forum");
087        }
088     }
089     // Either valid user/pass, or valid session. continue with post.
090      
091     if($allow_html == 0 || isset($html))
092       $message = htmlspecialchars($message);
093     if($sig && $userdata[user_id] != -1) {
094        $message .= "[addsig]";
095     }
096     if($allow_bbcode == 1 && !($HTTP_POST_VARS[bbcode]))
097       $message = bbencode($message);
098     $message = str_replace("\n", "<BR>", $message);
099     if(!$smile) {
100        $message = smile($message);
101     }
102     $message = make_clickable($message);
103   
104     $message = censor_string($message, $db);
105     $message = addslashes($message);
106     $subject = strip_tags($subject);
107     $subject = censor_string($subject, $db);
108     $subject = addslashes($subject);
109     $poster_ip = $REMOTE_ADDR;
110     $time = date("Y-m-d H:i");
111     $sql = "INSERT INTO topics (topic_title, topic_poster, forum_id, topic_time, topic_notify) VALUES ('$subject', '$userdata[user_id]', '$forum', '$time'";
112     if(isset($notify) && $userdata[user_id] != -1)    
113       $sql .= ", '1'";
114     else
115       $sql .= ", '0'";
116     $sql .= ")";
117     if(!$result = mysql_query($sql, $db)) {
118        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 enter data into the database. Please go back and try again.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
119     }
120     $topic_id = mysql_insert_id();
121     $sql = "INSERT INTO posts (topic_id, forum_id, poster_id, post_text, post_time, poster_ip) VALUES ('$topic_id', '$forum', '$userdata[user_id]', '$message', '$time', '$poster_ip')";
122     if(!$result = mysql_query($sql, $db)) {
123        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 enter data into the database. Please go back and try again.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
124     }
125     if($userdata[user_id] != -1) {
126        $sql = "UPDATE users SET user_posts=user_posts+1 WHERE (user_id = $userdata[user_id])";
127        $result = mysql_query($sql, $db);
128        if (!$result) {
129       echo mysql_error() . "<br>\n";
130       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 update post count.</ul><P></font></TD></TR></TABLE></TD></TR></TABLE><br>");
131        }
132     }
133     $forward = 1;
134     $topic = $topic_id;
135     include('page_header.'.$phpEx);
136     echo "<br><TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACEING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"$tablewidth\">";
137     echo "<TR><TD  BGCOLOR=\"$table_bgcolor\"><TABLE BORDER=\"0\" CALLPADDING=\"1\" CELLSPACEING=\"1\" WIDTH=\"100%\">";
138     echo "<TR BGCOLOR=\"$color1\" ALIGN=\"LEFT\"><TD><font face=\"Verdana\" size=\"2\"><P>";
139     echo "<P><BR><center>Your Topic Has Been Posted<P>Please click <a href=\"viewtopic.$phpEx?topic=$topic_id&forum=$forum\">here</a> to view your post.</center><P></font>";
140     echo "</TD></TR></TABLE></TD></TR></TABLE><br>";
141     
142     
143  } else {
144     include('page_header.'.$phpEx);
145  ?>
146   
147      <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="POST">
148      <TABLE BORDER="0" CELLPADDING="1" CELLSPACING=0" ALIGN="CENTER" VALIGN="TOP" WIDTH="<?php echo $tablewidth?>"><TR><TD  BGCOLOR="<?php echo $table_bgcolor?>">
149      <TABLE BORDER="0" CELLPADDING="1" CELLSPACING=1" WIDTH="100%">
150      <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
151          <TD width=25%><b>About Posting:</b></TD>
152  <?php
153      if($forum_access == 1) {
154  ?>
155          <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>
156  <?php
157      }
158      else if($forum_access == 2) {
159  ?>
160          <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>
161  <?php
162      }
163      else if($forum_access == 3) {
164  ?>
165          <TD>Only <B>Moderators and Administrators</b> can post new topics and replies in this forum.</TD>
166  <?php
167      }
168  ?>
169      </TR>
170      <TR ALIGN="LEFT">
171          <TD  BGCOLOR="<?php echo $color1?>"  width=25%><b>Username:<b></TD>
172          <TD  BGCOLOR="<?php echo $color2?>">
173  <?PHP
174      if ($user_logged_in) {
175          echo $userdata[username] . " \n";
176      } else {
177          echo "<INPUT TYPE=\"TEXT\" NAME=\"username\" SIZE=\"25\" MAXLENGTH=\"40\" VALUE=\"$userdata[username]\"> \n";
178      }
179  ?>
180   
181          </TD>
182      </TR>
183   
184  <?PHP
185      if (!$user_logged_in) { 
186          // no session, need a password.
187          echo "    <TR ALIGN=\"LEFT\"> \n";
188          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";
189          echo "        <TD BGCOLOR=\"$color2\"><INPUT TYPE=\"PASSWORD\" NAME=\"password\" SIZE=\"25\" MAXLENGTH=\"25\"></TD> \n";
190          echo "    </TR> \n";
191      }
192  ?>
193   
194      <TR ALIGN="LEFT">
195          <TD  BGCOLOR="<?php echo $color1?>" width=25%><b>Subject:</b></TD>
196          <TD  BGCOLOR="<?php echo $color2?>"> <INPUT TYPE="TEXT" NAME="subject" SIZE="50" MAXLENGTH="100"></TD>
197      </TR>
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.<?php echo $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          </font></TD>
214          <TD  BGCOLOR="<?php echo $color2?>"><TEXTAREA NAME="message" ROWS=10 COLS=45 WRAP="VIRTUAL"></TEXTAREA></TD>
215      </TR>
216      <TR ALIGN="LEFT">
217          <TD  BGCOLOR="<?php echo $color1?>" width=25%><b>Options:</b></TD>
218          <TD  BGCOLOR="<?php echo $color2?>" >
219          <?php
220              if($allow_html == 1) {
221                 if($userdata[user_html] == 1)
222                   $h = "CHECKED";
223          ?>    
224                  <INPUT TYPE="CHECKBOX" NAME="html" <?php echo $h?>>Disable HTML on this Post<BR>
225          <?php
226              }
227          ?>
228          <?php
229              if($allow_bbcode == 1) {
230                 if($userdata[user_bbcode] == 1)
231                   $b = "CHECKED";
232          ?>    
233                  <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>
234          <?php
235              }
236                          if($userdata[user_desmile] == 1)
237                             $ds = "CHECKED";
238          ?>
239   
240          <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>
241          <?php
242              if($allow_sig == 1) {
243                  if($userdata[user_attachsig] == 1)
244                      $s = "CHECKED";
245          ?>
246                  <INPUT TYPE="CHECKBOX" NAME="sig" <?php echo $s?>>Show signature <font size=-2>(This can be altered or added in your profile)</font><BR>
247          <?php
248              }
249          ?>
250          <INPUT TYPE="CHECKBOX" NAME="notify">Notify by email when replies are posted<BR>
251          </TD>
252      </TR>
253      <TR>
254          <TD  BGCOLOR="<?php echo $color1?>" colspan=2 ALIGN="CENTER">
255          <INPUT TYPE="HIDDEN" NAME="forum" VALUE="<?php echo $forum?>">
256          <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit">&nbsp;<INPUT TYPE="RESET" VALUE="Clear">
257          &nbsp;<INPUT TYPE="SUBMIT" NAME="cancel" VALUE="Cancel Post">
258          </FORM>
259      </TR>
260      </TABLE></TD></TR></TABLE>
261   
262  <?php
263  }
264  require('page_tail.'.$phpEx);
265  ?>
266