| 1 |
sysadm |
1.1 |
<?php
|
| 2 |
|
|
require_once "../lib/db_open.inc.php";
|
| 3 |
|
|
require_once "./section_list.inc.php";
|
| 4 |
|
|
require_once "./session_init.inc.php";
|
| 5 |
|
|
require_once "./user_section_favor.inc.php";
|
| 6 |
|
|
require_once "./theme.inc.php";
|
| 7 |
|
|
|
| 8 |
|
|
force_login();
|
| 9 |
|
|
|
| 10 |
|
|
$result_set = array(
|
| 11 |
|
|
"return" => array(
|
| 12 |
|
|
"code" => 0,
|
| 13 |
|
|
"message" => "",
|
| 14 |
|
|
"errorFields" => array(),
|
| 15 |
|
|
),
|
| 16 |
|
|
"data" => array(
|
| 17 |
|
|
"section_hierachy" => array(),
|
| 18 |
|
|
),
|
| 19 |
|
|
);
|
| 20 |
|
|
|
| 21 |
|
|
$s_favor = new section_favorite($_SESSION["BBS_uid"], $db_conn);
|
| 22 |
|
|
|
| 23 |
|
|
// Load section list
|
| 24 |
|
|
$ret = load_section_list($result_set["data"]["section_hierachy"],
|
| 25 |
|
|
function (array $section, array $filter_param) : bool
|
| 26 |
|
|
{
|
| 27 |
|
|
return $_SESSION["BBS_priv"]->checkpriv($section["SID"], S_LIST);
|
| 28 |
|
|
},
|
| 29 |
|
|
function (array $section, array $filter_param) : mixed
|
| 30 |
|
|
{
|
| 31 |
|
|
return $filter_param["s_favor"]->is_in($section["SID"]);
|
| 32 |
|
|
},
|
| 33 |
|
|
$db_conn,
|
| 34 |
|
|
array(
|
| 35 |
|
|
"s_favor" => $s_favor,
|
| 36 |
|
|
)
|
| 37 |
|
|
);
|
| 38 |
|
|
|
| 39 |
|
|
if ($ret == false)
|
| 40 |
|
|
{
|
| 41 |
|
|
$result_set["return"]["code"] = -2;
|
| 42 |
|
|
$result_set["return"]["message"] = "Query section error: " . mysqli_error($db_conn);
|
| 43 |
|
|
|
| 44 |
|
|
mysqli_close($db_conn);
|
| 45 |
|
|
exit(json_encode($result_set));
|
| 46 |
|
|
}
|
| 47 |
|
|
|
| 48 |
|
|
// Cleanup
|
| 49 |
|
|
unset($s_favor);
|
| 50 |
|
|
|
| 51 |
|
|
mysqli_close($db_conn);
|
| 52 |
|
|
|
| 53 |
|
|
// Output with theme view
|
| 54 |
sysadm |
1.2 |
$theme_view_file = get_theme_file("view/user_section_favor", $_SESSION["BBS_theme_name"]);
|
| 55 |
sysadm |
1.1 |
if ($theme_view_file == null)
|
| 56 |
|
|
{
|
| 57 |
|
|
exit(json_encode($result_set)); // Output data in Json
|
| 58 |
|
|
}
|
| 59 |
|
|
include $theme_view_file;
|
| 60 |
|
|
?>
|