Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: post.php 5171 2010-08-02 21:13:47Z RyanGordon $
| * $Id: post.php 5730 2011-12-11 07:23:23Z ralgith $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 145 | Zeile 145 |
---|
global $db; $post = &$this->data; $subject = &$post['subject'];
|
global $db; $post = &$this->data; $subject = &$post['subject'];
|
| $subject = trim_blank_chrs($subject);
|
// Are we editing an existing thread or post? if($this->method == "update" && $post['pid'])
| // Are we editing an existing thread or post? if($this->method == "update" && $post['pid'])
|
Zeile 173 | Zeile 174 |
---|
}
// 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(trim_blank_chrs($subject)) == 0 && $first_post)
| if(my_strlen($subject) == 0 && $first_post)
|
{ $this->set_error("firstpost_no_subject"); return false;
| { $this->set_error("firstpost_no_subject"); return false;
|
Zeile 188 | Zeile 189 |
---|
// This is a new post else if($this->action == "post") {
|
// This is a new post else if($this->action == "post") {
|
if(my_strlen(trim_blank_chrs($subject)) == 0)
| if(my_strlen($subject) == 0)
|
{ $thread = get_thread($post['tid']); $subject = "RE: ".$thread['subject'];
| { $thread = get_thread($post['tid']); $subject = "RE: ".$thread['subject'];
|
Zeile 198 | Zeile 199 |
---|
// This is a new thread and we require that a subject is present. else {
|
// This is a new thread and we require that a subject is present. else {
|
if(my_strlen(trim_blank_chrs($subject)) == 0)
| if(my_strlen($subject) == 0)
|
{ $this->set_error("missing_subject"); return false; }
|
{ $this->set_error("missing_subject"); return false; }
|
| }
if(my_strlen($subject) > 85) { // Subject is too long $this->set_error('subject_too_long', my_strlen($subject)); return false;
|
}
// Subject is valid - return true. return true; }
|
}
// Subject is valid - return true. return true; }
|
|
|
/** * Verifies a post message. *
| /** * Verifies a post message. *
|
Zeile 219 | Zeile 227 |
---|
global $mybb;
$post = &$this->data;
|
global $mybb;
$post = &$this->data;
|
| $post['message'] = trim_blank_chrs($post['message']);
|
// Do we even have a message at all?
|
// Do we even have a message at all?
|
if(my_strlen(trim_blank_chrs($post['message'])) == 0)
| if(my_strlen($post['message']) == 0)
|
{ $this->set_error("missing_message"); return false;
| { $this->set_error("missing_message"); return false;
|
Zeile 440 | Zeile 449 |
---|
{ // 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; } }
|
} /**
| } /**
|
Zeile 626 | Zeile 635 |
---|
$this->verify_options(); }
|
$this->verify_options(); }
|
$plugins->run_hooks_by_ref("datahandler_post_validate_post", $this);
| $plugins->run_hooks("datahandler_post_validate_post", $this);
|
// We are done validating, return. $this->set_validated(true);
| // We are done validating, return. $this->set_validated(true);
|
Zeile 760 | Zeile 769 |
---|
{ $visible = 0; }
|
{ $visible = 0; }
|
| } $post['pid'] = intval($post['pid']); $post['uid'] = intval($post['uid']);
if($post['pid'] > 0) { $query = $db->simple_select("posts", "tid", "pid='{$post['pid']}' AND uid='{$post['uid']}' AND visible='-2'"); $draft_check = $db->fetch_field($query, "tid"); } else { $draft_check = false;
|
} if($this->method != "update" && $visible == 1)
| } if($this->method != "update" && $visible == 1)
|
Zeile 771 | Zeile 793 |
---|
{ $this->pid = $double_post['pid'];
|
{ $this->pid = $double_post['pid'];
|
$post['message'] = $double_post['message'] .= $mybb->settings['postmergesep']."\n".$post['message'];
| $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'] = intval($post['uid']); $update_query['edittime'] = TIME_NOW; $query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");
|
$update_query = array( "message" => $db->escape_string($double_post['message']) ); $update_query['edituid'] = intval($post['uid']); $update_query['edittime'] = TIME_NOW; $query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");
|
| if($draft_check) { $db->delete_query("posts", "pid='".$post['pid']."'"); }
|
// Assign any uploaded attachments with the specific posthash to the merged post. if($double_post['posthash'])
| // Assign any uploaded attachments with the specific posthash to the merged post. if($double_post['posthash'])
|
Zeile 825 | Zeile 852 |
---|
} $db->update_query("users", $update_array, "uid='{$post['uid']}'", 1, true);
|
} $db->update_query("users", $update_array, "uid='{$post['uid']}'", 1, true);
|
}
$post['pid'] = intval($post['pid']); $post['uid'] = intval($post['uid']);
if($post['pid'] > 0) { $query = $db->simple_select("posts", "tid", "pid='{$post['pid']}' AND uid='{$post['uid']}' AND visible='-2'"); $draft_check = $db->fetch_field($query, "tid"); } else { $draft_check = false;
| |
}
// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
| }
// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
|
Zeile 859 | Zeile 873 |
---|
"posthash" => $db->escape_string($post['posthash']) );
|
"posthash" => $db->escape_string($post['posthash']) );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);
| $plugins->run_hooks("datahandler_post_insert_post", $this);
|
$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'];
|
Zeile 885 | Zeile 899 |
---|
"posthash" => $db->escape_string($post['posthash']) );
|
"posthash" => $db->escape_string($post['posthash']) );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);
| $plugins->run_hooks("datahandler_post_insert_post", $this);
|
$this->pid = $db->insert_query("posts", $this->post_insert_data); }
| $this->pid = $db->insert_query("posts", $this->post_insert_data); }
|
Zeile 1076 | Zeile 1090 |
---|
$this->verify_options(); }
|
$this->verify_options(); }
|
$plugins->run_hooks_by_ref("datahandler_post_validate_thread", $this);
| $plugins->run_hooks("datahandler_post_validate_thread", $this);
|
// We are done validating, return. $this->set_validated(true);
| // We are done validating, return. $this->set_validated(true);
|
Zeile 1171 | Zeile 1185 |
---|
"visible" => $visible );
|
"visible" => $visible );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);
| $plugins->run_hooks("datahandler_post_insert_thread", $this);
|
$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
| $db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
|
Zeile 1187 | Zeile 1201 |
---|
"visible" => $visible, "posthash" => $db->escape_string($thread['posthash']) );
|
"visible" => $visible, "posthash" => $db->escape_string($thread['posthash']) );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);
| $plugins->run_hooks("datahandler_post_insert_thread_post", $this);
|
$db->update_query("posts", $this->post_insert_data, "pid='{$thread['pid']}'"); $this->tid = $thread['tid'];
| $db->update_query("posts", $this->post_insert_data, "pid='{$thread['pid']}'"); $this->tid = $thread['tid'];
|
Zeile 1213 | Zeile 1227 |
---|
"notes" => '' );
|
"notes" => '' );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);
| $plugins->run_hooks("datahandler_post_insert_thread", $this);
|
$this->tid = $db->insert_query("threads", $this->thread_insert_data);
| $this->tid = $db->insert_query("threads", $this->thread_insert_data);
|
Zeile 1233 | Zeile 1247 |
---|
"visible" => $visible, "posthash" => $db->escape_string($thread['posthash']) );
|
"visible" => $visible, "posthash" => $db->escape_string($thread['posthash']) );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);
| $plugins->run_hooks("datahandler_post_insert_thread_post", $this);
|
$this->pid = $db->insert_query("posts", $this->post_insert_data);
| $this->pid = $db->insert_query("posts", $this->post_insert_data);
|
Zeile 1582 | Zeile 1596 |
---|
} if(count($this->thread_update_data) > 0) {
|
} if(count($this->thread_update_data) > 0) {
|
$plugins->run_hooks_by_ref("datahandler_post_update_thread", $this);
| $plugins->run_hooks("datahandler_post_update_thread", $this);
|
$db->update_query("threads", $this->thread_update_data, "tid='".intval($post['tid'])."'"); }
| $db->update_query("threads", $this->thread_update_data, "tid='".intval($post['tid'])."'"); }
|
Zeile 1628 | Zeile 1642 |
---|
$this->post_update_data['visible'] = $visible;
|
$this->post_update_data['visible'] = $visible;
|
$plugins->run_hooks_by_ref("datahandler_post_update", $this);
| $plugins->run_hooks("datahandler_post_update", $this);
|
$db->update_query("posts", $this->post_update_data, "pid='".intval($post['pid'])."'");
| $db->update_query("posts", $this->post_update_data, "pid='".intval($post['pid'])."'");
|