| 1 |
<? |
<?php |
| 2 |
require_once "../lib/str_process.inc.php"; |
require_once "../lib/str_process.inc.php"; |
| 3 |
?> |
|
| 4 |
<? |
function load_doc_list(string $sid, int $num, int $length, int $style, bool $subtitle, mysqli $db_conn) : bool |
|
function load_doc_list($section_name, $num, $length, $style, $subtitle, $db_conn) |
|
| 5 |
{ |
{ |
| 6 |
$sql = "SELECT SID, title FROM section_config WHERE sname = '" . |
$sql = "SELECT SID, title FROM section_config WHERE SID = $sid"; |
|
mysqli_real_escape_string($db_conn, $section_name) . "'"; |
|
| 7 |
|
|
| 8 |
$rs = mysqli_query($db_conn, $sql); |
$rs = mysqli_query($db_conn, $sql); |
| 9 |
if ($rs == false) |
if ($rs == false) |
| 10 |
{ |
{ |
| 11 |
echo("Query section error: " . mysqli_error($db_conn)); |
return false; |
|
exit(); |
|
| 12 |
} |
} |
| 13 |
|
|
| 14 |
if ($row = mysqli_fetch_array($rs)) |
if ($row = mysqli_fetch_array($rs)) |
| 15 |
{ |
{ |
|
$sid = $row["SID"]; |
|
| 16 |
$title = $row["title"]; |
$title = $row["title"]; |
| 17 |
} |
} |
| 18 |
else |
else |
| 24 |
|
|
| 25 |
if ($subtitle) |
if ($subtitle) |
| 26 |
{ |
{ |
| 27 |
echo (" <tr class=title_list><td height=20 valign=bottom>" . |
echo <<<HTML |
| 28 |
"<a href=\"/bbs/list.php?sid=$sid&ex=1\" target=_blank>" . |
<tr class="title_list"> |
| 29 |
"<b>$title</b></a></td></tr>\n"); |
<td height="25" valign=bottom> |
| 30 |
|
<a href="..//bbs/list.php?sid={$sid}&ex=1" target=_blank> |
| 31 |
|
<b>{$title}</b> |
| 32 |
|
</a> |
| 33 |
|
</td> |
| 34 |
|
</tr> |
| 35 |
|
HTML; |
| 36 |
} |
} |
| 37 |
else |
else |
| 38 |
{ |
{ |
| 39 |
echo (" <tr class=title_bar_$style><td>" . |
echo <<<HTML |
| 40 |
"<a class=guide href=\"/bbs/list.php?sid=$sid&ex=1\" target=_blank>" . |
<tr class="title_bar_{$style}"> |
| 41 |
"$title>></a></td></tr>\n"); |
<td> |
| 42 |
} |
<a class="guide" href="../bbs/list.php?sid={$sid}&ex=1" target=_blank> |
| 43 |
|
{$title}>> |
| 44 |
echo ("<tr class=title_list><td height=8></td></tr>\n"); |
</a> |
| 45 |
|
</td> |
| 46 |
|
</tr> |
| 47 |
|
HTML; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
echo <<<HTML |
| 51 |
|
<tr class="title_list"> |
| 52 |
|
<td height="8"> |
| 53 |
|
</td> |
| 54 |
|
</tr> |
| 55 |
|
HTML; |
| 56 |
|
|
| 57 |
$sql = "SELECT AID, title FROM bbs WHERE TID = 0 AND SID = $sid AND excerption |
$sql = "SELECT AID, title FROM bbs WHERE TID = 0 AND SID = $sid AND excerption |
| 58 |
AND visible ORDER BY ontop DESC, AID DESC LIMIT $num"; |
AND visible ORDER BY ontop DESC, AID DESC LIMIT $num"; |
| 60 |
$rs = mysqli_query($db_conn, $sql); |
$rs = mysqli_query($db_conn, $sql); |
| 61 |
if ($rs == false) |
if ($rs == false) |
| 62 |
{ |
{ |
| 63 |
echo("Query article error: " . mysqli_error($db_conn)); |
return false; |
|
exit(); |
|
| 64 |
} |
} |
| 65 |
|
|
| 66 |
while($row = mysqli_fetch_array($rs)) |
while($row = mysqli_fetch_array($rs)) |
| 67 |
{ |
{ |
| 68 |
echo ("<tr class=title_list><td height=18>" . |
$title_f = htmlspecialchars(split_line($row["title"], "", $length, 1), ENT_HTML401, 'UTF-8'); |
|
"·<a href=\"../bbs/view_article.php?tn=portal&id=" . $row["AID"] . "\" target=_blank>" . |
|
|
htmlspecialchars(split_line($row["title"], "", $length, 1), ENT_HTML401, 'UTF-8') . |
|
|
"</a></td></tr>\n"); |
|
|
} |
|
|
mysqli_free_result($rs); |
|
| 69 |
|
|
| 70 |
echo ("<tr class=title_list><td height=8 align=right></td></tr>\n"); |
echo <<<HTML |
| 71 |
} |
<tr class="title_list"> |
| 72 |
|
<td height="18"> |
| 73 |
function load_class_list($class_name, $section_name_list, $num, $length, $style, $db_conn) |
·<a href="../bbs/view_article.php?tn=portal&id={$row["AID"]}" target=_blank> |
| 74 |
{ |
{$title_f} |
| 75 |
$sql = "SELECT CID,title FROM section_class WHERE cname = '" . |
</a> |
| 76 |
mysqli_real_escape_string($db_conn, $class_name) . "'"; |
</td> |
| 77 |
|
</tr> |
| 78 |
$rs = mysqli_query($db_conn, $sql); |
HTML; |
|
if ($rs == false) |
|
|
{ |
|
|
echo("Query class error: " . mysqli_error($db_conn)); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
if ($row = mysqli_fetch_array($rs)) |
|
|
{ |
|
|
$cid = $row["CID"]; |
|
|
$title = $row["title"]; |
|
|
} |
|
|
else |
|
|
{ |
|
|
$cid = 0; |
|
|
$title = ""; |
|
| 79 |
} |
} |
| 80 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 81 |
|
|
| 82 |
echo ("<tr class=title_bar_$style><td>$title>></td></tr>\n"); |
echo <<<HTML |
| 83 |
|
<tr class="title_list"> |
| 84 |
$sql = "SELECT sname FROM section_config WHERE CID = $cid |
<td height="8" align="right"> |
| 85 |
AND enable ORDER BY sort_order"; |
</td> |
| 86 |
|
</tr> |
| 87 |
|
HTML; |
| 88 |
|
|
| 89 |
$rs = mysqli_query($db_conn, $sql); |
return true; |
|
if ($rs == false) |
|
|
{ |
|
|
echo("Query section error: " . mysqli_error($db_conn)); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
while ($row = mysqli_fetch_array($rs)) |
|
|
{ |
|
|
if (in_array($row["sname"], $section_name_list)) |
|
|
{ |
|
|
load_doc_list($row["sname"], $num, $length, $style, true, $db_conn); |
|
|
} |
|
|
} |
|
|
mysqli_free_result($rs); |
|
| 90 |
} |
} |
| 91 |
|
|
| 92 |
function load_top($num, $length, $db_conn) |
function load_top(int $num, int $length, mysqli $db_conn) : bool |
| 93 |
{ |
{ |
| 94 |
$sql = "SELECT AID, bbs.title AS title, section_config.title as s_title |
$sql = "SELECT AID, bbs.title AS title, section_config.title as s_title |
| 95 |
FROM bbs INNER JOIN section_config ON bbs.SID = section_config.SID |
FROM bbs INNER JOIN section_config ON bbs.SID = section_config.SID |
| 101 |
$rs = mysqli_query($db_conn, $sql); |
$rs = mysqli_query($db_conn, $sql); |
| 102 |
if ($rs == false) |
if ($rs == false) |
| 103 |
{ |
{ |
| 104 |
echo("Query data error: " . mysqli_error($db_conn)); |
return false; |
|
exit(); |
|
| 105 |
} |
} |
| 106 |
|
|
| 107 |
echo ("<tr><td height=8></td></tr>\n"); |
echo <<<HTML |
| 108 |
|
<tr> |
| 109 |
|
<td height="8"> |
| 110 |
|
</td> |
| 111 |
|
</tr> |
| 112 |
|
HTML; |
| 113 |
|
|
| 114 |
while ($row = mysqli_fetch_array($rs)) |
while ($row = mysqli_fetch_array($rs)) |
| 115 |
{ |
{ |
| 116 |
echo ("<tr><td height=18>·<a href=\"../bbs/view_article.php?tn=portal&id=" . $row["AID"] . "\" target=_blank>" . |
$title_f = htmlspecialchars(split_line("[" . $row["s_title"] . "] " . $row["title"], "", $length, 1), ENT_HTML401, 'UTF-8'); |
|
htmlspecialchars(split_line("[" . $row["s_title"] . "] " . $row["title"], "", $length, 1), ENT_HTML401, 'UTF-8') . |
|
|
"</a></td></tr>\n"); |
|
|
} |
|
|
mysqli_free_result($rs); |
|
| 117 |
|
|
| 118 |
echo ("<tr><td height=8></td></tr>\n"); |
echo <<<HTML |
| 119 |
} |
<tr> |
| 120 |
|
<td height="18"> |
| 121 |
function load_recommend($num, $length, $db_conn) |
·<a href="../bbs/view_article.php?tn=portal&id={$row["AID"]}" target=_blank> |
| 122 |
{ |
{$title_f} |
| 123 |
$sql = "SELECT AID, title FROM bbs WHERE TID = 0 AND recommend AND visible |
</a> |
| 124 |
ORDER BY sub_dt DESC LIMIT $num"; |
</td> |
| 125 |
|
</tr> |
| 126 |
$rs = mysqli_query($db_conn, $sql); |
HTML; |
|
if ($rs == false) |
|
|
{ |
|
|
echo("Query data error: " . mysqli_error($db_conn)); |
|
|
exit(); |
|
| 127 |
} |
} |
| 128 |
|
mysqli_free_result($rs); |
| 129 |
|
|
| 130 |
echo ("<tr class=title_list><td height=8></td></tr>\n"); |
echo <<<HTML |
| 131 |
|
<tr> |
| 132 |
while ($row = mysqli_fetch_array($rs)) |
<td height="8"> |
| 133 |
{ |
</td> |
| 134 |
echo ("<tr class=title_list><td height=18>·<a href=\"../bbs/view_article.php?tn=portal&id=" . $row["AID"] . "\" target=_blank>" . |
</tr> |
| 135 |
htmlspecialchars(split_line($row["title"], "", $length, 1), ENT_HTML401, 'UTF-8') . |
HTML; |
|
"</a></td></tr>\n"); |
|
|
} |
|
|
mysql_free_result($rs); |
|
| 136 |
|
|
| 137 |
echo ("<tr class=title_list><td height=8></td></tr>\n"); |
return true; |
| 138 |
} |
} |
| 139 |
?> |
?> |