Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: newthread.php 3992 2008-07-06 17:27:56Z Tikitiki $
| * $Id: newthread.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
define("IN_MYBB", 1);
|
*/
define("IN_MYBB", 1);
|
| define('THIS_SCRIPT', 'newthread.php');
|
$templatelist = "newthread,previewpost,error_invalidforum,redirect_newthread,loginbox,changeuserbox,newthread_postpoll,posticons,attachment,newthread_postpoll,codebuttons,smilieinsert,error_nosubject"; $templatelist .= "posticons,newthread_disablesmilies,newreply_modoptions,post_attachments_new,post_attachments,post_savedraftbutton,post_subscription_method";
| $templatelist = "newthread,previewpost,error_invalidforum,redirect_newthread,loginbox,changeuserbox,newthread_postpoll,posticons,attachment,newthread_postpoll,codebuttons,smilieinsert,error_nosubject"; $templatelist .= "posticons,newthread_disablesmilies,newreply_modoptions,post_attachments_new,post_attachments,post_savedraftbutton,post_subscription_method";
|
Zeile 97 | Zeile 98 |
---|
{ if(!$mybb->input['previewpost'] && $mybb->input['action'] != "do_newthread") {
|
{ if(!$mybb->input['previewpost'] && $mybb->input['action'] != "do_newthread") {
|
$username = $lang->guest;
| $username = '';
|
} else {
| } else {
|
Zeile 126 | Zeile 127 |
---|
// Handle attachments if we've got any. if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || ($mybb->input['action'] == "do_newthread" && $mybb->input['submit'] && $_FILES['attachment']))) {
|
// Handle attachments if we've got any. if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || ($mybb->input['action'] == "do_newthread" && $mybb->input['submit'] && $_FILES['attachment']))) {
|
// If there's an attachment, check it and upload it if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0)
| // Verify incoming POST request verify_post_check($mybb->input['my_post_key']); if($mybb->input['action'] == "editdraft" || ($mybb->input['tid'] && $mybb->input['pid'])) { $attachwhere = "pid='{$pid}'"; } else { $attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'"; } $query = $db->simple_select("attachments", "COUNT(aid) as numattachs", $attachwhere); $attachcount = $db->fetch_field($query, "numattachs"); // If there's an attachment, check it and upload it if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments']))
|
{ require_once MYBB_ROOT."inc/functions_upload.php"; $attachedfile = upload_attachment($_FILES['attachment']);
| { require_once MYBB_ROOT."inc/functions_upload.php"; $attachedfile = upload_attachment($_FILES['attachment']);
|
Zeile 137 | Zeile 152 |
---|
if($attachedfile['error']) { eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");
|
if($attachedfile['error']) { eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");
|
$mybb->input['action'] = "newthread"; }
| $mybb->input['action'] = "newthread"; }
|
// If we were dealing with an attachment but didn't click 'Post Thread', force the new thread page again. if(!$mybb->input['submit'])
| // If we were dealing with an attachment but didn't click 'Post Thread', force the new thread page again. if(!$mybb->input['submit'])
|
Zeile 148 | Zeile 163 |
---|
}
// Are we removing an attachment from the thread?
|
}
// Are we removing an attachment from the thread?
|
if($mybb->input['attachmentaid'] && $mybb->input['posthash'])
| if($mybb->input['attachmentaid'] && $mybb->input['attachmentact'] == "remove" && $mybb->input['posthash'])
|
{
|
{
|
| // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
|
require_once MYBB_ROOT."inc/functions_upload.php"; remove_attachment(0, $mybb->input['posthash'], $mybb->input['attachmentaid']); if(!$mybb->input['submit'])
| require_once MYBB_ROOT."inc/functions_upload.php"; remove_attachment(0, $mybb->input['posthash'], $mybb->input['attachmentaid']); if(!$mybb->input['submit'])
|
Zeile 205 | Zeile 223 |
---|
if(!$mybb->user['uid']) { my_setcookie('loginattempts', $logins + 1);
|
if(!$mybb->user['uid']) { my_setcookie('loginattempts', $logins + 1);
|
$db->write_query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'");
| $db->write_query("UPDATE ".TABLE_PREFIX."users SET loginattempts=loginattempts+1 WHERE username = '".$db->escape_string($mybb->input['username'])."'");
|
if($mybb->settings['failedlogintext'] == 1) { $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
| if($mybb->settings['failedlogintext'] == 1) { $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
|
Zeile 221 | Zeile 239 |
---|
// Update the session to contain their user ID $updated_session = array( "uid" => $mybb->user['uid'],
|
// Update the session to contain their user ID $updated_session = array( "uid" => $mybb->user['uid'],
|
"loginattempts" => 0 );
| );
|
$db->update_query("sessions", $updated_session, "sid='{$session->sid}'");
|
$db->update_query("sessions", $updated_session, "sid='{$session->sid}'");
|
| $db->update_query("users", array("loginattempts" => 1), "uid='{$mybb->user['uid']}'");
|
// Set uid and username $uid = $mybb->user['uid']; $username = $mybb->user['username'];
| // Set uid and username $uid = $mybb->user['uid']; $username = $mybb->user['username'];
|
Zeile 232 | Zeile 251 |
---|
// Check if this user is allowed to post here $mybb->usergroup = &$groupscache[$mybb->user['usergroup']]; $forumpermissions = forum_permissions($fid);
|
// Check if this user is allowed to post here $mybb->usergroup = &$groupscache[$mybb->user['usergroup']]; $forumpermissions = forum_permissions($fid);
|
if($forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0 || $mybb->user['suspendposting'] == 1)
| if($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1)
|
{ error_no_permission();
|
{ error_no_permission();
|
}
| }
|
} // This username does not exist. else
| } // This username does not exist. else
|
Zeile 258 | Zeile 277 |
---|
{ $username = $mybb->user['username']; $uid = $mybb->user['uid'];
|
{ $username = $mybb->user['username']; $uid = $mybb->user['uid'];
|
}
| }
|
// Attempt to see if this post is a duplicate or not if($uid > 0) { $user_check = "p.uid='{$uid}'";
|
// Attempt to see if this post is a duplicate or not if($uid > 0) { $user_check = "p.uid='{$uid}'";
|
}
| }
|
else { $user_check = "p.ipaddress='".$db->escape_string($session->ipaddress)."'"; } if(!$mybb->input['savedraft'] && !$pid)
|
else { $user_check = "p.ipaddress='".$db->escape_string($session->ipaddress)."'"; } if(!$mybb->input['savedraft'] && !$pid)
|
{
| {
|
$query = $db->simple_select("posts p", "p.pid", "$user_check AND p.fid='{$forum['fid']}' AND p.subject='".$db->escape_string($mybb->input['subject'])."' AND p.message='".$db->escape_string($mybb->input['message'])."' AND p.posthash='".$db->escape_string($mybb->input['posthash'])."'"); $duplicate_check = $db->fetch_field($query, "pid"); if($duplicate_check)
| $query = $db->simple_select("posts p", "p.pid", "$user_check AND p.fid='{$forum['fid']}' AND p.subject='".$db->escape_string($mybb->input['subject'])."' AND p.message='".$db->escape_string($mybb->input['message'])."' AND p.posthash='".$db->escape_string($mybb->input['posthash'])."'"); $duplicate_check = $db->fetch_field($query, "pid"); if($duplicate_check)
|
Zeile 305 | Zeile 324 |
---|
if($mybb->input['savedraft'] && $mybb->user['uid']) { $new_thread['savedraft'] = 1;
|
if($mybb->input['savedraft'] && $mybb->user['uid']) { $new_thread['savedraft'] = 1;
|
}
| }
|
else
|
else
|
{
| {
|
$new_thread['savedraft'] = 0;
|
$new_thread['savedraft'] = 0;
|
}
| }
|
// Is this thread already a draft and we're updating it? if(isset($thread['tid']) && $thread['visible'] == -2) { $new_thread['tid'] = $thread['tid'];
|
// Is this thread already a draft and we're updating it? if(isset($thread['tid']) && $thread['visible'] == -2) { $new_thread['tid'] = $thread['tid'];
|
}
| }
|
// Set up the thread options from the input. $new_thread['options'] = array( "signature" => $mybb->input['postoptions']['signature'],
| // Set up the thread options from the input. $new_thread['options'] = array( "signature" => $mybb->input['postoptions']['signature'],
|
Zeile 575 | Zeile 594 |
---|
$postoptionschecked['disablesmilies'] = " checked=\"checked\""; } $icon = $post['icon'];
|
$postoptionschecked['disablesmilies'] = " checked=\"checked\""; } $icon = $post['icon'];
|
| if($forum['allowpicons'] != 0) { $posticons = get_post_icons(); }
|
} // Otherwise, this is our initial visit to this page.
| } // Otherwise, this is our initial visit to this page.
|
Zeile 585 | Zeile 608 |
---|
$postoptionschecked['signature'] = " checked=\"checked\""; } if($mybb->user['subscriptionmethod'] == 1)
|
$postoptionschecked['signature'] = " checked=\"checked\""; } if($mybb->user['subscriptionmethod'] == 1)
|
{
| {
|
$postoptions_subscriptionmethod_none = "checked=\"checked\""; } else if($mybb->user['subscriptionmethod'] == 2)
| $postoptions_subscriptionmethod_none = "checked=\"checked\""; } else if($mybb->user['subscriptionmethod'] == 2)
|
Zeile 595 | Zeile 618 |
---|
else { $postoptions_subscriptionmethod_dont = "checked=\"checked\"";
|
else { $postoptions_subscriptionmethod_dont = "checked=\"checked\"";
|
}
| }
|
$numpolloptions = "2"; }
| $numpolloptions = "2"; }
|
Zeile 663 | Zeile 686 |
---|
if(!$mybb->user['uid'] || !$post['username']) { $post['username'] = htmlspecialchars_uni($mybb->input['username']);
|
if(!$mybb->user['uid'] || !$post['username']) { $post['username'] = htmlspecialchars_uni($mybb->input['username']);
|
}
| }
|
else { $post['userusername'] = $mybb->user['username'];
| else { $post['userusername'] = $mybb->user['username'];
|
Zeile 686 | Zeile 709 |
---|
if($mybb->input['pid']) { $attachwhere = "pid='".intval($mybb->input['pid'])."'";
|
if($mybb->input['pid']) { $attachwhere = "pid='".intval($mybb->input['pid'])."'";
|
} else {
| } else {
|
$attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'"; }
| $attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'"; }
|
Zeile 701 | Zeile 724 |
---|
$postbit = build_postbit($post, 1); eval("\$preview = \"".$templates->get("previewpost")."\";"); }
|
$postbit = build_postbit($post, 1); eval("\$preview = \"".$templates->get("previewpost")."\";"); }
|
$message = htmlspecialchars_uni($mybb->input['message']);
| $message = htmlspecialchars_uni($mybb->input['message']);
|
$subject = htmlspecialchars_uni($mybb->input['subject']); } // Removing an attachment or adding a new one, or showting thread errors. else if($mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)
|
$subject = htmlspecialchars_uni($mybb->input['subject']); } // Removing an attachment or adding a new one, or showting thread errors. else if($mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)
|
{
| {
|
$message = htmlspecialchars_uni($mybb->input['message']); $subject = htmlspecialchars_uni($mybb->input['subject']);
|
$message = htmlspecialchars_uni($mybb->input['message']); $subject = htmlspecialchars_uni($mybb->input['subject']);
|
}
| }
|
// Setup a unique posthash for attachment management if(!$mybb->input['posthash'] && $mybb->input['action'] != "editdraft") {
|
// Setup a unique posthash for attachment management if(!$mybb->input['posthash'] && $mybb->input['action'] != "editdraft") {
|
mt_srand((double) microtime() * 1000000); $posthash = md5($mybb->user['uid'].mt_rand());
| $posthash = md5($mybb->user['uid'].random_str()); } elseif($mybb->input['action'] == "editdraft") { // Drafts have posthashes, too... $posthash = $post['posthash'];
|
} else {
| } else {
|
Zeile 872 | Zeile 899 |
---|
$plugins->run_hooks("newthread_end");
|
$plugins->run_hooks("newthread_end");
|
| $forum['name'] = strip_tags($forum['name']);
|
$lang->newthread_in = $lang->sprintf($lang->newthread_in, $forum['name']);
|
$lang->newthread_in = $lang->sprintf($lang->newthread_in, $forum['name']);
|
$forum['name'] = strip_tags($forum['name']);
| |
eval("\$newthread = \"".$templates->get("newthread")."\";"); output_page($newthread);
| eval("\$newthread = \"".$templates->get("newthread")."\";"); output_page($newthread);
|