public function readLesson()
 {
     if (isset($this->inputs->last_time)) {
         $logs = Mesalva::moreThan($this->inputs->last_time);
         REST::returnJson(['status' => 'more', 'logs' => $logs]);
     } else {
         $logs = Mesalva::lastTen();
         REST::returnJson(['status' => 'last', 'logs' => $logs]);
     }
 }
 public function all()
 {
     $active = isset($_GET['active']) ? $_GET['active'] : 1;
     $start = isset($_GET['start']) ? $_GET['start'] : 0;
     $posts = Post::lasts($start, $active);
     $where = 'TRUE';
     if ($active !== null) {
         $where = "estacao_post.active = " . ($active ? '1' : '0');
     }
     $query = "SELECT\n\t\t\t\testacao_post.*,\n\t\t\t\tusers.name gamer_name,\n\t\t\t\tusers.slug gamer_slug\n\t\t\tFROM estacao_post\n\t\t\tLEFT JOIN users\n\t\t\tON users.id = estacao_post.user_id\n\t\t\tWHERE {$where}\n\t\t\tORDER BY estacao_post.created_at DESC\n\t\t\tLIMIT 12\n\t\t\tOFFSET {$start}";
     REST::returnJson(['status' => 'ok', 'posts' => $posts, 'query' => $query]);
 }
Exemplo n.º 3
0
 public static function return401($response = null)
 {
     header('HTTP/1.0 401 Unauthorized');
     if ($response === null) {
         $response = array('error' => true);
     }
     return REST::returnJson($response);
 }
 public function all()
 {
     $active = isset($_GET['active']) ? $_GET['active'] : 1;
     $gamers = Gamer::all($active);
     REST::returnJson(['status' => 'ok', 'gamers' => $gamers]);
 }