Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: post.php 4276 2008-11-23 03:01:33Z Tikitiki $
| * $Id: post.php 4372 2009-05-15 16:13:13Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 873 | Zeile 873 |
---|
continue; } $done_users[$subscribedmember['uid']] = 1;
|
continue; } $done_users[$subscribedmember['uid']] = 1;
|
| $forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue; }
|
if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language'];
| if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language'];
|
Zeile 1001 | Zeile 1008 |
---|
if(count($this->get_errors()) > 0) { return false;
|
if(count($this->get_errors()) > 0) { return false;
|
}
| }
|
else { return true;
| else { return true;
|
Zeile 1025 | Zeile 1032 |
---|
if(count($this->get_errors()) > 0) { die("The thread is not valid.");
|
if(count($this->get_errors()) > 0) { die("The thread is not valid.");
|
}
| }
|
$thread = &$this->data;
| $thread = &$this->data;
|
Zeile 1057 | Zeile 1064 |
---|
{ $visible = 0; }
|
{ $visible = 0; }
|
}
| }
|
// Have a post ID but not a thread ID - fetch thread ID if($thread['pid'] && !$thread['tid'])
|
// Have a post ID but not a thread ID - fetch thread ID if($thread['pid'] && !$thread['tid'])
|
{
| {
|
$query = $db->simple_select("posts", "tid", "pid='{$thread['pid']}"); $thread['tid'] = $db->fetch_field($query, "tid"); }
if($thread['pid'] > 0)
|
$query = $db->simple_select("posts", "tid", "pid='{$thread['pid']}"); $thread['tid'] = $db->fetch_field($query, "tid"); }
if($thread['pid'] > 0)
|
{
| {
|
$query = $db->simple_select("posts", "pid", "pid='{$thread['pid']}' AND uid='{$thread['uid']}' AND visible='-2'"); $draft_check = $db->fetch_field($query, "pid");
|
$query = $db->simple_select("posts", "pid", "pid='{$thread['pid']}' AND uid='{$thread['uid']}' AND visible='-2'"); $draft_check = $db->fetch_field($query, "pid");
|
}
| }
|
else { $draft_check = false;
|
else { $draft_check = false;
|
}
| }
|
// 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( "subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']),
| { $this->thread_insert_data = array( "subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']),
|
"lastpost" => intval($thread['dateline']), "lastposter" => $db->escape_string($thread['username']), "visible" => $visible
|
"lastpost" => intval($thread['dateline']), "lastposter" => $db->escape_string($thread['username']), "visible" => $visible
|
);
$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);
$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
| );
$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);
$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");
|
$this->post_insert_data = array( "subject" => $db->escape_string($thread['subject']),
| $this->post_insert_data = array( "subject" => $db->escape_string($thread['subject']),
|
Zeile 1133 | Zeile 1140 |
---|
$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);
$this->tid = $db->insert_query("threads", $this->thread_insert_data);
|
$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);
$this->tid = $db->insert_query("threads", $this->thread_insert_data);
|
|
|
$this->post_insert_data = array( "tid" => $this->tid, "fid" => $thread['fid'],
| $this->post_insert_data = array( "tid" => $this->tid, "fid" => $thread['fid'],
|
Zeile 1244 | Zeile 1251 |
---|
{ $forum['lastpost'] = 0; }
|
{ $forum['lastpost'] = 0; }
|
| $done_users = array();
|
// 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;
| // 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;
|
Zeile 1270 | Zeile 1279 |
---|
continue; } $done_users[$subscribedmember['uid']] = 1;
|
continue; } $done_users[$subscribedmember['uid']] = 1;
|
| $forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue; }
|
// 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'])) {
|
Zeile 1327 | Zeile 1343 |
---|
// 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'])
|
{
| {
|
$thread['posthash'] = $db->escape_string($thread['posthash']); $attachmentassign = array( "pid" => $this->pid
| $thread['posthash'] = $db->escape_string($thread['posthash']); $attachmentassign = array( "pid" => $this->pid
|
Zeile 1336 | Zeile 1352 |
---|
} if($visible == 1)
|
} if($visible == 1)
|
{ update_thread_data($this->tid);
| { update_thread_data($this->tid);
|
update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1"));
|
update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1"));
|
}
| }
|
else if($visible == 0) { update_thread_data($this->tid);
|
else if($visible == 0) { update_thread_data($this->tid);
|
update_thread_counters($thread['tid'], array("replies" => 0, "unapprovedposts" => 1));
| update_thread_counters($this->tid, array("replies" => 0, "unapprovedposts" => 1));
|
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));
|
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));
|
}
| }
|
$query = $db->simple_select("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}"));
|
$query = $db->simple_select("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}"));
|
}
| }
|
// Return the post's pid and whether or not it is visible. return array( "pid" => $this->pid,
| // Return the post's pid and whether or not it is visible. return array( "pid" => $this->pid,
|
Zeile 1361 | Zeile 1377 |
---|
"visible" => $visible ); }
|
"visible" => $visible ); }
|
|
|
/** * Updates a post that is already in the database. *
| /** * Updates a post that is already in the database. *
|
Zeile 1378 | Zeile 1394 |
---|
if(count($this->get_errors()) > 0) { die("The post is not valid.");
|
if(count($this->get_errors()) > 0) { die("The post is not valid.");
|
}
| }
|
$post = &$this->data;
| $post = &$this->data;
|
Zeile 1391 | Zeile 1407 |
---|
$forum = get_forum($post['fid']);
// Decide on the visibility of this post.
|
$forum = get_forum($post['fid']);
// Decide on the visibility of this post.
|
if($forum['mod_edit_posts'] == 1 && !is_moderator($post['fid'], "", $post['uid'])) { if($existing_post['visible'] == 1) { update_thread_data($existing_post['tid']); update_thread_counters($existing_post['tid'], array('replies' => '-1', 'unapprovedposts' => '+1')); update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '+1', 'unapprovedposts' => '+1')); // Subtract from the users post count // Update the post count if this forum allows post counts to be tracked if($forum['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$existing_post['uid']}'"); } }
| if(isset($post['visible']) && $post['visible'] != $existing_post['visible']) { if($forum['mod_edit_posts'] == 1 && !is_moderator($post['fid'], "", $post['uid'])) { if($existing_post['visible'] == 1) { update_thread_data($existing_post['tid']); update_thread_counters($existing_post['tid'], array('replies' => '-1', 'unapprovedposts' => '+1')); update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '+1', 'unapprovedposts' => '+1')); // Subtract from the users post count // Update the post count if this forum allows post counts to be tracked if($forum['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$existing_post['uid']}'"); } } $visible = 0; } else { if($existing_post['visible'] == 0) { update_thread_data($existing_post['tid']); update_thread_counters($existing_post['tid'], array('replies' => '+1', 'unapprovedposts' => '-1')); update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '-1', 'unapprovedposts' => '-1')); // Update the post count if this forum allows post counts to be tracked if($forum['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum+1 WHERE uid='{$existing_post['uid']}'"); } } $visible = 1; } } else {
|
$visible = 0;
|
$visible = 0;
|
} else { if($existing_post['visible'] == 0)
| if($forum['mod_edit_posts'] != 1 || is_moderator($post['fid'], "", $post['uid']))
|
{
|
{
|
update_thread_data($existing_post['tid']); update_thread_counters($existing_post['tid'], array('replies' => '+1', 'unapprovedposts' => '-1')); update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '-1', 'unapprovedposts' => '-1')); // Update the post count if this forum allows post counts to be tracked if($forum['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum+1 WHERE uid='{$existing_post['uid']}'"); }
| $visible = 1;
|
}
|
}
|
$visible = 1; }
| }
|
// Check if this is the first post in a thread. $options = array(
| // Check if this is the first post in a thread. $options = array(
|