新增候选提醒到管理组

1. 新增候选提醒到管理组消息
2. 修改发送私信的实现为message::add()
This commit is contained in:
tonghoil
2025-09-16 20:14:51 +08:00
parent 25db083394
commit 44e88a7404
13 changed files with 309 additions and 84 deletions
+62 -9
View File
@@ -108,6 +108,17 @@ if (isset($_GET['new_offer']) && $_GET["new_offer"]){
}
$id = mysql_insert_id();
// add new offer message to staffmessage
\App\Models\StaffMessage::query()->insert([
'sender' => $CURUSER['id'],
'subject' => nexus_trans('offer.msg_new_offer_subject'),
'msg' => nexus_trans('offer.msg_new_offer_msg', [
'username' => "[url=userdetails.php?id={$CURUSER['id']}]{$CURUSER['username']}[/url]",
'offername' => "[url=offers.php?id={$id}&off_details=1]{$name}[/url]"]),
'added' => now(),
]);
clear_staff_message_cache();
write_log("offer $name was added by ".$CURUSER['username'],'normal');
header("Location: offers.php?id=$id&off_details=1");
@@ -258,7 +269,16 @@ if (isset($_GET["allow_offer"]) && $_GET["allow_offer"]) {
$subject = nexus_trans("offer.msg_your_offer_allowed", [], $locale);
$allowedtime = date("Y-m-d H:i:s");
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$arr['userid']}, '" . $allowedtime . "', " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
//sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$arr['userid']}, '" . $allowedtime . "', " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
\App\Models\Message::add([
'sender' => 0,
'receiver' => $arr['userid'],
'msg' => $msg,
'subject' => $subject,
'added' => $allowedtime,
]);
sql_query ("UPDATE offers SET allowed = 'allowed', allowedtime = '".$allowedtime."' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
write_log("{$CURUSER['username']} allowed offer {$arr['name']}",'normal');
@@ -309,7 +329,15 @@ if (isset($_GET["finish_offer"]) && $_GET["finish_offer"]) {
}
//===use this line if you DO HAVE subject in your PM system
$subject = nexus_trans("offer.msg_your_offer", [], $locale).$arr['name'].nexus_trans("offer.msg_voted_on", [], $locale);
sql_query("INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).", {$arr['userid']}, '" . $finishvotetime . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
\App\Models\Message::add([
'sender' => 0,
'subject' => $subject,
'receiver' => $arr['userid'],
'added' => $finishvotetime,
'msg' => $msg,
]);
//===use this line if you DO NOT subject in your PM system
//sql_query("INSERT INTO messages (sender, receiver, added, msg) VALUES(0, $arr['userid'], '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
write_log("{$CURUSER['username']} closed poll {$arr['name']}",'normal');
@@ -502,7 +530,15 @@ if (isset($_GET["vote"]) && $_GET["vote"]){
sql_query("UPDATE offers SET allowed='allowed', allowedtime=".sqlesc($finishtime)." WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$msg = nexus_trans("offer.msg_offer_voted_on", [], $locale)."[b][url=". get_protocol_prefix() . $BASEURL."/offers.php?id=$offerid&off_details=1]" . $arr['name'] . "[/url][/b].". nexus_trans("offer.msg_find_offer_option", [], $locale).$timeoutnote;
$subject = nexus_trans("offer.msg_your_offer_allowed", [], $locale);
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$arr['userid']}, " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
\App\Models\Message::add([
'sender' => 0,
'receiver' => $arr['userid'],
'msg' => $msg,
'subject' => $subject,
'added' => now(),
]);
write_log("System allowed offer {$arr['name']}",'normal');
}
//denied and send offer voted off message
@@ -511,7 +547,17 @@ if (isset($_GET["vote"]) && $_GET["vote"]){
sql_query("UPDATE offers SET allowed='denied' WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$msg = nexus_trans("offer.msg_offer_voted_off", [], $locale)."[b][url=" . get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr['name'] . "[/url][/b].".nexus_trans("offer.msg_offer_deleted", [], $locale) ;
$subject = nexus_trans("offer.msg_offer_deleted", [], $locale);
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$arr['userid']}, " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
\App\Models\Message::add([
'sender' => 0,
'receiver' => $arr['userid'],
'msg' => $msg,
'subject' => $subject,
'added' => now(),
]);
write_log("System denied offer {$arr['name']}",'normal');
}
@@ -576,11 +622,18 @@ if (isset($_GET["del_offer"]) && $_GET["del_offer"]){
if ($CURUSER["id"] != $num["userid"])
{
$added = sqlesc(date("Y-m-d H:i:s"));
$added = date("Y-m-d H:i:s");
$locale = get_user_locale($num["userid"]);
$subject = sqlesc(nexus_trans("offer.msg_offer_deleted", [], $locale));
$msg = sqlesc(nexus_trans("offer.msg_your_offer", [], $locale).$num['name'].nexus_trans("offer.msg_was_deleted_by", [], $locale). "[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".nexus_trans("offer.msg_blank", [], $locale).($reason != "" ? nexus_trans("offer.msg_reason_is", [], $locale).$reason : ""));
sql_query("INSERT INTO messages (sender, receiver, msg, added, subject) VALUES(0, {$num['userid']}, $msg, $added, $subject)") or sqlerr(__FILE__, __LINE__);
$subject = nexus_trans("offer.msg_offer_deleted", [], $locale);
$msg = nexus_trans("offer.msg_your_offer", [], $locale).$num['name'].nexus_trans("offer.msg_was_deleted_by", [], $locale). "[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".nexus_trans("offer.msg_blank", [], $locale).($reason != "" ? nexus_trans("offer.msg_reason_is", [], $locale).$reason : "");
\App\Models\Message::add([
'sender' => 0,
'receiver' => $num['userid'],
'msg' => $msg,
'subject' => $subject,
'added' => now(),
]);
}
write_log("Offer: $offer ({$num['name']}) was deleted by {$CURUSER['username']}".($reason != "" ? " (".$reason.")" : ""),'normal');
header("Location: offers.php");
@@ -714,7 +767,7 @@ if ($offeruptimeout_main)
print("<li>".$lang_offers['text_rule_four_one']."<b>".($offeruptimeout_main / 3600)."</b>".$lang_offers['text_rule_four_two']."</li>\n");
print("</ul></div>");
if (user_can('addoffer'))
print("<div align=\"right\" style=\"margin-bottom: 8px;\"><a href=\"?add_offer=1\">".
print("<div align=\"center\" style=\"margin-bottom: 8px;\"><a href=\"?add_offer=1\">".
"<b>".$lang_offers['text_add_offer']."</b></a></div>");
print("<div align=\"center\"><form method=\"get\" action=\"?\">".$lang_offers['text_search_offers']."&nbsp;&nbsp;<input type=\"text\" id=\"specialboxg\" name=\"search\" />&nbsp;&nbsp;");
$cats = genrelist($browsecatmode);