Forum - New Thread - Parse error

Hier könnt Ihr fragen zu PHP Scriptproblemen diskutieren. Auch Anfängerfragen in Sachen PHP können hier gestellt werden.

Forum - New Thread - Parse error

Beitragvon -Dark-Emperor- am Sa, 16:15:57 20.03.10

http://darkemperor.bplaced.de/filemanager/files/forum/post.php?action=newthread&forum_id=2

Da liegt das Problem!
Ich kann in diesem Forum keine neuen Beiträge erstellen!
Parse error: syntax error, unexpected '}' in /users/darkemperor/www/filemanager/files/forum/postnewthread.php on line 174


  1. <?php
  2. /*-------------------------------------------------------+
  3. | PHP-Fusion Content Management System
  4. | Copyright (C) 2002 - 2008 Nick Jones
  5. | http://www.php-fusion.co.uk/
  6. +--------------------------------------------------------+
  7. | Filename: postnewthread.php
  8. | Author: Nick Jones (Digitanium)
  9. +--------------------------------------------------------+
  10. | This program is released as free software under the
  11. | Affero GPL license. You can redistribute it and/or
  12. | modify it under the terms of this license which you
  13. | can read by viewing the included agpl.txt or online
  14. | at www.gnu.org/licenses/agpl.html. Removal of this
  15. | copyright header is strictly prohibited without
  16. | written permission from the original author(s).
  17. +--------------------------------------------------------*/
  18. if (!defined("IN_FUSION")) { die("Access Denied"); }
  19.  
  20. if (isset($_POST['previewpost']) || isset($_POST['add_poll_option'])) {
  21.         $subject = trim(stripinput(censorwords($_POST['subject'])));
  22.         $message = trim(stripinput(censorwords($_POST['message'])));
  23.         $sticky_thread_check = isset($_POST['sticky_thread']) ? " checked='checked'" : "";
  24.         $lock_thread_check = isset($_POST['lock_thread']) ? " checked='checked'" : "";
  25.         $sig_checked = isset($_POST['show_sig']) ? " checked='checked'" : "";
  26.         $disable_smileys_check = isset($_POST['disable_smileys']) || preg_match("#\[code\](.*?)\[/code\]#si", $message) ? " checked='checked'" : "";
  27.         if ($settings['thread_notify']) { $notify_checked = isset($_POST['notify_me']) ? " checked='checked'" : ""; }
  28.  
  29.         if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  30.                 $poll_title = trim(stripinput(censorwords($_POST['poll_title'])));
  31.                 if (isset($_POST['poll_options']) && is_array($_POST['poll_options'])) {
  32.                         $poll_opts = array();
  33.                         foreach ($_POST['poll_options'] as $poll_option) {
  34.                                 if ($poll_option) { $poll_opts[] = stripinput($poll_option); }
  35.                         }
  36.                 } else {
  37.                         $poll_opts = array();
  38.                 }
  39.                 if (isset($_POST['add_poll_option'])) {
  40.                         if (count($poll_opts)) { array_push($poll_opts, ""); }
  41.                 }
  42.         }
  43.  
  44.         if (isset($_POST['previewpost'])) {
  45.                 if ($subject == "") { $subject = $locale['420']; }
  46.                 if ($message == "") {
  47.                         $previewmessage = $locale['421'];
  48.                 } else {
  49.                         $previewmessage = $message;
  50.                         if ($sig_checked) { $previewmessage = $previewmessage."\n\n".$userdata['user_sig']; }
  51.                         if (!$disable_smileys_check) { $previewmessage = parsesmileys($previewmessage); }
  52.                         $previewmessage = parseubb($previewmessage);
  53.                         $previewmessage = nl2br($previewmessage);
  54.                 }
  55.                 //$is_mod = iMOD && iUSER < "102" ? true : false;
  56.                 opentable($locale['400']);
  57.                 echo "<div class='tbl2' style='margin-bottom:5px'><span class='small'><a href='index.php'>".$settings['sitename']."</a> :: ".$caption."</span></div>\n";
  58.  
  59.                 if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  60.                         if ((isset($poll_title) && $poll_title) && (isset($poll_opts) && is_array($poll_opts))) {
  61.                                 echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border' style='margin-bottom:5px'>\n<tr>\n";
  62.                                 echo "<td align='center' class='tbl2'><strong>".$poll_title."</strong></td>\n</tr>\n<tr>\n<td class='tbl1'>\n";
  63.                                 echo "<table align='center' cellpadding='0' cellspacing='0'>\n";
  64.                                 foreach ($poll_opts as $poll_option) {
  65.                                         echo "<tr>\n<td class='tbl1'><input type='radio' name='poll_option' value='$i' style='vertical-align:middle;' /> ".$poll_option."</td>\n</tr>\n";
  66.                                         $i++;
  67.                                 }
  68.                                 echo "</table>\n</td>\n</tr>\n</table>\n";
  69.                         }
  70.                 }
  71.                 echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
  72.                 echo "<td colspan='2' class='tbl2'><strong>".$subject."</strong></td>\n</tr>\n";
  73.                 echo "<tr>\n<td class='tbl2' style='width:140px;'><a href='../profile.php?lookup=".$userdata['user_id']."'>".$userdata['user_name']."</a></td>\n";
  74.                 echo "<td class='tbl2'>".$locale['426'].showdate("forumdate", time())."</td>\n";
  75.                 echo "</tr>\n<tr>\n<td valign='top' width='140' class='tbl2'>\n";
  76.                 if ($userdata['user_avatar'] && file_exists(IMAGES."avatars/".$userdata['user_avatar'])) {
  77.                         echo "<img src='".IMAGES."avatars/".$userdata['user_avatar']."' alt='' /><br /><br />\n";
  78.                 }
  79.                 echo "<span class='small'>".getuserlevel($userdata['user_level'])."</span><br /><br />\n";
  80.                 echo "<span class='small'><strong>".$locale['423']."</strong> ".$userdata['user_posts']."</span><br />\n";
  81.                 echo "<span class='small'><strong>".$locale['425']."</strong> ".showdate("%d.%m.%y", $userdata['user_joined'])."</span><br />\n";
  82.                 echo "<br /></td>\n<td valign='top' class='tbl1'>".$previewmessage."</td>\n";
  83.                 echo "</tr>\n</table>\n";
  84.                 closetable();
  85.         }
  86. }
  87. if (isset($_POST['postnewthread'])) {
  88.         $subject = trim(stripinput(censorwords($_POST['subject'])));
  89.         $message = trim(stripinput(censorwords($_POST['message'])));
  90.         $flood = false; $error = 0;
  91.         $sticky_thread = isset($_POST['sticky_thread']) && (iMOD || iSUPERADMIN) ? 1 : 0;
  92.         $lock_thread = isset($_POST['lock_thread']) && (iMOD || iSUPERADMIN) ? 1 : 0;
  93.         $sig = isset($_POST['show_sig']) ? 1 : 0;
  94.         $smileys = isset($_POST['disable_smileys']) || preg_match("#\[code\](.*?)\[/code\]#si", $message) ? 0 : 1;
  95.         $thread_poll = 0;
  96.  
  97.         if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  98.                 if (isset($_POST['poll_options']) && is_array($_POST['poll_options'])) {
  99.                         foreach ($_POST['poll_options'] as $poll_option) {
  100.                                 if (trim($poll_option)) { $poll_opts[] = trim(stripinput(censorwords($poll_option))); }
  101.                                 unset($poll_option);
  102.                         }
  103.                 }
  104.                 $thread_poll = (trim($_POST['poll_title']) && (isset($poll_opts) && is_array($poll_opts)) ? 1 : 0);
  105.         }
  106.  
  107.         if (iMEMBER) {
  108.                 if ($subject != "" && $message != "") {
  109.                         require_once INCLUDES."flood_include.php";
  110.                         if (!flood_control("post_datestamp", DB_POSTS, "post_author='".$userdata['user_id']."'")) {
  111.                                 $result = dbquery("INSERT INTO ".DB_THREADS." (forum_id, thread_subject, thread_author, thread_views, thread_lastpost, thread_lastpostid, thread_lastuser, thread_postcount, thread_poll, thread_sticky, thread_locked) VALUES('".$_GET['forum_id']."', '$subject', '".$userdata['user_id']."', '0', '".time()."', '0', '".$userdata['user_id']."', '1', '".$thread_poll."', '".$sticky_thread."', '".$lock_thread."')");
  112.                                 $thread_id = mysql_insert_id();
  113.                                 $result = dbquery("INSERT INTO ".DB_POSTS." (forum_id, thread_id, post_message, post_showsig, post_smileys, post_author, post_datestamp, post_ip, post_edituser, post_edittime) VALUES ('".$_GET['forum_id']."', '".$thread_id."', '".$message."', '".$sig."', '".$smileys."', '".$userdata['user_id']."', '".time()."', '".USER_IP."', '0', '0')");
  114.                                 $post_id = mysql_insert_id();
  115.                                 $result = dbquery("UPDATE ".DB_FORUMS." SET forum_lastpost='".time()."', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastuser='".$userdata['user_id']."' WHERE forum_id='".$_GET['forum_id']."'");
  116.                                 $result = dbquery("UPDATE ".DB_THREADS." SET thread_lastpostid='".$post_id."' WHERE thread_id='".$thread_id."'");
  117.                                 $result = dbquery("UPDATE ".DB_USERS." SET user_posts=user_posts+1 WHERE user_id='".$userdata['user_id']."'");
  118.                                 if ($settings['thread_notify'] && isset($_POST['notify_me'])) { $result = dbquery("INSERT INTO ".DB_THREAD_NOTIFY." (thread_id, notify_datestamp, notify_user, notify_status) VALUES('".$thread_id."', '".time()."', '".$userdata['user_id']."', '1')"); }
  119.  
  120.                                 if (($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) && $thread_poll) {
  121.                                         $poll_title = trim(stripinput(censorwords($_POST['poll_title'])));
  122.                                         if ($poll_title && (isset($poll_opts) && is_array($poll_opts))) {
  123.                                                 $result = dbquery("INSERT INTO ".DB_FORUM_POLLS." (thread_id, forum_poll_title, forum_poll_start, forum_poll_length, forum_poll_votes) VALUES('".$thread_id."', '".$poll_title."', '".time()."', '0', '0')");
  124.                                                 $forum_poll_id = mysql_insert_id();
  125.                                                 $i = 1;
  126.                                                 foreach ($poll_opts as $poll_option) {
  127.                                                         $result = dbquery("INSERT INTO ".DB_FORUM_POLL_OPTIONS." (thread_id, forum_poll_option_id, forum_poll_option_text, forum_poll_option_votes) VALUES('".$thread_id."', '".$i."', '".$poll_option."', '0')");
  128.                                                         $i++;
  129.                                                 }
  130.                                         }
  131.                                 }
  132.  
  133.                                 if ($fdata['forum_attach'] && checkgroup($fdata['forum_attach'])) {
  134.                                         $attach = $_FILES['attach'];
  135.                                         if ($attach['name'] != "" && !empty($attach['name']) && is_uploaded_file($attach['tmp_name'])) {
  136.                                                 $attachname = substr($attach['name'], 0, strrpos($attach['name'], "."));
  137.                                                 $attachext = strtolower(strrchr($attach['name'],"."));
  138.                                                 if (preg_match("/^[-0-9A-Z_\[\]]+$/i", $attachname) && $attach['size'] <= $settings['attachmax']) {
  139.                                                         $attachtypes = explode(",", $settings['attachtypes']);
  140.                                                         if (in_array($attachext, $attachtypes)) {
  141.                                                                 $attachname = attach_exists(strtolower($attach['name']));
  142.                                                                 move_uploaded_file($attach['tmp_name'], FORUM."attachments/".$attachname);
  143.                                                                 chmod(FORUM."attachments/".$attachname,0644);
  144.                                                                 if (in_array($attachext, $imagetypes) && (!@getimagesize(FORUM."attachments/".$attachname) || !@verify_image(FORUM."attachments/".$attachname))) {
  145.                                                                         unlink(FORUM."attachments/".$attachname);
  146.                                                                         $error = 1;
  147.                                                                 }
  148.                                                                 if (!$error) { $result = dbquery("INSERT INTO ".DB_FORUM_ATTACHMENTS." (thread_id, post_id, attach_name, attach_ext, attach_size) VALUES ('".$thread_id."', '".$post_id."', '$attachname', '$attachext', '".$attach['size']."')"); }
  149.                                                         } else {
  150.                                                                 @unlink($attach['tmp_name']);
  151.                                                                 $error = 1;
  152.                                                         }
  153.                                                 } else {
  154.                                                         @unlink($attach['tmp_name']);
  155.                                                         $error = 2;
  156.                                                         }
  157.                                                 }
  158.                                         }
  159.                                 }
  160.                         } else {
  161.                                         redirect("viewforum.php?forum_id=".$_GET['forum_id']);
  162.                         }
  163.                 } else {
  164.                         $error = 3;
  165.                 }
  166.         } else {
  167.                 $error = 4;
  168.         }
  169.         if ($error > 2) {
  170.                 redirect("postify.php?post=new&error=$error&forum_id=".$_GET['forum_id']);
  171.         } else {
  172.                 redirect("postify.php?post=new&error=$error&forum_id=".$_GET['forum_id']."&thread_id=".$thread_id."");
  173.         }
  174. } else {
  175.         if (!isset($_POST['previewpost']) && !isset($_POST['add_poll_option'])) {
  176.                 $subject = "";
  177.                 $message = "";
  178.                 $sticky_thread_check = "";
  179.                 $lock_thread_check = "";
  180.                 $disable_smileys_check = "";
  181.                 $sig_checked = " checked='checked'";
  182.                 if ($settings['thread_notify']) { $notify_checked = ""; }
  183.                 $poll_title = "";
  184.                 $poll_opts = array();
  185.         }
  186.         add_to_title($locale['global_201'].$locale['401']);
  187.         echo "<!--pre_postnewthread-->";
  188.         opentable($locale['401']);
  189.         if (!isset($_POST['previewpost'])) { echo "<div class='tbl2' style='margin-bottom:5px'><span class='small'><a href='index.php'>".$settings['sitename']."</a> :: ".$caption."</span></div>\n"; }
  190.  
  191.         echo "<form id='inputform' method='post' action='".FUSION_SELF."?action=newthread&amp;forum_id=".$_GET['forum_id']."' enctype='multipart/form-data'>\n";
  192.         echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
  193.         echo "<td width='145' class='tbl2'>".$locale['460']."</td>\n";
  194.         echo "<td class='tbl1'><input type='text' name='subject' value='".$subject."' class='textbox' maxlength='255' style='width: 250px' /></td>\n";
  195.         echo "</tr>\n<tr>\n";
  196.         echo "<td valign='top' width='145' class='tbl2'>".$locale['461']."</td>\n";
  197.         echo "<td class='tbl1'><textarea name='message' cols='60' rows='15' class='textbox' style='width:98%'>".$message."</textarea></td>\n";
  198.         echo "</tr>\n<tr>\n";
  199.         echo "<td width='145' class='tbl2'>&nbsp;</td>\n";
  200.         echo "<td class='tbl1'>".display_bbcodes("99%", "message")."</td>\n";
  201.         echo "</tr>\n<tr>\n";
  202.         echo "<td valign='top' width='145' class='tbl2'>".$locale['463']."</td>\n";
  203.         echo "<td class='tbl1'>\n";
  204.         if (iMOD || iSUPERADMIN) {
  205.                 echo "<label><input type='checkbox' name='sticky_thread' value='1'".$sticky_thread_check." /> ".$locale['480']."</label><br />\n";
  206.                 echo "<label><input type='checkbox' name='lock_thread' value='1'".$lock_thread_check." /> ".$locale['481']."</label><br />\n";
  207.         }
  208.         echo "<label><input type='checkbox' name='disable_smileys' value='1'".$disable_smileys_check." /> ".$locale['482']."</label>";
  209.         if (array_key_exists("user_sig", $userdata) && $userdata['user_sig']) {
  210.                 echo "<br />\n<label><input type='checkbox' name='show_sig' value='1'".$sig_checked." /> ".$locale['483']."</label>";
  211.         }
  212.         if ($settings['thread_notify']) { echo "<br />\n<label><input type='checkbox' name='notify_me' value='1'".$notify_checked." /> ".$locale['486']."</label>"; }
  213.         echo "</td>\n</tr>\n";
  214.         if ($fdata['forum_attach'] && checkgroup($fdata['forum_attach'])) {
  215.                 echo "<tr>\n<td width='145' class='tbl2'>".$locale['464']."</td>\n";
  216.                 echo "<td class='tbl1'><input type='file' name='attach' class='textbox' style='width:200px;' /><br />\n";
  217.                 echo "<span class='small2'>".sprintf($locale['466'], parsebytesize($settings['attachmax']), str_replace(',', ' ', $settings['attachtypes']))."</span></td>\n";
  218.                 echo "</tr>\n";
  219.         }
  220.         if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  221.                 echo "<tr>\n<td align='center' colspan='2' class='tbl2'>".$locale['467']."</td>\n";
  222.                 echo "</tr>\n<tr>\n";
  223.                 echo "<td width='145' class='tbl2'>".$locale['469']."</td>\n";
  224.                 echo "<td class='tbl1'><input type='text' name='poll_title' value='".$poll_title."' class='textbox' maxlength='255' style='width:250px' /></td>\n";
  225.                 echo "</tr>\n";
  226.                 $i = 1;
  227.                 if (isset($poll_opts) && is_array($poll_opts) && count($poll_opts)) {
  228.                         foreach ($poll_opts as $poll_option) {
  229.                                 echo "<tr>\n<td width='145' class='tbl2'>".$locale['470']." ".$i."</td>\n";
  230.                                 echo "<td class='tbl1'><input type='text' name='poll_options[$i]' value='".$poll_option."' class='textbox' maxlength='255' style='width:250px'>";
  231.                                 if ($i == count($poll_opts)) {
  232.                                         echo " <input type='submit' name='add_poll_option' value='".$locale['471']."' class='button' />";
  233.                                 }
  234.                                 echo "</td>\n</tr>\n";
  235.                                 $i++;
  236.                         }
  237.                 } else {
  238.                         echo "<tr>\n<td width='145' class='tbl2'>".$locale['470']." 1</td>\n";
  239.                         echo "<td class='tbl1'><input type='text' name='poll_options[1]' value='' class='textbox' maxlength='255' style='width:250px' /> ";
  240.                         echo "<tr>\n<td width='145' class='tbl2'>".$locale['470']." 2</td>\n";
  241.                         echo "<td class='tbl1'><input type='text' name='poll_options[2]' value='' class='textbox' maxlength='255' style='width:250px' /> ";
  242.                         echo "<input type='submit' name='add_poll_option' value='".$locale['471']."' class='button' /></td>\n</tr>\n";
  243.                 }
  244.         }
  245.         echo "<tr>\n<td align='center' colspan='2' class='tbl1'>\n";
  246.         echo "<input type='submit' name='previewpost' value='".$locale['400']."' class='button' />\n";
  247.         echo "<input type='submit' name='postnewthread' value='".$locale['401']."' class='button' />\n";
  248.         echo "</td>\n</tr>\n</table>\n</form>\n";
  249.         closetable();
  250.         echo "<!--sub_postnewthread-->";
  251. }
  252. ?>


Ich habe mal lieber gleich den gesamten Quellcode rein gesetzt! Ich hoffe das mir jemand helfen kann was falsch ist!?

Mit freundlichen Grüßen
Dark

PS: Schonmal Danke im Vorraus!
-Dark-Emperor-
Newbi
 
Beiträge: 3
Registriert: Sa, 14:47:53 20.03.10
Wohnort: Dresden

Re: Forum - New Thread - Parse error

Beitragvon -Dark-Emperor- am Sa, 18:38:10 20.03.10

Ich habs hinbekommen! Besser es hat schon wer für mich gemacht!

Das ist die Lösung:

  1. <?php
  2. /*-------------------------------------------------------+
  3. | PHP-Fusion Content Management System
  4. | Copyright (C) 2002 - 2008 Nick Jones
  5. | http://www.php-fusion.co.uk/
  6. +--------------------------------------------------------+
  7. | Filename: postnewthread.php
  8. | Author: Nick Jones (Digitanium)
  9. +--------------------------------------------------------+
  10. | This program is released as free software under the
  11. | Affero GPL license. You can redistribute it and/or
  12. | modify it under the terms of this license which you
  13. | can read by viewing the included agpl.txt or online
  14. | at www.gnu.org/licenses/agpl.html. Removal of this
  15. | copyright header is strictly prohibited without
  16. | written permission from the original author(s).
  17. +--------------------------------------------------------*/
  18. if (!defined("IN_FUSION")) { die("Access Denied"); }
  19.  
  20. if (isset($_POST['previewpost']) || isset($_POST['add_poll_option'])) {
  21.         $subject = trim(stripinput(censorwords($_POST['subject'])));
  22.         $message = trim(stripinput(censorwords($_POST['message'])));
  23.         $sticky_thread_check = isset($_POST['sticky_thread']) ? " checked='checked'" : "";
  24.         $lock_thread_check = isset($_POST['lock_thread']) ? " checked='checked'" : "";
  25.         $sig_checked = isset($_POST['show_sig']) ? " checked='checked'" : "";
  26.         $disable_smileys_check = isset($_POST['disable_smileys']) || preg_match("#\[code\](.*?)\[/code\]#si", $message) ? " checked='checked'" : "";
  27.         if ($settings['thread_notify']) { $notify_checked = isset($_POST['notify_me']) ? " checked='checked'" : ""; }
  28.  
  29.         if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  30.                 $poll_title = trim(stripinput(censorwords($_POST['poll_title'])));
  31.                 if (isset($_POST['poll_options']) && is_array($_POST['poll_options'])) {
  32.                         $poll_opts = array();
  33.                         foreach ($_POST['poll_options'] as $poll_option) {
  34.                                 if ($poll_option) { $poll_opts[] = stripinput($poll_option); }
  35.                         }
  36.                 } else {
  37.                         $poll_opts = array();
  38.                 }
  39.                 if (isset($_POST['add_poll_option'])) {
  40.                         if (count($poll_opts)) { array_push($poll_opts, ""); }
  41.                 }
  42.         }
  43.  
  44.         if (isset($_POST['previewpost'])) {
  45.                 if ($subject == "") { $subject = $locale['420']; }
  46.                 if ($message == "") {
  47.                         $previewmessage = $locale['421'];
  48.                 } else {
  49.                         $previewmessage = $message;
  50.                         if ($sig_checked) { $previewmessage = $previewmessage."\n\n".$userdata['user_sig']; }
  51.                         if (!$disable_smileys_check) { $previewmessage = parsesmileys($previewmessage); }
  52.                         $previewmessage = parseubb($previewmessage);
  53.                         $previewmessage = nl2br($previewmessage);
  54.                 }
  55.                 //$is_mod = iMOD && iUSER < "102" ? true : false;
  56.                 opentable($locale['400']);
  57.                 echo "<div class='tbl2' style='margin-bottom:5px'><span class='small'><a href='index.php'>".$settings['sitename']."</a> :: ".$caption."</span></div>\n";
  58.  
  59.                 if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  60.                         if ((isset($poll_title) && $poll_title) && (isset($poll_opts) && is_array($poll_opts))) {
  61.                                 echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border' style='margin-bottom:5px'>\n<tr>\n";
  62.                                 echo "<td align='center' class='tbl2'><strong>".$poll_title."</strong></td>\n</tr>\n<tr>\n<td class='tbl1'>\n";
  63.                                 echo "<table align='center' cellpadding='0' cellspacing='0'>\n";
  64.                                 foreach ($poll_opts as $poll_option) {
  65.                                         echo "<tr>\n<td class='tbl1'><input type='radio' name='poll_option' value='$i' style='vertical-align:middle;' /> ".$poll_option."</td>\n</tr>\n";
  66.                                         $i++;
  67.                                 }
  68.                                 echo "</table>\n</td>\n</tr>\n</table>\n";
  69.                         }
  70.                 }
  71.                 echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
  72.                 echo "<td colspan='2' class='tbl2'><strong>".$subject."</strong></td>\n</tr>\n";
  73.                 echo "<tr>\n<td class='tbl2' style='width:140px;'><a href='../profile.php?lookup=".$userdata['user_id']."'>".$userdata['user_name']."</a></td>\n";
  74.                 echo "<td class='tbl2'>".$locale['426'].showdate("forumdate", time())."</td>\n";
  75.                 echo "</tr>\n<tr>\n<td valign='top' width='140' class='tbl2'>\n";
  76.                 if ($userdata['user_avatar'] && file_exists(IMAGES."avatars/".$userdata['user_avatar'])) {
  77.                         echo "<img src='".IMAGES."avatars/".$userdata['user_avatar']."' alt='' /><br /><br />\n";
  78.                 }
  79.                 echo "<span class='small'>".getuserlevel($userdata['user_level'])."</span><br /><br />\n";
  80.                 echo "<span class='small'><strong>".$locale['423']."</strong> ".$userdata['user_posts']."</span><br />\n";
  81.                 echo "<span class='small'><strong>".$locale['425']."</strong> ".showdate("%d.%m.%y", $userdata['user_joined'])."</span><br />\n";
  82.                 echo "<br /></td>\n<td valign='top' class='tbl1'>".$previewmessage."</td>\n";
  83.                 echo "</tr>\n</table>\n";
  84.                 closetable();
  85.         }
  86. }
  87. if (isset($_POST['postnewthread'])) {
  88.         $subject = trim(stripinput(censorwords($_POST['subject'])));
  89.         $message = trim(stripinput(censorwords($_POST['message'])));
  90.         $flood = false; $error = 0;
  91.         $sticky_thread = isset($_POST['sticky_thread']) && (iMOD || iSUPERADMIN) ? 1 : 0;
  92.         $lock_thread = isset($_POST['lock_thread']) && (iMOD || iSUPERADMIN) ? 1 : 0;
  93.         $sig = isset($_POST['show_sig']) ? 1 : 0;
  94.         $smileys = isset($_POST['disable_smileys']) || preg_match("#\[code\](.*?)\[/code\]#si", $message) ? 0 : 1;
  95.         $thread_poll = 0;
  96.  
  97.         if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  98.                 if (isset($_POST['poll_options']) && is_array($_POST['poll_options'])) {
  99.                         foreach ($_POST['poll_options'] as $poll_option) {
  100.                                 if (trim($poll_option)) { $poll_opts[] = trim(stripinput(censorwords($poll_option))); }
  101.                                 unset($poll_option);
  102.                         }
  103.                 }
  104.                 $thread_poll = (trim($_POST['poll_title']) && (isset($poll_opts) && is_array($poll_opts)) ? 1 : 0);
  105.         }
  106.  
  107.         if (iMEMBER) {
  108.                 if ($subject != "" && $message != "") {
  109.                         require_once INCLUDES."flood_include.php";
  110.                         if (!flood_control("post_datestamp", DB_POSTS, "post_author='".$userdata['user_id']."'")) {
  111.                                 $result = dbquery("INSERT INTO ".DB_THREADS." (forum_id, thread_subject, thread_author, thread_views, thread_lastpost, thread_lastpostid, thread_lastuser, thread_postcount, thread_poll, thread_sticky, thread_locked) VALUES('".$_GET['forum_id']."', '$subject', '".$userdata['user_id']."', '0', '".time()."', '0', '".$userdata['user_id']."', '1', '".$thread_poll."', '".$sticky_thread."', '".$lock_thread."')");
  112.                                 $thread_id = mysql_insert_id();
  113.                                 $result = dbquery("INSERT INTO ".DB_POSTS." (forum_id, thread_id, post_message, post_showsig, post_smileys, post_author, post_datestamp, post_ip, post_edituser, post_edittime) VALUES ('".$_GET['forum_id']."', '".$thread_id."', '".$message."', '".$sig."', '".$smileys."', '".$userdata['user_id']."', '".time()."', '".USER_IP."', '0', '0')");
  114.                                 $post_id = mysql_insert_id();
  115.                                 $result = dbquery("UPDATE ".DB_FORUMS." SET forum_lastpost='".time()."', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastuser='".$userdata['user_id']."' WHERE forum_id='".$_GET['forum_id']."'");
  116.                                 $result = dbquery("UPDATE ".DB_THREADS." SET thread_lastpostid='".$post_id."' WHERE thread_id='".$thread_id."'");
  117.                                 $result = dbquery("UPDATE ".DB_USERS." SET user_posts=user_posts+1 WHERE user_id='".$userdata['user_id']."'");
  118.                                 if ($settings['thread_notify'] && isset($_POST['notify_me'])) { $result = dbquery("INSERT INTO ".DB_THREAD_NOTIFY." (thread_id, notify_datestamp, notify_user, notify_status) VALUES('".$thread_id."', '".time()."', '".$userdata['user_id']."', '1')"); }
  119.  
  120.                                 if (($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) && $thread_poll) {
  121.                                         $poll_title = trim(stripinput(censorwords($_POST['poll_title'])));
  122.                                         if ($poll_title && (isset($poll_opts) && is_array($poll_opts))) {
  123.                                                 $result = dbquery("INSERT INTO ".DB_FORUM_POLLS." (thread_id, forum_poll_title, forum_poll_start, forum_poll_length, forum_poll_votes) VALUES('".$thread_id."', '".$poll_title."', '".time()."', '0', '0')");
  124.                                                 $forum_poll_id = mysql_insert_id();
  125.                                                 $i = 1;
  126.                                                 foreach ($poll_opts as $poll_option) {
  127.                                                         $result = dbquery("INSERT INTO ".DB_FORUM_POLL_OPTIONS." (thread_id, forum_poll_option_id, forum_poll_option_text, forum_poll_option_votes) VALUES('".$thread_id."', '".$i."', '".$poll_option."', '0')");
  128.                                                         $i++;
  129.                                                 }
  130.                                         }
  131.                                 }
  132.  
  133.                                 if ($fdata['forum_attach'] && checkgroup($fdata['forum_attach'])) {
  134.                                         $attach = $_FILES['attach'];
  135.                                         if ($attach['name'] != "" && !empty($attach['name']) && is_uploaded_file($attach['tmp_name'])) {
  136.                                                 $attachname = substr($attach['name'], 0, strrpos($attach['name'], "."));
  137.                                                 $attachext = strtolower(strrchr($attach['name'],"."));
  138.                                                 if (preg_match("/^[-0-9A-Z_\[\]]+$/i", $attachname) && $attach['size'] <= $settings['attachmax']) {
  139.                                                         $attachtypes = explode(",", $settings['attachtypes']);
  140.                                                         if (in_array($attachext, $attachtypes)) {
  141.                                                                 $attachname = attach_exists(strtolower($attach['name']));
  142.                                                                 move_uploaded_file($attach['tmp_name'], FORUM."attachments/".$attachname);
  143.                                                                 chmod(FORUM."attachments/".$attachname,0644);
  144.                                                                 if (in_array($attachext, $imagetypes) && (!@getimagesize(FORUM."attachments/".$attachname) || !@verify_image(FORUM."attachments/".$attachname))) {
  145.                                                                         unlink(FORUM."attachments/".$attachname);
  146.                                                                         $error = 1;
  147.                                                                 }
  148.                                                                 if (!$error) { $result = dbquery("INSERT INTO ".DB_FORUM_ATTACHMENTS." (thread_id, post_id, attach_name, attach_ext, attach_size) VALUES ('".$thread_id."', '".$post_id."', '$attachname', '$attachext', '".$attach['size']."')"); }
  149.                                                         } else {
  150.                                                                 @unlink($attach['tmp_name']);
  151.                                                                 $error = 1;
  152.                                                         }
  153.                                                 } else {
  154.                                                         @unlink($attach['tmp_name']);
  155.                                                         $error = 2;
  156.                                                 }
  157.                                         }
  158.                                 }
  159.                         } else {
  160.                                         redirect("viewforum.php?forum_id=".$_GET['forum_id']);
  161.                         }
  162.                 } else {
  163.                         $error = 3;
  164.                 }
  165.         } else {
  166.                 $error = 4;
  167.         }
  168.         if ($error > 2) {
  169.                 redirect("postify.php?post=new&error=$error&forum_id=".$_GET['forum_id']);
  170.         } else {
  171.                 redirect("postify.php?post=new&error=$error&forum_id=".$_GET['forum_id']."&thread_id=".$thread_id."");
  172.         }
  173. } else {
  174.         if (!isset($_POST['previewpost']) && !isset($_POST['add_poll_option'])) {
  175.                 $subject = "";
  176.                 $message = "";
  177.                 $sticky_thread_check = "";
  178.                 $lock_thread_check = "";
  179.                 $disable_smileys_check = "";
  180.                 $sig_checked = " checked='checked'";
  181.                 if ($settings['thread_notify']) { $notify_checked = ""; }
  182.                 $poll_title = "";
  183.                 $poll_opts = array();
  184.         }
  185.         add_to_title($locale['global_201'].$locale['401']);
  186.         echo "<!--pre_postnewthread-->";
  187.         opentable($locale['401']);
  188.         if (!isset($_POST['previewpost'])) { echo "<div class='tbl2' style='margin-bottom:5px'><span class='small'><a href='index.php'>".$settings['sitename']."</a> :: ".$caption."</span></div>\n"; }
  189.  
  190.         echo "<form id='inputform' method='post' action='".FUSION_SELF."?action=newthread&amp;forum_id=".$_GET['forum_id']."' enctype='multipart/form-data'>\n";
  191.         echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
  192.         echo "<td width='145' class='tbl2'>".$locale['460']."</td>\n";
  193.         echo "<td class='tbl1'><input type='text' name='subject' value='".$subject."' class='textbox' maxlength='255' style='width: 250px' /></td>\n";
  194.         echo "</tr>\n<tr>\n";
  195.         echo "<td valign='top' width='145' class='tbl2'>".$locale['461']."</td>\n";
  196.         echo "<td class='tbl1'><textarea name='message' cols='60' rows='15' class='textbox' style='width:98%'>".$message."</textarea></td>\n";
  197.         echo "</tr>\n<tr>\n";
  198.         echo "<td width='145' class='tbl2'>&nbsp;</td>\n";
  199.         echo "<td class='tbl1'>".display_bbcodes("99%", "message")."</td>\n";
  200.         echo "</tr>\n<tr>\n";
  201.         echo "<td valign='top' width='145' class='tbl2'>".$locale['463']."</td>\n";
  202.         echo "<td class='tbl1'>\n";
  203.         if (iMOD || iSUPERADMIN) {
  204.                 echo "<label><input type='checkbox' name='sticky_thread' value='1'".$sticky_thread_check." /> ".$locale['480']."</label><br />\n";
  205.                 echo "<label><input type='checkbox' name='lock_thread' value='1'".$lock_thread_check." /> ".$locale['481']."</label><br />\n";
  206.         }
  207.         echo "<label><input type='checkbox' name='disable_smileys' value='1'".$disable_smileys_check." /> ".$locale['482']."</label>";
  208.         if (array_key_exists("user_sig", $userdata) && $userdata['user_sig']) {
  209.                 echo "<br />\n<label><input type='checkbox' name='show_sig' value='1'".$sig_checked." /> ".$locale['483']."</label>";
  210.         }
  211.         if ($settings['thread_notify']) { echo "<br />\n<label><input type='checkbox' name='notify_me' value='1'".$notify_checked." /> ".$locale['486']."</label>"; }
  212.         echo "</td>\n</tr>\n";
  213.         if ($fdata['forum_attach'] && checkgroup($fdata['forum_attach'])) {
  214.                 echo "<tr>\n<td width='145' class='tbl2'>".$locale['464']."</td>\n";
  215.                 echo "<td class='tbl1'><input type='file' name='attach' class='textbox' style='width:200px;' /><br />\n";
  216.                 echo "<span class='small2'>".sprintf($locale['466'], parsebytesize($settings['attachmax']), str_replace(',', ' ', $settings['attachtypes']))."</span></td>\n";
  217.                 echo "</tr>\n";
  218.         }
  219.         if ($fdata['forum_poll'] && checkgroup($fdata['forum_poll'])) {
  220.                 echo "<tr>\n<td align='center' colspan='2' class='tbl2'>".$locale['467']."</td>\n";
  221.                 echo "</tr>\n<tr>\n";
  222.                 echo "<td width='145' class='tbl2'>".$locale['469']."</td>\n";
  223.                 echo "<td class='tbl1'><input type='text' name='poll_title' value='".$poll_title."' class='textbox' maxlength='255' style='width:250px' /></td>\n";
  224.                 echo "</tr>\n";
  225.                 $i = 1;
  226.                 if (isset($poll_opts) && is_array($poll_opts) && count($poll_opts)) {
  227.                         foreach ($poll_opts as $poll_option) {
  228.                                 echo "<tr>\n<td width='145' class='tbl2'>".$locale['470']." ".$i."</td>\n";
  229.                                 echo "<td class='tbl1'><input type='text' name='poll_options[$i]' value='".$poll_option."' class='textbox' maxlength='255' style='width:250px'>";
  230.                                 if ($i == count($poll_opts)) {
  231.                                         echo " <input type='submit' name='add_poll_option' value='".$locale['471']."' class='button' />";
  232.                                 }
  233.                                 echo "</td>\n</tr>\n";
  234.                                 $i++;
  235.                         }
  236.                 } else {
  237.                         echo "<tr>\n<td width='145' class='tbl2'>".$locale['470']." 1</td>\n";
  238.                         echo "<td class='tbl1'><input type='text' name='poll_options[1]' value='' class='textbox' maxlength='255' style='width:250px' /> ";
  239.                         echo "<tr>\n<td width='145' class='tbl2'>".$locale['470']." 2</td>\n";
  240.                         echo "<td class='tbl1'><input type='text' name='poll_options[2]' value='' class='textbox' maxlength='255' style='width:250px' /> ";
  241.                         echo "<input type='submit' name='add_poll_option' value='".$locale['471']."' class='button' /></td>\n</tr>\n";
  242.                 }
  243.         }
  244.         echo "<tr>\n<td align='center' colspan='2' class='tbl1'>\n";
  245.         echo "<input type='submit' name='previewpost' value='".$locale['400']."' class='button' />\n";
  246.         echo "<input type='submit' name='postnewthread' value='".$locale['401']."' class='button' />\n";
  247.         echo "</td>\n</tr>\n</table>\n</form>\n";
  248.         closetable();
  249.         echo "<!--sub_postnewthread-->";
  250. }
  251. ?>
-Dark-Emperor-
Newbi
 
Beiträge: 3
Registriert: Sa, 14:47:53 20.03.10
Wohnort: Dresden

Zurück zu PHP Hilfe



cron