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 */
| * * @var array */
|
public $post_insert_data = array();
/** * Array of data used to update a post.
|
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. *
| /** * Post ID currently being manipulated by the datahandlers. *
|
Zeile 83 | Zeile 85 |
---|
* @var array */ public $thread_insert_data = array();
|
* @var array */ public $thread_insert_data = array();
|
|
|
/** * Array of data used to update a thread. *
| /** * Array of data used to update a thread. *
|
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.
|
Zeile 111 | Zeile 120 |
---|
* @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 165 | Zeile 174 |
---|
/** * 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 183 |
---|
$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 243 |
---|
/** * Verifies a post message. *
|
/** * Verifies a post message. *
|
* @param string The message content.
| * @return bool
|
*/ function verify_message() {
| */ function verify_message() {
|
Zeile 331 | Zeile 315 |
---|
/** * 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 354 |
---|
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;
|
Zeile 396 | Zeile 385 |
---|
// Check to see if this person is in a usergroup that is excluded if(is_member($mybb->settings['postmergeuignore'], $post['uid']))
|
// Check to see if this person is in a usergroup that is excluded if(is_member($mybb->settings['postmergeuignore'], $post['uid']))
|
{ return true; }
| { return true; }
|
// Select the lastpost and fid information for this thread $query = $db->simple_select("threads", "lastpost,fid", "lastposteruid='".$post['uid']."' AND tid='".$post['tid']."'", array('limit' => '1')); $thread = $db->fetch_array($query);
|
// Select the lastpost and fid information for this thread $query = $db->simple_select("threads", "lastpost,fid", "lastposteruid='".$post['uid']."' AND tid='".$post['tid']."'", array('limit' => '1')); $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)) {
| // 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)) {
|
Zeile 411 | Zeile 400 |
---|
}
if($mybb->settings['postmergefignore'] == -1)
|
}
if($mybb->settings['postmergefignore'] == -1)
|
{
| {
|
return true; } elseif($mybb->settings['postmergefignore'] != '')
| return true; } elseif($mybb->settings['postmergefignore'] != '')
|
Zeile 425 | Zeile 414 |
---|
$fid = (int)$fid; } unset($fid);
|
$fid = (int)$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($post['uid'])
|
if($simple_mode == true) { return false; }
if($post['uid'])
|
{
| {
|
$user_check = "uid='".$post['uid']."'"; } else
| $user_check = "uid='".$post['uid']."'"; } else
|
Zeile 467 | Zeile 456 |
---|
// Fetch the forum this post is being made in if(!$post['fid'])
|
// 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'); } $forum = get_forum($post['fid']);
|
$query = $db->simple_select('posts', 'fid', "pid = '{$post['pid']}'"); $post['fid'] = $db->fetch_field($query, 'fid'); } $forum = get_forum($post['fid']);
|
|
|
// Check if this post contains more images than the forum allows if((!isset($post['savedraft']) || $post['savedraft'] != 1) && $mybb->settings['maxpostimages'] != 0 && $permissions['cancp'] != 1) {
| // Check if this post contains more images than the forum allows if((!isset($post['savedraft']) || $post['savedraft'] != 1) && $mybb->settings['maxpostimages'] != 0 && $permissions['cancp'] != 1) {
|
Zeile 480 | Zeile 469 |
---|
$parser = new postParser;
// Parse the message.
|
$parser = new postParser;
// Parse the message.
|
$parser_options = array(
| $parser_options = array(
|
"allow_html" => $forum['allowhtml'], "allow_mycode" => $forum['allowmycode'], "allow_imgcode" => $forum['allowimgcode'],
| "allow_html" => $forum['allowhtml'], "allow_mycode" => $forum['allowmycode'], "allow_imgcode" => $forum['allowimgcode'],
|
Zeile 489 | Zeile 478 |
---|
);
if($post['options']['disablesmilies'] != 1)
|
);
if($post['options']['disablesmilies'] != 1)
|
{
| {
|
$parser_options['allow_smilies'] = $forum['allowsmilies']; } else { $parser_options['allow_smilies'] = 0;
|
$parser_options['allow_smilies'] = $forum['allowsmilies']; } else { $parser_options['allow_smilies'] = 0;
|
}
| }
|
$image_check = $parser->parse_message($post['message'], $parser_options);
| $image_check = $parser->parse_message($post['message'], $parser_options);
|
Zeile 505 | Zeile 494 |
---|
{ // Throw back a message if over the count with the number of images as well as the maximum number of images per post. $this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
|
{ // Throw back a message if over the count with the number of images as well as the maximum number of images per post. $this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
|
return false; } }
| return false; } }
return true;
|
}
/**
| }
/**
|
Zeile 520 | Zeile 511 |
---|
global $mybb, $db;
$post = &$this->data;
|
global $mybb, $db;
$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 533 | Zeile 524 |
---|
{ // Throw back a message if over the count with the number of images as well as the maximum number of images per post. $this->set_error("too_many_videos", array(1 => $video_count, 2 => $mybb->settings['maxpostvideos']));
|
{ // Throw back a message if over the count with the number of images as well as the maximum number of images per post. $this->set_error("too_many_videos", array(1 => $video_count, 2 => $mybb->settings['maxpostvideos']));
|
return false;
| return false;
|
} }
|
} }
|
}
| return true; }
|
/** * Verify the reply-to post.
| /** * Verify the reply-to post.
|
Zeile 554 | Zeile 547 |
---|
$query = $db->simple_select("posts", "pid", "pid='".(int)$post['replyto']."'"); $valid_post = $db->fetch_array($query); if(!$valid_post['pid'])
|
$query = $db->simple_select("posts", "pid", "pid='".(int)$post['replyto']."'"); $valid_post = $db->fetch_array($query); if(!$valid_post['pid'])
|
{
| {
|
$post['replyto'] = 0; } else { return true;
|
$post['replyto'] = 0; } else { return true;
|
}
| }
|
}
// If this post isn't a reply to a specific post, attach it to the first post.
| }
// If this post isn't a reply to a specific post, attach it to the first post.
|
Zeile 586 | Zeile 579 |
---|
* @return boolean True when valid, false when not valid. */ function verify_post_icon()
|
* @return boolean True when valid, false when not valid. */ function verify_post_icon()
|
{
| {
|
global $cache;
$post = &$this->data;
|
global $cache;
$post = &$this->data;
|
|
|
$posticons_cache = $cache->read("posticons");
// If we don't have a post icon assign it as 0.
| $posticons_cache = $cache->read("posticons");
// If we don't have a post icon assign it as 0.
|
Zeile 612 | Zeile 605 |
---|
// The date has to be numeric and > 0. if($dateline < 0 || is_numeric($dateline) == false)
|
// The date has to be numeric and > 0. if($dateline < 0 || is_numeric($dateline) == false)
|
{
| {
|
$dateline = TIME_NOW; } }
| $dateline = TIME_NOW; } }
|
Zeile 625 | Zeile 618 |
---|
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))
|
Zeile 689 | Zeile 680 |
---|
else { $user = get_user($this->data['uid']);
|
else { $user = get_user($this->data['uid']);
|
}
$prefix_cache = build_prefixes();
| }
$prefix_cache = build_prefixes();
|
if(!empty($prefix_cache)) { foreach($prefix_cache as $required)
| if(!empty($prefix_cache)) { foreach($prefix_cache as $required)
|
Zeile 703 | Zeile 694 |
---|
$forums = explode(",", $required['forums']);
if(!in_array($forum['fid'], $forums))
|
$forums = explode(",", $required['forums']);
if(!in_array($forum['fid'], $forums))
|
{
| {
|
continue;
|
continue;
|
} }
| } }
|
if($required['groups'] != "-1")
|
if($required['groups'] != "-1")
|
{
| {
|
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;
|
Zeile 719 | Zeile 710 |
---|
{ $num_prefixes = true; }
|
{ $num_prefixes = true; }
|
} }
| } }
|
if($prefix == 0 && $num_prefixes) { $this->set_error('require_prefix');
| if($prefix == 0 && $num_prefixes) { $this->set_error('require_prefix');
|
Zeile 743 | 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'])
|
if($this->method != "update" && !$post['savedraft'])
|
{
| {
|
$this->verify_post_flooding();
|
$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 788 | Zeile 802 |
---|
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 816 |
---|
if(count($this->get_errors()) > 0) { return false;
|
if(count($this->get_errors()) > 0) { return false;
|
} else
| } else
|
{ return true; }
| { return true; }
|
Zeile 823 | Zeile 842 |
---|
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']);
|
Zeile 877 | Zeile 896 |
---|
// Close the thread. if($modoptions['closethread'] == 1 && $thread['closed'] != 1)
|
// Close the thread. if($modoptions['closethread'] == 1 && $thread['closed'] != 1)
|
{
| {
|
$modoptions_update['closed'] = $closed = 0; log_moderator_action($modlogdata, $lang->thread_closed);
|
$modoptions_update['closed'] = $closed = 0; log_moderator_action($modlogdata, $lang->thread_closed);
|
}
| }
|
// Open the thread. if($modoptions['closethread'] != 1 && $thread['closed'] == 1)
|
// Open the thread. if($modoptions['closethread'] != 1 && $thread['closed'] == 1)
|
{
| {
|
$modoptions_update['closed'] = $closed = 1; log_moderator_action($modlogdata, $lang->thread_opened);
|
$modoptions_update['closed'] = $closed = 1; log_moderator_action($modlogdata, $lang->thread_opened);
|
}
| }
|
if(!isset($modoptions['stickthread']))
|
if(!isset($modoptions['stickthread']))
|
{
| {
|
$modoptions['stickthread'] = $thread['sticky']; }
| $modoptions['stickthread'] = $thread['sticky']; }
|
Zeile 903 | Zeile 922 |
---|
// Unstick the thread. if($modoptions['stickthread'] != 1 && $thread['sticky'])
|
// Unstick the thread. if($modoptions['stickthread'] != 1 && $thread['sticky'])
|
{
| {
|
$modoptions_update['sticky'] = 0; log_moderator_action($modlogdata, $lang->thread_unstuck); }
| $modoptions_update['sticky'] = 0; log_moderator_action($modlogdata, $lang->thread_unstuck); }
|
Zeile 969 | Zeile 988 |
---|
); $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 1537 | Zeile 1556 |
---|
// Execute moderation options. if($modoptions_update)
|
// Execute moderation options. if($modoptions_update)
|
{
| {
|
$db->update_query('threads', $modoptions_update, "tid='{$this->tid}'"); } }
| $db->update_query('threads', $modoptions_update, "tid='{$this->tid}'"); } }
|
Zeile 1558 | Zeile 1577 |
---|
if($forum['usepostcounts'] != 0) { $update_query['postnum'] = "postnum+1";
|
if($forum['usepostcounts'] != 0) { $update_query['postnum'] = "postnum+1";
|
}
| }
|
if($forum['usethreadcounts'] != 0) { $update_query['threadnum'] = 'threadnum+1';
|
if($forum['usethreadcounts'] != 0) { $update_query['threadnum'] = 'threadnum+1';
|
}
| }
|
// Only update the table if we need to. if(!empty($update_query))
| // Only update the table if we need to. if(!empty($update_query))
|
Zeile 1717 | Zeile 1736 |
---|
/** * 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 1762 |
---|
$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 1786 | Zeile 1788 |
---|
}
// 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 1887 | Zeile 1889 |
---|
// 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);
|