--- fenglin/bbs/article_service_post.php 2025/04/29 11:55:32 1.6 +++ fenglin/bbs/article_service_post.php 2026/02/11 10:59:14 1.13 @@ -52,8 +52,9 @@ )); } - $r_title = check_badwords($title, "****"); - if ($title != $r_title) + $bw_count = 0; + $r_title = check_badwords($title, "****", $bw_count); + if ($bw_count > 0) { $result_set["return"]["code"] = -1; array_push($result_set["return"]["errorFields"], array( @@ -63,8 +64,9 @@ )); } - $r_content = check_badwords($content, "****"); - if ($content != $r_content) + $bw_count = 0; + $r_content = check_badwords($content, "****", $bw_count); + if ($bw_count > 0) { $result_set["return"]["code"] = -1; array_push($result_set["return"]["errorFields"], array( @@ -122,11 +124,11 @@ // Append indication of article update if ($id != 0) { - $content .= ("\n--\n※作者已于 " . date("Y-m-d H:i:s") . " 修改本文※\n"); + $content .= ("\n--\n※ 作者已于 " . (new DateTimeImmutable("", $_SESSION["BBS_user_tz"]))->format("Y-m-d H:i:s (\U\T\C P)") . " 修改本文※\n"); } // Calculate length of content - $length = str_length(LML($content, false, false, 1024)); + $length = str_length($content, true); // Initial variables $tid = 0; @@ -394,7 +396,7 @@ } // Get upload quota and used space - $atta_id_list = "-1"; + $atta_id_list = array(-1); $attachment_count = (isset($_FILES['attachment']['error']) ? count($_FILES['attachment']['error']) : 0); if ($attachment_count > $BBS_upload_count_limit) { @@ -568,7 +570,7 @@ } $attachment_id = mysqli_insert_id($db_conn); - $atta_id_list .= ("," . $attachment_id); + array_push($atta_id_list, $attachment_id); $file_path = "upload/" . $attachment_id; if(!move_uploaded_file($_FILES['attachment']['tmp_name'][$i], $file_path)) @@ -637,8 +639,8 @@ exit(json_encode($result_set)); } - //Notify the authors of the topic which is replyed. - $sql = "SELECT DISTINCT UID FROM bbs WHERE (AID = $tid OR TID = $tid) + //Notify the authors of the topic / article which is replyed. + $sql = "SELECT DISTINCT UID FROM bbs WHERE (AID = $tid OR AID = $reply_id) AND visible AND reply_note AND UID <> " . $_SESSION["BBS_uid"]; $rs = mysqli_query($db_conn, $sql); @@ -654,7 +656,7 @@ while ($row = mysqli_fetch_array($rs)) { //Send notification message - $msg_content = "[hide]SYS_Reply_Article[/hide]有人回复了您所发表/回复的主题文章,快来". + $msg_content = "有人回复了您所发表/回复的文章,快来". "[article $aid]看看[/article]《" . $r_title . "》吧!\n"; $sql = "INSERT INTO bbs_msg(fromUID, toUID, content, send_dt, send_ip) @@ -726,7 +728,9 @@ } // Link attachments to article - $sql = "UPDATE upload_file SET ref_AID = $aid WHERE AID IN ($atta_id_list)"; + $sql = "UPDATE upload_file SET ref_AID = $aid WHERE AID IN (" . + implode(",", $atta_id_list) . + ")"; $rs = mysqli_query($db_conn, $sql); if ($rs == false)