Vergleich reputation.php - 1.8.3 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 12Zeile 12
define('THIS_SCRIPT', 'reputation.php');

$templatelist = "reputation_addlink,reputation_no_votes,reputation,reputation_vote,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,reputation_vote_delete";

define('THIS_SCRIPT', 'reputation.php');

$templatelist = "reputation_addlink,reputation_no_votes,reputation,reputation_vote,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,reputation_vote_delete";

$templatelist .= ",reputation_add_delete,reputation_add_neutral,reputation_add_positive,reputation_add_negative,reputation_add_error,reputation_add_error_nomodal,reputation_add,reputation_added,reputation_deleted,reputation_vote_report";

$templatelist .= ",reputation_add_delete,reputation_add_neutral,reputation_add_positive,reputation_add_negative,reputation_add_error,reputation_add_error_nomodal,reputation_add,reputation_added,reputation_deleted,reputation_vote_report,postbit_reputation_formatted_link";


require_once "./global.php";
require_once MYBB_ROOT."inc/class_parser.php";


require_once "./global.php";
require_once MYBB_ROOT."inc/class_parser.php";

Zeile 36Zeile 36
}

// If we have a specified incoming username, validate it and fetch permissions for it

}

// If we have a specified incoming username, validate it and fetch permissions for it

$uid = $mybb->get_input('uid', 1);

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

$user = get_user($uid);
if(!$user)
{
error($lang->add_no_uid);
}
$user_permissions = user_permissions($uid);

$user = get_user($uid);
if(!$user)
{
error($lang->add_no_uid);
}
$user_permissions = user_permissions($uid);

 

// Fetch display group properties.
$displaygroupfields = array("title", "description", "namestyle", "usertitle", "stars", "starimage", "image");

if(!$user['displaygroup'])
{
$user['displaygroup'] = $user['usergroup'];
}

$display_group = usergroup_displaygroup($user['displaygroup']);
if(is_array($display_group))
{
$user_permissions = array_merge($user_permissions, $display_group);
}


$mybb->input['action'] = $mybb->get_input('action');



$mybb->input['action'] = $mybb->get_input('action');


Zeile 54Zeile 68
	if($mybb->usergroup['cangivereputations'] != 1)
{
$message = $lang->add_no_permission;

	if($mybb->usergroup['cangivereputations'] != 1)
{
$message = $lang->add_no_permission;

		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 user we're trying to give a reputation to doesn't have permission to receive reps.
if($user_permissions['usereputationsystem'] != 1)
{
$message = $lang->add_disabled;

	// The user we're trying to give a reputation to doesn't have permission to receive reps.
if($user_permissions['usereputationsystem'] != 1)
{
$message = $lang->add_disabled;

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

		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", 1, 0)."\";");
}

Zeile 84Zeile 98

// Is this user trying to give themself a reputation?
if($uid == $mybb->user['uid'])


// Is this user trying to give themself a reputation?
if($uid == $mybb->user['uid'])

	{

	{

		$message = $lang->add_yours;
if($mybb->input['nomodal'])

		$message = $lang->add_yours;
if($mybb->input['nomodal'])

		{

		{

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

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

		}

		}

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

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

		}

		}

		echo $error;
exit;

		echo $error;
exit;

	}


	}


	// If a post has been given but post ratings have been disabled, set the post to 0. This will mean all subsequent code will think no post was given.
if($mybb->settings['postrep'] != 1)

	// If a post has been given but post ratings have been disabled, set the post to 0. This will mean all subsequent code will think no post was given.
if($mybb->settings['postrep'] != 1)

	{

	{

		$mybb->input['pid'] = 0;
}


		$mybb->input['pid'] = 0;
}


	// Check if this user has reached their "maximum reputations per day" quota
if($mybb->usergroup['maxreputationsday'] != 0 && ($mybb->input['action'] != "do_add" || ($mybb->input['action'] == "do_add" && empty($mybb->input['delete']))))
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND dateline>'$timesearch'");
$numtoday = $db->num_rows($query);

// Reached the quota - error.
if($numtoday >= $mybb->usergroup['maxreputationsday'])
{
$message = $lang->add_maxperday;
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;
}
}

// Is the user giving too much reputation to another?
if($mybb->usergroup['maxreputationsperuser'] != 0 && ($mybb->input['action'] != "do_add" || ($mybb->input['action'] == "do_add" && empty($mybb->input['delete']))))
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->simple_select("reputation", "*", "uid='".$uid."' AND dateline>'$timesearch'");
$numtoday = $db->num_rows($query);

if($numtoday >= $mybb->usergroup['maxreputationsperuser'])
{
$message = $lang->add_maxperuser;
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->get_input('pid', 1))

	if($mybb->get_input('pid', MyBB::INPUT_INT))
















































	{
// Make sure that this post exists, and that the author of the post we're giving this reputation for corresponds with the user the rep is being given to.

	{
// Make sure that this post exists, and that the author of the post we're giving this reputation for corresponds with the user the rep is being given to.

		$post = get_post($mybb->get_input('pid', 1));

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

		if($post)
{
$thread = get_thread($post['tid']);
$forum = get_forum($thread['fid']);
$forumpermissions = forum_permissions($forum['fid']);

		if($post)
{
$thread = get_thread($post['tid']);
$forum = get_forum($thread['fid']);
$forumpermissions = forum_permissions($forum['fid']);

 


			// Post doesn't belong to that user or isn't visible

			// Post doesn't belong to that user or isn't visible

			if($uid != $post['uid'] || ($post['visible'] == 0 && !is_moderator($fid, "canviewunapprove")) || $post['visible'] < 0)
{
$mybb->input['pid'] = 0;
}
// Thread isn't visible
elseif(($thread['visible'] == 0 && !is_moderator($forum['fid'], "canviewunapprove")) || $thread['visible'] < 0)
{
$mybb->input['pid'] = 0;
}



			if($uid != $post['uid'] || $post['visible'] != 1)
{
$mybb->input['pid'] = 0;
}

// Thread isn't visible
elseif($thread['visible'] != 1)
{
$mybb->input['pid'] = 0;
}


			// Current user can't see the forum
elseif($forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0 || $mybb->user['suspendposting'] == 1)

			// Current user can't see the forum
elseif($forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0 || $mybb->user['suspendposting'] == 1)

			{

			{

				$mybb->input['pid'] = 0;
}

				$mybb->input['pid'] = 0;
}

 


			// Current user can't see that thread
elseif(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
$mybb->input['pid'] = 0;
}

			// Current user can't see that thread
elseif(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
$mybb->input['pid'] = 0;
}

			else
// We have the correct post, but has the user given too much reputation to another in the same thread?
if($mybb->usergroup['maxreputationsperthread'] != 0 && ($mybb->input['action'] != "do_add" || ($mybb->input['action'] == "do_add" && empty($mybb->input['delete']))))
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->query("
SELECT COUNT(p.pid) AS posts
FROM ".TABLE_PREFIX."reputation r
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid = r.pid)
WHERE r.uid = '{$uid}' AND r.adduid = '{$mybb->user['uid']}' AND p.tid = '{$post['tid']}' AND r.dateline > '{$timesearch}'
");

$numtoday = $db->fetch_field($query, 'posts');

if($numtoday >= $mybb->usergroup['maxreputationsperthread'])
{
$message = $lang->add_maxperthread;
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;
}
}
}

		}






























		else
{
$mybb->input['pid'] = 0;

		else
{
$mybb->input['pid'] = 0;

		}
}

$rid = 0;


		}
}

$rid = 0;


	// Fetch the existing reputation for this user given by our current user if there is one.
// If multiple reputations is allowed, then this isn't needed

	// Fetch the existing reputation for this user given by our current user if there is one.
// If multiple reputations is allowed, then this isn't needed

	if($mybb->settings['multirep'] != 1 && $mybb->get_input('pid', 1) == 0)
{

	if($mybb->settings['multirep'] != 1 && $mybb->get_input('pid', MyBB::INPUT_INT) == 0)
{

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

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




		$existing_reputation = $db->fetch_array($query);
if($existing_reputation)
{
$rid = $existing_reputation['rid'];
}

		$was_post = false;

		$was_post = false;

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

	}
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);

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

 
	}

if($rid == 0 && ($mybb->input['action'] != "do_add" || ($mybb->input['action'] == "do_add" && empty($mybb->input['delete']))))
{
$message = '';

// Check if this user has reached their "maximum reputations per day" quota
if($mybb->usergroup['maxreputationsday'] != 0)
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->simple_select("reputation", "*", "adduid='{$mybb->user['uid']}' AND dateline>'$timesearch'");
$numtoday = $db->num_rows($query);

// Reached the quota - error.
if($numtoday >= $mybb->usergroup['maxreputationsday'])
{
$message = $lang->add_maxperday;
}
}

// Is the user giving too much reputation to another?
if(!$message && $mybb->usergroup['maxreputationsperuser'] != 0)
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->simple_select("reputation", "*", "uid='{$uid}' AND adduid='{$mybb->user['uid']}' AND dateline>'$timesearch'");
$numtoday = $db->num_rows($query);

if($numtoday >= $mybb->usergroup['maxreputationsperuser'])
{
$message = $lang->add_maxperuser;
}
}

// We have the correct post, but has the user given too much reputation to another in the same thread?
if(!$message && !empty($was_post) && $mybb->usergroup['maxreputationsperthread'] != 0)
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->query("
SELECT COUNT(p.pid) AS posts
FROM ".TABLE_PREFIX."reputation r
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid = r.pid)
WHERE r.uid = '{$uid}' AND r.adduid = '{$mybb->user['uid']}' AND p.tid = '{$post['tid']}' AND r.dateline > '{$timesearch}'
");

$numtoday = $db->fetch_field($query, 'posts');

if($numtoday >= $mybb->usergroup['maxreputationsperthread'])
{
$message = $lang->add_maxperthread;
}
}

if($message)
{
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;
}

	}
}


	}
}


Zeile 245Zeile 264
	$plugins->run_hooks("reputation_do_add_start");

// Check if the reputation power they're trying to give is within their "power limit"

	$plugins->run_hooks("reputation_do_add_start");

// Check if the reputation power they're trying to give is within their "power limit"

	$reputation = abs($mybb->get_input('reputation', 1));

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


// Deleting our current reputation of this user.
if(!empty($mybb->input['delete']))
{
// Only administrators, super moderators, as well as users who gave a specifc vote can delete one.


// Deleting our current reputation of this user.
if(!empty($mybb->input['delete']))
{
// Only administrators, super moderators, as well as users who gave a specifc vote can delete one.

		if($mybb->usergroup['cancp'] != 1 && $mybb->usergroup['issupermod'] != 1 && $existing_reputation['adduid'] != $mybb->user['uid'])

		if($mybb->usergroup['issupermod'] != 1 && ($mybb->usergroup['candeletereputations'] != 1 || $existing_reputation['adduid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0))

		{
error_no_permission();
}


		{
error_no_permission();
}


		if($mybb->get_input('pid', 1) != 0)

		if($mybb->get_input('pid', MyBB::INPUT_INT) != 0)

		{

		{

			$db->delete_query("reputation", "uid='{$uid}' AND adduid='".$mybb->user['uid']."' AND pid = '".$mybb->get_input('pid', 1)."'");

			$db->delete_query("reputation", "uid='{$uid}' AND adduid='".$mybb->user['uid']."' AND pid = '".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

		}
else
{
$db->delete_query("reputation", "rid='{$rid}' AND uid='{$uid}' AND adduid='".$mybb->user['uid']."'");

		}
else
{
$db->delete_query("reputation", "rid='{$rid}' AND uid='{$uid}' AND adduid='".$mybb->user['uid']."'");

		}


		}


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

Zeile 276Zeile 295
	}

$mybb->input['comments'] = trim($mybb->get_input('comments')); // Trim whitespace to check for length

	}

$mybb->input['comments'] = trim($mybb->get_input('comments')); // Trim whitespace to check for length

	if(my_strlen($mybb->input['comments']) < $mybb->settings['minreplength'] && $mybb->get_input('pid', 1) == 0)
{
$message = $lang->add_no_comment;

	if(my_strlen($mybb->input['comments']) < $mybb->settings['minreplength'] && $mybb->get_input('pid', MyBB::INPUT_INT) == 0)
{
$message = $lang->sprintf($lang->add_no_comment, $mybb->settings['minreplength']);

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

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

Zeile 295Zeile 314
	if($reputation > $mybb->usergroup['reputationpower'])
{
$message = $lang->add_invalidpower;

	if($reputation > $mybb->usergroup['reputationpower'])
{
$message = $lang->add_invalidpower;

		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;

		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 user is trying to give a negative reputation, but negative reps have been disabled.

		exit;
}

// The user is trying to give a negative reputation, but negative reps have been disabled.

	if($mybb->get_input('reputation', 1) < 0 && $mybb->settings['negrep'] != 1)

	if($mybb->get_input('reputation', MyBB::INPUT_INT) < 0 && $mybb->settings['negrep'] != 1)

	{
$message = $lang->add_negative_disabled;

	{
$message = $lang->add_negative_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)."\";");

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

// This user is trying to give a neutral reputation, but neutral reps have been disabled.

		}
echo $error;
exit;
}

// This user is trying to give a neutral reputation, but neutral reps have been disabled.

	if($mybb->get_input('reputation', 1) == 0 && $mybb->settings['neurep'] != 1)

	if($mybb->get_input('reputation', MyBB::INPUT_INT) == 0 && $mybb->settings['neurep'] != 1)

	{
$message = $lang->add_neutral_disabled;

	{
$message = $lang->add_neutral_disabled;

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

		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", 1, 0)."\";");
}

Zeile 340Zeile 359
	}

// This user is trying to give a positive reputation, but positive reps have been disabled.

	}

// This user is trying to give a positive reputation, but positive reps have been disabled.

	if($mybb->get_input('reputation', 1) > 0 && $mybb->settings['posrep'] != 1)

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

	{
$message = $lang->add_positive_disabled;

	{
$message = $lang->add_positive_disabled;

		if($mybb->input['nomodal'])
{

		if($mybb->input['nomodal'])
{

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

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

		}

		}

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

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

Zeile 357Zeile 376

// The length of the comment is too long
if(my_strlen($mybb->input['comments']) > $mybb->settings['maxreplength'])


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

		$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)."\";");
}
echo $error;
exit;

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

	}


	}


	// Build array of reputation data.
$reputation = array(
"uid" => $uid,
"adduid" => $mybb->user['uid'],

	// Build array of reputation data.
$reputation = array(
"uid" => $uid,
"adduid" => $mybb->user['uid'],

		"pid" => $mybb->get_input('pid', 1),
"reputation" => $mybb->get_input('reputation', 1),

		"pid" => $mybb->get_input('pid', MyBB::INPUT_INT),
"reputation" => $mybb->get_input('reputation', MyBB::INPUT_INT),

		"dateline" => TIME_NOW,
"comments" => $db->escape_string($mybb->input['comments'])
);

		"dateline" => TIME_NOW,
"comments" => $db->escape_string($mybb->input['comments'])
);

Zeile 407Zeile 426
		$reputation_value = $db->fetch_field($query, "reputation_count");

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

		$reputation_value = $db->fetch_field($query, "reputation_count");

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

	}

$plugins->run_hooks("reputation_do_add_end");

	}

$plugins->run_hooks("reputation_do_add_end");


eval("\$reputation = \"".$templates->get("reputation_added", 1, 0)."\";");
echo $reputation;


eval("\$reputation = \"".$templates->get("reputation_added", 1, 0)."\";");
echo $reputation;

Zeile 420Zeile 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.


// If we have an existing reputation for this user, the user can modify or delete it.

 
	$user['username'] = htmlspecialchars_uni($user['username']);

	if(!empty($existing_reputation['uid']))
{
$vote_title = $lang->sprintf($lang->update_reputation_vote, $user['username']);
$vote_button = $lang->update_vote;
$comments = htmlspecialchars_uni($existing_reputation['comments']);


	if(!empty($existing_reputation['uid']))
{
$vote_title = $lang->sprintf($lang->update_reputation_vote, $user['username']);
$vote_button = $lang->update_vote;
$comments = htmlspecialchars_uni($existing_reputation['comments']);


		eval("\$delete_button = \"".$templates->get("reputation_add_delete")."\";");





		if($mybb->usergroup['issupermod'] == 1 || ($mybb->usergroup['candeletereputations'] == 1 && $existing_reputation['adduid'] == $mybb->user['uid'] && $mybb->user['uid'] != 0))
{
$reputation_pid = $mybb->get_input('pid', MyBB::INPUT_INT);
eval("\$delete_button = \"".$templates->get("reputation_add_delete")."\";");
}

	}
// Otherwise we're adding an entirely new reputation for this user.
else

	}
// Otherwise we're adding an entirely new reputation for this user.
else

Zeile 440Zeile 465
	}
$lang->user_comments = $lang->sprintf($lang->user_comments, $user['username']);


	}
$lang->user_comments = $lang->sprintf($lang->user_comments, $user['username']);


	if($mybb->get_input('pid', 1))

	if($mybb->get_input('pid', MyBB::INPUT_INT))

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

Zeile 448Zeile 473
	else
{
$post_rep_info = '';

	else
{
$post_rep_info = '';

	}


	}


	// Draw the "power" options
if($mybb->settings['negrep'] || $mybb->settings['neurep'] || $mybb->settings['posrep'])
{

	// Draw the "power" options
if($mybb->settings['negrep'] || $mybb->settings['neurep'] || $mybb->settings['posrep'])
{

Zeile 461Zeile 486
		foreach(range(-$mybb->usergroup['reputationpower'], $mybb->usergroup['reputationpower']) as $value)
{
$vote_check[$value] = '';

		foreach(range(-$mybb->usergroup['reputationpower'], $mybb->usergroup['reputationpower']) as $value)
{
$vote_check[$value] = '';

		}


		}


		if(!empty($existing_reputation['uid']) && !$was_post)

		if(!empty($existing_reputation['uid']) && !$was_post)

		{

		{

			$vote_check[$existing_reputation['reputation']] = " selected=\"selected\"";

			$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 475Zeile 500
		}

for($value = 1; $value <= $reputationpower; ++$value)

		}

for($value = 1; $value <= $reputationpower; ++$value)

		{

		{

			if($mybb->settings['posrep'])
{
$positive_title = $lang->sprintf($lang->power_positive, "+".$value);

			if($mybb->settings['posrep'])
{
$positive_title = $lang->sprintf($lang->power_positive, "+".$value);

Zeile 490Zeile 515
			}
}


			}
}


		$mybb->input['pid'] = $mybb->get_input('pid', 1);

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


$plugins->run_hooks("reputation_add_end");
eval("\$reputation_add = \"".$templates->get("reputation_add", 1, 0)."\";");


$plugins->run_hooks("reputation_add_end");
eval("\$reputation_add = \"".$templates->get("reputation_add", 1, 0)."\";");

Zeile 501Zeile 526

$plugins->run_hooks("reputation_add_end_error");
if($mybb->input['nomodal'])


$plugins->run_hooks("reputation_add_end_error");
if($mybb->input['nomodal'])

		{

		{

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

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

		}

		}

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

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





	echo $reputation_add;
exit;

	echo $reputation_add;
exit;

}


}


// Delete a specific reputation from a user.
if($mybb->input['action'] == "delete")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

// Delete a specific reputation from a user.
if($mybb->input['action'] == "delete")
{
// 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', 1)."'

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

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

// Only administrators, super moderators, as well as users who gave a specifc vote can delete one.

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

// Only administrators, super moderators, as well as users who gave a specifc vote can delete one.

	if($mybb->usergroup['cancp'] != 1 && $mybb->usergroup['issupermod'] != 1 && $existing_reputation['adduid'] != $mybb->user['uid'])
{
error_no_permission();
}



	if($mybb->usergroup['issupermod'] != 1 && ($mybb->usergroup['candeletereputations'] != 1 || $existing_reputation['adduid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0))
{
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', 1)."'");

	$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 559Zeile 590
		error_no_permission();
}


		error_no_permission();
}


	// Set display group to their user group if they don't have a display group.
if(!$user['displaygroup'])
{
$user['displaygroup'] = $user['usergroup'];
}

// Fetch display group properties.
$displaygroupfields = array('title', 'description', 'namestyle', 'usertitle', 'stars', 'starimage', 'image', 'usereputationsystem');
$display_group = usergroup_displaygroup($user['displaygroup']);

if($user_permissions['usereputationsystem'] != 1 || $display_group['title'] && $display_group['usereputationsystem'] == 0)

	if($user_permissions['usereputationsystem'] != 1)











	{
// Group has reputation disabled or user has a display group that has reputation disabled
error($lang->reputations_disabled_group);
}


	{
// Group has reputation disabled or user has a display group that has reputation disabled
error($lang->reputations_disabled_group);
}


 
	$user['username'] = htmlspecialchars_uni($user['username']);

	$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
$lang->reputation_report = $lang->sprintf($lang->reputation_report, $user['username']);

// Format the user name using the group username style
$username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);

	$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
$lang->reputation_report = $lang->sprintf($lang->reputation_report, $user['username']);

// Format the user name using the group username style
$username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);


// Set display group to their user group if they don't have a display group.
if(!$user['displaygroup'])
{
$user['displaygroup'] = $user['usergroup'];
}

 

$usertitle = '';



$usertitle = '';


Zeile 608Zeile 624
			if($title['posts'] <= $user['postnum'])
{
$usertitle = $title['title'];

			if($title['posts'] <= $user['postnum'])
{
$usertitle = $title['title'];

 
				break;

			}
}
unset($usertitles, $title);

			}
}
unset($usertitles, $title);

Zeile 656Zeile 673
	}

// 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 767Zeile 784
			}
}
}

			}
}
}


















	
// Format all reputation numbers
$rep_total = my_number_format($user['reputation']);
$f_positive_count = my_number_format($positive_count);
$f_negative_count = my_number_format($negative_count);
$f_neutral_count = my_number_format($neutral_count);
$f_positive_week = my_number_format($positive_week);
$f_negative_week = my_number_format($negative_week);
$f_neutral_week = my_number_format($neutral_week);
$f_positive_month = my_number_format($positive_month);
$f_negative_month = my_number_format($negative_month);
$f_neutral_month = my_number_format($neutral_month);
$f_positive_6months = my_number_format($positive_6months);
$f_negative_6months = my_number_format($negative_6months);
$f_neutral_6months = my_number_format($neutral_6months);


	// Format the user's 'total' reputation
if($user['reputation'] < 0)
{

	// Format the user's 'total' reputation
if($user['reputation'] < 0)
{

Zeile 776Zeile 808
	elseif($user['reputation'] > 0)
{
$total_class = "_plus";

	elseif($user['reputation'] > 0)
{
$total_class = "_plus";

	}

	}

	else
{
$total_class = "_neutral";

	else
{
$total_class = "_neutral";

	}


	}


	// Figure out how many reps have come from posts / 'general'
// Posts
$query = $db->simple_select("reputation", "COUNT(rid) AS rep_posts", "uid = '".$user['uid']."' AND pid > 0");

	// Figure out how many reps have come from posts / 'general'
// Posts
$query = $db->simple_select("reputation", "COUNT(rid) AS rep_posts", "uid = '".$user['uid']."' AND pid > 0");

Zeile 790Zeile 822

// General
// We count how many reps in total, then subtract the reps from posts


// General
// We count how many reps in total, then subtract the reps from posts

	$rep_members = my_number_format($total_reputation - $rep_posts);


	$rep_members = my_number_format($total_reputation - $rep_post_count);


	// Is negative reputation disabled? If so, tell the user
if($mybb->settings['negrep'] == 0)
{
$neg_rep_info = $lang->neg_rep_disabled;

	// Is negative reputation disabled? If so, tell the user
if($mybb->settings['negrep'] == 0)
{
$neg_rep_info = $lang->neg_rep_disabled;

	}


	}


	if($mybb->settings['posrep'] == 0)

	if($mybb->settings['posrep'] == 0)

	{

	{

		$pos_rep_info = $lang->pos_rep_disabled;
}


		$pos_rep_info = $lang->pos_rep_disabled;
}


	if($mybb->settings['neurep'] == 0)







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

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

	{

	{

		$neu_rep_info = $lang->neu_rep_disabled;

		$perpage = 15;

	}

// Check if we're browsing a specific page of results

	}

// Check if we're browsing a specific page of results

	if($mybb->get_input('page', 1) > 0)

	if($mybb->get_input('page', MyBB::INPUT_INT) > 0)

	{

	{

		$page = $mybb->get_input('page', 1);
$start = ($page-1) * $mybb->settings['repsperpage'];
$pages = $reputation_count / $mybb->settings['repsperpage'];

		$page = $mybb->get_input('page', MyBB::INPUT_INT);
$start = ($page-1) * $perpage;
$pages = $reputation_count / $perpage;

		$pages = ceil($pages);
if($page > $pages)
{

		$pages = ceil($pages);
if($page > $pages)
{

Zeile 832Zeile 870
	// Build out multipage navigation
if($reputation_count > 0)
{

	// Build out multipage navigation
if($reputation_count > 0)
{

		$multipage = multipage($reputation_count, $mybb->settings['repsperpage'], $page, "reputation.php?uid={$user['uid']}".$s_url);

		$multipage = multipage($reputation_count, $perpage, $page, "reputation.php?uid={$user['uid']}".$s_url);

	}

// Fetch the reputations which will be displayed on this page

	}

// Fetch the reputations which will be displayed on this page

Zeile 842Zeile 880
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)
WHERE r.uid='{$user['uid']}' $conditions
ORDER BY $order

		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)
WHERE r.uid='{$user['uid']}' $conditions
ORDER BY $order

		LIMIT $start, {$mybb->settings['repsperpage']}

		LIMIT $start, {$perpage}

	");

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


while($reputation_vote = $db->fetch_array($query))
{

Zeile 861Zeile 899

if(!empty($post_cache))
{


if(!empty($post_cache))
{

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

























		$pids = implode(',', $post_cache);

$sql = array("p.pid IN ({$pids})");

// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if($unviewable)
{
$sql[] = "p.fid NOT IN ({$unviewable})";
}

// get inactive forums
$inactive = get_inactive_forums();
if($inactive)
{
$sql[] = "p.fid NOT IN ({$inactive})";
}

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

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


$query = $db->query("


$query = $db->query("

			SELECT p.pid, p.uid, p.message, t.tid, t.subject

			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)

			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

			WHERE p.pid IN ({$sql})

			WHERE {$sql}

		");

		");






$forumpermissions = array();


		while($post = $db->fetch_array($query))
{

		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(!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;
}


			$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 884Zeile 984
		if($reputation_vote['adduid'] == 0)
{
$reputation_vote['user_reputation'] = 0;

		if($reputation_vote['adduid'] == 0)
{
$reputation_vote['user_reputation'] = 0;

		}


		}


		$reputation_vote['user_reputation'] = get_reputation($reputation_vote['user_reputation'], $reputation_vote['adduid']);

// Format the username of this poster

		$reputation_vote['user_reputation'] = get_reputation($reputation_vote['user_reputation'], $reputation_vote['adduid']);

// Format the username of this poster

Zeile 893Zeile 993
		{
$reputation_vote['username'] = $lang->na;
$reputation_vote['user_reputation'] = '';

		{
$reputation_vote['username'] = $lang->na;
$reputation_vote['user_reputation'] = '';

		}
else

		}
else

		{

		{

			$reputation_vote['username'] = format_name($reputation_vote['username'], $reputation_vote['user_usergroup'], $reputation_vote['user_displaygroup']);

			$reputation_vote['username'] = format_name(htmlspecialchars_uni($reputation_vote['username']), $reputation_vote['user_usergroup'], $reputation_vote['user_displaygroup']);

			$reputation_vote['username'] = build_profile_link($reputation_vote['username'], $reputation_vote['uid']);
$reputation_vote['user_reputation'] = "({$reputation_vote['user_reputation']})";
}

			$reputation_vote['username'] = build_profile_link($reputation_vote['username'], $reputation_vote['uid']);
$reputation_vote['user_reputation'] = "({$reputation_vote['user_reputation']})";
}

Zeile 931Zeile 1031
		// Format the date this reputation was last modified
$last_updated_date = my_date('relative', $reputation_vote['dateline']);
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date);

		// Format the date this reputation was last modified
$last_updated_date = my_date('relative', $reputation_vote['dateline']);
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date);

 

$user['username'] = htmlspecialchars_uni($user['username']);


// Is this rating specific to a post?
$postrep_given = '';
if($reputation_vote['pid'])
{


// Is this rating specific to a post?
$postrep_given = '';
if($reputation_vote['pid'])
{

			$link = get_post_link($reputation_vote['pid'])."#pid{$reputation_vote['pid']}";

$thread_link = '';

			$postrep_given = $lang->sprintf($lang->postrep_given_nolink, $user['username']);



			if(isset($post_reputation[$reputation_vote['pid']]))
{

			if(isset($post_reputation[$reputation_vote['pid']]))
{

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

$thread_link = get_thread_link($post['tid']);
$subject = htmlspecialchars_uni($post['subject']);


				$thread_link = get_thread_link($post_reputation[$reputation_vote['pid']]['tid']);
$subject = htmlspecialchars_uni($parser->parse_badwords($post_reputation[$reputation_vote['pid']]['subject']));




				$thread_link = $lang->sprintf($lang->postrep_given_thread, $thread_link, $subject);

				$thread_link = $lang->sprintf($lang->postrep_given_thread, $thread_link, $subject);

 
				$link = get_post_link($reputation_vote['pid'])."#pid{$reputation_vote['pid']}";

$postrep_given = $lang->sprintf($lang->postrep_given, $link, $user['username'], $thread_link);

			}

			}


$postrep_given = $lang->sprintf($lang->postrep_given, $link, $user['username'], $thread_link);

 
		}

// Does the current user have permission to delete this reputation? Show delete link
$delete_link = '';

		}

// Does the current user have permission to delete this reputation? Show delete link
$delete_link = '';

		if($mybb->usergroup['cancp'] == 1 || $mybb->usergroup['issupermod'] == 1 || ($mybb->usergroup['cangivereputations'] == 1 && $reputation_vote['adduid'] == $mybb->user['uid'] && $mybb->user['uid'] != 0))

		if($mybb->usergroup['issupermod'] == 1 || ($mybb->usergroup['candeletereputations'] == 1 && $reputation_vote['adduid'] == $mybb->user['uid'] && $mybb->user['uid'] != 0))

		{
eval("\$delete_link = \"".$templates->get("reputation_vote_delete")."\";");
}

$report_link = '';

		{
eval("\$delete_link = \"".$templates->get("reputation_vote_delete")."\";");
}

$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")."\";");
}