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 5380 2011-02-21 12:04:43Z Tomm $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 341 | Zeile 341 |
---|
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 357 |
---|
// 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 372 | Zeile 381 |
---|
$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']); $lang->reputation_report = $lang->sprintf($lang->reputation_report, $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']);
| // Format the user name using the group username style $username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
|
Zeile 387 | Zeile 396 |
---|
// This user has a custom user title if($user['usertitle'] != '')
|
// This user has a custom user title if($user['usertitle'] != '')
|
{
| {
|
$usertitle = $user['usertitle']; } // Using our display group's user title else if($display_group['usertitle'] != '')
|
$usertitle = $user['usertitle']; } // Using our display group's user title else if($display_group['usertitle'] != '')
|
{
| {
|
$usertitle = $display_group['usertitle']; } // Otherwise, fetch it from our titles table for the number of posts this user has
| $usertitle = $display_group['usertitle']; } // Otherwise, fetch it from our titles table for the number of posts this user has
|
Zeile 401 | Zeile 410 |
---|
$query = $db->simple_select("usertitles", "*", "posts<='{$user['postnum']}'", array('order_by' => 'posts', 'order_dir' => 'DESC')); $title = $db->fetch_array($query); $usertitle = $title['title'];
|
$query = $db->simple_select("usertitles", "*", "posts<='{$user['postnum']}'", array('order_by' => 'posts', 'order_dir' => 'DESC')); $title = $db->fetch_array($query); $usertitle = $title['title'];
|
}
| }
|
// If the user has permission to add reputations - show the image if($mybb->usergroup['cangivereputations'] == 1) {
| // If the user has permission to add reputations - show the image if($mybb->usergroup['cangivereputations'] == 1) {
|
Zeile 432 | Zeile 441 |
---|
case "negative": $conditions = 'AND r.reputation<0'; $show_selected['negative'] = 'selected="selected"';
|
case "negative": $conditions = 'AND r.reputation<0'; $show_selected['negative'] = 'selected="selected"';
|
break;
| break;
|
default: $conditions = ''; $show_select['all'] = 'selected="selected"';
| default: $conditions = ''; $show_select['all'] = 'selected="selected"';
|
Zeile 463 | Zeile 472 |
---|
}
// 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 575 |
---|
// 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 599 | Zeile 611 |
---|
// 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 675 |
---|
$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);
|