Exemple #1
0
 public static function MonthsAvailable($year = NULL)
 {
     $months = array();
     if (is_null($year)) {
         $year = date('Y');
     }
     $db = SQLite::Instance();
     $query = $db->prepare("SELECT DISTINCT strftime('%m', timestamp, 'unixepoch', 'localtime') AS month FROM mood WHERE strftime('%Y', timestamp, 'unixepoch', 'localtime') = :year ORDER BY month DESC");
     $query->execute(array('year' => $year));
     while ($data = $query->fetch()) {
         $months[] = $data['month'];
     }
     $query->closeCursor();
     return $months;
 }
Exemple #2
0
 private static function loadDataBase()
 {
     if (empty(self::$db)) {
         self::$db = SQLite::Instance(self::DB);
     }
 }
Exemple #3
0
 public static function getUsers()
 {
     $q = SQLite::Instance(self::DB)->query('SELECT id, email, last_login FROM users ORDER BY id ASC');
     $result = $q->fetchAll();
     $q->closeCursor();
     return $result;
 }
Exemple #4
0
 public static function getApis()
 {
     $query = SQLite::Instance(self::DB)->query('SELECT id, api_name, last_timestamp, last_ip, count FROM credentials');
     $data = $query->fetchAll();
     $query->closeCursor();
     return $data;
 }
Exemple #5
0
 protected function buildDebug()
 {
     if (Config::Get('debug')) {
         $this->template->assign('db_access', SQLite::Access());
         $timeend = microtime(true);
         $this->template->assign('build_time', number_format(($timeend - $this->timestart) * 1000, 2));
     }
     $this->template->assign('debug', Config::Get('debug'));
 }
Exemple #6
0
 public static function countPendingRequests()
 {
     $query = SQLite::Instance(self::DB)->prepare('SELECT count(id) AS count FROM api_request WHERE approbation = :pending');
     $query->execute(array('pending' => self::PENDING));
     $data = $query->fetch();
     $query->closeCursor();
     return $data['count'];
 }
Exemple #7
0
 public function __construct()
 {
     $this->db = SQLite::Instance(self::DB_API);
 }