Vergleich reputation.php - 1.8.0 - 1.8.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
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)
{

$user = get_user($uid);
if(!$user)
{

Zeile 151Zeile 151
		}
}


		}
}


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

		if($post)
{
$thread = get_thread($post['tid']);

Zeile 220Zeile 220

// 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'");
$existing_reputation = $db->fetch_array($query);
$rid = $existing_reputation['rid'];

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

 
		$was_post = false;

	}

	}

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

	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', 1)."'");
$existing_post_reputation = $db->fetch_array($query);
$rid = $existing_post_reputation['rid'];


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

	}
}

	}
}





// Saving the new reputation
if($mybb->input['action'] == "do_add" && $mybb->request_method == "post")
{

// Saving the new reputation
if($mybb->input['action'] == "do_add" && $mybb->request_method == "post")
{

Zeile 243Zeile 245
	$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)
{
$db->delete_query("reputation", "uid='{$uid}' AND adduid='".$mybb->user['uid']."' AND pid = '".$mybb->get_input('pid', 1)."'");

		}

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', MyBB::INPUT_INT)."'");

		}
else
{

		}
else
{

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

			$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 274Zeile 276
	}

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

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

	{
$message = $lang->add_no_comment;

	{
$message = $lang->add_no_comment;

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

















		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 power for the reputation they specified was invalid.
if($reputation > $mybb->usergroup['reputationpower'])
{
$message = $lang->add_invalidpower;
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)."\";");
}
echo $error;
exit;
}

// The power for the reputation they specified was invalid.
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)."\";");

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

Zeile 306Zeile 308
	}

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

	}

// 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;
if($mybb->input['nomodal'])

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

Zeile 322Zeile 324
	}

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

	}

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

















		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 positive reputation, but positive reps have been 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)."\";");

		{
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 positive reputation, but positive reps have been disabled.
if($mybb->get_input('reputation', 1) > 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)."\";");

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

Zeile 373Zeile 375
	$reputation = array(
"uid" => $uid,
"adduid" => $mybb->user['uid'],

	$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 382Zeile 384
	$plugins->run_hooks("reputation_do_add_process");

// Updating an existing reputation

	$plugins->run_hooks("reputation_do_add_process");

// Updating an existing reputation

	if(!empty($existing_reputation['uid']) || !empty($existing_post_reputation['uid']))

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

	{

	{

		if(!empty($existing_reputation['uid']))
{
$db->update_query("reputation", $reputation, "rid='".$existing_reputation['rid']."'");
}
elseif(!empty($existing_post_reputation['uid']))
{
$db->update_query("reputation", $reputation, "rid='".$existing_post_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}'");


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

Zeile 427Zeile 422
	$plugins->run_hooks("reputation_add_start");

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

	$plugins->run_hooks("reputation_add_start");

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

	if(!empty($existing_reputation['uid']) || !empty($existing_post_reputation['uid']))

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

	{
$vote_title = $lang->sprintf($lang->update_reputation_vote, $user['username']);
$vote_button = $lang->update_vote;

	{
$vote_title = $lang->sprintf($lang->update_reputation_vote, $user['username']);
$vote_button = $lang->update_vote;

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



		$comments = htmlspecialchars_uni($existing_reputation['comments']);

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

		{

		{

			$comments = htmlspecialchars_uni($existing_reputation['comments']);
}
elseif(!empty($existing_post_reputation['uid']))
{
$comments = htmlspecialchars_uni($existing_post_reputation['comments']);

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





		}

		}


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 452Zeile 443
	}
$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 475Zeile 466
			$vote_check[$value] = '';
}


			$vote_check[$value] = '';
}


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

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

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

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

Zeile 502Zeile 493
			}
}


			}
}


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

		$mybb->input['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 537Zeile 528
		SELECT r.*, u.username
FROM ".TABLE_PREFIX."reputation r
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)

		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 rid = '".$mybb->get_input('rid', MyBB::INPUT_INT)."'

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

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

	{
error_no_permission();
}

// Delete the specified reputation

	{
error_no_permission();
}

// 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='".$mybb->get_input('rid', MyBB::INPUT_INT)."'");


// 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 821Zeile 812
	}

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

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

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

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

Zeile 966Zeile 957

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

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