/[LeafOK_CVS]/fenglin/bbs/list.php
ViewVC logotype

Diff of /fenglin/bbs/list.php

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

Revision 1.3 by sysadm, Sat Apr 12 05:02:55 2025 UTC Revision 1.5 by sysadm, Tue Apr 15 01:10:48 2025 UTC
# Line 25  Line 25 
25          $page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1);          $page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1);
26          $rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20);          $rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20);
27    
28            if (!in_array($rpp, $BBS_list_rpp_options))
29            {
30                    $rpp = $BBS_list_rpp_options[0];
31            }
32    
33          if (!$_SESSION["BBS_priv"]->checkpriv($sid, S_LIST))          if (!$_SESSION["BBS_priv"]->checkpriv($sid, S_LIST))
34          {          {
35                  force_login();                  force_login();
# Line 107  Line 112 
112          }          }
113          mysqli_free_result($rs);          mysqli_free_result($rs);
114    
         if (!in_array($rpp, $BBS_list_rpp_options))  
         {  
                 $rpp = $BBS_list_rpp_options[0];  
         }  
   
115          $page_total = ceil($toa / $rpp);          $page_total = ceil($toa / $rpp);
116          if ($page > $page_total)          if ($page > $page_total)
117          {          {
# Line 244  Line 244 
244                  }                  }
245          }          }
246    
247            $author_list = array();
248    
249          while ($row = mysqli_fetch_array($rs))          while ($row = mysqli_fetch_array($rs))
250          {          {
251                  array_push($result_set["data"]["articles"], array(                  array_push($result_set["data"]["articles"], array(
# Line 269  Line 271 
271                          "last_reply_nickname" => $row["last_reply_nickname"],                          "last_reply_nickname" => $row["last_reply_nickname"],
272                          "visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0),                          "visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0),
273                  ));                  ));
274    
275                    if (!isset($author_list[$row["UID"]]))
276                    {
277                            $author_list[$row["UID"]] = true;
278                    }
279                    if (!isset($author_list[$row["last_reply_UID"]]))
280                    {
281                            $author_list[$row["last_reply_UID"]] = true;
282                    }
283            }
284            mysqli_free_result($rs);
285    
286            $uid_list = "-1";
287            foreach ($author_list as $uid => $status)
288            {
289                    $uid_list .= (", " . $uid);
290            }
291            unset($author_list);
292    
293            $author_list = array();
294    
295            $sql = "SELECT UID FROM user_list WHERE UID IN ($uid_list) AND enable";
296    
297            $rs = mysqli_query($db_conn, $sql);
298            if ($rs == false)
299            {
300                    $result_set["return"]["code"] = -2;
301                    $result_set["return"]["message"] = "Query user list error: " . mysqli_error($db_conn);
302    
303                    mysqli_close($db_conn);
304                    exit(json_encode($result_set));
305            }
306    
307            while ($row = mysqli_fetch_array($rs))
308            {
309                    $author_list[$row["UID"]] = true;
310          }          }
311          mysqli_free_result($rs);          mysqli_free_result($rs);
312    
313            $result_set["data"]["author_list"] = $author_list;
314            unset($author_list);
315    
316          mysqli_close($db_conn);          mysqli_close($db_conn);
317    
318          // Cleanup          // Cleanup


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

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