| 1 |
<? |
<? |
| 2 |
//Log article operation into table bbs_article_log |
//Log article operation into table bbs_article_log |
| 3 |
function article_op_log($aid,$uid,$op_type,$ip_addr,$db_conn=null) |
function article_op_log(int $aid, int $uid, string $op_type, string $ip_addr, mysqli $db_conn = null) : mysqli_result | bool |
| 4 |
{ |
{ |
| 5 |
/* |
/* |
| 6 |
Type Description |
Type Description |
| 7 |
A Add article |
A Add article |
| 8 |
D Delete article |
D Delete article |
| 9 |
|
X Delete article by Admin |
| 10 |
S Restore article |
S Restore article |
| 11 |
L Lock article |
L Lock article |
| 12 |
U Unlock article |
U Unlock article |
| 16 |
O Unset article as excerption |
O Unset article as excerption |
| 17 |
F Set article on top |
F Set article on top |
| 18 |
V Unset article on top |
V Unset article on top |
|
R Recommend article |
|
|
N Unrecommend article |
|
| 19 |
Z Set article as trnasship |
Z Set article as trnasship |
| 20 |
*/ |
*/ |
| 21 |
$ret = mysql_query("insert into bbs_article_op(AID,UID,type,op_dt,op_ip)". |
|
| 22 |
" values($aid,$uid,'$op_type',now(),'$ip_addr')",$db_conn); |
$sql = "INSERT INTO bbs_article_op(AID, UID, type, op_dt, op_ip) |
| 23 |
|
VALUES($aid, $uid, '$op_type', NOW(), '$ip_addr')"; |
| 24 |
|
|
| 25 |
|
$ret = mysqli_query($db_conn, $sql); |
| 26 |
|
|
| 27 |
return $ret; |
return $ret; |
| 28 |
} |
} |
| 29 |
|
|
| 30 |
//Add/Subtract user exp |
//Add/Subtract user exp |
| 31 |
function user_exp_change($uid,$exp_change,$db_conn=null) |
function user_exp_change(int $uid, int $exp_change, mysqli $db_conn = null) : mysqli_result | bool |
| 32 |
{ |
{ |
| 33 |
$ret = mysql_query("update user_pubinfo set exp=exp+$exp_change". |
$sql = "UPDATE user_pubinfo SET exp = exp + $exp_change WHERE UID = $uid"; |
| 34 |
" where UID=".$uid); |
|
| 35 |
|
$ret = mysqli_query($db_conn, $sql); |
| 36 |
|
|
| 37 |
return $ret; |
return $ret; |
| 38 |
} |
} |
| 39 |
|
|
| 40 |
//Display error message in a pop-up window |
//Display error message in a pop-up window |
| 41 |
function error_msg($msg,$back=false,$close=false) |
function error_msg($msg, $back=false, $close=false) |
| 42 |
{ |
{ |
| 43 |
$ret = "<script language=\"JavaScript\">\n". |
$ret = "<script language=\"JavaScript\">\n". |
| 44 |
" alert(\"".str_replace("\n","\\\n",$msg)."\");\n". |
" alert(\"".str_replace("\n","\\\n",$msg)."\");\n". |