Zeile 53 | Zeile 53 |
---|
* post = New post * thread = New thread * edit = Editing a thread or post
|
* post = New post * thread = New thread * edit = Editing a thread or post
|
| * * @var string
|
*/ public $action;
|
*/ public $action;
|
|
|
/** * Array of data inserted in to a post.
|
/** * Array of data inserted in to a post.
|
*
| *
|
* @var array */ public $post_insert_data = array();
/** * Array of data used to update a post.
|
* @var array */ public $post_insert_data = array();
/** * Array of data used to update a post.
|
* * @var array
| * * @var array
|
*/ public $post_update_data = array();
|
*/ public $post_update_data = array();
|
/**
| /**
|
* Post ID currently being manipulated by the datahandlers. * * @var int
| * Post ID currently being manipulated by the datahandlers. * * @var int
|
Zeile 79 | Zeile 81 |
---|
/** * Array of data inserted in to a thread.
|
/** * Array of data inserted in to a thread.
|
* * @var array */
| * * @var array */
|
public $thread_insert_data = array();
/**
| public $thread_insert_data = array();
/**
|
Zeile 104 | Zeile 106 |
---|
* @var array */ public $return_values = array();
|
* @var array */ public $return_values = array();
|
| /** * Is this the first post of a thread when editing * * @var boolean */ public $first_post = false;
|
/** * Verifies the author of a post and fetches the username if necessary.
|
/** * Verifies the author of a post and fetches the username if necessary.
|
*
| *
|
* @return boolean True if the author information is valid, false if invalid. */ function verify_author() {
|
* @return boolean True if the author information is valid, false if invalid. */ function verify_author() {
|
global $mybb;
| global $mybb, $lang;
|
$post = &$this->data;
| $post = &$this->data;
|
Zeile 129 | 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 139 | Zeile 148 |
---|
$userhandler->set_data($data_array);
if(!$userhandler->verify_username())
|
$userhandler->set_data($data_array);
if(!$userhandler->verify_username())
|
{
| {
|
// invalid username
|
// invalid username
|
$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()); return false; }
|
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 true;
|
Zeile 165 | Zeile 168 |
---|
/** * Verifies a post subject. *
|
/** * Verifies a post subject. *
|
* @param string True if the subject is valid, false if invalid.
| |
* @return boolean True when valid, false when not valid. */ function verify_subject()
| * @return boolean True when valid, false when not valid. */ function verify_subject()
|
Zeile 175 | Zeile 177 |
---|
$subject = &$post['subject']; $subject = trim_blank_chrs($subject);
|
$subject = &$post['subject']; $subject = trim_blank_chrs($subject);
|
// Are we editing an existing thread or post?
| |
if($this->method == "update" && $post['pid']) {
|
if($this->method == "update" && $post['pid']) {
|
if(empty($post['tid'])) { $query = $db->simple_select("posts", "tid", "pid='".(int)$post['pid']."'"); $post['tid'] = $db->fetch_field($query, "tid"); } // Here we determine if we're editing the first post of a thread or not. $options = array( "limit" => 1, "limit_start" => 0, "order_by" => "dateline", "order_dir" => "asc" ); $query = $db->simple_select("posts", "pid", "tid='".$post['tid']."'", $options); $first_check = $db->fetch_array($query); if($first_check['pid'] == $post['pid']) { $first_post = true; } else { $first_post = false; }
| |
// If this is the first post there needs to be a subject, else make it the default one.
|
// If this is the first post there needs to be a subject, else make it the default one.
|
if(my_strlen($subject) == 0 && $first_post)
| if(my_strlen($subject) == 0 && $this->first_post)
|
{ $this->set_error("firstpost_no_subject"); return false;
| { $this->set_error("firstpost_no_subject"); return false;
|
Zeile 259 | Zeile 237 |
---|
/** * Verifies a post message. *
|
/** * Verifies a post message. *
|
* @param string The message content.
| * @return bool
|
*/ function verify_message() {
| */ function verify_message() {
|
Zeile 331 | Zeile 309 |
---|
/** * Verify that the user is not flooding the system. *
|
/** * Verify that the user is not flooding the system. *
|
* @return boolean True
| * @return boolean
|
*/ function verify_post_flooding() {
| */ function verify_post_flooding() {
|
Zeile 370 | Zeile 348 |
---|
return true; }
|
return true; }
|
| /** * @param bool $simple_mode * * @return array|bool */
|
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;
| $post = &$this->data;
|
// Are we starting a new thread? if(empty($post['tid'])) {
| // Are we starting a new thread? if(empty($post['tid'])) {
|
Zeile 384 | Zeile 367 |
---|
// 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 417 | Zeile 400 |
---|
elseif($mybb->settings['postmergefignore'] != '') { $fids = explode(',', (string)$mybb->settings['postmergefignore']);
|
elseif($mybb->settings['postmergefignore'] != '') { $fids = explode(',', (string)$mybb->settings['postmergefignore']);
|
|
|
if(is_array($fids)) { foreach($fids as &$fid)
|
if(is_array($fids)) { foreach($fids as &$fid)
|
{
| {
|
$fid = (int)$fid;
|
$fid = (int)$fid;
|
}
| }
|
unset($fid);
|
unset($fid);
|
|
|
if(in_array($thread['fid'], $fids)) { return true; }
|
if(in_array($thread['fid'], $fids)) { return true; }
|
} }
| } }
|
if($simple_mode == true) { return false;
| if($simple_mode == true) { return false;
|
Zeile 464 | Zeile 447 |
---|
// Get the permissions of the user who is making this post or thread $permissions = user_permissions($post['uid']);
|
// Get the permissions of the user who is making this post or thread $permissions = user_permissions($post['uid']);
|
|
|
// Fetch the forum this post is being made in if(!$post['fid']) {
| // Fetch the forum this post is being made in if(!$post['fid']) {
|
Zeile 495 | Zeile 478 |
---|
else { $parser_options['allow_smilies'] = 0;
|
else { $parser_options['allow_smilies'] = 0;
|
}
| }
|
$image_check = $parser->parse_message($post['message'], $parser_options);
|
$image_check = $parser->parse_message($post['message'], $parser_options);
|
|
|
// And count the number of image tags in the message. $image_count = substr_count($image_check, "<img"); if($image_count > $mybb->settings['maxpostimages'])
| // And count the number of image tags in the message. $image_count = substr_count($image_check, "<img"); if($image_count > $mybb->settings['maxpostimages'])
|
Zeile 508 | Zeile 491 |
---|
return false; } }
|
return false; } }
|
}
| return true; }
|
/** * Verifies the video count.
| /** * Verifies the video count.
|
Zeile 518 | Zeile 503 |
---|
function verify_video_count() { global $mybb, $db;
|
function verify_video_count() { global $mybb, $db;
|
$post = &$this->data;
| $post = &$this->data;
|
// Get the permissions of the user who is making this post or thread $permissions = user_permissions($post['uid']);
| // Get the permissions of the user who is making this post or thread $permissions = user_permissions($post['uid']);
|
Zeile 536 | Zeile 521 |
---|
return false; } }
|
return false; } }
|
| return true;
|
}
/**
| }
/**
|
Zeile 544 | Zeile 531 |
---|
* @return boolean True when valid, false when not valid. */ function verify_reply_to()
|
* @return boolean True when valid, false when not valid. */ function verify_reply_to()
|
{
| {
|
global $db; $post = &$this->data;
| global $db; $post = &$this->data;
|
Zeile 597 | Zeile 584 |
---|
if(empty($post['icon']) || !isset($posticons_cache[$post['icon']])) { $post['icon'] = 0;
|
if(empty($post['icon']) || !isset($posticons_cache[$post['icon']])) { $post['icon'] = 0;
|
}
| }
|
return true; }
| return true; }
|
Zeile 625 | Zeile 612 |
---|
function verify_prefix() { $prefix = &$this->data['prefix'];
|
function verify_prefix() { $prefix = &$this->data['prefix'];
|
$prefix_cache = build_prefixes();
| |
// If a valid prefix isn't supplied, don't assign one. if(empty($prefix))
|
// If a valid prefix isn't supplied, don't assign one. if(empty($prefix))
|
{
| {
|
$prefix = 0; } else {
|
$prefix = 0; } else {
|
| if(!empty($this->data['tid'])) { // Fetch the thread $thread = get_thread($this->data['tid']); }
|
$prefix_cache = build_prefixes($prefix);
if(empty($prefix_cache))
| $prefix_cache = build_prefixes($prefix);
if(empty($prefix_cache))
|
Zeile 654 | Zeile 645 |
---|
$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 665 | Zeile 656 |
---|
// 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;
|
Zeile 705 | Zeile 696 |
---|
if(!in_array($forum['fid'], $forums)) { continue;
|
if(!in_array($forum['fid'], $forums)) { continue;
|
} }
if($required['groups'] != "-1") { if(!is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups']))) { $num_prefixes = true; } } else { $num_prefixes = true;
| } }
if(is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups']))) { $num_prefixes = true;
|
} } }
| } } }
|
Zeile 749 | Zeile 733 |
---|
if($this->method != "update" && !$post['savedraft']) { $this->verify_post_flooding();
|
if($this->method != "update" && !$post['savedraft']) { $this->verify_post_flooding();
|
| }
// Are we editing an existing thread or post? 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"); } // Here we determine if we're editing the first post of a thread or not. $options = array( "limit" => 1, "limit_start" => 0, "order_by" => "dateline", "order_dir" => "asc" ); $query = $db->simple_select("posts", "pid", "tid='".$post['tid']."'", $options); $first_check = $db->fetch_array($query); if($first_check['pid'] == $post['pid']) { $this->first_post = true; }
|
}
// Verify all post assets.
| }
// Verify all post assets.
|
Zeile 756 | Zeile 763 |
---|
if($this->method == "insert" || array_key_exists('uid', $post)) { $this->verify_author();
|
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();
|
}
| }
|
if($this->method == "insert" || array_key_exists('message', $post)) {
| if($this->method == "insert" || array_key_exists('message', $post)) {
|
Zeile 771 | Zeile 778 |
---|
}
if($this->method == "insert" || array_key_exists('dateline', $post))
|
}
if($this->method == "insert" || array_key_exists('dateline', $post))
|
{
| {
|
$this->verify_dateline(); }
if($this->method == "insert" || array_key_exists('replyto', $post)) { $this->verify_reply_to();
|
$this->verify_dateline(); }
if($this->method == "insert" || array_key_exists('replyto', $post)) { $this->verify_reply_to();
|
}
| }
|
if($this->method == "insert" || array_key_exists('icon', $post)) {
| if($this->method == "insert" || array_key_exists('icon', $post)) {
|
Zeile 788 | Zeile 795 |
---|
if($this->method == "insert" || array_key_exists('options', $post)) { $this->verify_options();
|
if($this->method == "insert" || array_key_exists('options', $post)) { $this->verify_options();
|
| }
if($this->method == "update" && $this->first_post) { $this->verify_prefix();
|
}
$plugins->run_hooks("datahandler_post_validate_post", $this);
| }
$plugins->run_hooks("datahandler_post_validate_post", $this);
|
Zeile 797 | Zeile 809 |
---|
if(count($this->get_errors()) > 0) { return false;
|
if(count($this->get_errors()) > 0) { return false;
|
} else
| } else
|
{ return true; }
| { return true; }
|
Zeile 852 | Zeile 864 |
---|
break; default: $notification = 0;
|
break; default: $notification = 0;
|
}
| }
|
require_once MYBB_ROOT."inc/functions_user.php"; 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);
$modoptions = $post['modoptions']; $modlogdata['fid'] = $thread['fid']; $modlogdata['tid'] = $thread['tid'];
|
{ $lang->load($this->language_file, true);
$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) { $modoptions_update['closed'] = $closed = 1;
| if(empty($modoptions['closethread']) && $thread['closed'] == 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid'])) { $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 937 | Zeile 939 |
---|
}
if(!isset($post['pid']))
|
}
if(!isset($post['pid']))
|
{ $post['pid'] = 0; }
$post['pid'] = (int)$post['pid'];
| { $post['pid'] = 0; }
$post['pid'] = (int)$post['pid'];
|
$post['uid'] = (int)$post['uid'];
if($post['pid'] > 0)
| $post['uid'] = (int)$post['uid'];
if($post['pid'] > 0)
|
Zeile 969 | Zeile 971 |
---|
); $update_query['edituid'] = (int)$post['uid']; $update_query['edittime'] = TIME_NOW;
|
); $update_query['edituid'] = (int)$post['uid']; $update_query['edittime'] = TIME_NOW;
|
$query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");
| $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");
|
if($draft_check) {
| if($draft_check) {
|
Zeile 995 | Zeile 997 |
---|
"posthash" => '' ); $db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");
|
"posthash" => '' ); $db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");
|
}
| }
|
// Return the post's pid and whether or not it is visible. $this->return_values = array( "pid" => $double_post['pid'],
| // Return the post's pid and whether or not it is visible. $this->return_values = array( "pid" => $double_post['pid'],
|
Zeile 1004 | Zeile 1006 |
---|
"merge" => true );
|
"merge" => true );
|
$plugins->run_hooks("datahandler_post_insert_merge", $this);
| $plugins->run_hooks("datahandler_post_insert_merge", $this);
|
return $this->return_values; } }
|
return $this->return_values; } }
|
if($visible == 1 && $thread['visible'] == 1)
| if($visible == 1)
|
{ $now = TIME_NOW;
| { $now = TIME_NOW;
|
Zeile 1018 | Zeile 1020 |
---|
$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 1086 | Zeile 1088 |
---|
$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;
$done_users = array();
$subject = $parser->parse_badwords($thread['subject']);
|
require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new Postparser;
$done_users = array();
$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 1104 | Zeile 1105 |
---|
// 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 1133 | Zeile 1134 |
---|
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue;
|
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue;
|
}
| }
|
if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthread'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid'])) { // User isn't a moderator or the author of the thread... continue;
|
if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthread'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid'])) { // User isn't a moderator or the author of the thread... continue;
|
}
| }
|
if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language']; } elseif($mybb->settings['orig_bblanguage'])
|
if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language']; } elseif($mybb->settings['orig_bblanguage'])
|
{
| {
|
$uselang = $mybb->settings['orig_bblanguage']; } else
|
$uselang = $mybb->settings['orig_bblanguage']; } else
|
{
| {
|
$uselang = "english"; }
|
$uselang = "english"; }
|
|
|
if($uselang == $mybb->settings['bblanguage']) { if($subscribedmember['notification'] == 1) { $emailsubject = $lang->emailsubject_subscription; $emailmessage = $lang->email_subscription;
|
if($uselang == $mybb->settings['bblanguage']) { if($subscribedmember['notification'] == 1) { $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(($subscribedmember['notification'] == 1 && !isset($langcache[$uselang]['emailsubject_subscription'])) || !isset($langcache[$uselang]['guest']))
|
{
|
{
|
if(!isset($langcache[$uselang]['emailsubject_subscription']))
| $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'];
|
} }
if($subscribedmember['notification'] == 1) { $emailsubject = $lang->sprintf($emailsubject, $subject);
|
} }
if($subscribedmember['notification'] == 1) { $emailsubject = $lang->sprintf($emailsubject, $subject);
|
|
|
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
|
$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'], $post_code);
|
$new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '',
| $new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '',
|
Zeile 1203 | Zeile 1223 |
---|
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']); $pm = array( 'subject' => array('pmsubject_subscription', $subject),
|
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']); $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'], $post_code),
|
'touid' => $subscribedmember['uid'], 'language' => $subscribedmember['language'], 'language_file' => 'messages'
| 'touid' => $subscribedmember['uid'], 'language' => $subscribedmember['language'], 'language_file' => 'messages'
|
Zeile 1222 | Zeile 1242 |
---|
$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']);
|
}
| }
|
// Post is stuck in moderation queue else if($visible == 0) {
| // Post is stuck in moderation queue else if($visible == 0) {
|
Zeile 1236 | Zeile 1256 |
---|
update_forum_counters($post['fid'], array("unapprovedposts" => "+1")); } else if($thread['visible'] == 0)
|
update_forum_counters($post['fid'], array("unapprovedposts" => "+1")); } else if($thread['visible'] == 0)
|
{ // Update the unapproved posts count for the current forum $thread_update = array('replies' => '+1');
| { // Update the unapproved posts count for the current forum $thread_update = array('replies' => '+1');
|
update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));
|
update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));
|
}
| }
|
else if($thread['visible'] == -1)
|
else if($thread['visible'] == -1)
|
{
| {
|
// 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 1453 | Zeile 1479 |
---|
"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 1508 | Zeile 1535 |
---|
}
// 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 1522 | Zeile 1549 |
---|
$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); }
// Stick the thread.
|
{ $modoptions_update['closed'] = 1; log_moderator_action($modlogdata, $lang->thread_closed); }
// 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 1599 | Zeile 1626 |
---|
while($subscribedmember = $db->fetch_array($query)) { if($done_users[$subscribedmember['uid']])
|
while($subscribedmember = $db->fetch_array($query)) { if($done_users[$subscribedmember['uid']])
|
{ continue; }
| { continue; }
|
$done_users[$subscribedmember['uid']] = 1;
$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue;
|
$done_users[$subscribedmember['uid']] = 1;
$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue;
|
}
| }
|
if(!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1) {
| if(!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1) {
|
Zeile 1618 | Zeile 1645 |
---|
// Determine the language pack we'll be using to send this email in and load it if it isn't already. if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
|
// Determine the language pack we'll be using to send this email in and load it if it isn't already. if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
|
{
| {
|
$uselang = $subscribedmember['language']; } else if($mybb->settings['bblanguage'])
|
$uselang = $subscribedmember['language']; } else if($mybb->settings['bblanguage'])
|
{
| {
|
$uselang = $mybb->settings['bblanguage']; } else { $uselang = "english";
|
$uselang = $mybb->settings['bblanguage']; } else { $uselang = "english";
|
}
| }
|
if($uselang == $mybb->settings['bblanguage'])
|
if($uselang == $mybb->settings['bblanguage'])
|
{
| {
|
$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);
|
unset($userlang);
|
}
| }
|
$emailsubject = $langcache[$uselang]['emailsubject_forumsubscription']; $emailmessage = $langcache[$uselang]['email_forumsubscription'];
|
$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']);
|
Zeile 1682 | Zeile 1723 |
---|
"posthash" => '' ); $db->update_query("attachments", $attachmentassign, "posthash='{$thread['posthash']}' AND pid='0'");
|
"posthash" => '' ); $db->update_query("attachments", $attachmentassign, "posthash='{$thread['posthash']}' AND pid='0'");
|
}
| }
|
if($visible == 1) {
| if($visible == 1) {
|
Zeile 1717 | Zeile 1758 |
---|
/** * Updates a post that is already in the database. *
|
/** * Updates a post that is already in the database. *
|
| * @return array
|
*/ function update_post() {
| */ function update_post() {
|
Zeile 1742 | Zeile 1784 |
---|
$forum = get_forum($post['fid']); $forumpermissions = forum_permissions($post['fid'], $post['uid']);
|
$forum = get_forum($post['fid']); $forumpermissions = forum_permissions($post['fid'], $post['uid']);
|
// Check if this is the first post in a thread. $options = array( "order_by" => "dateline", "order_dir" => "asc", "limit_start" => 0, "limit" => 1 ); $query = $db->simple_select("posts", "pid", "tid='".(int)$post['tid']."'", $options); $first_post_check = $db->fetch_array($query); if($first_post_check['pid'] == $post['pid']) { $first_post = true; } else { $first_post = false; }
| |
// Decide on the visibility of this post. $ismod = is_moderator($post['fid'], "", $post['uid']);
| // Decide on the visibility of this post. $ismod = is_moderator($post['fid'], "", $post['uid']);
|
Zeile 1770 | Zeile 1794 |
---|
$visible = 0; } elseif($existing_post['visible'] == -1)
|
$visible = 0; } elseif($existing_post['visible'] == -1)
|
{
| {
|
$visible = -1; } elseif($forumpermissions['mod_edit_posts'] == 1 && !$ismod)
|
$visible = -1; } elseif($forumpermissions['mod_edit_posts'] == 1 && !$ismod)
|
{
| {
|
$visible = 0; require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
| $visible = 0; require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
Zeile 1786 | Zeile 1810 |
---|
}
// Update the thread details that might have been changed first.
|
}
// Update the thread details that might have been changed first.
|
if($first_post)
| if($this->first_post)
|
{ $this->tid = $post['tid'];
| { $this->tid = $post['tid'];
|
Zeile 1829 | Zeile 1853 |
---|
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($post['editreason'] == '') { $this->post_update_data['editreason'] = '';
|
}
if(isset($post['icon']))
| }
if(isset($post['icon']))
|
Zeile 1887 | Zeile 1915 |
---|
// Return the thread's first post id and whether or not it is visible. $this->return_values = array( 'visible' => $visible,
|
// Return the thread's first post id and whether or not it is visible. $this->return_values = array( 'visible' => $visible,
|
'first_post' => $first_post
| 'first_post' => $this->first_post
|
);
$plugins->run_hooks("datahandler_post_update_end", $this);
| );
$plugins->run_hooks("datahandler_post_update_end", $this);
|