Vergleich reputation.php - 1.8.18 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 166Zeile 166
	{
$query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid='0'");
$existing_reputation = $db->fetch_array($query);

	{
$query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid='0'");
$existing_reputation = $db->fetch_array($query);

		$rid = $existing_reputation['rid'];




		if($existing_reputation)
{
$rid = $existing_reputation['rid'];
}

		$was_post = false;
}
if($mybb->get_input('pid', MyBB::INPUT_INT) != 0)
{
$query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid = '".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
$existing_reputation = $db->fetch_array($query);

		$was_post = false;
}
if($mybb->get_input('pid', MyBB::INPUT_INT) != 0)
{
$query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid = '".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
$existing_reputation = $db->fetch_array($query);

		$rid = $existing_reputation['rid'];











if($existing_reputation)
{
$rid = $existing_reputation['rid'];
}
else
{
$rid = 0;
}


		$was_post = true;
}


		$was_post = true;
}


Zeile 209Zeile 221
		}

// We have the correct post, but has the user given too much reputation to another in the same thread?

		}

// We have the correct post, but has the user given too much reputation to another in the same thread?

		if(!$message && $was_post && $mybb->usergroup['maxreputationsperthread'] != 0)

		if(!$message && !empty($was_post) && $mybb->usergroup['maxreputationsperthread'] != 0)

		{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->query("

		{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->query("

Zeile 350Zeile 362
	if($mybb->get_input('reputation', MyBB::INPUT_INT) > 0 && $mybb->settings['posrep'] != 1)
{
$message = $lang->add_positive_disabled;

	if($mybb->get_input('reputation', MyBB::INPUT_INT) > 0 && $mybb->settings['posrep'] != 1)
{
$message = $lang->add_positive_disabled;

		if($mybb->input['nomodal'])
{
eval("\$error = \"".$templates->get("reputation_add_error_nomodal", 1, 0)."\";");
}
else
{
eval("\$error = \"".$templates->get("reputation_add_error", 1, 0)."\";");
}
echo $error;
exit;
}


		if($mybb->input['nomodal'])
{
eval("\$error = \"".$templates->get("reputation_add_error_nomodal", 1, 0)."\";");
}
else
{
eval("\$error = \"".$templates->get("reputation_add_error", 1, 0)."\";");
}
echo $error;
exit;
}


	// The length of the comment is too long
if(my_strlen($mybb->input['comments']) > $mybb->settings['maxreplength'])
{
$message = $lang->sprintf($lang->add_toolong, $mybb->settings['maxreplength']);
if($mybb->input['nomodal'])

	// The length of the comment is too long
if(my_strlen($mybb->input['comments']) > $mybb->settings['maxreplength'])
{
$message = $lang->sprintf($lang->add_toolong, $mybb->settings['maxreplength']);
if($mybb->input['nomodal'])

		{

		{

			eval("\$error = \"".$templates->get("reputation_add_error_nomodal", 1, 0)."\";");
}
else
{
eval("\$error = \"".$templates->get("reputation_add_error", 1, 0)."\";");

			eval("\$error = \"".$templates->get("reputation_add_error_nomodal", 1, 0)."\";");
}
else
{
eval("\$error = \"".$templates->get("reputation_add_error", 1, 0)."\";");

		}

		}

		echo $error;
exit;
}

		echo $error;
exit;
}

Zeile 395Zeile 407
	{
$db->update_query("reputation", $reputation, "rid='".$existing_reputation['rid']."'");


	{
$db->update_query("reputation", $reputation, "rid='".$existing_reputation['rid']."'");


		// Recount the reputation of this user - keep it in sync.
$query = $db->simple_select("reputation", "SUM(reputation) AS reputation_count", "uid='{$uid}'");
$reputation_value = $db->fetch_field($query, "reputation_count");


		// Recount the reputation of this user - keep it in sync.
$query = $db->simple_select("reputation", "SUM(reputation) AS reputation_count", "uid='{$uid}'");
$reputation_value = $db->fetch_field($query, "reputation_count");


		$db->update_query("users", array('reputation' => (int)$reputation_value), "uid='{$uid}'");

$lang->vote_added = $lang->vote_updated;

		$db->update_query("users", array('reputation' => (int)$reputation_value), "uid='{$uid}'");

$lang->vote_added = $lang->vote_updated;

Zeile 427Zeile 439
if($mybb->input['action'] == "add")
{
$plugins->run_hooks("reputation_add_start");

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("reputation_add_start");

 
	$delete_button = '';


// If we have an existing reputation for this user, the user can modify or delete it.
$user['username'] = htmlspecialchars_uni($user['username']);


// If we have an existing reputation for this user, the user can modify or delete it.
$user['username'] = htmlspecialchars_uni($user['username']);

Zeile 456Zeile 469
	{
$post_rep_info = $lang->sprintf($lang->add_reputation_to_post, $user['username']);
$lang->user_comments = $lang->no_comment_needed;

	{
$post_rep_info = $lang->sprintf($lang->add_reputation_to_post, $user['username']);
$lang->user_comments = $lang->no_comment_needed;

	}
else

	}
else

	{
$post_rep_info = '';
}

	{
$post_rep_info = '';
}

Zeile 478Zeile 491
		if(!empty($existing_reputation['uid']) && !$was_post)
{
$vote_check[$existing_reputation['reputation']] = " selected=\"selected\"";

		if(!empty($existing_reputation['uid']) && !$was_post)
{
$vote_check[$existing_reputation['reputation']] = " selected=\"selected\"";

		}


		}


		if($mybb->settings['neurep'])
{
$neutral_title = $lang->power_neutral;

		if($mybb->settings['neurep'])
{
$neutral_title = $lang->power_neutral;

Zeile 500Zeile 513
				$neg_value = "-{$value}";
eval("\$negative_power .= \"".$templates->get("reputation_add_negative")."\";");
}

				$neg_value = "-{$value}";
eval("\$negative_power .= \"".$templates->get("reputation_add_negative")."\";");
}

		}


		}


		$reputation_pid = $mybb->get_input('pid', MyBB::INPUT_INT);

$plugins->run_hooks("reputation_add_end");

		$reputation_pid = $mybb->get_input('pid', MyBB::INPUT_INT);

$plugins->run_hooks("reputation_add_end");

Zeile 531Zeile 544
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

 

$rid = $mybb->get_input('rid', MyBB::INPUT_INT);

$plugins->run_hooks("reputation_delete_start");


// Fetch the existing reputation for this user given by our current user if there is one.
$query = $db->query("
SELECT r.*, u.username
FROM ".TABLE_PREFIX."reputation r
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)


// Fetch the existing reputation for this user given by our current user if there is one.
$query = $db->query("
SELECT r.*, u.username
FROM ".TABLE_PREFIX."reputation r
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)

		WHERE rid = '".$mybb->get_input('rid', MyBB::INPUT_INT)."'

		WHERE r.rid = '{$rid}' AND r.uid = '{$uid}'

	");
$existing_reputation = $db->fetch_array($query);


	");
$existing_reputation = $db->fetch_array($query);


Zeile 546Zeile 563
	{
error_no_permission();
}

	{
error_no_permission();
}

 
	
$plugins->run_hooks("reputation_delete_end");


// Delete the specified reputation


// Delete the specified reputation

	$db->delete_query("reputation", "uid='{$uid}' AND rid='".$mybb->get_input('rid', MyBB::INPUT_INT)."'");

	$db->delete_query("reputation", "uid='{$uid}' AND rid='{$rid}'");


// Recount the reputation of this user - keep it in sync.
$query = $db->simple_select("reputation", "SUM(reputation) AS reputation_count", "uid='{$uid}'");


// Recount the reputation of this user - keep it in sync.
$query = $db->simple_select("reputation", "SUM(reputation) AS reputation_count", "uid='{$uid}'");

Zeile 650Zeile 669
			$s_url = '&show=all';
$conditions = '';
$show_select['all'] = 'selected="selected"';

			$s_url = '&show=all';
$conditions = '';
$show_select['all'] = 'selected="selected"';

			break;
}


			break;
}


	// Check the sorting options for the reputation list

	// Check the sorting options for the reputation list

	$sort_selected = array('username' => '', 'last_ipdated' => '');

	$sort_selected = array('username' => '', 'last_updated' => '');

	switch($mybb->get_input('sort'))
{
case "username":

	switch($mybb->get_input('sort'))
{
case "username":

Zeile 677Zeile 696
	// Fetch the total number of reputations for this user
$query = $db->simple_select("reputation r", "COUNT(r.rid) AS reputation_count", "r.uid='{$user['uid']}' $conditions");
$reputation_count = $db->fetch_field($query, "reputation_count");

	// Fetch the total number of reputations for this user
$query = $db->simple_select("reputation r", "COUNT(r.rid) AS reputation_count", "r.uid='{$user['uid']}' $conditions");
$reputation_count = $db->fetch_field($query, "reputation_count");





	// If the user has no reputation, suspect 0...
if(!$user['reputation'])
{

	// If the user has no reputation, suspect 0...
if(!$user['reputation'])
{

Zeile 724Zeile 743
			if($reputation_vote['dateline'] >= $last_month)
{
$positive_month++;

			if($reputation_vote['dateline'] >= $last_month)
{
$positive_month++;

			}
if($reputation_vote['dateline'] >= $last_6months)

			}
if($reputation_vote['dateline'] >= $last_6months)

			{
$positive_6months++;
}

			{
$positive_6months++;
}

Zeile 737Zeile 756
			if($reputation_vote['dateline'] >= $last_week)
{
$negative_week++;

			if($reputation_vote['dateline'] >= $last_week)
{
$negative_week++;

			}

			}

			if($reputation_vote['dateline'] >= $last_month)

			if($reputation_vote['dateline'] >= $last_month)

			{

			{

				$negative_month++;
}
if($reputation_vote['dateline'] >= $last_6months)

				$negative_month++;
}
if($reputation_vote['dateline'] >= $last_6months)

Zeile 749Zeile 768
		}
// Neutral reputation given
else

		}
// Neutral reputation given
else

		{

		{

			$neutral_count++;
if($reputation_vote['dateline'] >= $last_week)
{

			$neutral_count++;
if($reputation_vote['dateline'] >= $last_week)
{

Zeile 819Zeile 838
	if($mybb->settings['neurep'] == 0)
{
$neu_rep_info = $lang->neu_rep_disabled;

	if($mybb->settings['neurep'] == 0)
{
$neu_rep_info = $lang->neu_rep_disabled;

	}


	}


	$perpage = (int)$mybb->settings['repsperpage'];
if($perpage < 1)
{

	$perpage = (int)$mybb->settings['repsperpage'];
if($perpage < 1)
{

Zeile 844Zeile 863
	{
$start = 0;
$page = 1;

	{
$start = 0;
$page = 1;

	}


	}


	$multipage = '';

// Build out multipage navigation

	$multipage = '';

// Build out multipage navigation

Zeile 865Zeile 884
	");

// Gather a list of items that have post reputation

	");

// Gather a list of items that have post reputation

	$reputation_cache = $post_cache = $post_reputation = array();

	$reputation_cache = $post_cache = $post_reputation = $not_reportable = array();


while($reputation_vote = $db->fetch_array($query))
{
$reputation_cache[] = $reputation_vote;


while($reputation_vote = $db->fetch_array($query))
{
$reputation_cache[] = $reputation_vote;





		// If this is a post, hold it and gather some information about it
if($reputation_vote['pid'] && !isset($post_cache[$reputation_vote['pid']]))
{

		// If this is a post, hold it and gather some information about it
if($reputation_vote['pid'] && !isset($post_cache[$reputation_vote['pid']]))
{

Zeile 894Zeile 913
		// get inactive forums
$inactive = get_inactive_forums();
if($inactive)

		// get inactive forums
$inactive = get_inactive_forums();
if($inactive)

		{

		{

			$sql[] = "p.fid NOT IN ({$inactive})";

			$sql[] = "p.fid NOT IN ({$inactive})";

		}

		}


if(!$mybb->user['ismoderator'])
{
$sql[] = "p.visible='1'";
$sql[] = "t.visible='1'";
}


if(!$mybb->user['ismoderator'])
{
$sql[] = "p.visible='1'";
$sql[] = "t.visible='1'";
}





		$sql = implode(' AND ', $sql);

		$sql = implode(' AND ', $sql);


$query = $db->query("


$query = $db->query("

			SELECT p.pid, p.uid, p.fid, p.visible, p.message, t.tid, t.subject, t.visible AS thread_visible
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE {$sql}
");

			SELECT p.pid, p.uid, p.fid, p.visible, p.message, t.tid, t.subject, t.visible AS thread_visible
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE {$sql}
");





		$forumpermissions = array();

while($post = $db->fetch_array($query))
{
if(($post['visible'] == 0 || $post['thread_visible'] == 0) && !is_moderator($post['fid'], 'canviewunapprove'))
{

		$forumpermissions = array();

while($post = $db->fetch_array($query))
{
if(($post['visible'] == 0 || $post['thread_visible'] == 0) && !is_moderator($post['fid'], 'canviewunapprove'))
{

				continue;
}

if(($post['visible'] == -1 || $post['thread_visible'] == -1) && !is_moderator($post['fid'], 'canviewdeleted'))
{

				continue;
}

if(($post['visible'] == -1 || $post['thread_visible'] == -1) && !is_moderator($post['fid'], 'canviewdeleted'))
{

				continue;
}

if(!isset($forumpermissions[$post['fid']]))
{
$forumpermissions[$post['fid']] = forum_permissions($post['fid']);

				continue;
}

if(!isset($forumpermissions[$post['fid']]))
{
$forumpermissions[$post['fid']] = forum_permissions($post['fid']);

			}

			}


// Make sure we can view this post
if(isset($forumpermissions[$post['fid']]['canonlyviewownthreads']) && $forumpermissions[$post['fid']]['canonlyviewownthreads'] == 1 && $post['uid'] != $mybb->user['uid'])
{
continue;


// Make sure we can view this post
if(isset($forumpermissions[$post['fid']]['canonlyviewownthreads']) && $forumpermissions[$post['fid']]['canonlyviewownthreads'] == 1 && $post['uid'] != $mybb->user['uid'])
{
continue;

			}

			}


$post_reputation[$post['pid']] = $post;


$post_reputation[$post['pid']] = $post;

		}

		}

	}

$reputation_votes = '';

	}

$reputation_votes = '';

 
	if(!empty($reputation_cache) && $mybb->user['uid'] != 0)
{
$reputation_ids = implode(',', array_column($reputation_cache, 'rid'));
$query = $db->query("
SELECT id, reporters FROM ".TABLE_PREFIX."reportedcontent WHERE reportstatus != '1' AND id IN (".$reputation_ids.") AND type = 'reputation'
");
while($report = $db->fetch_array($query))
{
$reporters = my_unserialize($report['reporters']);
if(is_array($reporters) && in_array($mybb->user['uid'], $reporters))
{
$not_reportable[] = $report['id'];
}
}
}


foreach($reputation_cache as $reputation_vote)
{


foreach($reputation_cache as $reputation_vote)
{

Zeile 1025Zeile 1059
		}

$report_link = '';

		}

$report_link = '';

		if($mybb->user['uid'] != 0)

		if($mybb->user['uid'] != 0 && !in_array($reputation_vote['rid'], $not_reportable))

		{
eval("\$report_link = \"".$templates->get("reputation_vote_report")."\";");
}

		{
eval("\$report_link = \"".$templates->get("reputation_vote_report")."\";");
}