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