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: newreply.php 5125 2010-07-27 07:28:03Z RyanGordon $
| * $Id: newreply.php 5605 2011-09-19 11:17:26Z Tomm $
|
*/
define("IN_MYBB", 1); define('THIS_SCRIPT', 'newreply.php');
$templatelist = "newreply,previewpost,error_invalidforum,error_invalidthread,redirect_threadposted,loginbox,changeuserbox,posticons,newreply_threadreview,forumrules,attachments,newreply_threadreview_post";
|
*/
define("IN_MYBB", 1); define('THIS_SCRIPT', 'newreply.php');
$templatelist = "newreply,previewpost,error_invalidforum,error_invalidthread,redirect_threadposted,loginbox,changeuserbox,posticons,newreply_threadreview,forumrules,attachments,newreply_threadreview_post";
|
$templatelist .= ",smilieinsert,codebuttons,post_attachments_new,post_attachments,post_savedraftbutton,newreply_modoptions,newreply_threadreview_more,newreply_disablesmilies,postbit_online,postbit_find,postbit_pm,postbit_www,postbit_email,postbit_reputation,postbit_warninglevel,postbit_author_user,postbit_edit,postbit_quickdelete,postbit_inlinecheck,postbit_posturl,postbit_quote,postbit_multiquote,postbit_report,postbit_ignored,postbit,post_subscription_method";
| $templatelist .= ",smilieinsert,smilieinsert_getmore,codebuttons,post_attachments_new,post_attachments,post_savedraftbutton,newreply_modoptions,newreply_threadreview_more,newreply_disablesmilies,postbit_online,postbit_find,postbit_pm,postbit_www,postbit_email,postbit_reputation,postbit_warninglevel,postbit_author_user,postbit_edit,postbit_quickdelete,postbit_inlinecheck,postbit_posturl,postbit_quote,postbit_multiquote,postbit_report,postbit_ignored,postbit,post_subscription_method";
|
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 107 | Zeile 107 |
---|
error_no_permission(); }
|
error_no_permission(); }
|
if($forumpermissions['canonlyviewthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
| if($forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
|
{ error_no_permission(); }
| { error_no_permission(); }
|
Zeile 435 | Zeile 435 |
---|
mark_thread_read($tid, $fid);
// Check captcha image
|
mark_thread_read($tid, $fid);
// 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(false, "post_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; }
|
// if we're using AJAX, and we have a captcha, regenerate a new one
|
|
if($mybb->input['ajax'])
|
if($mybb->input['ajax'])
|
{ $randomstr = random_str(5); $imagehash = md5(random_str(12)); $imagearray = array( "imagehash" => $imagehash, "imagestring" => $randomstr, "dateline" => TIME_NOW ); $db->insert_query("captcha", $imagearray); header("Content-type: text/html; charset={$lang->settings['charset']}"); echo "<captcha>$imagehash"; if($hide_captcha)
| { if($post_captcha->type == 1) { $randomstr = random_str(5); $imagehash = md5(random_str(12));
$imagearray = array( "imagehash" => $imagehash, "imagestring" => $randomstr, "dateline" => TIME_NOW );
$db->insert_query("captcha", $imagearray);
header("Content-type: text/html; charset={$lang->settings['charset']}"); echo "<captcha>$imagehash";
if($hide_captcha) { echo "|$randomstr"; }
echo "</captcha>"; } else if($post_captcha->type == 2)
|
{
|
{
|
echo "|$randomstr";
| header("Content-type: text/html; charset={$lang->settings['charset']}"); echo "<captcha>reload</captcha>";
|
}
|
}
|
echo "</captcha>";
| |
} }
| } }
|
Zeile 529 | Zeile 543 |
---|
} // Still have an array - set the new cookie if(is_array($multiquote))
|
} // Still have an array - set the new cookie if(is_array($multiquote))
|
{
| {
|
$new_multiquote = implode(",", $multiquote); my_setcookie("multiquote", $new_multiquote); }
| $new_multiquote = implode(",", $multiquote); my_setcookie("multiquote", $new_multiquote); }
|
Zeile 602 | Zeile 616 |
---|
// Now lets fetch all of the attachments for this post $query = $db->simple_select("attachments", "*", "pid='{$pid}'"); while($attachment = $db->fetch_array($query))
|
// Now lets fetch all of the attachments for this post $query = $db->simple_select("attachments", "*", "pid='{$pid}'"); while($attachment = $db->fetch_array($query))
|
{
| {
|
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
|
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
|
}
| }
|
// Establish altbg - may seem like this is backwards, but build_postbit reverses it if(($postcounter - $mybb->settings['postsperpage']) % 2 != 0)
|
// Establish altbg - may seem like this is backwards, but build_postbit reverses it if(($postcounter - $mybb->settings['postsperpage']) % 2 != 0)
|
{
| {
|
$altbg = "trow1";
|
$altbg = "trow1";
|
}
| }
|
else
|
else
|
{
| {
|
$altbg = "trow2";
|
$altbg = "trow2";
|
| }
$charset = "UTF-8"; if($lang->settings['charset']) { $charset = $lang->settings['charset'];
|
}
require_once MYBB_ROOT."inc/functions_post.php"; $pid = $post['pid']; $post = build_postbit($post);
|
}
require_once MYBB_ROOT."inc/functions_post.php"; $pid = $post['pid']; $post = build_postbit($post);
|
| header("Content-type: text/plain; charset={$charset}");
|
echo $post;
// Build a new posthash incase the user wishes to quick reply again
| echo $post;
// Build a new posthash incase the user wishes to quick reply again
|
Zeile 638 | Zeile 660 |
---|
} else {
|
} else {
|
$lang->redirect_newreply .= $lang->sprintf($lang->redirect_return_forum, get_forum_link($fid));
| $lang->redirect_newreply .= $lang->sprintf($lang->redirect_return_thread, get_forum_link($fid));
|
redirect($url, $lang->redirect_newreply); exit; }
| redirect($url, $lang->redirect_newreply); exit; }
|
Zeile 950 | Zeile 972 |
---|
elseif($mybb->input['action'] == "editdraft") { // Drafts have posthashes, too...
|
elseif($mybb->input['action'] == "editdraft") { // Drafts have posthashes, too...
|
$posthash = $post['posthash'];
| $posthash = htmlspecialchars_uni($post['posthash']);
|
} else {
|
} else {
|
$posthash = $mybb->input['posthash'];
| $posthash = htmlspecialchars_uni($mybb->input['posthash']);
|
}
// Do we have attachment errors?
| }
// Do we have attachment errors?
|
Zeile 968 | Zeile 990 |
---|
{ $attachcount = 0; if($mybb->input['action'] == "editdraft" && $mybb->input['pid'])
|
{ $attachcount = 0; if($mybb->input['action'] == "editdraft" && $mybb->input['pid'])
|
{
| {
|
$attachwhere = "pid='$pid'"; } else
| $attachwhere = "pid='$pid'"; } else
|
Zeile 981 | Zeile 1003 |
---|
{ $attachment['size'] = get_friendly_size($attachment['filesize']); $attachment['icon'] = get_attachment_icon(get_extension($attachment['filename']));
|
{ $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)) {
|
Zeile 1004 | Zeile 1027 |
---|
$noshowattach = 1; } if($mybb->usergroup['attachquota'] == 0)
|
$noshowattach = 1; } if($mybb->usergroup['attachquota'] == 0)
|
{
| {
|
$friendlyquota = $lang->unlimited; } else
| $friendlyquota = $lang->unlimited; } else
|
Zeile 1022 | Zeile 1045 |
---|
// If the user is logged in, provide a save draft button. if($mybb->user['uid'])
|
// If the user is logged in, provide a save draft button. if($mybb->user['uid'])
|
{
| {
|
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";"); }
|
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";"); }
|
|
|
// Show captcha image for guests if enabled
|
// 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
| require_once MYBB_ROOT.'inc/class_captcha.php';
|
if($mybb->input['previewpost'] || $hide_captcha == true)
|
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")."\";");
| { // If previewing a post - check their current captcha input - if correct, hide the captcha input area $post_captcha = new captcha;
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")."\";");
| $post_captcha = new captcha(true, "post_captcha");
if($post_captcha->html) { $captcha = $post_captcha->html; }
|
} }
| } }
|