/[LeafOK_CVS]/fenglin/www/load_doc_list.inc.php
ViewVC logotype

Diff of /fenglin/www/load_doc_list.inc.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.12 by sysadm, Sun Apr 13 05:06:12 2025 UTC Revision 1.14 by sysadm, Mon Apr 14 05:09:58 2025 UTC
# Line 2  Line 2 
2          require_once "../lib/str_process.inc.php";          require_once "../lib/str_process.inc.php";
3  ?>  ?>
4  <?  <?
5  function load_doc_list($section_name, $num, $length, $style, $subtitle, $db_conn)  function load_doc_list(string $sid, int $num, int $length, int $style, bool $subtitle, mysqli $db_conn) : bool
6  {  {
7          $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) . "'";  
8    
9          $rs = mysqli_query($db_conn, $sql);          $rs = mysqli_query($db_conn, $sql);
10          if ($rs == false)          if ($rs == false)
11          {          {
12                  echo("Query section error: " . mysqli_error($db_conn));                  return false;
                 exit();  
13          }          }
14    
15          if ($row = mysqli_fetch_array($rs))          if ($row = mysqli_fetch_array($rs))
16          {          {
                 $sid = $row["SID"];  
17                  $title = $row["title"];                  $title = $row["title"];
18          }          }
19          else          else
# Line 28  function load_doc_list($section_name, $n Line 25  function load_doc_list($section_name, $n
25    
26          if ($subtitle)          if ($subtitle)
27          {          {
28                  echo (" <tr class=title_list><td height=20 valign=bottom>" .  ?>
29                          "<a href=\"/bbs/list.php?sid=$sid&ex=1\" target=_blank>" .          <tr class=title_list>
30                          "<b>$title</b></a></td></tr>\n");                  <td height="25" valign=bottom>
31                                            <a href="..//bbs/list.php?sid=<? echo $sid; ?>&ex=1" target=_blank>
32                                    <b><? echo $title; ?></b>
33                            </a>
34                    </td>
35            </tr>
36    <?              
37          }          }
38          else          else
39          {          {
40                  echo (" <tr class=title_bar_$style><td>" .  ?>
41                          "<a class=guide href=\"/bbs/list.php?sid=$sid&ex=1\" target=_blank>" .          <tr class=title_bar_<? echo $style; ?>>
42                          "$title&gt;&gt;</a></td></tr>\n");                  <td>
43                            <a class="guide" href="../bbs/list.php?sid=<? echo $sid; ?>&ex=1" target=_blank>
44                                    <? echo $title; ?>&gt;&gt;
45                            </a>
46                    </td>
47            </tr>
48    <?
49          }          }
50    ?>
51          echo ("<tr class=title_list><td height=8></td></tr>\n");          <tr class="title_list">
52                    <td height="8">
53                    </td>
54            </tr>
55    <?
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";
# Line 48  function load_doc_list($section_name, $n Line 60  function load_doc_list($section_name, $n
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>" .  ?>
69                          "·<a href=\"../bbs/view_article.php?tn=portal&id=" . $row["AID"] . "\" target=_blank>" .          <tr class="title_list">
70                          htmlspecialchars(split_line($row["title"], "", $length, 1), ENT_HTML401, 'UTF-8') .                  <td height="18">
71                          "</a></td></tr>\n");                          ·<a href="../bbs/view_article.php?tn=portal&id=<? echo $row["AID"]; ?>" target=_blank>
72          }                                  <? echo htmlspecialchars(split_line($row["title"], "", $length, 1), ENT_HTML401, 'UTF-8'); ?>
73          mysqli_free_result($rs);                          </a>
74                    </td>
75          echo ("<tr class=title_list><td height=8 align=right></td></tr>\n");          </tr>
76  }  <?
   
 function load_class_list($class_name, $section_name_list, $num, $length, $style, $db_conn)  
 {  
         $sql = "SELECT CID,title FROM section_class WHERE cname = '" .  
                         mysqli_real_escape_string($db_conn, $class_name) . "'";  
   
         $rs = mysqli_query($db_conn, $sql);  
         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 = "";  
77          }          }
78          mysqli_free_result($rs);          mysqli_free_result($rs);
79    ?>
80            <tr class="title_list">
81                    <td height="8" align="right">
82                    </td>
83            </tr>
84    <?
85    
86          echo ("<tr class=title_bar_$style><td>$title&gt;&gt;</td></tr>\n");          return true;
   
         $sql = "SELECT sname FROM section_config WHERE CID = $cid  
                         AND enable ORDER BY sort_order";  
   
         $rs = mysqli_query($db_conn, $sql);  
         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);  
87  }  }
88    
89  function load_top($num, $length, $db_conn)  function load_top(int $num, int $length, mysqli $db_conn) : bool
90  {  {
91          $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
92                          FROM bbs INNER JOIN section_config ON bbs.SID = section_config.SID                          FROM bbs INNER JOIN section_config ON bbs.SID = section_config.SID
# Line 122  function load_top($num, $length, $db_con Line 98  function load_top($num, $length, $db_con
98          $rs = mysqli_query($db_conn, $sql);          $rs = mysqli_query($db_conn, $sql);
99          if ($rs == false)          if ($rs == false)
100          {          {
101                  echo("Query data error: " . mysqli_error($db_conn));                  return false;
                 exit();  
102          }          }
103    ?>
104          echo ("<tr><td height=8></td></tr>\n");          <tr>
105                    <td height="8">
106                    </td>
107            </tr>
108    <?
109          while ($row = mysqli_fetch_array($rs))          while ($row = mysqli_fetch_array($rs))
110          {          {
111                  echo ("<tr><td height=18>·<a href=\"../bbs/view_article.php?tn=portal&id=" . $row["AID"] . "\" target=_blank>" .  ?>
112                          htmlspecialchars(split_line("[" . $row["s_title"] . "] " . $row["title"], "", $length, 1), ENT_HTML401, 'UTF-8') .          <tr>
113                          "</a></td></tr>\n");                  <td height="18">
114                            ·<a href="../bbs/view_article.php?tn=portal&id=<? echo $row["AID"]; ?>" target=_blank>
115                                    <? echo htmlspecialchars(split_line("[" . $row["s_title"] . "] " . $row["title"], "", $length, 1), ENT_HTML401, 'UTF-8'); ?>
116                            </a>
117                    </td>
118            </tr>
119    <?
120          }          }
121          mysqli_free_result($rs);          mysqli_free_result($rs);
122    
123          echo ("<tr><td height=8></td></tr>\n");  ?>
124            <tr>
125                    <td height="8">
126                    </td>
127            </tr>
128    <?
129    
130            return true;
131  }  }
132    
133  ?>  ?>


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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