| 38 |
|
|
| 39 |
if($row = mysqli_fetch_array($rs)) |
if($row = mysqli_fetch_array($rs)) |
| 40 |
{ |
{ |
| 41 |
$result_set["return"]["data"] = array( |
$result_set["data"] = array( |
| 42 |
"sid" => $sid, |
"sid" => $sid, |
|
"sname" => $row["sname"], |
|
|
"s_title" => $row["title"], |
|
| 43 |
"announcement" => $row["announcement"], |
"announcement" => $row["announcement"], |
| 44 |
"comment" => $row["comment"], |
"comment" => $row["comment"], |
| 45 |
"ex_update" => $row["ex_update"], |
"ex_update" => $row["ex_update"], |
| 46 |
"ex_dir" => array(), |
"section_hierachy" => array(), |
| 47 |
); |
); |
| 48 |
} |
} |
| 49 |
else |
else |
| 57 |
|
|
| 58 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 59 |
|
|
| 60 |
$sql = "SELECT * FROM ex_dir WHERE SID = $sid AND enable ORDER BY dir"; |
// Load section list |
| 61 |
|
$sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_class.title AS c_title |
| 62 |
|
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |
| 63 |
|
WHERE section_class.enable AND section_config.enable |
| 64 |
|
ORDER BY section_class.sort_order, section_config.sort_order"; |
| 65 |
|
|
| 66 |
$rs = mysqli_query($db_conn, $sql); |
$rs = mysqli_query($db_conn, $sql); |
| 67 |
if ($rs == false) |
if ($rs == false) |
| 68 |
{ |
{ |
| 69 |
$result_set["return"]["code"] = -2; |
$result_set["return"]["code"] = -2; |
| 70 |
$result_set["return"]["message"] = "Query ex_dir error: " . mysqli_error($db_conn); |
$result_set["return"]["message"] = "Query section error: " . mysqli_error($db_conn); |
| 71 |
|
|
| 72 |
mysqli_close($db_conn); |
mysqli_close($db_conn); |
| 73 |
exit(json_encode($result_set)); |
exit(json_encode($result_set)); |
| 74 |
} |
} |
| 75 |
|
|
| 76 |
array_push($result_set["return"]["data"]["ex_dir"], array( |
$last_cid = -1; |
| 77 |
"dir" => "", |
$last_c_title = ""; |
| 78 |
"name" => "根目录", |
$section_list = array(); |
| 79 |
)); |
while ($row = mysqli_fetch_array($rs)) |
| 80 |
|
{ |
| 81 |
|
if ($row["CID"] != $last_cid) |
| 82 |
|
{ |
| 83 |
|
if (count($section_list) > 0) |
| 84 |
|
{ |
| 85 |
|
array_push($result_set["data"]["section_hierachy"], array( |
| 86 |
|
"cid" => $last_cid, |
| 87 |
|
"title" => $last_c_title, |
| 88 |
|
"sections" => $section_list, |
| 89 |
|
)); |
| 90 |
|
|
| 91 |
|
$section_list = array(); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
$last_cid = $row["CID"]; |
| 95 |
|
$last_c_title = $row["c_title"]; |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
if ($_SESSION["BBS_priv"]->checkpriv($row["SID"], S_POST | S_MAN_S)) |
| 99 |
|
{ |
| 100 |
|
array_push($section_list, array( |
| 101 |
|
"sid" => $row["SID"], |
| 102 |
|
"title" => $row["s_title"], |
| 103 |
|
)); |
| 104 |
|
} |
| 105 |
|
} |
| 106 |
|
|
| 107 |
while($row = mysqli_fetch_array($rs)) |
if (count($section_list) > 0) |
| 108 |
{ |
{ |
| 109 |
array_push($result_set["return"]["data"]["ex_dir"], array( |
array_push($result_set["data"]["section_hierachy"], array( |
| 110 |
"dir" => $row["dir"], |
"cid" => $last_cid, |
| 111 |
"name" => $row["name"], |
"title" => $last_c_title, |
| 112 |
|
"sections" => $section_list, |
| 113 |
)); |
)); |
| 114 |
} |
} |
| 115 |
|
|
| 116 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 117 |
|
|
| 118 |
mysqli_close($db_conn); |
mysqli_close($db_conn); |