--- fenglin/bbs/section_setting.php 2025/04/10 12:23:25 1.4 +++ fenglin/bbs/section_setting.php 2025/04/20 10:35:45 1.8 @@ -42,9 +42,18 @@ { $result_set["data"] = array( "sid" => $sid, + "cid" => $row["CID"], + "sname" => $row["sname"], + "title" => $row["title"], + "exp_get" => $row["exp_get"], + "recommend" => $row["recommend"], + "read_user_level" => $row["read_user_level"], + "write_user_level" => $row["write_user_level"], "announcement" => $row["announcement"], "comment" => $row["comment"], "ex_update" => $row["ex_update"], + "sort_order" => $row["sort_order"], + "class_sections" => array(), "section_hierachy" => array(), "masters" => array(), ); @@ -88,11 +97,39 @@ } mysqli_free_result($rs); + // Load sections in current class + $sql = "SELECT SID, title, sort_order FROM section_config WHERE CID = " . + $result_set["data"]["cid"] . " AND enable ORDER BY sort_order"; + + $rs = mysqli_query($db_conn, $sql); + if ($rs == false) + { + $result_set["return"]["code"] = -2; + $result_set["return"]["message"] = "Query section list error: " . mysqli_error($db_conn); + + mysqli_close($db_conn); + exit(json_encode($result_set)); + } + + while ($row = mysqli_fetch_array($rs)) + { + array_push($result_set["data"]["class_sections"], array( + "sid" => $row["SID"], + "title" => $row["title"], + "sort_order" => $row["sort_order"], + )); + } + mysqli_free_result($rs); + // Load section list $ret = load_section_list($result_set["data"]["section_hierachy"], - function (int $sid) : bool + function (array $section, array $filter_param) : bool + { + return $_SESSION["BBS_priv"]->checkpriv($section["SID"], S_POST | S_MAN_S); + }, + function (array $section, array $filter_param) : mixed { - return $_SESSION["BBS_priv"]->checkpriv($sid, S_POST | S_MAN_S); + return null; }, $db_conn);