Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: newthread.php 5380 2011-02-21 12:04:43Z Tomm $
| * $Id: newthread.php 5605 2011-09-19 11:17:26Z Tomm $
|
*/
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";
|
*/
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 .= "posticons,newthread_disablesmilies,newreply_modoptions,post_attachments_new,post_attachments,post_savedraftbutton,post_subscription_method,post_attachments_attachment_remove";
|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
| require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
|
Zeile 58 | Zeile 58 |
---|
$forumpermissions = forum_permissions($fid);
|
$forumpermissions = forum_permissions($fid);
|
if($forum['open'] == 0 || $forum['type'] != "f")
| if($forum['open'] == 0 || $forum['type'] != "f" || $forum['linkto'] != "")
|
{ error($lang->error_closedinvalidforum); }
| { error($lang->error_closedinvalidforum); }
|
Zeile 367 | Zeile 367 |
---|
} // Check captcha image
|
} // Check captcha image
|
if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])
| if($mybb->settings['captchaimage'] && !$mybb->user['uid'])
|
{
|
{
|
$imagehash = $db->escape_string($mybb->input['imagehash']); $imagestring = $db->escape_string($mybb->input['imagestring']); $query = $db->simple_select("captcha", "*", "imagehash='$imagehash'"); $imgcheck = $db->fetch_array($query); if(my_strtolower($imgcheck['imagestring']) != my_strtolower($imagestring) || !$imgcheck['imagehash']) { $post_errors[] = $lang->invalid_captcha; }
| require_once MYBB_ROOT.'inc/class_captcha.php'; $post_captcha = new captcha;
if($post_captcha->validate_captcha() == false) { // CAPTCHA validation failed foreach($post_captcha->get_errors() as $error) { $post_errors[] = $error; } }
|
else {
|
else {
|
$db->delete_query("captcha", "imagehash='$imagehash'");
| |
$hide_captcha = true;
|
$hide_captcha = true;
|
} }
| } }
|
// One or more errors returned, fetch error list and throw to newthread page if(count($post_errors) > 0) {
| // One or more errors returned, fetch error list and throw to newthread page if(count($post_errors) > 0) {
|
Zeile 407 | Zeile 408 |
---|
{ $lang->redirect_newthread = $lang->draft_saved; $url = "usercp.php?action=drafts";
|
{ $lang->redirect_newthread = $lang->draft_saved; $url = "usercp.php?action=drafts";
|
}
| }
|
// A poll was being posted with this thread, throw them to poll posting page. else if($mybb->input['postpoll'] && $forumpermissions['canpostpolls']) {
| // A poll was being posted with this thread, throw them to poll posting page. else if($mybb->input['postpoll'] && $forumpermissions['canpostpolls']) {
|
Zeile 439 | Zeile 440 |
---|
if($mybb->input['quoted_ids'] == "all") { my_unsetcookie("multiquote");
|
if($mybb->input['quoted_ids'] == "all") { my_unsetcookie("multiquote");
|
} }
| } }
|
$plugins->run_hooks("newthread_do_newthread_end");
| $plugins->run_hooks("newthread_do_newthread_end");
|
Zeile 448 | Zeile 449 |
---|
if(!$mybb->input['postpoll']) { $lang->redirect_newthread .= $lang->sprintf($lang->redirect_return_forum, get_forum_link($fid));
|
if(!$mybb->input['postpoll']) { $lang->redirect_newthread .= $lang->sprintf($lang->redirect_return_forum, get_forum_link($fid));
|
}
| }
|
redirect($url, $lang->redirect_newthread); } }
| redirect($url, $lang->redirect_newthread); } }
|
Zeile 488 | Zeile 489 |
---|
if(is_moderator($fid)) { $visible_where = "AND p.visible != 2";
|
if(is_moderator($fid)) { $visible_where = "AND p.visible != 2";
|
}
| }
|
else { $visible_where = "AND p.visible > 0";
| else { $visible_where = "AND p.visible > 0";
|
Zeile 504 | Zeile 505 |
---|
WHERE p.pid IN ($quoted_posts) {$unviewable_forums} {$visible_where} "); while($quoted_post = $db->fetch_array($query))
|
WHERE p.pid IN ($quoted_posts) {$unviewable_forums} {$visible_where} "); while($quoted_post = $db->fetch_array($query))
|
{
| {
|
if($quoted_post['userusername']) { $quoted_post['username'] = $quoted_post['userusername'];
| if($quoted_post['userusername']) { $quoted_post['username'] = $quoted_post['userusername'];
|
Zeile 534 | Zeile 535 |
---|
$multiquote_text = $lang->multiquote_external_one; $multiquote_deselect = $lang->multiquote_external_one_deselect; $multiquote_quote = $lang->multiquote_external_one_quote;
|
$multiquote_text = $lang->multiquote_external_one; $multiquote_deselect = $lang->multiquote_external_one_deselect; $multiquote_quote = $lang->multiquote_external_one_quote;
|
}
| }
|
else { $multiquote_text = $lang->sprintf($lang->multiquote_external, $external_quotes);
| else { $multiquote_text = $lang->sprintf($lang->multiquote_external, $external_quotes);
|
Zeile 567 | Zeile 568 |
---|
} if($postoptions['subscriptionmethod'] == "none") {
|
} if($postoptions['subscriptionmethod'] == "none") {
|
$postoptions_subscriptionmethod_none = "checked=\"checked\""; } else if($postoptions['subscriptionmethod'] == "instant") { $postoptions_subscriptionmethod_instant = "checked=\"checked\""; } else { $postoptions_subscriptionmethod_dont = "checked=\"checked\"";
| $postoptions_subscriptionmethod_none = "checked=\"checked\""; } else if($postoptions['subscriptionmethod'] == "instant") { $postoptions_subscriptionmethod_instant = "checked=\"checked\""; } else { $postoptions_subscriptionmethod_dont = "checked=\"checked\"";
|
} if($postoptions['disablesmilies'] == 1)
|
} if($postoptions['disablesmilies'] == 1)
|
{
| {
|
$postoptionschecked['disablesmilies'] = " checked=\"checked\""; } if($mybb->input['postpoll'] == 1) { $postpollchecked = "checked=\"checked\"";
|
$postoptionschecked['disablesmilies'] = " checked=\"checked\""; } if($mybb->input['postpoll'] == 1) { $postpollchecked = "checked=\"checked\"";
|
}
| }
|
$numpolloptions = intval($mybb->input['numpolloptions']); }
| $numpolloptions = intval($mybb->input['numpolloptions']); }
|
Zeile 600 | Zeile 601 |
---|
if($post['smilieoff'] == 1) { $postoptionschecked['disablesmilies'] = " checked=\"checked\"";
|
if($post['smilieoff'] == 1) { $postoptionschecked['disablesmilies'] = " checked=\"checked\"";
|
}
| }
|
$icon = $post['icon']; if($forum['allowpicons'] != 0) {
| $icon = $post['icon']; if($forum['allowpicons'] != 0) {
|
Zeile 616 | Zeile 617 |
---|
$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 632 | Zeile 633 |
---|
// If we're preving a post then generate the preview. if($mybb->input['previewpost'])
|
// If we're preving a post then generate the preview. if($mybb->input['previewpost'])
|
{
| {
|
// Set up posthandler. require_once MYBB_ROOT."inc/datahandlers/post.php"; $posthandler = new PostDataHandler("insert");
| // Set up posthandler. require_once MYBB_ROOT."inc/datahandlers/post.php"; $posthandler = new PostDataHandler("insert");
|
Zeile 825 | Zeile 826 |
---|
else { $attachwhere = "posthash='".$db->escape_string($posthash)."'";
|
else { $attachwhere = "posthash='".$db->escape_string($posthash)."'";
|
}
| }
|
$query = $db->simple_select("attachments", "*", $attachwhere); $attachments = ''; while($attachment = $db->fetch_array($query)) { $attachment['size'] = get_friendly_size($attachment['filesize']); $attachment['icon'] = get_attachment_icon(get_extension($attachment['filename']));
|
$query = $db->simple_select("attachments", "*", $attachwhere); $attachments = ''; while($attachment = $db->fetch_array($query)) { $attachment['size'] = get_friendly_size($attachment['filesize']); $attachment['icon'] = get_attachment_icon(get_extension($attachment['filename']));
|
| $attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
|
if($mybb->settings['bbcodeinserter'] != 0 && $forum['allowmycode'] != 0 && (!$mybb->user['uid'] || $mybb->user['showcodebuttons'] != 0))
|
if($mybb->settings['bbcodeinserter'] != 0 && $forum['allowmycode'] != 0 && (!$mybb->user['uid'] || $mybb->user['showcodebuttons'] != 0))
|
{
| {
|
eval("\$postinsert = \"".$templates->get("post_attachments_attachment_postinsert")."\";"); }
|
eval("\$postinsert = \"".$templates->get("post_attachments_attachment_postinsert")."\";"); }
|
| eval("\$attach_rem_options = \"".$templates->get("post_attachments_attachment_remove")."\";");
|
$attach_mod_options = ''; if($attachment['visible'] != 1) {
| $attach_mod_options = ''; if($attachment['visible'] != 1) {
|
Zeile 873 | Zeile 879 |
---|
}
if($mybb->user['uid'])
|
}
if($mybb->user['uid'])
|
{
| {
|
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";"); } // Show captcha image for guests if enabled
|
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";"); } // Show captcha image for guests if enabled
|
if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])
| if($mybb->settings['captchaimage'] && !$mybb->user['uid'])
|
{ $correct = false;
|
{ $correct = false;
|
// If previewing a post - check their current captcha input - if correct, hide the captcha input area if($mybb->input['previewpost'] || $hide_captcha == true) { $imagehash = $db->escape_string($mybb->input['imagehash']); $imagestring = $db->escape_string($mybb->input['imagestring']); $query = $db->simple_select("captcha", "*", "imagehash='$imagehash' AND imagestring='$imagestring'"); $imgcheck = $db->fetch_array($query); if($imgcheck['dateline'] > 0) { eval("\$captcha = \"".$templates->get("post_captcha_hidden")."\";");
| require_once MYBB_ROOT.'inc/class_captcha.php'; $post_captcha = new captcha(false, "post_captcha");
if($mybb->input['previewpost'] || $hide_captcha == true && $post_captcha->type == 1) { // If previewing a post - check their current captcha input - if correct, hide the captcha input area // ... but only if it's a default one, reCAPTCHAs must be filled in every time due to draconian limits if($post_captcha->validate_captcha() == true) {
|
$correct = true;
|
$correct = true;
|
} else { $db->delete_query("captcha", "imagehash='$imagehash'"); }
| // Generate a hidden list of items for our captcha $captcha = $post_captcha->build_hidden_captcha(); }
|
}
|
}
|
|
|
if(!$correct)
|
if(!$correct)
|
{ $randomstr = random_str(5); $imagehash = md5(random_str(12)); $imagearray = array( "imagehash" => $imagehash, "imagestring" => $randomstr, "dateline" => TIME_NOW ); $db->insert_query("captcha", $imagearray); eval("\$captcha = \"".$templates->get("post_captcha")."\";");
| { if($post_captcha->type == 1) { $post_captcha->build_captcha(); } else if($post_captcha->type == 2) { $post_captcha->build_recaptcha(); }
if($post_captcha->html) { $captcha = $post_captcha->html; }
|
} }
| } }
|