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


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

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