Vergleich reputation.php - 1.6.9 - 1.6.15

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


define("IN_MYBB", 1);
define('THIS_SCRIPT', 'reputation.php');


$templatelist = 'reputation_addlink,reputation_no_votes,reputation,reputation_add_error,reputation_deleted,reputation_added,reputation_add,reputation_vote,multipage_page_current,multipage_page,multipage_nextpage,multipage';

$templatelist = 'reputation_addlink,reputation_no_votes,reputation,reputation_add_error,reputation_deleted,reputation_added,reputation_add,reputation_vote,multipage_page_current,multipage_page,multipage_nextpage,multipage,multipage_prevpage,multipage_start,multipage_end';

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 76Zeile 76
		output_page($error);
exit;
}

		output_page($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->input['pid'] != 0 && $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->input['pid'] != 0 && $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" && !$mybb->input['delete'])))
{
$timesearch = TIME_NOW - (60 * 60 * 24);
$query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND dateline>'$timesearch'");

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

		$numtoday = $db->num_rows($query);


// Reached the quota - error.
if($numtoday >= $mybb->usergroup['maxreputationsday'])


// Reached the quota - error.
if($numtoday >= $mybb->usergroup['maxreputationsday'])

Zeile 99Zeile 99
			exit;
}
}

			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" && !$mybb->input['delete'])))
{

	// Is the user giving too much reputation to another?
if($mybb->usergroup['maxreputationsperuser'] != 0 && ($mybb->input['action'] != "do_add" || ($mybb->input['action'] == "do_add" && !$mybb->input['delete'])))
{

Zeile 115Zeile 115
			exit;
}
}

			exit;
}
}

	



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

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

		if($uid != $post['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" && !$mybb->input['delete'])))

		if($post)







		{

		{

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

			$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
if($uid != $post['uid'] || ($post['visible'] == 0 && !is_moderator($fid)) || $post['visible'] < 0)







			{

			{

				$message = $lang->add_maxperthread;
eval("\$error = \"".$templates->get("reputation_add_error")."\";");
output_page($error);
exit;



































				$mybb->input['pid'] = 0;
}
// Thread isn't visible
elseif(($thread['visible'] == 0 && !is_moderator($forum['fid'])) || $thread['visible'] < 0)
{
$mybb->input['pid'] = 0;
}
// Current user can't see the forum
elseif($forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0 || $mybb->user['suspendposting'] == 1)
{
$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" && !$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;
eval("\$error = \"".$templates->get("reputation_add_error")."\";");
output_page($error);
exit;
}

			}

			}

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

		}
}


		}
}


Zeile 183Zeile 209
		{
error_no_permission();
}

		{
error_no_permission();
}

		



		if($mybb->input['pid'] != 0)
{
$db->delete_query("reputation", "uid='{$uid}' AND adduid='".$mybb->user['uid']."' AND pid = '".intval($mybb->input['pid'])."'");

		if($mybb->input['pid'] != 0)
{
$db->delete_query("reputation", "uid='{$uid}' AND adduid='".$mybb->user['uid']."' AND pid = '".intval($mybb->input['pid'])."'");

Zeile 202Zeile 228
		output_page($error);
exit;
}

		output_page($error);
exit;
}

	



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

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

Zeile 221Zeile 247
	{
$show_back = 1;
$message = $lang->add_invalidpower;

	{
$show_back = 1;
$message = $lang->add_invalidpower;

		eval("\$error = \"".$templates->get("reputation_add_error")."\";");

		eval("\$error = \"".$templates->get("reputation_add_error")."\";");

		output_page($error);
exit;
}

		output_page($error);
exit;
}

	



	// The user is trying to give a negative reputation, but negative reps have been disabled.
if($mybb->input['reputation'] < 0 && $mybb->settings['negrep'] != 1)
{
$show_back = 1;
$message = $lang->add_negative_disabled;

	// The user is trying to give a negative reputation, but negative reps have been disabled.
if($mybb->input['reputation'] < 0 && $mybb->settings['negrep'] != 1)
{
$show_back = 1;
$message = $lang->add_negative_disabled;

		eval("\$error = \"".$templates->get("reputation_add_error")."\";");

		eval("\$error = \"".$templates->get("reputation_add_error")."\";");

		output_page($error);
exit;
}

		output_page($error);
exit;
}

Zeile 277Zeile 303
	);

$plugins->run_hooks("reputation_do_add_process");

	);

$plugins->run_hooks("reputation_do_add_process");





	// Updating an existing reputation
if($existing_reputation['uid'] || $existing_post_reputation['uid'])
{
if($existing_reputation['uid'])

	// Updating an existing reputation
if($existing_reputation['uid'] || $existing_post_reputation['uid'])
{
if($existing_reputation['uid'])

		{

		{

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

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

		}
elseif($existing_post_reputation['uid'])
{

		}
elseif($existing_post_reputation['uid'])
{

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

			$db->update_query("reputation", $reputation, "rid='".$existing_post_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");

$db->update_query("users", array('reputation' => intval($reputation_value)), "uid='{$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");

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


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


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

Zeile 303Zeile 329
	else
{
$db->insert_query("reputation", $reputation);

	else
{
$db->insert_query("reputation", $reputation);





		// 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' => intval($reputation_value)), "uid='{$uid}'");

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

	}

$plugins->run_hooks("reputation_do_add_end");

	}

$plugins->run_hooks("reputation_do_add_end");


eval("\$reputation = \"".$templates->get("reputation_added")."\";");
output_page($reputation);


eval("\$reputation = \"".$templates->get("reputation_added")."\";");
output_page($reputation);

Zeile 328Zeile 354
		$vote_title = $lang->sprintf($lang->update_reputation_vote, $user['username']);
$vote_button = $lang->update_vote;
if($existing_reputation['uid'])

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

		{

		{

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

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

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

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

	



	if($mybb->input['pid'])
{
$post_rep_info = $lang->sprintf($lang->add_reputation_to_post, $user['username']);

	if($mybb->input['pid'])
{
$post_rep_info = $lang->sprintf($lang->add_reputation_to_post, $user['username']);

Zeile 448Zeile 474
	{
// Reputation page is a part of a profile
error_no_permission();

	{
// Reputation page is a part of a profile
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.

	}

// Fetch display group properties.

Zeile 465Zeile 497

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


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

 

// This user has a custom user title
if(trim($user['usertitle']) != '')


// This user has a custom user title
if(trim($user['usertitle']) != '')

Zeile 565Zeile 591
	$query = $db->simple_select("reputation", "SUM(reputation) AS reputation, COUNT(rid) AS total_reputation", "uid = '".$user['uid']."'");
$reputation = $db->fetch_array($query);


	$query = $db->simple_select("reputation", "SUM(reputation) AS reputation, COUNT(rid) AS total_reputation", "uid = '".$user['uid']."'");
$reputation = $db->fetch_array($query);


	$sync_reputation = $reputation['reputation'];

	$sync_reputation = intval($reputation['reputation']);

	$total_reputation = $reputation['total_reputation'];

if($sync_reputation != $user['reputation'])

	$total_reputation = $reputation['total_reputation'];

if($sync_reputation != $user['reputation'])

Zeile 724Zeile 750
		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 758Zeile 784
			$vote_type = $lang->neutral;
}
// Otherwise, this is a positive reputation

			$vote_type = $lang->neutral;
}
// Otherwise, this is a positive reputation

		else
{

		else
{

			$vote_reputation = "+{$vote_reputation}";
$status_class = "trow_reputation_positive";
$vote_type_class = "reputation_positive";

			$vote_reputation = "+{$vote_reputation}";
$status_class = "trow_reputation_positive";
$vote_type_class = "reputation_positive";

Zeile 772Zeile 798
		$last_updated_date = my_date($mybb->settings['dateformat'], $reputation_vote['dateline']);
$last_updated_time = my_date($mybb->settings['timeformat'], $reputation_vote['dateline']);
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date, $last_updated_time);

		$last_updated_date = my_date($mybb->settings['dateformat'], $reputation_vote['dateline']);
$last_updated_time = my_date($mybb->settings['timeformat'], $reputation_vote['dateline']);
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date, $last_updated_time);

		



		// Is this rating specific to a post?
if($reputation_vote['pid'] && $reputation_vote['post_link'])

		// Is this rating specific to a post?
if($reputation_vote['pid'] && $reputation_vote['post_link'])

		{

		{

			$link = "<a href=\"".get_post_link($reputation_vote['pid'])."#pid{$reputation_vote['pid']}\">{$lang->postrep_post}".$reputation_vote['pid']."</a>";
$postrep_given = $lang->sprintf($lang->postrep_given, $link);
}
else
{
$postrep_given = '';

			$link = "<a href=\"".get_post_link($reputation_vote['pid'])."#pid{$reputation_vote['pid']}\">{$lang->postrep_post}".$reputation_vote['pid']."</a>";
$postrep_given = $lang->sprintf($lang->postrep_given, $link);
}
else
{
$postrep_given = '';

		}


		}


		// Does the current user have permission to delete this reputation? Show 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))

		// Does the current user have permission to delete this reputation? Show 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))

		{

		{

			$delete_link = "[<a href=\"reputation.php?action=delete&amp;uid={$reputation_vote['rated_uid']}&amp;rid={$reputation_vote['rid']}\" onclick=\"MyBB.deleteReputation({$reputation_vote['rated_uid']}, {$reputation_vote['rid']}); return false;\">{$lang->delete_vote}</a>]";

			$delete_link = "[<a href=\"reputation.php?action=delete&amp;uid={$reputation_vote['rated_uid']}&amp;rid={$reputation_vote['rid']}\" onclick=\"MyBB.deleteReputation({$reputation_vote['rated_uid']}, {$reputation_vote['rid']}); return false;\">{$lang->delete_vote}</a>]";

		}

		}

		else
{
$delete_link = '';

		else
{
$delete_link = '';

		}


		}


		// Parse smilies in the reputation vote
$reputation_parser = array(
"allow_html" => 0,

		// Parse smilies in the reputation vote
$reputation_parser = array(
"allow_html" => 0,

Zeile 816Zeile 842
	{
eval("\$reputation_votes = \"".$templates->get("reputation_no_votes")."\";");
}

	{
eval("\$reputation_votes = \"".$templates->get("reputation_no_votes")."\";");
}

	



	$plugins->run_hooks("reputation_end");
eval("\$reputation = \"".$templates->get("reputation")."\";");
output_page($reputation);

	$plugins->run_hooks("reputation_end");
eval("\$reputation = \"".$templates->get("reputation")."\";");
output_page($reputation);