Zeile 138 | Zeile 138 |
---|
$post['username'] = $user['username']; } // if the uid is 0 verify the username
|
$post['username'] = $user['username']; } // if the uid is 0 verify the username
|
else if($post['uid'] == 0 && $post['username'] != $lang->guest)
| else if($post['uid'] == 0 && $post['username'] != '')
|
{ // Set up user handler require_once MYBB_ROOT."inc/datahandlers/user.php";
| { // Set up user handler require_once MYBB_ROOT."inc/datahandlers/user.php";
|
Zeile 153 | Zeile 153 |
---|
$this->errors = array_merge($this->errors, $userhandler->get_errors()); return false; }
|
$this->errors = array_merge($this->errors, $userhandler->get_errors()); return false; }
|
|
|
if($userhandler->verify_username_exists()) { // username is in use $this->errors = array_merge($this->errors, $userhandler->get_errors());
|
if($userhandler->verify_username_exists()) { // username is in use $this->errors = array_merge($this->errors, $userhandler->get_errors());
|
return false; } }
// After all of this, if we still don't have a username, force the username as "Guest" (Note, this is not translatable as it is always a fallback) if(!$post['username']) { $post['username'] = "Guest"; }
return true; }
| return false; } }
return true; }
|
/** * Verifies a post subject. *
| /** * Verifies a post subject. *
|
Zeile 184 | Zeile 178 |
---|
$subject = trim_blank_chrs($subject);
if($this->method == "update" && $post['pid'])
|
$subject = trim_blank_chrs($subject);
if($this->method == "update" && $post['pid'])
|
{
| {
|
// If this is the first post there needs to be a subject, else make it the default one. if(my_strlen($subject) == 0 && $this->first_post) {
| // If this is the first post there needs to be a subject, else make it the default one. if(my_strlen($subject) == 0 && $this->first_post) {
|
Zeile 212 | Zeile 206 |
---|
else { if(my_strlen($subject) == 0)
|
else { if(my_strlen($subject) == 0)
|
{
| {
|
$this->set_error("missing_subject"); return false; }
| $this->set_error("missing_subject"); return false; }
|
Zeile 226 | Zeile 220 |
---|
if($position_re !== false && $position_re == 0) { $subject_length = $subject_length - 4;
|
if($position_re !== false && $position_re == 0) { $subject_length = $subject_length - 4;
|
}
| }
|
}
if($subject_length > 85)
| }
if($subject_length > 85)
|
Zeile 247 | Zeile 241 |
---|
*/ function verify_message() {
|
*/ function verify_message() {
|
global $mybb;
| global $db, $mybb;
|
$post = &$this->data; $post['message'] = trim_blank_chrs($post['message']);
// Do we even have a message at all? if(my_strlen($post['message']) == 0)
|
$post = &$this->data; $post['message'] = trim_blank_chrs($post['message']);
// Do we even have a message at all? if(my_strlen($post['message']) == 0)
|
{
| {
|
$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) { if(isset($post['fid'])) { $fid = $post['fid']; } else { $fid = 0; } if(isset($post['uid'])) { $uid = $post['uid']; } else { $uid = 0; }
$is_moderator = is_moderator($fid, "", $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 394 | Zeile 440 |
---|
$thread = $db->fetch_array($query);
// Check to see if the same author has posted within the merge post time limit
|
$thread = $db->fetch_array($query);
// Check to see if the same author has posted within the merge post time limit
|
if(((int)$mybb->settings['postmergemins'] != 0 && trim($mybb->settings['postmergemins']) != "") && (TIME_NOW-$thread['lastpost']) > ((int)$mybb->settings['postmergemins']*60))
| if( !$thread || ( ((int)$mybb->settings['postmergemins'] != 0 && trim($mybb->settings['postmergemins']) != "") && (TIME_NOW-$thread['lastpost']) > ((int)$mybb->settings['postmergemins']*60) ) )
|
{ return true; }
| { return true; }
|
Zeile 427 | Zeile 478 |
---|
return false; }
|
return false; }
|
if($post['uid'])
| if(!empty($post['uid']))
|
{ $user_check = "uid='".$post['uid']."'"; }
| { $user_check = "uid='".$post['uid']."'"; }
|
Zeile 450 | Zeile 501 |
---|
global $mybb, $db;
$post = &$this->data;
|
global $mybb, $db;
$post = &$this->data;
|
| if(isset($post['uid'])) { $uid = $post['uid']; } else { $uid = null; }
|
// Get the permissions of the user who is making this post or thread
|
// Get the permissions of the user who is making this post or thread
|
$permissions = user_permissions($post['uid']);
| $permissions = user_permissions($uid);
|
// Fetch the forum this post is being made in
|
// Fetch the forum this post is being made in
|
if(!$post['fid'])
| if(empty($post['fid']))
|
{ $query = $db->simple_select('posts', 'fid', "pid = '{$post['pid']}'"); $post['fid'] = $db->fetch_field($query, 'fid');
| { $query = $db->simple_select('posts', 'fid', "pid = '{$post['pid']}'"); $post['fid'] = $db->fetch_field($query, 'fid');
|
Zeile 467 | Zeile 527 |
---|
{ require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
{ require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
|
|
// Parse the message. $parser_options = array( "allow_html" => $forum['allowhtml'],
| // Parse the message. $parser_options = array( "allow_html" => $forum['allowhtml'],
|
Zeile 477 | Zeile 537 |
---|
"filter_badwords" => 1 );
|
"filter_badwords" => 1 );
|
if($post['options']['disablesmilies'] != 1)
| if(empty($post['options']['disablesmilies']))
|
{ $parser_options['allow_smilies'] = $forum['allowsmilies']; } else
|
{ $parser_options['allow_smilies'] = $forum['allowsmilies']; } else
|
{
| {
|
$parser_options['allow_smilies'] = 0; }
| $parser_options['allow_smilies'] = 0; }
|
Zeile 496 | Zeile 556 |
---|
$this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages'])); return false; }
|
$this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages'])); return false; }
|
}
| }
|
return true; }
| return true; }
|
Zeile 511 | Zeile 571 |
---|
global $mybb, $db;
$post = &$this->data;
|
global $mybb, $db;
$post = &$this->data;
|
| if(isset($post['uid'])) { $uid = $post['uid']; } else { $uid = null; }
|
// Get the permissions of the user who is making this post or thread
|
// Get the permissions of the user who is making this post or thread
|
$permissions = user_permissions($post['uid']);
| $permissions = user_permissions($uid);
|
// Check if this post contains more videos than the forum allows if((!isset($post['savedraft']) || $post['savedraft'] != 1) && $mybb->settings['maxpostvideos'] != 0 && $permissions['cancp'] != 1)
| // Check if this post contains more videos than the forum allows if((!isset($post['savedraft']) || $post['savedraft'] != 1) && $mybb->settings['maxpostvideos'] != 0 && $permissions['cancp'] != 1)
|
Zeile 562 | Zeile 631 |
---|
$options = array( "limit_start" => 0, "limit" => 1,
|
$options = array( "limit_start" => 0, "limit" => 1,
|
"order_by" => "dateline", "order_dir" => "asc"
| "order_by" => "dateline, pid",
|
); $query = $db->simple_select("posts", "pid", "tid='{$post['tid']}'", $options); $reply_to = $db->fetch_array($query);
| ); $query = $db->simple_select("posts", "pid", "tid='{$post['tid']}'", $options); $reply_to = $db->fetch_array($query);
|
Zeile 626 | Zeile 694 |
---|
} else {
|
} else {
|
| if(!empty($this->data['tid'])) { // Fetch the thread $thread = get_thread($this->data['tid']); }
|
$prefix_cache = build_prefixes($prefix);
if(empty($prefix_cache)) { $this->set_error('invalid_prefix'); return false;
|
$prefix_cache = build_prefixes($prefix);
if(empty($prefix_cache)) { $this->set_error('invalid_prefix'); return false;
|
}
| }
|
if($prefix_cache['groups'] != "-1") { if(!empty($this->data['edit_uid']))
|
if($prefix_cache['groups'] != "-1") { if(!empty($this->data['edit_uid']))
|
{
| {
|
// Post is being edited $user = get_user($this->data['edit_uid']); } else
|
// Post is being edited $user = get_user($this->data['edit_uid']); } 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'])))
| 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;
|
Zeile 656 | Zeile 730 |
---|
// Decide whether this prefix can be used in our forum $forums = explode(",", $prefix_cache['forums']);
|
// Decide whether this prefix can be used in our forum $forums = explode(",", $prefix_cache['forums']);
|
if(!in_array($this->data['fid'], $forums))
| if(!in_array($this->data['fid'], $forums) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
|
{ $this->set_error('invalid_prefix'); return false; }
|
{ $this->set_error('invalid_prefix'); return false; }
|
}
| }
|
}
// Does this forum require a prefix?
| }
// Does this forum require a prefix?
|
Zeile 689 | Zeile 763 |
---|
foreach($prefix_cache as $required) { if($required['forums'] != "-1")
|
foreach($prefix_cache as $required) { if($required['forums'] != "-1")
|
{
| {
|
// Decide whether this prefix can be used in our forum $forums = explode(",", $required['forums']);
|
// Decide whether this prefix can be used in our forum $forums = explode(",", $required['forums']);
|
|
|
if(!in_array($forum['fid'], $forums))
|
if(!in_array($forum['fid'], $forums))
|
{
| {
|
continue; } }
|
continue; } }
|
if($required['groups'] != "-1") { if(!is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups']))) { $num_prefixes = true; } } else
| if(is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
|
{ $num_prefixes = true; }
| { $num_prefixes = true; }
|
Zeile 754 | Zeile 821 |
---|
$options = array( "limit" => 1, "limit_start" => 0,
|
$options = array( "limit" => 1, "limit_start" => 0,
|
"order_by" => "dateline", "order_dir" => "asc"
| "order_by" => "dateline, pid",
|
); $query = $db->simple_select("posts", "pid", "tid='".$post['tid']."'", $options); $first_check = $db->fetch_array($query);
| ); $query = $db->simple_select("posts", "pid", "tid='".$post['tid']."'", $options); $first_check = $db->fetch_array($query);
|
Zeile 859 | Zeile 925 |
---|
else { // Automatic subscription to the thread
|
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']); } 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']);
|
}
|
}
|
require_once MYBB_ROOT."inc/functions_user.php"; 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']);
|
if($ismod) {
| if($ismod && isset($post['modoptions'])) {
|
$lang->load($this->language_file, true);
|
$lang->load($this->language_file, true);
|
|
|
$modoptions = $post['modoptions']; $modlogdata['fid'] = $thread['fid']; $modlogdata['tid'] = $thread['tid'];
|
$modoptions = $post['modoptions']; $modlogdata['fid'] = $thread['fid']; $modlogdata['tid'] = $thread['tid'];
|
if(!isset($modoptions['closethread'])) { $modoptions['closethread'] = $closed; }
|
|
$modoptions_update = array();
// Close the thread.
|
$modoptions_update = array();
// Close the thread.
|
if($modoptions['closethread'] == 1 && $thread['closed'] != 1)
| if(!empty($modoptions['closethread']) && $thread['closed'] != 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid']))
|
{
|
{
|
$modoptions_update['closed'] = $closed = 0;
| $modoptions_update['closed'] = $closed = 1;
|
log_moderator_action($modlogdata, $lang->thread_closed); }
// Open the thread.
|
log_moderator_action($modlogdata, $lang->thread_closed); }
// Open the thread.
|
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)
| if(empty($modoptions['closethread']) && $thread['closed'] == 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid']))
|
{
|
{
|
$modoptions_update['closed'] = $closed = 1;
| $modoptions_update['closed'] = $closed = 0;
|
log_moderator_action($modlogdata, $lang->thread_opened);
|
log_moderator_action($modlogdata, $lang->thread_opened);
|
}
if(!isset($modoptions['stickthread'])) { $modoptions['stickthread'] = $thread['sticky'];
| |
}
// Stick the thread.
|
}
// Stick the thread.
|
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)
| if(!empty($modoptions['stickthread']) && $thread['sticky'] != 1 && is_moderator($post['fid'], "canstickunstickthreads", $post['uid']))
|
{ $modoptions_update['sticky'] = 1; log_moderator_action($modlogdata, $lang->thread_stuck); }
// Unstick the thread.
|
{ $modoptions_update['sticky'] = 1; log_moderator_action($modlogdata, $lang->thread_stuck); }
// Unstick the thread.
|
if($modoptions['stickthread'] != 1 && $thread['sticky'])
| if(empty($modoptions['stickthread']) && $thread['sticky'] == 1 && is_moderator($post['fid'], "canstickunstickthreads", $post['uid']))
|
{ $modoptions_update['sticky'] = 0; log_moderator_action($modlogdata, $lang->thread_unstuck);
| { $modoptions_update['sticky'] = 0; log_moderator_action($modlogdata, $lang->thread_unstuck);
|
Zeile 940 | Zeile 1002 |
---|
// Decide on the visibility of this post. $forumpermissions = forum_permissions($post['fid'], $post['uid']); if($forumpermissions['modposts'] == 1 && !$ismod)
|
// Decide on the visibility of this post. $forumpermissions = forum_permissions($post['fid'], $post['uid']); if($forumpermissions['modposts'] == 1 && !$ismod)
|
{ $visible = 0; } else
| { $visible = 0; } else
|
{ $visible = 1; }
| { $visible = 1; }
|
Zeile 953 | Zeile 1015 |
---|
{ $visible = 0; }
|
{ $visible = 0; }
|
}
| }
|
if(!isset($post['pid'])) { $post['pid'] = 0;
| if(!isset($post['pid'])) { $post['pid'] = 0;
|
Zeile 979 | Zeile 1041 |
---|
// Only combine if they are both invisible (mod queue'd forum) or both visible if($double_post !== true && $double_post['visible'] == $visible)
|
// Only combine if they are both invisible (mod queue'd forum) or both visible if($double_post !== true && $double_post['visible'] == $visible)
|
{ $this->pid = $double_post['pid'];
$post['message'] = $double_post['message'] .= "\n".$mybb->settings['postmergesep']."\n".$post['message']; $update_query = array( "message" => $db->escape_string($double_post['message']) ); $update_query['edituid'] = (int)$post['uid']; $update_query['edittime'] = TIME_NOW; $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");
if($draft_check) { $db->delete_query("posts", "pid='".$post['pid']."'"); }
if($post['posthash']) { // Assign any uploaded attachments with the specific posthash to the merged post. $post['posthash'] = $db->escape_string($post['posthash']);
$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='0' AND visible='1' AND posthash='{$post['posthash']}'"); $attachmentcount = $db->fetch_field($query, "attachmentcount");
| { $_message = $post['message'];
|
|
|
if($attachmentcount > 0)
| $post['message'] = $double_post['message'] .= "\n".$mybb->settings['postmergesep']."\n".$post['message']; if ($this->validate_post()) { $this->pid = $double_post['pid']; $update_query = array( "message" => $db->escape_string($double_post['message']) ); $update_query['edituid'] = (int)$post['uid']; $update_query['edittime'] = TIME_NOW; $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'"); if($draft_check) { $db->delete_query("posts", "pid='".$post['pid']."'"); } if($post['posthash'])
|
{
|
{
|
// Update forum count update_thread_counters($post['tid'], array('attachmentcount' => "+{$attachmentcount}"));
| // Assign any uploaded attachments with the specific posthash to the merged post. $post['posthash'] = $db->escape_string($post['posthash']); $query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='0' AND visible='1' AND posthash='{$post['posthash']}'"); $attachmentcount = $db->fetch_field($query, "attachmentcount"); if($attachmentcount > 0) { // Update forum count update_thread_counters($post['tid'], array('attachmentcount' => "+{$attachmentcount}")); } $attachmentassign = array( "pid" => $double_post['pid'], "posthash" => '' ); $db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");
|
}
|
}
|
$attachmentassign = array(
| // Return the post's pid and whether or not it is visible. $this->return_values = array(
|
"pid" => $double_post['pid'],
|
"pid" => $double_post['pid'],
|
"posthash" => ''
| "visible" => $visible, "merge" => true
|
);
|
);
|
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");
| $plugins->run_hooks("datahandler_post_insert_merge", $this); return $this->return_values; } else { $post['message'] = $_message;
|
}
|
}
|
// Return the post's pid and whether or not it is visible. $this->return_values = array( "pid" => $double_post['pid'], "visible" => $visible, "merge" => true );
$plugins->run_hooks("datahandler_post_insert_merge", $this);
return $this->return_values;
| |
} }
|
} }
|
if($visible == 1 && $thread['visible'] == 1)
| if($visible == 1)
|
{ $now = TIME_NOW;
| { $now = TIME_NOW;
|
Zeile 1037 | Zeile 1109 |
---|
$update_array = array( 'lastpost' => "'{$now}'" );
|
$update_array = array( 'lastpost' => "'{$now}'" );
|
if($forum['usepostcounts'] != 0)
| if($forum['usepostcounts'] != 0 && $thread['visible'] == 1)
|
{ $update_array['postnum'] = 'postnum+1'; }
| { $update_array['postnum'] = 'postnum+1'; }
|
Zeile 1055 | Zeile 1127 |
---|
"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']), "includesig" => $post['options']['signature'],
| "message" => $db->escape_string($post['message']), "ipaddress" => $db->escape_binary($post['ipaddress']), "includesig" => $post['options']['signature'],
|
"smilieoff" => $post['options']['disablesmilies'], "visible" => $visible );
| "smilieoff" => $post['options']['disablesmilies'], "visible" => $visible );
|
Zeile 1101 | Zeile 1173 |
---|
); $db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'"); }
|
); $db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'"); }
|
|
|
$thread_update = array(); if($visible == 1 && $thread['visible'] == 1) {
|
$thread_update = array(); if($visible == 1 && $thread['visible'] == 1) {
|
$thread = get_thread($post['tid']);
| |
require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new Postparser;
|
require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new Postparser;
|
|
|
$done_users = array();
|
$done_users = array();
|
|
|
$subject = $parser->parse_badwords($thread['subject']);
|
$subject = $parser->parse_badwords($thread['subject']);
|
|
|
$parser_options = array( 'me_username' => $post['username'], 'filter_badwords' => 1
| $parser_options = array( 'me_username' => $post['username'], 'filter_badwords' => 1
|
Zeile 1123 | Zeile 1194 |
---|
// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices $query = $db->query("
|
// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices $query = $db->query("
|
SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.subscriptionkey, s.notification
| SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.notification
|
FROM ".TABLE_PREFIX."threadsubscriptions s LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid) WHERE (s.notification='1' OR s.notification='2') AND s.tid='{$post['tid']}'
| FROM ".TABLE_PREFIX."threadsubscriptions s LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid) WHERE (s.notification='1' OR s.notification='2') AND s.tid='{$post['tid']}'
|
Zeile 1139 | Zeile 1210 |
---|
while($subscribedmember = $db->fetch_array($query)) {
|
while($subscribedmember = $db->fetch_array($query)) {
|
if($done_users[$subscribedmember['uid']])
| if(isset($done_users[$subscribedmember['uid']]))
|
{ continue; }
| { continue; }
|
Zeile 1150 | Zeile 1221 |
---|
$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
|
$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
|
{
| {
|
continue;
|
continue;
|
}
if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthread'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid'])) {
| }
if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthreads'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid'])) {
|
// User isn't a moderator or the author of the thread... continue;
|
// User isn't a moderator or the author of the thread... continue;
|
}
| }
|
if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language'];
|
if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language'];
|
}
| }
|
elseif($mybb->settings['orig_bblanguage'])
|
elseif($mybb->settings['orig_bblanguage'])
|
{
| {
|
$uselang = $mybb->settings['orig_bblanguage']; } else { $uselang = "english";
|
$uselang = $mybb->settings['orig_bblanguage']; } else { $uselang = "english";
|
}
if($uselang == $mybb->settings['bblanguage']) { if($subscribedmember['notification'] == 1) {
| }
if($uselang == $mybb->settings['bblanguage']) { if($subscribedmember['notification'] == 1) {
|
$emailsubject = $lang->emailsubject_subscription; $emailmessage = $lang->email_subscription;
|
$emailsubject = $lang->emailsubject_subscription; $emailmessage = $lang->email_subscription;
|
}
| }
// If the poster is unregistered and hasn't set a username, call them Guest if(!$post['uid'] && !$post['username']) { $post['username'] = htmlspecialchars_uni($lang->guest); }
|
} else {
|
} else {
|
if($subscribedmember['notification'] == 1) { if(!isset($langcache[$uselang]['emailsubject_subscription']))
| if(($subscribedmember['notification'] == 1 && !isset($langcache[$uselang]['emailsubject_subscription'])) || !isset($langcache[$uselang]['guest'])) { $userlang = new MyLanguage; $userlang->set_path(MYBB_ROOT."inc/languages"); $userlang->set_language($uselang); if($subscribedmember['notification'] == 1)
|
{
|
{
|
$userlang = new MyLanguage; $userlang->set_path(MYBB_ROOT."inc/languages"); $userlang->set_language($uselang);
| |
$userlang->load("messages"); $langcache[$uselang]['emailsubject_subscription'] = $userlang->emailsubject_subscription; $langcache[$uselang]['email_subscription'] = $userlang->email_subscription;
|
$userlang->load("messages"); $langcache[$uselang]['emailsubject_subscription'] = $userlang->emailsubject_subscription; $langcache[$uselang]['email_subscription'] = $userlang->email_subscription;
|
unset($userlang);
| |
}
|
}
|
| $userlang->load("global");
$langcache[$uselang]['guest'] = $userlang->guest; unset($userlang); } if($subscribedmember['notification'] == 1) {
|
$emailsubject = $langcache[$uselang]['emailsubject_subscription']; $emailmessage = $langcache[$uselang]['email_subscription'];
|
$emailsubject = $langcache[$uselang]['emailsubject_subscription']; $emailmessage = $langcache[$uselang]['email_subscription'];
|
| }
// If the poster is unregistered and hasn't set a username, call them Guest if(!$post['uid'] && !$post['username']) { $post['username'] = $langcache[$uselang]['guest'];
|
} }
| } }
|
Zeile 1204 | Zeile 1294 |
---|
{ $emailsubject = $lang->sprintf($emailsubject, $subject);
|
{ $emailsubject = $lang->sprintf($emailsubject, $subject);
|
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']); $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);
| $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid']);
|
$new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '',
| $new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '',
|
Zeile 1219 | Zeile 1308 |
---|
} elseif($subscribedmember['notification'] == 2) {
|
} elseif($subscribedmember['notification'] == 2) {
|
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
| |
$pm = array( 'subject' => array('pmsubject_subscription', $subject),
|
$pm = array( 'subject' => array('pmsubject_subscription', $subject),
|
'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code),
| 'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid']),
|
'touid' => $subscribedmember['uid'], 'language' => $subscribedmember['language'], 'language_file' => 'messages' );
|
'touid' => $subscribedmember['uid'], 'language' => $subscribedmember['language'], 'language_file' => 'messages' );
|
| // Workaround for eliminating PHP warnings in PHP 8. Ref: https://github.com/mybb/mybb/issues/4630#issuecomment-1369144163 $pm['sender']['uid'] = -1;
|
send_pm($pm, -1, true); } }
| send_pm($pm, -1, true); } }
|
Zeile 1241 | Zeile 1331 |
---|
$thread_update = array('replies' => '+1');
|
$thread_update = array('replies' => '+1');
|
// Update forum count
| // Update counters
|
update_last_post($post['tid']); update_forum_counters($post['fid'], array("posts" => "+1")); update_forum_lastpost($thread['fid']);
| update_last_post($post['tid']); update_forum_counters($post['fid'], array("posts" => "+1")); update_forum_lastpost($thread['fid']);
|
Zeile 1265 | Zeile 1355 |
---|
// Update the unapproved posts count for the current forum $thread_update = array('replies' => '+1'); update_forum_counters($post['fid'], array("deletedposts" => "+1"));
|
// Update the unapproved posts count for the current forum $thread_update = array('replies' => '+1'); update_forum_counters($post['fid'], array("deletedposts" => "+1"));
|
| }
// Update last poster if($visible == 1 && $thread['visible'] != 1) { update_last_post($post['tid']);
|
}
$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
| }
$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
|
Zeile 1274 | Zeile 1370 |
---|
$thread_update['attachmentcount'] = "+{$attachmentcount}"; } update_thread_counters($post['tid'], $thread_update);
|
$thread_update['attachmentcount'] = "+{$attachmentcount}"; } update_thread_counters($post['tid'], $thread_update);
|
|
|
// Return the post's pid and whether or not it is visible. $this->return_values = array( "pid" => $this->pid, "visible" => $visible, "closed" => $closed );
|
// Return the post's pid and whether or not it is visible. $this->return_values = array( "pid" => $this->pid, "visible" => $visible, "closed" => $closed );
|
|
|
$plugins->run_hooks("datahandler_post_insert_post_end", $this);
return $this->return_values;
|
$plugins->run_hooks("datahandler_post_insert_post_end", $this);
return $this->return_values;
|
}
| }
|
/** * Validate a thread. *
| /** * Validate a thread. *
|
Zeile 1325 | Zeile 1421 |
---|
$this->verify_message(); $this->verify_image_count(); $this->verify_video_count();
|
$this->verify_message(); $this->verify_image_count(); $this->verify_video_count();
|
}
| }
|
if($this->method == "insert" || array_key_exists('dateline', $thread)) {
| if($this->method == "insert" || array_key_exists('dateline', $thread)) {
|
Zeile 1378 | Zeile 1474 |
---|
$thread = &$this->data;
// Fetch the forum this thread is being made in
|
$thread = &$this->data;
// Fetch the forum this thread is being made in
|
$forum = get_forum($thread['fid']);
| $query = $db->simple_select("forums", "*", "fid='{$thread['fid']}'"); $forum = $db->fetch_array($query);
|
// This thread is being saved as a draft. if($thread['savedraft']) { $visible = -2;
|
// This thread is being saved as a draft. if($thread['savedraft']) { $visible = -2;
|
}
| }
|
// Thread is being made now and we have a bit to do. else
| // Thread is being made now and we have a bit to do. else
|
Zeile 1422 | Zeile 1519 |
---|
else { $draft_check = false;
|
else { $draft_check = false;
|
}
| }
|
// 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(
|
// 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'],
| "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']), "visible" => $visible
| "lastpost" => (int)$thread['dateline'], "lastposter" => $db->escape_string($thread['username']), "visible" => $visible
|
Zeile 1440 | Zeile 1537 |
---|
$plugins->run_hooks("datahandler_post_insert_thread", $this);
$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
|
$plugins->run_hooks("datahandler_post_insert_thread", $this);
$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']),
| $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'],
| "ipaddress" => $db->escape_binary(my_inet_pton(get_ip())), "includesig" => $thread['options']['signature'], "smilieoff" => $thread['options']['disablesmilies'],
|
Zeile 1472 | Zeile 1569 |
---|
"dateline" => (int)$thread['dateline'], "lastpost" => (int)$thread['dateline'], "lastposter" => $db->escape_string($thread['username']),
|
"dateline" => (int)$thread['dateline'], "lastpost" => (int)$thread['dateline'], "lastposter" => $db->escape_string($thread['username']),
|
| "lastposteruid" => $thread['uid'],
|
"views" => 0, "replies" => 0, "visible" => $visible,
| "views" => 0, "replies" => 0, "visible" => $visible,
|
Zeile 1527 | Zeile 1625 |
---|
}
// Perform any selected moderation tools.
|
}
// Perform any selected moderation tools.
|
if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))
| if(is_moderator($thread['fid'], "", $thread['uid']) && isset($thread['modoptions']))
|
{ $lang->load($this->language_file, true);
| { $lang->load($this->language_file, true);
|
Zeile 1541 | Zeile 1639 |
---|
$modoptions_update = array();
// Close the thread.
|
$modoptions_update = array();
// Close the thread.
|
if(!empty($modoptions['closethread']))
| if(!empty($modoptions['closethread']) && is_moderator($thread['fid'], "canopenclosethreads", $thread['uid']))
|
{ $modoptions_update['closed'] = 1; log_moderator_action($modlogdata, $lang->thread_closed);
|
{ $modoptions_update['closed'] = 1; log_moderator_action($modlogdata, $lang->thread_closed);
|
}
| }
|
// Stick the thread.
|
// Stick the thread.
|
if(!empty($modoptions['stickthread']))
| if(!empty($modoptions['stickthread']) && is_moderator($thread['fid'], "canstickunstickthreads", $thread['uid']))
|
{ $modoptions_update['sticky'] = 1; log_moderator_action($modlogdata, $lang->thread_stuck);
| { $modoptions_update['sticky'] = 1; log_moderator_action($modlogdata, $lang->thread_stuck);
|
Zeile 1588 | Zeile 1686 |
---|
{ $db->update_query("users", $update_query, "uid='{$thread['uid']}'", 1, true); }
|
{ $db->update_query("users", $update_query, "uid='{$thread['uid']}'", 1, true); }
|
}
if(!isset($forum['lastpost'])) { $forum['lastpost'] = 0;
| |
}
$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 1617 | Zeile 1714 |
---|
"); while($subscribedmember = $db->fetch_array($query)) {
|
"); while($subscribedmember = $db->fetch_array($query)) {
|
if($done_users[$subscribedmember['uid']]) {
| if(!empty($done_users[$subscribedmember['uid']])) {
|
continue; } $done_users[$subscribedmember['uid']] = 1;
| continue; } $done_users[$subscribedmember['uid']] = 1;
|
Zeile 1627 | Zeile 1724 |
---|
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue;
|
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue;
|
}
| }
|
if(!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1) { // In a 'view own only' forum and not a moderator
| if(!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1) { // In a 'view own only' forum and not a moderator
|
Zeile 1641 | Zeile 1738 |
---|
$uselang = $subscribedmember['language']; } else if($mybb->settings['bblanguage'])
|
$uselang = $subscribedmember['language']; } else if($mybb->settings['bblanguage'])
|
{
| {
|
$uselang = $mybb->settings['bblanguage']; } else
| $uselang = $mybb->settings['bblanguage']; } else
|
Zeile 1653 | Zeile 1750 |
---|
{ $emailsubject = $lang->emailsubject_forumsubscription; $emailmessage = $lang->email_forumsubscription;
|
{ $emailsubject = $lang->emailsubject_forumsubscription; $emailmessage = $lang->email_forumsubscription;
|
}
| // If the poster is unregistered and hasn't set a username, call them Guest if(!$thread['uid'] && !$thread['username']) { $thread['username'] = htmlspecialchars_uni($lang->guest); } }
|
else { if(!isset($langcache[$uselang]['emailsubject_forumsubscription']))
|
else { if(!isset($langcache[$uselang]['emailsubject_forumsubscription']))
|
{
| {
|
$userlang = new MyLanguage; $userlang->set_path(MYBB_ROOT."inc/languages"); $userlang->set_language($uselang); $userlang->load("messages");
|
$userlang = new MyLanguage; $userlang->set_path(MYBB_ROOT."inc/languages"); $userlang->set_language($uselang); $userlang->load("messages");
|
| $userlang->load("global");
|
$langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription; $langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription;
|
$langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription; $langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription;
|
| $langcache[$uselang]['guest'] = $userlang->guest;
|
unset($userlang); } $emailsubject = $langcache[$uselang]['emailsubject_forumsubscription']; $emailmessage = $langcache[$uselang]['email_forumsubscription'];
|
unset($userlang); } $emailsubject = $langcache[$uselang]['emailsubject_forumsubscription']; $emailmessage = $langcache[$uselang]['email_forumsubscription'];
|
| // If the poster is unregistered and hasn't set a username, call them Guest if(!$thread['uid'] && !$thread['username']) { $thread['username'] = $langcache[$uselang]['guest']; }
|
} $emailsubject = $lang->sprintf($emailsubject, $forum['name']);
|
} $emailsubject = $lang->sprintf($emailsubject, $forum['name']);
|
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']); $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid'], $post_code);
| $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid']);
|
$new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '',
| $new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '',
|
Zeile 1729 | Zeile 1839 |
---|
);
$plugins->run_hooks("datahandler_post_insert_thread_end", $this);
|
);
$plugins->run_hooks("datahandler_post_insert_thread_end", $this);
|
|
|
return $this->return_values; }
| return $this->return_values; }
|
Zeile 1759 | Zeile 1869 |
---|
$existing_post = get_post($post['pid']); $post['tid'] = $existing_post['tid']; $post['fid'] = $existing_post['fid'];
|
$existing_post = get_post($post['pid']); $post['tid'] = $existing_post['tid']; $post['fid'] = $existing_post['fid'];
|
| if(isset($post['uid'])) { $uid = $post['uid']; } else { $uid = 0; }
|
$forum = get_forum($post['fid']);
|
$forum = get_forum($post['fid']);
|
$forumpermissions = forum_permissions($post['fid'], $post['uid']);
| $forumpermissions = forum_permissions($post['fid'], $uid);
|
// Decide on the visibility of this post.
|
// Decide on the visibility of this post.
|
$ismod = is_moderator($post['fid'], "", $post['uid']);
| $ismod = is_moderator($post['fid'], "", $uid);
|
// Keep visibility for unapproved and deleted posts if($existing_post['visible'] == 0)
|
// Keep visibility for unapproved and deleted posts if($existing_post['visible'] == 0)
|
{ $visible = 0;
| { $visible = 0;
|
} elseif($existing_post['visible'] == -1) {
| } elseif($existing_post['visible'] == -1) {
|
Zeile 1781 | Zeile 1900 |
---|
require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; $moderation->unapprove_posts(array($post['pid']));
|
require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; $moderation->unapprove_posts(array($post['pid']));
|
}
| }
|
else { $visible = 1;
| else { $visible = 1;
|
Zeile 1811 | Zeile 1930 |
---|
$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']."'"); } }
|
} }
| } }
|
Zeile 1819 | Zeile 1952 |
---|
$this->pid = $post['pid'];
if(isset($post['subject']))
|
$this->pid = $post['pid'];
if(isset($post['subject']))
|
{
| {
|
$this->post_update_data['subject'] = $db->escape_string($post['subject']);
|
$this->post_update_data['subject'] = $db->escape_string($post['subject']);
|
}
| }
|
if(isset($post['message'])) { $this->post_update_data['message'] = $db->escape_string($post['message']);
|
if(isset($post['message'])) { $this->post_update_data['message'] = $db->escape_string($post['message']);
|
}
| }
|
if(isset($post['editreason']) && trim($post['editreason']) != '') { $this->post_update_data['editreason'] = $db->escape_string(trim($post['editreason']));
|
if(isset($post['editreason']) && trim($post['editreason']) != '') { $this->post_update_data['editreason'] = $db->escape_string(trim($post['editreason']));
|
| } elseif(empty($post['editreason'])) { $this->post_update_data['editreason'] = '';
|
}
if(isset($post['icon']))
| }
if(isset($post['icon']))
|
Zeile 1862 | Zeile 1999 |
---|
$db->update_query("posts", $this->post_update_data, "pid='".(int)$post['pid']."'");
// Automatic subscription to the thread
|
$db->update_query("posts", $this->post_update_data, "pid='".(int)$post['pid']."'");
// Automatic subscription to the thread
|
if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
| if($post && !empty($post['options']['subscriptionmethod']) && $uid > 0)
|
{ switch($post['options']['subscriptionmethod']) {
| { switch($post['options']['subscriptionmethod']) {
|
Zeile 1880 | Zeile 2017 |
---|
} else {
|
} else {
|
$db->delete_query("threadsubscriptions", "uid='".(int)$post['uid']."' AND tid='".(int)$post['tid']."'");
| $db->delete_query("threadsubscriptions", "uid='".(int)$uid."' AND tid='".(int)$post['tid']."'");
|
}
update_forum_lastpost($post['fid']);
| }
update_forum_lastpost($post['fid']);
|