Zeile 241 | Zeile 241 |
---|
*/ function verify_message() {
|
*/ function verify_message() {
|
global $mybb;
| global $db, $mybb;
|
$post = &$this->data; $post['message'] = trim_blank_chrs($post['message']);
| $post = &$this->data; $post['message'] = trim_blank_chrs($post['message']);
|
Zeile 252 | Zeile 252 |
---|
$this->set_error("missing_message"); return false; }
|
$this->set_error("missing_message"); return false; }
|
// If this board has a maximum message length check if we're over it. Use strlen because SQL limits are in bytes else if(strlen($post['message']) > $mybb->settings['maxmessagelength'] && $mybb->settings['maxmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid'])) { $this->set_error("message_too_long", array($mybb->settings['maxmessagelength'], strlen($post['message']))); return false; }
// And if we've got a minimum message length do we meet that requirement too?
| |
else {
|
else {
|
| $limit = (int)$mybb->settings['maxmessagelength']; $dblimit = 0;
// If database is mysql or mysqli check field type and set max database limit if(stripos($db->type, 'my') !== false) { $fields = $db->show_fields_from("posts"); $type = $fields[array_search('message', array_column($fields, 'Field'))]['Type']; switch(strtolower($type)) { case 'longtext': $dblimit = 4294967295; break; case 'mediumtext': $dblimit = 16777215; break; case 'text': default: $dblimit = 65535; break; } }
if($limit > 0 || $dblimit > 0) { $is_moderator = is_moderator($post['fid'], "", $post['uid']); // Consider minimum in user defined and database limit other than 0 if($limit > 0 && $dblimit > 0) { $limit = $is_moderator ? $dblimit : min($limit, $dblimit); } else { $limit = max($limit, $dblimit); }
if(strlen($post['message']) > $limit && (!$is_moderator || $limit == $dblimit)) { $this->set_error("message_too_long", array($limit, strlen($post['message']))); return false; } }
|
if(!isset($post['fid'])) { $post['fid'] = 0; }
|
if(!isset($post['fid'])) { $post['fid'] = 0; }
|
|
|
if(!$mybb->settings['mycodemessagelength']) { // Check to see of the text is full of MyCode
| if(!$mybb->settings['mycodemessagelength']) { // Check to see of the text is full of MyCode
|
Zeile 294 | Zeile 329 |
---|
* Verifies the specified post options are correct. * * @return boolean True
|
* Verifies the specified post options are correct. * * @return boolean True
|
*/
| */
|
function verify_options() { $options = &$this->data['options'];
|
function verify_options() { $options = &$this->data['options'];
|
|
|
// Verify yes/no options. $this->verify_yesno_option($options, 'signature', 0); $this->verify_yesno_option($options, 'disablesmilies', 0);
| // Verify yes/no options. $this->verify_yesno_option($options, 'signature', 0); $this->verify_yesno_option($options, 'disablesmilies', 0);
|
Zeile 319 | Zeile 354 |
---|
// Check if post flooding is enabled within MyBB or if the admin override option is specified. if($mybb->settings['postfloodcheck'] == 1 && $post['uid'] != 0 && $this->admin_override == false)
|
// Check if post flooding is enabled within MyBB or if the admin override option is specified. if($mybb->settings['postfloodcheck'] == 1 && $post['uid'] != 0 && $this->admin_override == false)
|
{
| {
|
if($this->verify_post_merge(true) !== true)
|
if($this->verify_post_merge(true) !== true)
|
{
| {
|
return true;
|
return true;
|
}
| }
|
// Fetch the user information for this post - used to check their last post date. $user = get_user($post['uid']);
| // Fetch the user information for this post - used to check their last post date. $user = get_user($post['uid']);
|
Zeile 336 | Zeile 371 |
---|
if($time_to_wait == 1) { $this->set_error("post_flooding_one_second");
|
if($time_to_wait == 1) { $this->set_error("post_flooding_one_second");
|
}
| }
|
else { $this->set_error("post_flooding", array($time_to_wait)); } return false;
|
else { $this->set_error("post_flooding", array($time_to_wait)); } return false;
|
} }
| } }
|
// All is well that ends well - return true. return true; }
|
// All is well that ends well - return true. return true; }
|
|
|
/** * @param bool $simple_mode *
| /** * @param bool $simple_mode *
|
Zeile 356 | Zeile 391 |
---|
function verify_post_merge($simple_mode=false) { global $mybb, $db, $session;
|
function verify_post_merge($simple_mode=false) { global $mybb, $db, $session;
|
|
|
$post = &$this->data;
// Are we starting a new thread?
| $post = &$this->data;
// Are we starting a new thread?
|
Zeile 367 | Zeile 402 |
---|
// Are we even turned on? if(empty($mybb->settings['postmergemins']))
|
// Are we even turned on? if(empty($mybb->settings['postmergemins']))
|
{ return true;
| { return true;
|
}
// Assign a default separator if none is specified
| }
// Assign a default separator if none is specified
|
Zeile 440 | Zeile 475 |
---|
* @return boolean True when valid, false when not valid. */ function verify_image_count()
|
* @return boolean True when valid, false when not valid. */ function verify_image_count()
|
{ global $mybb, $db;
| { global $mybb, $db;
|
$post = &$this->data;
// Get the permissions of the user who is making this post or thread
| $post = &$this->data;
// Get the permissions of the user who is making this post or thread
|
Zeile 488 | Zeile 523 |
---|
{ // Throw back a message if over the count with the number of images as well as the maximum number of images per post. $this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
|
{ // Throw back a message if over the count with the number of images as well as the maximum number of images per post. $this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
|
return false; } }
return true;
| return false; } }
return true;
|
}
/**
| }
/**
|
Zeile 541 | Zeile 576 |
---|
$query = $db->simple_select("posts", "pid", "pid='".(int)$post['replyto']."'"); $valid_post = $db->fetch_array($query); if(!$valid_post['pid'])
|
$query = $db->simple_select("posts", "pid", "pid='".(int)$post['replyto']."'"); $valid_post = $db->fetch_array($query); if(!$valid_post['pid'])
|
{
| {
|
$post['replyto'] = 0;
|
$post['replyto'] = 0;
|
}
| }
|
else { return true; }
|
else { return true; }
|
}
| }
|
// If this post isn't a reply to a specific post, attach it to the first post. if(!$post['replyto'])
| // If this post isn't a reply to a specific post, attach it to the first post. if(!$post['replyto'])
|
Zeile 562 | Zeile 597 |
---|
$query = $db->simple_select("posts", "pid", "tid='{$post['tid']}'", $options); $reply_to = $db->fetch_array($query); $post['replyto'] = $reply_to['pid'];
|
$query = $db->simple_select("posts", "pid", "tid='{$post['tid']}'", $options); $reply_to = $db->fetch_array($query); $post['replyto'] = $reply_to['pid'];
|
}
return true; }
| }
return true; }
|
/** * Verify the post icon. *
| /** * Verify the post icon. *
|
Zeile 639 | Zeile 674 |
---|
{ // Post is being edited $user = get_user($this->data['edit_uid']);
|
{ // Post is being edited $user = get_user($this->data['edit_uid']);
|
} else
| } else
|
{ $user = get_user($this->data['uid']);
|
{ $user = get_user($this->data['uid']);
|
}
| }
|
if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
|
if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
|
{ $this->set_error('invalid_prefix'); return false; } }
| { $this->set_error('invalid_prefix'); return false; } }
|
if($prefix_cache['forums'] != "-1") { // Decide whether this prefix can be used in our forum
| if($prefix_cache['forums'] != "-1") { // Decide whether this prefix can be used in our forum
|
Zeile 665 | Zeile 700 |
---|
}
// Does this forum require a prefix?
|
}
// Does this forum require a prefix?
|
$forum = get_forum($this->data['fid']);
| $forum = get_forum($this->data['fid']);
|
if($forum['requireprefix'] == 1) {
| if($forum['requireprefix'] == 1) {
|
Zeile 714 | Zeile 749 |
---|
}
return true;
|
}
return true;
|
}
| }
|
/** * Validate a post. *
| /** * Validate a post. *
|
Zeile 724 | Zeile 759 |
---|
function validate_post() { global $mybb, $db, $plugins;
|
function validate_post() { global $mybb, $db, $plugins;
|
|
|
$post = &$this->data; $time = TIME_NOW;
|
$post = &$this->data; $time = TIME_NOW;
|
|
|
$this->action = "post";
if($this->method != "update" && !$post['savedraft'])
| $this->action = "post";
if($this->method != "update" && !$post['savedraft'])
|
Zeile 739 | Zeile 774 |
---|
if($this->method == "update") { if(empty($post['tid']))
|
if($this->method == "update") { if(empty($post['tid']))
|
{
| {
|
$query = $db->simple_select("posts", "tid", "pid='".(int)$post['pid']."'"); $post['tid'] = $db->fetch_field($query, "tid"); }
| $query = $db->simple_select("posts", "tid", "pid='".(int)$post['pid']."'"); $post['tid'] = $db->fetch_field($query, "tid"); }
|
Zeile 756 | Zeile 791 |
---|
{ $this->first_post = true; }
|
{ $this->first_post = true; }
|
}
| }
|
// Verify all post assets.
if($this->method == "insert" || array_key_exists('uid', $post)) { $this->verify_author();
|
// Verify all post assets.
if($this->method == "insert" || array_key_exists('uid', $post)) { $this->verify_author();
|
}
| }
|
if($this->method == "insert" || array_key_exists('subject', $post)) { $this->verify_subject();
| if($this->method == "insert" || array_key_exists('subject', $post)) { $this->verify_subject();
|
Zeile 838 | Zeile 873 |
---|
}
// Fetch the thread
|
}
// Fetch the thread
|
$thread = get_thread($post['tid']);
| $thread = get_thread($post['tid']);
|
$closed = $thread['closed'];
|
$closed = $thread['closed'];
|
|
|
// This post is being saved as a draft. if($post['savedraft'])
|
// This post is being saved as a draft. if($post['savedraft'])
|
{
| {
|
$visible = -2; }
|
$visible = -2; }
|
|
|
// Otherwise this post is being made now and we have a bit to do. else { // Automatic subscription to the thread
|
// Otherwise this post is being made now and we have a bit to do. else { // Automatic subscription to the thread
|
if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
| if($post['uid'] > 0)
|
{
|
{
|
switch($post['options']['subscriptionmethod'])
| require_once MYBB_ROOT."inc/functions_user.php"; if($post['options']['subscriptionmethod'] == "")
|
{
|
{
|
case "pm": $notification = 2; break; case "email": $notification = 1; break; default: $notification = 0;
| remove_subscribed_thread($post['tid'], $post['uid']);
|
}
|
}
|
require_once MYBB_ROOT."inc/functions_user.php"; add_subscribed_thread($post['tid'], $notification, $post['uid']); }
| else { switch($post['options']['subscriptionmethod']) { case "pm": $notification = 2; break; case "email": $notification = 1; break; default: $notification = 0; } add_subscribed_thread($post['tid'], $notification, $post['uid']); } }
|
// Perform any selected moderation tools. $ismod = is_moderator($post['fid'], "", $post['uid']);
| // Perform any selected moderation tools. $ismod = is_moderator($post['fid'], "", $post['uid']);
|
Zeile 941 | Zeile 982 |
---|
if(!isset($post['pid'])) { $post['pid'] = 0;
|
if(!isset($post['pid'])) { $post['pid'] = 0;
|
}
| }
|
$post['pid'] = (int)$post['pid']; $post['uid'] = (int)$post['uid'];
| $post['pid'] = (int)$post['pid']; $post['uid'] = (int)$post['uid'];
|
Zeile 1013 | Zeile 1054 |
---|
}
if($visible == 1)
|
}
if($visible == 1)
|
{
| {
|
$now = TIME_NOW;
// Yes, the value to the lastpost key in this array has single quotes within double quotes. It's not a bug.
| $now = TIME_NOW;
// Yes, the value to the lastpost key in this array has single quotes within double quotes. It's not a bug.
|
Zeile 1038 | Zeile 1079 |
---|
"uid" => $post['uid'], "username" => $db->escape_string($post['username']), "dateline" => (int)$post['dateline'],
|
"uid" => $post['uid'], "username" => $db->escape_string($post['username']), "dateline" => (int)$post['dateline'],
|
"message" => $db->escape_string($post['message']), "ipaddress" => $db->escape_binary($post['ipaddress']),
| "message" => $db->escape_string($post['message']), "ipaddress" => $db->escape_binary($post['ipaddress']),
|
"includesig" => $post['options']['signature'], "smilieoff" => $post['options']['disablesmilies'], "visible" => $visible
| "includesig" => $post['options']['signature'], "smilieoff" => $post['options']['disablesmilies'], "visible" => $visible
|
Zeile 1433 | Zeile 1474 |
---|
// Are we updating a post which is already a draft? Perhaps changing it into a visible post? if($draft_check)
|
// Are we updating a post which is already a draft? Perhaps changing it into a visible post? if($draft_check)
|
{ $this->thread_insert_data = array( "subject" => $db->escape_string($thread['subject']), "icon" => (int)$thread['icon'], "username" => $db->escape_string($thread['username']), "dateline" => (int)$thread['dateline'],
| { $this->thread_insert_data = array( "subject" => $db->escape_string($thread['subject']), "icon" => (int)$thread['icon'], "username" => $db->escape_string($thread['username']), "dateline" => (int)$thread['dateline'],
|
"lastpost" => (int)$thread['dateline'], "lastposter" => $db->escape_string($thread['username']),
|
"lastpost" => (int)$thread['dateline'], "lastposter" => $db->escape_string($thread['username']),
|
"visible" => $visible
| "visible" => $visible
|
);
|
);
|
|
|
$plugins->run_hooks("datahandler_post_insert_thread", $this);
|
$plugins->run_hooks("datahandler_post_insert_thread", $this);
|
|
|
$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
|
$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
|
$this->post_insert_data = array( "subject" => $db->escape_string($thread['subject']), "icon" => (int)$thread['icon'], "username" => $db->escape_string($thread['username']), "dateline" => (int)$thread['dateline'], "message" => $db->escape_string($thread['message']), "ipaddress" => $db->escape_binary(my_inet_pton(get_ip())), "includesig" => $thread['options']['signature'], "smilieoff" => $thread['options']['disablesmilies'], "visible" => $visible
| $this->post_insert_data = array( "subject" => $db->escape_string($thread['subject']), "icon" => (int)$thread['icon'], "username" => $db->escape_string($thread['username']), "dateline" => (int)$thread['dateline'], "message" => $db->escape_string($thread['message']), "ipaddress" => $db->escape_binary(my_inet_pton(get_ip())), "includesig" => $thread['options']['signature'], "smilieoff" => $thread['options']['disablesmilies'], "visible" => $visible
|
); $plugins->run_hooks("datahandler_post_insert_thread_post", $this);
| ); $plugins->run_hooks("datahandler_post_insert_thread_post", $this);
|
Zeile 1544 | Zeile 1585 |
---|
if(isset($thread['tid'])) { $modlogdata['tid'] = $thread['tid'];
|
if(isset($thread['tid'])) { $modlogdata['tid'] = $thread['tid'];
|
}
| }
|
$modoptions_update = array();
// Close the thread.
| $modoptions_update = array();
// Close the thread.
|
Zeile 1589 | Zeile 1630 |
---|
if($forum['usethreadcounts'] != 0) { $update_query['threadnum'] = 'threadnum+1';
|
if($forum['usethreadcounts'] != 0) { $update_query['threadnum'] = 'threadnum+1';
|
}
| }
|
// Only update the table if we need to. if(!empty($update_query))
| // Only update the table if we need to. if(!empty($update_query))
|
Zeile 1606 | Zeile 1647 |
---|
$done_users = array();
// Queue up any forum subscription notices to users who are subscribed to this forum.
|
$done_users = array();
// Queue up any forum subscription notices to users who are subscribed to this forum.
|
$excerpt = my_substr($thread['message'], 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;
| $excerpt = $thread['message'];
|
// Parse badwords require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; $excerpt = $parser->parse_badwords($excerpt);
|
// Parse badwords require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; $excerpt = $parser->parse_badwords($excerpt);
|
| $excerpt = $parser->text_parse_message($excerpt); if(strlen($excerpt) > $mybb->settings['subscribeexcerpt']) { $excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread; }
|
$query = $db->query(" SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate FROM ".TABLE_PREFIX."forumsubscriptions fs
| $query = $db->query(" SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate FROM ".TABLE_PREFIX."forumsubscriptions fs
|
Zeile 1833 | Zeile 1878 |
---|
$plugins->run_hooks("datahandler_post_update_thread", $this);
$db->update_query("threads", $this->thread_update_data, "tid='".(int)$post['tid']."'");
|
$plugins->run_hooks("datahandler_post_update_thread", $this);
$db->update_query("threads", $this->thread_update_data, "tid='".(int)$post['tid']."'");
|
| }
// Update any moved thread links to have corresponding new subject. if(isset($post['subject'])) { $query = $db->simple_select("threads", "tid, closed", "closed='moved|".$this->tid."'"); if($db->num_rows($query) > 0) { $update_data['subject'] = $db->escape_string($post['subject']); while($result = $db->fetch_array($query)) { $db->update_query("threads", $update_data, "tid='".(int)$result['tid']."'"); } }
|
} }
| } }
|