Vergleich inc/datahandlers/post.php - 1.4.0 - 1.4.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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 4036 2008-07-24 11:35:12Z ZiNgaBuRgA $

 * $Id: post.php 4328 2009-03-09 21:58:37Z Tikitiki $

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 309Zeile 309
		global $mybb, $db, $session;

$post = &$this->data;

		global $mybb, $db, $session;

$post = &$this->data;

 
		
// Are we starting a new thread?
if(!$post['tid'])
{
return true;
}

		
// Are we even turned on?
if(empty($mybb->settings['postmergemins']))

		
// Are we even turned on?
if(empty($mybb->settings['postmergemins']))

Zeile 326Zeile 332
		if(trim($mybb->settings['postmergeuignore']) != "")
{
$gids = explode(',', $mybb->settings['postmergeuignore']);

		if(trim($mybb->settings['postmergeuignore']) != "")
{
$gids = explode(',', $mybb->settings['postmergeuignore']);

			array_walk($gids, 'intval');

			$gids = array_map('intval', $gids);

			

$user_usergroups = explode(',', $mybb->user['usergroup'].",".$mybb->user['additionalgroups']);

			

$user_usergroups = explode(',', $mybb->user['usergroup'].",".$mybb->user['additionalgroups']);

Zeile 449Zeile 455
		// Check if the post being replied to actually exists in this thread.
if($post['replyto'])
{

		// Check if the post being replied to actually exists in this thread.
if($post['replyto'])
{

			$query = $db->simple_select("posts", "pid", "pid='{$post['replyto']}'");

			$query = $db->simple_select("posts", "pid", "pid='".intval($post['replyto'])."'");

			$valid_post = $db->fetch_array($query);
if(!$valid_post['pid'])
{

			$valid_post = $db->fetch_array($query);
if(!$valid_post['pid'])
{

Zeile 726Zeile 732
				{
$post['posthash'] = $db->escape_string($post['posthash']);
$double_post['posthash'] = $db->escape_string($double_post['posthash']);

				{
$post['posthash'] = $db->escape_string($post['posthash']);
$double_post['posthash'] = $db->escape_string($double_post['posthash']);

					

					

					$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='0' AND visible='1' AND posthash='{$post['posthash']}'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");


					$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='0' AND visible='1' AND posthash='{$post['posthash']}'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");


Zeile 854Zeile 860
			// 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, s.subscriptionkey

			// 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, s.subscriptionkey

				FROM ".TABLE_PREFIX."threadsubscriptions s, ".TABLE_PREFIX."users u


				FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)

				WHERE s.notification='1' AND s.tid='{$post['tid']}'

				WHERE s.notification='1' AND s.tid='{$post['tid']}'

				AND u.uid=s.uid

 
				AND s.uid != '{$post['uid']}'
AND u.lastactive>'{$thread['lastpost']}'
");

				AND s.uid != '{$post['uid']}'
AND u.lastactive>'{$thread['lastpost']}'
");

Zeile 867Zeile 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'];
}

				elseif($mybb->settings['bblanguage'])

				elseif($mybb->settings['orig_bblanguage'])

				{

				{

					$uselang = $mybb->settings['bblanguage'];

					$uselang = $mybb->settings['orig_bblanguage'];

				}
else
{

				}
else
{

Zeile 901Zeile 914
					$emailmessage = $langcache[$uselang]['email_subscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $subject);

					$emailmessage = $langcache[$uselang]['email_subscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $subject);

				$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], get_thread_link($thread['tid'], 0, "newpost"), $thread['tid'], $subscribedmember['subscriptionkey']);

				$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey']);

				$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

				$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

Zeile 937Zeile 950
			"pid" => $this->pid,
"visible" => $visible
);

			"pid" => $this->pid,
"visible" => $visible
);

	}

/**

	}

/**

	 * Validate a thread.
*
* @return boolean True when valid, false when invalid.

	 * Validate a thread.
*
* @return boolean True when valid, false when invalid.

Zeile 955Zeile 968
		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		}


		}


		if($this->method == "insert" || array_key_exists('uid', $thread))
{
$this->verify_author();

		if($this->method == "insert" || array_key_exists('uid', $thread))
{
$this->verify_author();

		}


		}


		if($this->method == "insert" || array_key_exists('subject', $thread))

		if($this->method == "insert" || array_key_exists('subject', $thread))

		{

		{

			$this->verify_subject();

			$this->verify_subject();

		}

		}


if($this->method == "insert" || array_key_exists('message', $thread))
{


if($this->method == "insert" || array_key_exists('message', $thread))
{

Zeile 974Zeile 987
		}

if($this->method == "insert" || array_key_exists('dateline', $thread))

		}

if($this->method == "insert" || array_key_exists('dateline', $thread))

		{

		{

			$this->verify_dateline();
}


			$this->verify_dateline();
}


Zeile 1008Zeile 1021
	 * @return array Array of new thread details, tid and visibility.
*/
function insert_thread()

	 * @return array Array of new thread details, tid and visibility.
*/
function insert_thread()

	{

	{

		global $db, $mybb, $plugins, $cache, $lang;

// Yes, validating is required.

		global $db, $mybb, $plugins, $cache, $lang;

// Yes, validating is required.

Zeile 1238Zeile 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 1260Zeile 1275
				while($subscribedmember = $db->fetch_array($query))
{
if($done_users[$subscribedmember['uid']])

				while($subscribedmember = $db->fetch_array($query))
{
if($done_users[$subscribedmember['uid']])

					{

					{

						continue;

						continue;

					}

					}

					$done_users[$subscribedmember['uid']] = 1;

					$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 1331Zeile 1353
		
if($visible == 1)
{

		
if($visible == 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}"));
}


 
			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 1346Zeile 1361
			update_thread_data($this->tid);
update_thread_counters($thread['tid'], array("replies" => 0, "unapprovedposts" => 1));
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));

			update_thread_data($this->tid);
update_thread_counters($thread['tid'], array("replies" => 0, "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}"));

		}

// Return the post's pid and whether or not it is visible.

		}

// Return the post's pid and whether or not it is visible.

Zeile 1385Zeile 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(

Zeile 1433Zeile 1466
			$first_post = true;
}
else

			$first_post = true;
}
else

		{

		{

			$first_post = false;

			$first_post = false;

 
		}

if($existing_post['visible'] == 0)
{
$visible = 0;

		}

// Update the thread details that might have been changed first.
if($first_post)

		}

// Update the thread details that might have been changed first.
if($first_post)

		{
if($existing_post['visible'] == 0)
{
$visible = 0;
}


		{			






			$this->tid = $post['tid'];

$this->thread_update_data['visible'] = $visible;

			$this->tid = $post['tid'];

$this->thread_update_data['visible'] = $visible;

Zeile 1526Zeile 1559
		}
else
{

		}
else
{

			$db->delete_query("threadsubscriptions", "uid='{$post['uid']}' AND tid='{$post['tid']}'");

			$db->delete_query("threadsubscriptions", "uid='".intval($post['uid'])."' AND tid='".intval($post['tid'])."'");

		}

update_forum_lastpost($post['fid']);

		}

update_forum_lastpost($post['fid']);