예제 #1
0
 public function boards_threads_index($params = null)
 {
     // aka create thread
     if ($params && isset($params["__partial"])) {
         return null;
     }
     if ($params === null) {
         $this->requireRequestType("GET");
         /*
         $params = array(
           "boardid"=>SC::getParam("boardid"),
           "start"=>SC::getParam("start"),
           "num"=>SC::getParam("num"),
           "showthreads"=>SC::getParam("showthreads")
         );
         */
         $params = $_GET;
     }
     $current_user = $this->requireLogin("You must be logged in to view the threads on a board");
     $board = new SCBoard($params["boardid"]);
     if (!$current_user->isMemberOf($board->boardid)) {
         throw new APIException("You can only view threads from boards you belong to", 403);
     }
     $hidethreads = !$params["showthreads"];
     $board->loadThreads($params["start"], $params["num"], $hidethreads);
     return $board->threads();
 }