コード例 #1
0
ファイル: newreply.php プロジェクト: mainhan1804/xomvanphong
 // Set up posthandler.
 require_once MYBB_ROOT . "inc/datahandlers/post.php";
 $posthandler = new PostDataHandler("insert");
 $posthandler->action = "post";
 // Set the post data that came from the input to the $post array.
 $post = array("tid" => $mybb->get_input('tid', MyBB::INPUT_INT), "replyto" => $mybb->get_input('replyto', MyBB::INPUT_INT), "fid" => $thread['fid'], "subject" => $mybb->get_input('subject'), "icon" => $mybb->get_input('icon', MyBB::INPUT_INT), "uid" => $uid, "username" => $username, "message" => $mybb->get_input('message'), "ipaddress" => $session->packedip, "posthash" => $mybb->get_input('posthash'));
 if (isset($mybb->input['pid'])) {
     $post['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);
 }
 $posthandler->set_data($post);
 // Now let the post handler do all the hard work.
 $valid_post = $posthandler->verify_message();
 $valid_subject = $posthandler->verify_subject();
 // guest post --> verify author
 if ($post['uid'] == 0) {
     $valid_username = $posthandler->verify_author();
 } else {
     $valid_username = true;
 }
 $post_errors = array();
 // Fetch friendly error messages if this is an invalid post
 if (!$valid_post || !$valid_subject || !$valid_username) {
     $post_errors = $posthandler->get_friendly_errors();
 }
 // One or more errors returned, fetch error list and throw to newreply page
 if (count($post_errors) > 0) {
     $reply_errors = inline_error($post_errors);
 } else {
     $quote_ids = htmlspecialchars_uni($mybb->get_input('quote_ids'));
     if (!isset($mybb->input['username'])) {
         $mybb->input['username'] = $lang->guest;