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
| if($userhandler->verify_username_exists()) { // username is in use
|
Zeile 423 | Zeile 423 |
---|
}
if($simple_mode == true)
|
}
if($simple_mode == true)
|
{ return false; }
if($post['uid'])
| { return false; }
if($post['uid'])
|
{ $user_check = "uid='".$post['uid']."'"; }
| { $user_check = "uid='".$post['uid']."'"; }
|
Zeile 435 | Zeile 435 |
---|
{ $user_check = "ipaddress=".$db->escape_binary($session->packedip); }
|
{ $user_check = "ipaddress=".$db->escape_binary($session->packedip); }
|
|
|
$query = $db->simple_select("posts", "pid,message,visible", "{$user_check} AND tid='".$post['tid']."' AND dateline='".$thread['lastpost']."'", array('order_by' => 'pid', 'order_dir' => 'DESC', 'limit' => 1)); return $db->fetch_array($query);
|
$query = $db->simple_select("posts", "pid,message,visible", "{$user_check} AND tid='".$post['tid']."' AND dateline='".$thread['lastpost']."'", array('order_by' => 'pid', 'order_dir' => 'DESC', 'limit' => 1)); return $db->fetch_array($query);
|
}
| }
|
/** * Verifies the image count. *
| /** * Verifies the image count. *
|
Zeile 449 | Zeile 449 |
---|
{ global $mybb, $db;
|
{ 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']);
// Fetch the forum this post is being made in if(!$post['fid'])
|
// 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'])
|
{
| {
|
$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 507 | Zeile 507 |
---|
* @return boolean True when valid, false when not valid. */ function verify_video_count()
|
* @return boolean True when valid, false when not valid. */ function verify_video_count()
|
{
| {
|
global $mybb, $db;
$post = &$this->data;
| global $mybb, $db;
$post = &$this->data;
|
Zeile 558 | Zeile 558 |
---|
// 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'])
|
{ $options = array( "limit_start" => 0, "limit" => 1, "order_by" => "dateline", "order_dir" => "asc"
| { $options = array( "limit_start" => 0, "limit" => 1, "order_by" => "dateline", "order_dir" => "asc"
|
); $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 581 | Zeile 581 |
---|
function verify_post_icon() { global $cache;
|
function verify_post_icon() { global $cache;
|
|
|
$post = &$this->data;
$posticons_cache = $cache->read("posticons");
| $post = &$this->data;
$posticons_cache = $cache->read("posticons");
|
Zeile 630 | Zeile 630 |
---|
{ // Fetch the thread $thread = get_thread($this->data['tid']);
|
{ // Fetch the thread $thread = get_thread($this->data['tid']);
|
}
$prefix_cache = build_prefixes($prefix);
| }
$prefix_cache = build_prefixes($prefix);
|
if(empty($prefix_cache))
|
if(empty($prefix_cache))
|
{
| {
|
$this->set_error('invalid_prefix'); return false; }
| $this->set_error('invalid_prefix'); return false; }
|
Zeile 649 | Zeile 649 |
---|
else { $user = get_user($this->data['uid']);
|
else { $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'])) {
|
Zeile 700 | Zeile 700 |
---|
$forums = explode(",", $required['forums']);
if(!in_array($forum['fid'], $forums))
|
$forums = explode(",", $required['forums']);
if(!in_array($forum['fid'], $forums))
|
{
| {
|
continue; }
|
continue; }
|
}
| }
|
if(is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups']))) { $num_prefixes = true; } }
|
if(is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups']))) { $num_prefixes = true; } }
|
}
| }
|
if($prefix == 0 && $num_prefixes) { $this->set_error('require_prefix'); return false;
|
if($prefix == 0 && $num_prefixes) { $this->set_error('require_prefix'); return false;
|
} }
| } }
|
return true; }
| return true; }
|
Zeile 734 | Zeile 734 |
---|
$post = &$this->data; $time = TIME_NOW;
|
$post = &$this->data; $time = TIME_NOW;
|
$this->action = "post";
| $this->action = "post";
|
if($this->method != "update" && !$post['savedraft']) { $this->verify_post_flooding();
| if($this->method != "update" && !$post['savedraft']) { $this->verify_post_flooding();
|
Zeile 801 | Zeile 801 |
---|
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();
|
if($this->method == "update" && $this->first_post) { $this->verify_prefix();
|
}
| }
|
$plugins->run_hooks("datahandler_post_validate_post", $this);
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
$plugins->run_hooks("datahandler_post_validate_post", $this);
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
{
| {
|
return false; } else { return true;
|
return false; } else { return true;
|
}
| }
|
}
/**
| }
/**
|
Zeile 830 | Zeile 830 |
---|
function insert_post() { global $db, $mybb, $plugins, $cache, $lang;
|
function insert_post() { global $db, $mybb, $plugins, $cache, $lang;
|
|
|
$post = &$this->data;
// Yes, validating is required. if(!$this->get_validated()) { die("The post needs to be validated before inserting it into the DB.");
|
$post = &$this->data;
// Yes, validating is required. if(!$this->get_validated()) { die("The post needs to be validated before inserting it into the DB.");
|
}
| }
|
if(count($this->get_errors()) > 0) { die("The post is not valid."); }
|
if(count($this->get_errors()) > 0) { die("The post is not valid."); }
|
|
|
// Fetch the thread $thread = get_thread($post['tid']);
|
// Fetch the thread $thread = get_thread($post['tid']);
|
|
|
$closed = $thread['closed'];
// This post is being saved as a draft.
| $closed = $thread['closed'];
// This post is being saved as a draft.
|
Zeile 878 | Zeile 878 |
---|
// 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) { $modoptions_update['closed'] = $closed = 0;
| if(!empty($modoptions['closethread']) && $thread['closed'] != 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid'])) { $modoptions_update['closed'] = $closed = 1;
|
log_moderator_action($modlogdata, $lang->thread_closed); }
|
log_moderator_action($modlogdata, $lang->thread_closed); }
|
// Open the thread. if($modoptions['closethread'] != 1 && $thread['closed'] == 1) { $modoptions_update['closed'] = $closed = 1; log_moderator_action($modlogdata, $lang->thread_opened); }
if(!isset($modoptions['stickthread']))
| // Open the thread. if(empty($modoptions['closethread']) && $thread['closed'] == 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid']))
|
{
|
{
|
$modoptions['stickthread'] = $thread['sticky'];
| $modoptions_update['closed'] = $closed = 0; log_moderator_action($modlogdata, $lang->thread_opened);
|
}
// 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 1028 | Zeile 1018 |
---|
} }
|
} }
|
if($visible == 1 && $thread['visible'] == 1)
| if($visible == 1)
|
{ $now = TIME_NOW;
| { $now = TIME_NOW;
|
Zeile 1036 | Zeile 1026 |
---|
$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 1065 | Zeile 1055 |
---|
$db->update_query("posts", $this->post_update_data, "pid='{$post['pid']}'"); $this->pid = $post['pid'];
|
$db->update_query("posts", $this->post_update_data, "pid='{$post['pid']}'"); $this->pid = $post['pid'];
|
}
| }
|
else { // Insert the post.
| else { // Insert the post.
|
Zeile 1104 | Zeile 1094 |
---|
$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 );
|
|
|
$excerpt = $parser->text_parse_message($post['message'], $parser_options); $excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;
|
$excerpt = $parser->text_parse_message($post['message'], $parser_options); $excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;
|
|
|
// 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.notification
| // 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.notification
|
Zeile 1129 | Zeile 1118 |
---|
AND s.uid != '{$post['uid']}' AND u.lastactive>'{$thread['lastpost']}' ");
|
AND s.uid != '{$post['uid']}' AND u.lastactive>'{$thread['lastpost']}' ");
|
|
|
$args = array( 'this' => &$this, 'done_users' => &$done_users,
| $args = array( 'this' => &$this, 'done_users' => &$done_users,
|
Zeile 1162 | Zeile 1151 |
---|
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']) { $uselang = $mybb->settings['orig_bblanguage'];
| elseif($mybb->settings['orig_bblanguage']) { $uselang = $mybb->settings['orig_bblanguage'];
|
Zeile 1178 | Zeile 1167 |
---|
{ $emailsubject = $lang->emailsubject_subscription; $emailmessage = $lang->email_subscription;
|
{ $emailsubject = $lang->emailsubject_subscription; $emailmessage = $lang->email_subscription;
|
} }
| } }
|
else { if($subscribedmember['notification'] == 1)
| else { if($subscribedmember['notification'] == 1)
|
Zeile 1228 | Zeile 1217 |
---|
); send_pm($pm, -1, true); }
|
); send_pm($pm, -1, true); }
|
}
| }
|
$plugins->run_hooks('datahandler_post_insert_subscribed', $args);
// Have one or more emails been queued? Update the queue count
| $plugins->run_hooks('datahandler_post_insert_subscribed', $args);
// Have one or more emails been queued? Update the queue count
|
Zeile 1240 | Zeile 1229 |
---|
$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']); } // Post is stuck in moderation queue else if($visible == 0)
|
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)
|
{
| {
|
// Update the unapproved posts count for the current thread and current forum $thread_update = array('unapprovedposts' => '+1'); update_thread_counters($post['tid'], array("unapprovedposts" => "+1"));
|
// Update the unapproved posts count for the current thread and current forum $thread_update = array('unapprovedposts' => '+1'); update_thread_counters($post['tid'], array("unapprovedposts" => "+1"));
|
update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));
| update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));
|
} else if($thread['visible'] == 0)
|
} else if($thread['visible'] == 0)
|
{ // Update the unapproved posts count for the current forum
| { // Update the unapproved posts count for the current forum
|
$thread_update = array('replies' => '+1'); update_forum_counters($post['fid'], array("unapprovedposts" => "+1")); }
| $thread_update = array('replies' => '+1'); update_forum_counters($post['fid'], array("unapprovedposts" => "+1")); }
|
Zeile 1264 | Zeile 1253 |
---|
// 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 1527 | Zeile 1522 |
---|
}
// 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 1536 |
---|
$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);
|