/[LeafOK_CVS]/fenglin/www/home.php
ViewVC logotype

Annotation of /fenglin/www/home.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (hide annotations)
Fri Apr 25 03:32:03 2025 UTC (10 months, 3 weeks ago) by sysadm
Branch: MAIN
Changes since 1.28: +1 -1 lines
Update

1 sysadm 1.27 <?php
2 sysadm 1.14 require_once "../lib/common.inc.php";
3 sysadm 1.12 require_once "../lib/db_open.inc.php";
4 sysadm 1.16 require_once "../bbs/session_init.inc.php";
5 sysadm 1.20 require_once "../bbs/section_list.inc.php";
6 sysadm 1.28 require_once "../bbs/user_section_favor.inc.php";
7 sysadm 1.12 require_once "./load_doc_list.inc.php";
8 sysadm 1.20
9     $s_favor = new section_favorite($_SESSION["BBS_uid"], $db_conn);
10    
11     // Load section list
12     $section_hierachy = array();
13    
14     $ret = load_section_list($section_hierachy,
15     function (array $section, array $filter_param) : bool
16     {
17     if ($_SESSION["BBS_uid"] > 0)
18     {
19     return ($section["recommend"] &&
20     $_SESSION["BBS_priv"]->checkpriv($section["SID"], S_LIST) &&
21     $filter_param["s_favor"]->is_in($section["SID"]));
22     }
23    
24     return $section["recommend"];
25     },
26     function (array $section, array $filter_param) : mixed
27     {
28     return null;
29     },
30     $db_conn,
31     array(
32     "s_favor" => $s_favor,
33     )
34     );
35    
36     if ($ret == false)
37     {
38     $result_set["return"]["code"] = -2;
39     $result_set["return"]["message"] = "Query section error: " . mysqli_error($db_conn);
40    
41     mysqli_close($db_conn);
42     exit(json_encode($result_set));
43     }
44 sysadm 1.28
45     echo <<<HTML
46     <html>
47     <head>
48     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
49 sysadm 1.29 <title>{$BBS_name}</title>
50 sysadm 1.28 <link rel="stylesheet" href="css/default.css" type="text/css">
51     </head>
52     <body>
53     <center>
54     HTML;
55    
56 sysadm 1.1 include "./head.inc.php";
57 sysadm 1.28
58     echo <<<HTML
59     <table width="1050" border="0" cellpadding="0" cellspacing="0">
60     <tr height="25" bgcolor=#F3F9FC>
61     <td width="20">&nbsp;</td>
62     <td><?= $BBS_name; ?> &gt;&gt; 首页</td>
63     <td width="20">&nbsp;</td>
64     </tr>
65     <tr>
66     <td colspan=3 height=1 bgcolor=gray></td>
67     </tr>
68     <tr height=5>
69     <td>&nbsp;</td>
70     </tr>
71     </table>
72     HTML;
73    
74 sysadm 1.20 $cache_path = "../bbs/cache/www_doc_list_" . $_SESSION["BBS_uid"];
75     $buffer = false;
76     if (file_exists($cache_path))
77     {
78     if (filemtime($cache_path) >= time() - 3600) // refresh interval = 1 hour
79     {
80     $buffer = file_get_contents($cache_path);
81     }
82     }
83     if ($buffer == false)
84     {
85     ob_start();
86    
87 sysadm 1.28 echo <<<HTML
88     <table width="1050" border="0" cellpadding="0" cellspacing="0">
89     <tr>
90     <td width="25%" align="left" valign="top">
91     <table width="100%" border="0" cellpadding="0" cellspacing="0">
92     <tr>
93     <td class="td3">
94     <table width="100%" border="0" cellspacing="0" cellpadding="0">
95     <tr><td height=10></td></tr>
96     <tr><td height=18>·<a href="../bbs/view_article.php?tn=portal&id=472035" target="_blank">本站源码上传GitHub</a></td></tr>
97     <tr><td height=18>·<a href="../bbs/view_article.php?tn=portal&id=472032" target="_blank"><font color="red">重要系统升级提示【2025-04-14】</font></a></td></tr>
98     <tr><td height=18>·<a href="../bbs/view_article.php?tn=portal&id=471914" target="_blank">中文编码及重要功能调整</a></td></tr>
99     <tr><td height=10></td></tr>
100     </table>
101     </td>
102     </tr>
103     </table>
104     </td>
105     <td width="50%" align="center" valign="top">
106     <table width="95%" border="0" cellspacing="0" cellpadding="0">
107     <tr>
108     <td class="alpha"><font color=brown><b><font size=3>本周导读</font></b></font></td>
109     </tr>
110     <tr><td bgcolor=gray height=1></td></tr>
111     HTML;
112    
113     load_top(10, 60, $db_conn);
114    
115     echo <<<HTML
116     <tr><td></td></tr>
117     </table>
118     </td>
119     <td width="25%" align="right" valign="top">
120     <table width="100%" border="0" cellpadding="0" cellspacing="0">
121     <tr class=title_bar_4><td>进入论坛</td></tr>
122     <tr class=title_list><td height=8></td></tr>
123     <tr class=title_list><td height=18 align="center">
124     <a href="/bbs/main.php" target="_blank">讨论区</a>&nbsp;
125     <a href="/gen_ex/" target="_blank">精华区</a>
126     </td></tr>
127     <tr class=title_list><td height=8></td></tr>
128     </table>
129     </td>
130     </tr>
131     <tr height="10">
132     <td>&nbsp;</td>
133     </tr>
134     </table>
135     <table width="1050" border="0" cellspacing="0" cellpadding="5">
136     <tr>
137     HTML;
138    
139     $column = 0;
140     $column_limit = 3;
141     $style_count = 4;
142    
143     foreach ($section_hierachy as $c_index => $section_class)
144 sysadm 1.20 {
145 sysadm 1.28 foreach ($section_class["sections"] as $s_index => $section)
146 sysadm 1.20 {
147 sysadm 1.28 if ($column % $column_limit == 0)
148     {
149     echo <<<HTML
150     </tr>
151     </table>
152     <table width="1050" border="0" cellspacing="0" cellpadding="5">
153     <tr>
154     HTML;
155     }
156    
157    
158     echo <<<HTML
159     <td width="33%" align="center" valign="top">
160     <table width="100%" border="0" cellspacing="0" cellpadding="1">
161     HTML;
162    
163     load_doc_list($section["sid"], 5, 40, $column % $style_count + 1, false, $db_conn);
164    
165     echo <<<HTML
166     </table>
167     </td>
168     HTML;
169    
170     $column++;
171 sysadm 1.20 }
172     }
173    
174 sysadm 1.28 for (; $column % $column_limit != 0; $column++)
175     {
176     echo <<<HTML
177     <td width="33%" align="center" valign="top">
178     </td>
179     HTML;
180     }
181    
182     echo <<<HTML
183     </tr>
184     </table>
185     HTML;
186    
187 sysadm 1.20 $buffer = ob_get_clean();
188    
189     file_put_contents($cache_path, $buffer);
190     }
191    
192     echo $buffer;
193    
194     // Cleanup
195     unset($s_favor);
196     unset($section_hierachy);
197    
198     mysqli_close($db_conn);
199    
200 sysadm 1.1 include "./foot.inc.php";
201 sysadm 1.28
202     echo <<<HTML
203     </center>
204     </body>
205     </html>
206    
207     HTML;
208 sysadm 1.1 ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1