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

Annotation of /fenglin/www/home.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.36 - (hide annotations)
Sat Nov 15 01:54:28 2025 UTC (4 months ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.35: +3 -1 lines
Add switch to turn on/off cache

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

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