Zeile 225 | Zeile 225 |
---|
$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) { $query = $db->simple_select("reputation", "*", "adduid='".$mybb->user['uid']."' AND uid='{$uid}' AND pid = '".$mybb->get_input('pid', 1)."'");
|
} if($mybb->get_input('pid', 1) != 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'];
| $existing_reputation = $db->fetch_array($query); $rid = $existing_reputation['rid']; $was_post = true;
|
} }
| } }
|
Zeile 382 | Zeile 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']."'"); }
// 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("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}'"); $reputation_value = $db->fetch_field($query, "reputation_count");
|
$db->update_query("users", array('reputation' => (int)$reputation_value), "uid='{$uid}'");
$lang->vote_added = $lang->vote_updated; $lang->vote_added_message = $lang->vote_updated_message;
|
$db->update_query("users", array('reputation' => (int)$reputation_value), "uid='{$uid}'");
$lang->vote_added = $lang->vote_updated; $lang->vote_added_message = $lang->vote_updated_message;
|
}
| }
|
// Insert a new reputation else { $db->insert_query("reputation", $reputation);
|
// Insert a new 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' => (int)$reputation_value), "uid='{$uid}'"); }
|
$db->update_query("users", array('reputation' => (int)$reputation_value), "uid='{$uid}'"); }
|
|
|
$plugins->run_hooks("reputation_do_add_end");
|
$plugins->run_hooks("reputation_do_add_end");
|
|
|
eval("\$reputation = \"".$templates->get("reputation_added", 1, 0)."\";"); echo $reputation; exit; }
|
eval("\$reputation = \"".$templates->get("reputation_added", 1, 0)."\";"); echo $reputation; exit; }
|
|
|
// Adding a new reputation if($mybb->input['action'] == "add") { $plugins->run_hooks("reputation_add_start");
// If we have an existing reputation for this user, the user can modify or delete it.
|
// Adding a new reputation if($mybb->input['action'] == "add") { $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']); } elseif(!empty($existing_post_reputation['uid'])) { $comments = htmlspecialchars_uni($existing_post_reputation['comments']); }
| $comments = htmlspecialchars_uni($existing_reputation['comments']);
|
eval("\$delete_button = \"".$templates->get("reputation_add_delete")."\";"); }
| eval("\$delete_button = \"".$templates->get("reputation_add_delete")."\";"); }
|
Zeile 475 | Zeile 463 |
---|
$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\""; }
|