Vergleich inc/datahandlers/post.php - 1.6.0 - 1.6.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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 5412 2011-03-20 03:53:36Z jammerx2 $

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 760Zeile 760
			{
$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 778Zeile 791
				$update_query['edituid'] = intval($post['uid']);
$update_query['edittime'] = TIME_NOW;
$query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");

				$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 808Zeile 826
					"pid" => $double_post['pid'],
"visible" => $visible
);

					"pid" => $double_post['pid'],
"visible" => $visible
);

			}

			}

		}

if($visible == 1 && $thread['visible'] == 1)

		}

if($visible == 1 && $thread['visible'] == 1)

Zeile 825Zeile 843
			}

$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 933Zeile 938
				if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
continue;

				if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
continue;

 
				}

if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthread'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid']))
{
// User isn't a moderator or the author of the thread...
continue;

				}

if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))

				}

if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))

Zeile 1058Zeile 1069
		if($this->method == "insert" || array_key_exists('dateline', $thread))
{
$this->verify_dateline();

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

		}

		}


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


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

Zeile 1104Zeile 1115
		}

$thread = &$this->data;

		}

$thread = &$this->data;





		// Fetch the forum this thread is being made in
$forum = get_forum($thread['fid']);

		// Fetch the forum this thread is being made in
$forum = get_forum($thread['fid']);





		// This thread is being saved as a draft.
if($thread['savedraft'])
{
$visible = -2;

		// This thread is being saved as a draft.
if($thread['savedraft'])
{
$visible = -2;

		}


		}


		// Thread is being made now and we have a bit to do.
else
{

// Decide on the visibility of this post.
if(($forum['modthreads'] == 1 || $forum['modposts'] == 1) && !is_moderator($thread['fid'], "", $thread['uid']))

		// Thread is being made now and we have a bit to do.
else
{

// Decide on the visibility of this post.
if(($forum['modthreads'] == 1 || $forum['modposts'] == 1) && !is_moderator($thread['fid'], "", $thread['uid']))

			{
$visible = 0;
}
else

			{
$visible = 0;
}
else

			{
$visible = 1;

			{
$visible = 1;

			}

			}


// Are posts from this user being moderated? Change visibility
if($mybb->user['uid'] == $thread['uid'] && $mybb->user['moderateposts'] == 1)
{
$visible = 0;


// Are posts from this user being moderated? Change visibility
if($mybb->user['uid'] == $thread['uid'] && $mybb->user['moderateposts'] == 1)
{
$visible = 0;

			}
}


			}
}


		// 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");

		// 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)

		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");
}
else
{
$draft_check = false;

			$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;

		}

		}


// 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']),
"icon" => intval($thread['icon']),

			$this->post_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => intval($thread['icon']),

Zeile 1205Zeile 1216
				"replies" => 0,
"visible" => $visible,
"notes" => ''

				"replies" => 0,
"visible" => $visible,
"notes" => ''

			);

$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);

			);

$plugins->run_hooks_by_ref("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 1235Zeile 1246
			$firstpostup = array("firstpost" => $this->pid);
$db->update_query("threads", $firstpostup, "tid='{$this->tid}'");
}

			$firstpostup = array("firstpost" => $this->pid);
$db->update_query("threads", $firstpostup, "tid='{$this->tid}'");
}





		// If we're not saving a draft there are some things we need to check now
if(!$thread['savedraft'])
{

		// If we're not saving a draft there are some things we need to check now
if(!$thread['savedraft'])
{

Zeile 1272Zeile 1283

// Stick the thread.
if($modoptions['stickthread'] == 1)


// Stick the thread.
if($modoptions['stickthread'] == 1)

				{

				{

					$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);
}

					$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);
}

Zeile 1281Zeile 1292
				if($newstick && $newclosed)
{
$sep = ",";

				if($newstick && $newclosed)
{
$sep = ",";

				}

				}

				if($newstick || $newclosed)
{
$db->write_query("

				if($newstick || $newclosed)
{
$db->write_query("

Zeile 1300Zeile 1311
					$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 = 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'])

					{

					{

						// Yes this has a single quote within a double quote. It's not a bug.
$update_query['lastpost'] = "'{$thread['dateline']}'";

						// Yes this has a single quote within a double quote. It's not a bug.
$update_query['lastpost'] = "'{$thread['dateline']}'";

					}

					}

					// Update the post count if this forum allows post counts to be tracked
if($forum['usepostcounts'] != 0)
{
$update_query['postnum'] = "postnum+1";

					// Update the post count if this forum allows post counts to be tracked
if($forum['usepostcounts'] != 0)
{
$update_query['postnum'] = "postnum+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 1318Zeile 1329
				}

if(!$forum['lastpost'])

				}

if(!$forum['lastpost'])

				{

				{

					$forum['lastpost'] = 0;
}


					$forum['lastpost'] = 0;
}


Zeile 1345Zeile 1356
				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;

$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)

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

$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)

					{

					{

					    continue;
}

					    continue;
}

					








if(!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1)
{
// In a 'view own only' forum and not a moderator
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']))
{