Parašė ewl· 2012 Bir. 21 10:06:42
#3
Reputacija dariau ne aš, nes
fusionBoard 4 neradau tokiu eilučių, kuriu reikėjo.
function userreputation($user_id, $post_id="", $type="") {
global $db_prefix;
$result = dbquery("SELECT
SUM(IF(type=1,1,-1)) as total FROM ".$db_prefix."reputation WHERE to_id = '$user_id' GROUP BY to_id");
if (dbrows($result) != 0) {
$data = dbarray($result);
$total = $data['total'];
$info = "<sup><a href='reputation.php?uid=$user_id&pid=$post_id'><font color='".($total<0?"red":($total>0?"green":"black"))."'><b>".($total<=0?"":"+")."$total</b></font></a></sup>";
} else {
$info = "<sup><a href='reputation.php?uid=$user_id&pid=$post_id'><font color='black'><b>0</b></font></a></sup>";
}
return $info;
}
Kodas iš maincore.php failo.
Redagavo ewl· 2012 Bir. 21 15:06:08