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

Diff of /fenglin/bbs/section_setting.php

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

Revision 1.2 by sysadm, Tue Apr 8 11:23:00 2025 UTC Revision 1.3 by sysadm, Wed Apr 9 04:10:57 2025 UTC
# Line 24  Line 24 
24                  exit(json_encode($result_set));                  exit(json_encode($result_set));
25          }          }
26    
27            // Load section setting
28          $sql = "SELECT * FROM section_config WHERE SID = $sid AND enable";          $sql = "SELECT * FROM section_config WHERE SID = $sid AND enable";
29    
30          $rs = mysqli_query($db_conn, $sql);          $rs = mysqli_query($db_conn, $sql);
# Line 36  Line 37 
37                  exit(json_encode($result_set));                  exit(json_encode($result_set));
38          }          }
39    
40          if($row = mysqli_fetch_array($rs))          if ($row = mysqli_fetch_array($rs))
41          {          {
42                  $result_set["data"] = array(                  $result_set["data"] = array(
43                          "sid" => $sid,                          "sid" => $sid,
# Line 44  Line 45 
45                          "comment" => $row["comment"],                          "comment" => $row["comment"],
46                          "ex_update" => $row["ex_update"],                          "ex_update" => $row["ex_update"],
47                          "section_hierachy" => array(),                          "section_hierachy" => array(),
48                            "masters" => array(),
49                  );                  );
50          }          }
51          else          else
# Line 57  Line 59 
59    
60          mysqli_free_result($rs);          mysqli_free_result($rs);
61    
62            // Load section master
63            $sql = "SELECT section_master.UID, username, major, begin_dt, end_dt FROM section_master
64                            INNER JOIN user_list ON section_master.UID = user_list.UID
65                            WHERE SID = $sid AND section_master.enable AND (NOW() BETWEEN begin_dt AND end_dt)
66                            ORDER BY major DESC, begin_dt ASC, end_dt ASC";
67    
68            $rs = mysqli_query($db_conn, $sql);
69            if ($rs == false)
70            {
71                    $result_set["return"]["code"] = -2;
72                    $result_set["return"]["message"] = "Query section master error: " . mysqli_error($db_conn);
73    
74                    mysqli_close($db_conn);
75                    exit(json_encode($result_set));
76            }
77    
78            while ($row = mysqli_fetch_array($rs))
79            {
80                    array_push($result_set["data"]["masters"], array(
81                            "uid" => $row["UID"],
82                            "username" => $row["username"],
83                            "major" => $row["major"],
84                            "begin_dt" => $row["begin_dt"],
85                            "end_dt" => $row["end_dt"],
86                    ));
87            }
88            mysqli_free_result($rs);
89    
90          // Load section list          // Load section list
91          $sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_class.title AS c_title          $sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_class.title AS c_title
92                          FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID                          FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID


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

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