Vergleich reputation.php - 1.6.4 - 1.6.10

  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: reputation.php 5392 2011-03-18 09:39:59Z Tomm $

 * $Id$

 */

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

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

		// Has the user given too much reputation to another in the same thread?








		// 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'])))
{
$timesearch = TIME_NOW - (60 * 60 * 24);

		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 p.pid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."reputation r ON (p.pid=r.pid)
WHERE r.uid = '{$uid}'
AND r.dateline > '{$timesearch}'

			$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->num_rows($query);



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


if($numtoday >= $mybb->usergroup['maxreputationsperthread'])
{


if($numtoday >= $mybb->usergroup['maxreputationsperthread'])
{

Zeile 138Zeile 145
				output_page($error);
exit;
}

				output_page($error);
exit;
}

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

 
		}
}


		}
}


Zeile 170Zeile 171
	verify_post_check($mybb->input['my_post_key']);

$plugins->run_hooks("reputation_do_add_start");

	verify_post_check($mybb->input['my_post_key']);

$plugins->run_hooks("reputation_do_add_start");





	// Check if the reputation power they're trying to give is within their "power limit"
$reputation = intval(str_replace("-", "", $mybb->input['reputation']));

// Deleting our current reputation of this user.
if($mybb->input['delete'])
{

	// Check if the reputation power they're trying to give is within their "power limit"
$reputation = intval(str_replace("-", "", $mybb->input['reputation']));

// Deleting our current reputation of this user.
if($mybb->input['delete'])
{

		if($mybb->input['pid'] != 0)







		// 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->input['pid'] != 0)

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

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

		}

		}

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

			output_page($error);
exit;
}

	}

	}


// The power for the reputation they specified was invalid.
if($reputation > $mybb->usergroup['reputationpower'] || !is_numeric($mybb->input['reputation']))


// The power for the reputation they specified was invalid.
if($reputation > $mybb->usergroup['reputationpower'] || !is_numeric($mybb->input['reputation']))

	{
$show_back = 1;

	{
$show_back = 1;

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

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

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

		output_page($error);
exit;
}

	






















// This user is trying to give a neutral reputation, but neutral reps have been disabled.
if($mybb->input['reputation'] == 0 && $mybb->settings['neurep'] != 1)
{
$show_back = 1;
$message = $lang->add_neutral_disabled;
eval("\$error = \"".$templates->get("reputation_add_error")."\";");
output_page($error);
exit;
}

// This user is trying to give a positive reputation, but positive reps have been disabled.
if($mybb->input['reputation'] > 0 && $mybb->settings['posrep'] != 1)
{
$show_back = 1;
$message = $lang->add_positive_disabled;
eval("\$error = \"".$templates->get("reputation_add_error")."\";");
output_page($error);
exit;
}


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

Zeile 331Zeile 358
	}

// Draw the "power" options

	}

// Draw the "power" options

	$positive_power = '';
$negative_power = '';
$vote_check = '';
if($existing_reputation['uid'])

	if($mybb->settings['negrep'] || $mybb->settings['neurep'] || $mybb->settings['posrep'])




	{

	{

		$vote_check[$existing_reputation['reputation']] = " selected=\"selected\"";
}
$reputationpower = $mybb->usergroup['reputationpower'];
for($i = 1; $i <= $reputationpower; ++$i)
{
$positive_title = $lang->sprintf($lang->power_positive, "+".$i);
$positive_power = "\t\t\t\t\t<option value=\"{$i}\" class=\"reputation_positive\" onclick=\"$('reputation').className='reputation_positive'\"{$vote_check[$i]}>{$positive_title}</option>\n".$positive_power;
if($mybb->settings['negrep'])










		$vote_check = '';
$positive_power = '';
$negative_power = '';
$reputationpower = $mybb->usergroup['reputationpower'];

if($existing_reputation['uid'])
{
$vote_check[$existing_reputation['reputation']] = " selected=\"selected\"";
}

if($mybb->settings['neurep'])
{
$neutral_title = $lang->power_neutral;
$neutral_power = "\t\t\t\t\t<option value=\"0\" class=\"reputation_neutral\" onclick=\"$('reputation').className='reputation_neutral'\"{$vote_check[0]}>{$lang->power_neutral}</option>\n";
}

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

		{

		{

			$negative_title = $lang->sprintf($lang->power_negative, "-".$i);
$negative_power .= "\t\t\t\t\t<option value=\"-{$i}\" class=\"reputation_negative\" onclick=\"$('reputation').className='reputation_negative'\"{$vote_check[-$i]}>{$negative_title}</option>\n";










			if($mybb->settings['posrep'])
{
$positive_title = $lang->sprintf($lang->power_positive, "+".$i);
$positive_power = "\t\t\t\t\t<option value=\"{$i}\" class=\"reputation_positive\" onclick=\"$('reputation').className='reputation_positive'\"{$vote_check[$i]}>{$positive_title}</option>\n".$positive_power;
}

if($mybb->settings['negrep'])
{
$negative_title = $lang->sprintf($lang->power_negative, "-".$i);
$negative_power .= "\t\t\t\t\t<option value=\"-{$i}\" class=\"reputation_negative\" onclick=\"$('reputation').className='reputation_negative'\"{$vote_check[-$i]}>{$negative_title}</option>\n";
}

		}

		}

 

$plugins->run_hooks("reputation_add_end");
eval("\$reputation_add = \"".$templates->get("reputation_add")."\";");
}
else
{
$message = $lang->add_all_rep_disabled;

$plugins->run_hooks("reputation_add_end_error");
eval("\$reputation_add = \"".$templates->get("reputation_add_error")."\";");

	}

	}

	
$plugins->run_hooks("reputation_add_end");

 




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

 
	output_page($reputation_add);
}


	output_page($reputation_add);
}


Zeile 373Zeile 422

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


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

// Delete the specified reputation
$db->delete_query("reputation", "uid='{$uid}' AND rid='".$mybb->input['rid']."'");


	{
error_no_permission();
}

// Delete the specified reputation
$db->delete_query("reputation", "uid='{$uid}' AND rid='".intval($mybb->input['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");





	// Create moderator log

	// Create moderator log

	$rep_remove = build_profile_link($existing_reputation['username'], $existing_reputation['adduid']);
log_moderator_action(array("uid" => $user['uid'], "username" => $user['username']), $lang->sprintf($lang->delete_reputation_log, $rep_remove));

	log_moderator_action(array("uid" => $user['uid'], "username" => $user['username']), $lang->sprintf($lang->delete_reputation_log, $existing_reputation['username'], $existing_reputation['adduid']));



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


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





	redirect("reputation.php?uid={$uid}", $lang->vote_deleted_message);
}

// Otherwise, show a listing of reputations for the given user.
if(!$mybb->input['action'])
{

	redirect("reputation.php?uid={$uid}", $lang->vote_deleted_message);
}

// Otherwise, show a listing of reputations for the given user.
if(!$mybb->input['action'])
{

	if($user_permissions['usereputationsystem'] != 1)
{
error($lang->reputations_disabled_group);
}


 
	if($mybb->usergroup['canviewprofiles'] == 0)
{
// Reputation page is a part of a profile
error_no_permission();

	if($mybb->usergroup['canviewprofiles'] == 0)
{
// Reputation page is a part of a profile
error_no_permission();

 
	}

// 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)
{
// Group has reputation disabled or user has a display group that has reputation disabled
error($lang->reputations_disabled_group);

	}

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

	}

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

Zeile 417Zeile 470
	if(!$user['displaygroup'])
{
$user['displaygroup'] = $user['usergroup'];

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

	}

// Fetch display group properties.
$display_group = usergroup_displaygroup($user['displaygroup']);

	}





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


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

	}

	}

	// Using our display group's user title
elseif(trim($display_group['usertitle']) != '')
{

	// Using our display group's user title
elseif(trim($display_group['usertitle']) != '')
{

Zeile 441Zeile 491
	}

// If the user has permission to add reputations - show the image

	}

// If the user has permission to add reputations - show the image

	if($mybb->usergroup['cangivereputations'] == 1)
{

	if($mybb->usergroup['cangivereputations'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']))
{

		eval("\$add_reputation = \"".$templates->get("reputation_addlink")."\";");
}
else

		eval("\$add_reputation = \"".$templates->get("reputation_addlink")."\";");
}
else

Zeile 561Zeile 611
		else if($reputation_vote['reputation'] < 0)
{
$negative_count++;

		else if($reputation_vote['reputation'] < 0)
{
$negative_count++;

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

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

				$negative_week++;

				$negative_week++;

			}

			}

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

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

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

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

			{
$negative_6months++;
}

			{
$negative_6months++;
}

Zeile 591Zeile 641
				$neutral_6months++;
}
}

				$neutral_6months++;
}
}

	}

	}


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


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

Zeile 605Zeile 655
	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 620Zeile 670
	// Is negative reputation disabled? If so, tell the user
if($mybb->settings['negrep'] == 0)
{

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

		$negative_count = $negative_count."*";

 
		$neg_rep_info = $lang->neg_rep_disabled;

		$neg_rep_info = $lang->neg_rep_disabled;

 
	}

if($mybb->settings['posrep'] == 0)
{
$pos_rep_info = $lang->pos_rep_disabled;
}

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

	}

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

	}

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

Zeile 740Zeile 799
			"allow_html" => 0,
"allow_mycode" => 0,
"allow_smilies" => 1,

			"allow_html" => 0,
"allow_mycode" => 0,
"allow_smilies" => 1,

			"allow_imgcode" => 0


			"allow_imgcode" => 0,
"filter_badwords" => 1

		);

$reputation_vote['comments'] = $parser->parse_message($reputation_vote['comments'], $reputation_parser);

		);

$reputation_vote['comments'] = $parser->parse_message($reputation_vote['comments'], $reputation_parser);