Beispiel #1
0
 public static function tuoreimmat()
 {
     $query = DB::connection()->prepare('SELECT * FROM message order by time desc LIMIT 35');
     $query->execute();
     $rows = $query->fetchAll();
     $viestit = array();
     $kaytetyt = array();
     foreach ($rows as $row) {
         if (Viesti::onkoKaytetty($row, $kaytetyt) && sizeof($kaytetyt) < 20) {
             array_push($kaytetyt, $row['thread']);
             $viestit[] = new Viesti(array('id' => $row['thread'], 'content' => $row['content'], 'time' => $row['time'], 'author' => Tili::getKayttajaIDlla($row['author']), 'thread' => Keskustelu::getTopic($row['thread'])));
         }
     }
     return $viestit;
 }