"); addnav("","donators.php?op=add1&ret=".rawurlencode($ret).""); $name = httppost("name"); if ($name=="") $name = httpget("name"); $amt = httppost("amt"); if ($amt=="") $amt = httpget("amt"); $reason = httppost("reason"); if ($reason=="") $reason = httpget("reason"); $txnid = httppost("txnid"); if ($txnid=="") $txnid = httpget("txnid"); if ($reason == "") $reason = translate_inline("manual donation entry"); output("`bAdd Donation Points:`b`n"); output("Character: "); rawoutput(""); output("`nPoints: "); rawoutput(""); output("`nReason: "); rawoutput(""); rawoutput(""); output_notl("`n"); if ($txnid>"") output("For transaction: %s`n",$txnid); rawoutput(""); rawoutput(""); addnav("Donations"); if (($session['user']['superuser'] & SU_EDIT_PAYLOG) && file_exists("paylog.php")){ addnav("Payment Log","paylog.php"); } $op = httpget('op'); if ($op=="add2"){ $id = httpget('id'); $amt = httpget('amt'); $reason = httpget('reason'); $sql="SELECT name FROM ".db_prefix("accounts")." WHERE acctid=$id;"; $result=db_query($sql); $row=db_fetch_assoc($result); output("%s donation points added to %s`0, reason: `^%s`0",$amt,$row['name'],$reason); $txnid = httpget("txnid"); $ret = httpget('ret'); if ($id==$session['user']['acctid']){ $session['user']['donation']+=$amt; } if ($txnid > ""){ $result = modulehook("donation_adjustments",array("points"=>$amt,"amount"=>$amt/100,"acctid"=>$id,"messages"=>array())); $points = $result['points']; if (!is_array($result['messages'])){ $result['messages'] = array($result['messages']); } foreach($result['messages'] as $messageid=>$message){ debuglog($message,false,$id,"donation",0,false); } }else{ $points = $amt; } // ok to execute when this is the current user, they'll overwrite the // value at the end of their page hit, and this will allow the display // table to update in real time. $sql = "UPDATE " . db_prefix("accounts") . " SET donation=donation+'$points' WHERE acctid='$id'"; db_query($sql); modulehook("donation", array("id"=>$id, "amt"=>$points, "manual"=>($txnid>""?false:true))); if ($txnid>""){ $sql = "UPDATE ".db_prefix("paylog")." SET acctid='$id', processed=1 WHERE txnid='$txnid'"; db_query($sql); debuglog("Received donator points for donating -- Credited manually [$reason]",false,$id,"donation",$points,false); redirect("paylog.php"); }else{ debuglog("Received donator points -- Manually assigned, not based on a known dollar donation [$reason]",false,$id,"donation",$amt,false); } if ($points == 1) { systemmail($id,array("Donation Point Added"),array("`2You have received a donation point for %s.",$reason)); }else { systemmail($id,array("Donation Points Added"),array("`2You have received %d donation points for %s.",$points,$reason)); } httpset('op', ""); $op = ""; } if ($op==""){ $sql = "SELECT name,donation,donationspent FROM " . db_prefix("accounts") . " WHERE donation>0 ORDER BY donation DESC LIMIT 25"; $result = db_query($sql); $name = translate_inline("Name"); $points = translate_inline("Points"); $spent = translate_inline("Spent"); rawoutput("
$name | $points | $spent |
"); output_notl("`^%s`0",$row['name']); rawoutput(" | "); output_notl("`@%s`0", number_format($row['donation'])); rawoutput(" | "); output_notl("`%%s`0", number_format($row['donationspent'])); rawoutput(" | "); rawoutput("