Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: reputation.php 5135 2010-07-28 17:24:20Z RyanGordon $
| * $Id: reputation.php 5392 2011-03-18 09:39:59Z Tomm $
|
*/
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';
| $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';
|
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 76 | Zeile 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) { $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']))) {
| // 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']))) {
|
Zeile 88 | Zeile 94 |
---|
if($numtoday >= $mybb->usergroup['maxreputationsday']) { $message = $lang->add_maxperday;
|
if($numtoday >= $mybb->usergroup['maxreputationsday']) { $message = $lang->add_maxperday;
|
eval("\$error = \"".$templates->get("reputation_add_error")."\";"); output_page($error); exit; } }
| eval("\$error = \"".$templates->get("reputation_add_error")."\";"); output_page($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" && !$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 110 | Zeile 116 |
---|
} }
|
} }
|
// Has the user given too much reputation to another in the same thread?
| |
if($mybb->input['pid']) {
|
if($mybb->input['pid']) {
|
| // 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);
|
Zeile 124 | Zeile 130 |
---|
AND r.dateline > '{$timesearch}' "); $numtoday = $db->num_rows($query);
|
AND r.dateline > '{$timesearch}' "); $numtoday = $db->num_rows($query);
|
|
|
if($numtoday >= $mybb->usergroup['maxreputationsperthread']) { $message = $lang->add_maxperthread;
| if($numtoday >= $mybb->usergroup['maxreputationsperthread']) { $message = $lang->add_maxperthread;
|
Zeile 132 | Zeile 138 |
---|
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 142 | Zeile 154 |
---|
$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'];
|
}
| }
|
if($mybb->input['pid'] != 0) { $query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid = '".intval($mybb->input['pid'])."'");
| if($mybb->input['pid'] != 0) { $query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid = '".intval($mybb->input['pid'])."'");
|
Zeile 166 | Zeile 178 |
---|
if($mybb->input['delete']) { if($mybb->input['pid'] != 0)
|
if($mybb->input['delete']) { if($mybb->input['pid'] != 0)
|
{
| {
|
$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']."'");
|
$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']."'");
|
}
| }
|
// 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 180 | Zeile 192 |
---|
$db->update_query("users", array('reputation' => intval($reputation_value)), "uid='{$uid}'"); eval("\$error = \"".$templates->get("reputation_deleted")."\";");
|
$db->update_query("users", array('reputation' => intval($reputation_value)), "uid='{$uid}'"); eval("\$error = \"".$templates->get("reputation_deleted")."\";");
|
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 202 | Zeile 214 |
---|
{ $show_back = 1; $message = $lang->add_invalidpower;
|
{ $show_back = 1; $message = $lang->add_invalidpower;
|
| eval("\$error = \"".$templates->get("reputation_add_error")."\";"); 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;
|
eval("\$error = \"".$templates->get("reputation_add_error")."\";"); output_page($error); exit;
| eval("\$error = \"".$templates->get("reputation_add_error")."\";"); output_page($error); exit;
|
Zeile 341 | Zeile 363 |
---|
verify_post_check($mybb->input['my_post_key']);
// Fetch the existing reputation for this user given by our current user if there is one.
|
verify_post_check($mybb->input['my_post_key']);
// Fetch the existing reputation for this user given by our current user if there is one.
|
$query = $db->simple_select("reputation", "*", "rid='".$mybb->input['rid']."'");
| $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 = '".intval($mybb->input['rid'])."' ");
|
$existing_reputation = $db->fetch_array($query);
|
$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']) {
| // 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']) {
|
Zeile 352 | Zeile 379 |
---|
// Delete the specified reputation $db->delete_query("reputation", "uid='{$uid}' AND rid='".$mybb->input['rid']."'");
|
// Delete the specified reputation $db->delete_query("reputation", "uid='{$uid}' AND rid='".$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 $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));
|
$db->update_query("users", array('reputation' => intval($reputation_value)), "uid='{$uid}'");
| $db->update_query("users", array('reputation' => intval($reputation_value)), "uid='{$uid}'");
|
Zeile 368 | Zeile 399 |
---|
if($user_permissions['usereputationsystem'] != 1) { error($lang->reputations_disabled_group);
|
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();
|
}
$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
| }
$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
|
Zeile 386 | Zeile 423 |
---|
$display_group = usergroup_displaygroup($user['displaygroup']);
// This user has a custom user title
|
$display_group = usergroup_displaygroup($user['displaygroup']);
// This user has a custom user title
|
if($user['usertitle'] != '')
| if(trim($user['usertitle']) != '')
|
{ $usertitle = $user['usertitle']; } // Using our display group's user title
|
{ $usertitle = $user['usertitle']; } // Using our display group's user title
|
else if($display_group['usertitle'] != '')
| elseif(trim($display_group['usertitle']) != '')
|
{ $usertitle = $display_group['usertitle']; }
| { $usertitle = $display_group['usertitle']; }
|
Zeile 422 | Zeile 459 |
---|
switch($mybb->input['show']) { case "positive":
|
switch($mybb->input['show']) { case "positive":
|
| $s_url = "&show=positive";
|
$conditions = 'AND r.reputation>0'; $show_selected['positive'] = 'selected="selected"'; break; case "neutral":
|
$conditions = 'AND r.reputation>0'; $show_selected['positive'] = 'selected="selected"'; break; case "neutral":
|
| $s_url = "&show=neutral";
|
$conditions = 'AND r.reputation=0'; $show_selected['neutral'] = 'selected="selected"'; break; case "negative":
|
$conditions = 'AND r.reputation=0'; $show_selected['neutral'] = 'selected="selected"'; break; case "negative":
|
| $s_url = "&show=negative";
|
$conditions = 'AND r.reputation<0'; $show_selected['negative'] = 'selected="selected"'; break; default:
|
$conditions = 'AND r.reputation<0'; $show_selected['negative'] = 'selected="selected"'; break; default:
|
| $s_url = '&show=all';
|
$conditions = ''; $show_select['all'] = 'selected="selected"'; break;
| $conditions = ''; $show_select['all'] = 'selected="selected"'; break;
|
Zeile 444 | Zeile 485 |
---|
switch($mybb->input['sort']) { case "username":
|
switch($mybb->input['sort']) { case "username":
|
| $s_url .= "&sort=username";
|
$order = "u.username ASC"; $sort_selected['username'] = 'selected="selected"'; break; default:
|
$order = "u.username ASC"; $sort_selected['username'] = 'selected="selected"'; break; default:
|
| $s_url .= '&sort=dateline';
|
$order = "r.dateline DESC"; $sort_selected['last_updated'] = 'selected="selected"'; break; }
|
$order = "r.dateline DESC"; $sort_selected['last_updated'] = 'selected="selected"'; break; }
|
| if(!$mybb->input['show'] && !$mybb->input['sort']) { $s_url = ''; }
|
// Fetch the total number of reputations for this user $query = $db->simple_select("reputation r", "COUNT(r.rid) AS reputation_count", "r.uid='{$user['uid']}' $conditions"); $reputation_count = $db->fetch_field($query, "reputation_count");
| // Fetch the total number of reputations for this user $query = $db->simple_select("reputation r", "COUNT(r.rid) AS reputation_count", "r.uid='{$user['uid']}' $conditions"); $reputation_count = $db->fetch_field($query, "reputation_count");
|
Zeile 461 | Zeile 510 |
---|
{ $user['reputation'] = 0; }
|
{ $user['reputation'] = 0; }
|
|
|
// Quickly check to see if we're in sync...
|
// Quickly check to see if we're in sync...
|
$query = $db->simple_select("reputation", "SUM(reputation) AS reputation", "uid = '".$user['uid']."'"); $sync_reputation = $db->fetch_field($query, "reputation");
| $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']; $total_reputation = $reputation['total_reputation'];
|
if($sync_reputation != $user['reputation']) {
| if($sync_reputation != $user['reputation']) {
|
Zeile 563 | Zeile 615 |
---|
// 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($reputation_count - $rep_posts);
| $rep_members = my_number_format($total_reputation - $rep_posts);
|
// 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)
|
Zeile 594 | Zeile 646 |
---|
// 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']}");
| $multipage = multipage($reputation_count, $mybb->settings['repsperpage'], $page, "reputation.php?uid={$user['uid']}".$s_url);
|
}
// Fetch the reputations which will be displayed on this page $query = $db->query("
|
}
// Fetch the reputations which will be displayed on this page $query = $db->query("
|
SELECT r.*, r.uid AS rated_uid, u.uid, u.username, u.reputation AS user_reputation, u.usergroup AS user_usergroup, u.displaygroup AS user_displaygroup
| SELECT r.*, r.uid AS rated_uid, u.uid, u.username, u.reputation AS user_reputation, u.usergroup AS user_usergroup, u.displaygroup AS user_displaygroup, p.pid AS post_link
|
FROM ".TABLE_PREFIX."reputation r LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)
|
FROM ".TABLE_PREFIX."reputation r LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=r.adduid)
|
| LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=r.pid)
|
WHERE r.uid='{$user['uid']}' $conditions ORDER BY $order LIMIT $start, {$mybb->settings['repsperpage']}
| WHERE r.uid='{$user['uid']}' $conditions ORDER BY $order LIMIT $start, {$mybb->settings['repsperpage']}
|
Zeile 662 | Zeile 715 |
---|
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date, $last_updated_time); // Is this rating specific to a post?
|
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date, $last_updated_time); // Is this rating specific to a post?
|
if($reputation_vote['pid'])
| 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);
| { $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);
|