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

Annotation of /fenglin/www/home.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.35 - (hide annotations)
Thu Jun 19 03:05:05 2025 UTC (8 months, 4 weeks ago) by sysadm
Branch: MAIN
Changes since 1.34: +9 -0 lines
Add prompt for no favour section

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

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