Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html *
|
* $Id: post.php 3030 2007-04-26 00:19:47Z Tikitiki $
| * $Id: post.php 4005 2008-07-10 17:53:25Z Tikitiki $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 613 | Zeile 613 |
---|
} }
|
} }
|
if($visible != -2)
| if($visible == 1)
|
{ $now = time(); if($forum['usepostcounts'] != "no")
| { $now = time(); if($forum['usepostcounts'] != "no")
|
Zeile 638 | Zeile 638 |
---|
{ // Update a post that is a draft $this->post_update_data = array(
|
{ // Update a post that is a draft $this->post_update_data = array(
|
"subject" => $db->escape_string($post['subject']), "icon" => intval($post['icon']), "uid" => $post['uid'],
| "subject" => $db->escape_string($post['subject']), "icon" => intval($post['icon']), "uid" => $post['uid'],
|
"username" => $db->escape_string($post['username']), "dateline" => intval($post['dateline']),
|
"username" => $db->escape_string($post['username']), "dateline" => intval($post['dateline']),
|
"message" => $db->escape_string($post['message']), "ipaddress" => $db->escape_string($post['ipaddress']), "includesig" => $post['options']['signature'], "smilieoff" => $post['options']['disablesmilies'], "visible" => $visible, "posthash" => $db->escape_string($post['posthash']) );
| "message" => $db->escape_string($post['message']), "ipaddress" => $db->escape_string($post['ipaddress']), "includesig" => $post['options']['signature'], "smilieoff" => $post['options']['disablesmilies'], "visible" => $visible, "posthash" => $db->escape_string($post['posthash']) );
|
$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);
| $plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);
|
Zeile 686 | Zeile 686 |
---|
if($post['posthash']) { $post['posthash'] = $db->escape_string($post['posthash']);
|
if($post['posthash']) { $post['posthash'] = $db->escape_string($post['posthash']);
|
$attachmentassign = array( "pid" => $this->pid );
| $attachmentassign = array( "pid" => $this->pid );
|
$db->update_query(TABLE_PREFIX."attachments", $attachmentassign, "posthash='{$post['posthash']}'"); }
| $db->update_query(TABLE_PREFIX."attachments", $attachmentassign, "posthash='{$post['posthash']}'"); }
|
Zeile 697 | Zeile 697 |
---|
$thread = get_thread($post['tid']); require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new Postparser();
|
$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']); $excerpt = $parser->strip_mycode($post['message']); $excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;
|
$subject = $parser->parse_badwords($thread['subject']); $excerpt = $parser->strip_mycode($post['message']); $excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;
|
| // Parse badwords $excerpt = $parser->parse_badwords($excerpt);
|
// Fetch any users subscribed to this thread and queue up their subscription notices $query = $db->query("
| // Fetch any users subscribed to this thread and queue up their subscription notices $query = $db->query("
|
Zeile 719 | Zeile 725 |
---|
} $done_users[$subscribedmember['uid']] = 1; if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
|
} $done_users[$subscribedmember['uid']] = 1; if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
|
{
| {
|
$uselang = $subscribedmember['language'];
|
$uselang = $subscribedmember['language'];
|
}
| }
|
elseif($mybb->settings['bblanguage'])
|
elseif($mybb->settings['bblanguage'])
|
{
| {
|
$uselang = $mybb->settings['bblanguage'];
|
$uselang = $mybb->settings['bblanguage'];
|
} else {
| } else {
|
$uselang = "english"; }
| $uselang = "english"; }
|
Zeile 753 | Zeile 759 |
---|
} $emailsubject = sprintf($emailsubject, $subject); $emailmessage = sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], $thread['tid']);
|
} $emailsubject = sprintf($emailsubject, $subject); $emailmessage = sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], $thread['tid']);
|
$new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '', "subject" => $db->escape_string($emailsubject), "message" => $db->escape_string($emailmessage), "headers" => '' ); $db->insert_query(TABLE_PREFIX."mailqueue", $new_email);
| $new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '', "subject" => $db->escape_string($emailsubject), "message" => $db->escape_string($emailmessage), "headers" => '' ); $db->insert_query(TABLE_PREFIX."mailqueue", $new_email);
|
unset($userlang); $queued_email = 1;
|
unset($userlang); $queued_email = 1;
|
}
| }
|
// Have one or more emails been queued? Update the queue count if($queued_email == 1) { $cache->updatemailqueue(); } $thread_update = array("replies" => "+1");
|
// Have one or more emails been queued? Update the queue count if($queued_email == 1) { $cache->updatemailqueue(); } $thread_update = array("replies" => "+1");
|
$query = $db->simple_select(TABLE_PREFIX."attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'"); $attachmentcount = $db->fetch_field($query, "attachmentcount");
$thread_update['attachmentcount'] = "+{$attachmentcount}";
| |
// Update forum count update_thread_counters($post['tid'], $thread_update);
| // Update forum count update_thread_counters($post['tid'], $thread_update);
|
Zeile 915 | Zeile 916 |
---|
// Are we updating a post which is already a draft? Perhaps changing it into a visible post? if($draft_check)
|
// 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(
| { $this->thread_insert_data = array(
|
"subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "username" => $db->escape_string($thread['username']),
| "subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "username" => $db->escape_string($thread['username']),
|
Zeile 993 | Zeile 994 |
---|
$this->pid = $db->insert_id();
// Now that we have the post id for this first post, update the threads table.
|
$this->pid = $db->insert_id();
// Now that we have the post id for this first post, update the threads table.
|
$firstpostup = array("firstpost" => $pid); $db->update_query(TABLE_PREFIX."threads", $firstpostup, "tid='{$tid}'");
| $firstpostup = array("firstpost" => $this->pid); $db->update_query(TABLE_PREFIX."threads", $firstpostup, "tid='{$this->tid}'");
|
}
// If we're not saving a draft there are some things we need to check now
| }
// If we're not saving a draft there are some things we need to check now
|
Zeile 1047 | Zeile 1048 |
---|
"); } }
|
"); } }
|
// If we have a registered user then update their post count and last post times. if($thread['uid'] > 0)
| if($visible == 1)
|
{
|
{
|
$user = get_user($thread['uid']); $update_query = array(); // Only update the lastpost column of the user if the date of the thread is newer than their last post. if($thread['dateline'] > $user['lastpost'])
| // If we have a registered user then update their post count and last post times. if($thread['uid'] > 0)
|
{
|
{
|
$update_query[] = "lastpost='".$thread['dateline']."'"; } // Update the post count if this forum allows post counts to be tracked if($forum['usepostcounts'] != "no") { $update_query[] = "postnum=postnum+1"; }
| $user = get_user($thread['uid']); $update_query = array(); // Only update the lastpost column of the user if the date of the thread is newer than their last post. if($thread['dateline'] > $user['lastpost']) { $update_query[] = "lastpost='".$thread['dateline']."'"; } // Update the post count if this forum allows post counts to be tracked if($forum['usepostcounts'] != "no") { $update_query[] = "postnum=postnum+1"; }
// Only update the table if we need to. if(!empty($update_query)) { $update_query = implode(", ", $update_query); $db->query("UPDATE ".TABLE_PREFIX."users SET $update_query WHERE uid='".$thread['uid']."'"); } }
// 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;
|
|
|
// Only update the table if we need to. if(!empty($update_query)) { $update_query = implode(", ", $update_query); $db->query("UPDATE ".TABLE_PREFIX."users SET $update_query WHERE uid='".$thread['uid']."'"); } }
// 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; $query = $db->query(" SELECT u.username, u.email, u.uid, u.language FROM ".TABLE_PREFIX."forumsubscriptions fs, ".TABLE_PREFIX."users u WHERE fs.fid='".intval($thread['fid'])."' AND u.uid=fs.uid AND fs.uid!='".intval($thread['uid'])."' AND u.lastactive>'{$forum['lastpost']}' "); while($subscribedmember = $db->fetch_array($query)) { if($done_users[$subscribedmember['uid']]) { continue; } $done_users[$subscribedmember['uid']] = 1; // 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 = $mybb->settings['bblanguage']; } else { $uselang = "english"; }
| // Parse badwords require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; $excerpt = $parser->parse_badwords($excerpt);
|
|
|
if($uselang == $mybb->settings['bblanguage']) { $emailsubject = $lang->emailsubject_forumsubscription; $emailmessage = $lang->email_forumsubscription; } else
| $query = $db->query(" SELECT u.username, u.email, u.uid, u.language FROM ".TABLE_PREFIX."forumsubscriptions fs, ".TABLE_PREFIX."users u WHERE fs.fid='".intval($thread['fid'])."' AND u.uid=fs.uid AND fs.uid!='".intval($thread['uid'])."' AND u.lastactive>'{$forum['lastpost']}' "); while($subscribedmember = $db->fetch_array($query))
|
{
|
{
|
if(!isset($langcache[$uselang]['emailsubject_forumsubscription']))
| if($done_users[$subscribedmember['uid']])
|
{
|
{
|
$userlang = new MyLanguage; $userlang->set_path(MYBB_ROOT."inc/languages"); $userlang->set_language($uselang); $userlang->load("messages"); $langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription; $langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription; unset($userlang);
| continue;
|
}
|
}
|
$emailsubject = $langcache[$uselang]['emailsubject_forumsubscription']; $emailmessage = $langcache[$uselang]['email_forumsubscription']; } $emailsubject = sprintf($emailsubject, $forum['name']); $emailmessage = sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], $this->tid, $thread['fid']); $new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '', "subject" => $db->escape_string($emailsubject), "message" => $db->escape_string($emailmessage), "headers" => '' ); $db->insert_query(TABLE_PREFIX."mailqueue", $new_email); unset($userlang); $queued_email = 1; } // Have one or more emails been queued? Update the queue count if($queued_email == 1) { $cache->updatemailqueue();
| $done_users[$subscribedmember['uid']] = 1; // 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 = $mybb->settings['bblanguage']; } else { $uselang = "english"; }
if($uselang == $mybb->settings['bblanguage']) { $emailsubject = $lang->emailsubject_forumsubscription; $emailmessage = $lang->email_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"); $langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription; $langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription; unset($userlang); } $emailsubject = $langcache[$uselang]['emailsubject_forumsubscription']; $emailmessage = $langcache[$uselang]['email_forumsubscription']; } $emailsubject = sprintf($emailsubject, $forum['name']); $emailmessage = sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], $this->tid, $thread['fid']); $new_email = array( "mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '', "subject" => $db->escape_string($emailsubject), "message" => $db->escape_string($emailmessage), "headers" => '' ); $db->insert_query(TABLE_PREFIX."mailqueue", $new_email); unset($userlang); $queued_email = 1; } // Have one or more emails been queued? Update the queue count if($queued_email == 1) { $cache->updatemailqueue(); }
|
}
|
}
|
}
| }
|
// Assign any uploaded attachments with the specific posthash to the newly created post. if($thread['posthash'])
| // Assign any uploaded attachments with the specific posthash to the newly created post. if($thread['posthash'])
|
Zeile 1151 | Zeile 1162 |
---|
); $db->update_query(TABLE_PREFIX."attachments", $attachmentassign, "posthash='{$thread['posthash']}'"); }
|
); $db->update_query(TABLE_PREFIX."attachments", $attachmentassign, "posthash='{$thread['posthash']}'"); }
|
$query = $db->simple_select(TABLE_PREFIX."attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'"); $attachmentcount = $db->fetch_field($query, "attachmentcount"); if($attachmentcount > 0) { update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}")); }
| |
if($visible == 1) {
|
if($visible == 1) {
|
| $query = $db->simple_select(TABLE_PREFIX."attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'"); $attachmentcount = $db->fetch_field($query, "attachmentcount"); if($attachmentcount > 0) { update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}")); }
|
update_thread_data($this->tid); update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1")); }
| update_thread_data($this->tid); update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1")); }
|
Zeile 1285 | Zeile 1296 |
---|
$this->post_update_data['edituid'] = intval($post['edit_uid']); $this->post_update_data['edittime'] = time(); }
|
$this->post_update_data['edituid'] = intval($post['edit_uid']); $this->post_update_data['edittime'] = time(); }
|
|
|
$plugins->run_hooks_by_ref("datahandler_post_update", $this);
$db->update_query(TABLE_PREFIX."posts", $this->post_update_data, "pid='".intval($post['pid'])."'");
| $plugins->run_hooks_by_ref("datahandler_post_update", $this);
$db->update_query(TABLE_PREFIX."posts", $this->post_update_data, "pid='".intval($post['pid'])."'");
|