Exemplo n.º 1
0
 static function getSettings()
 {
     $db = DbModel::getInstance();
     $db->query('SELECT * from settings');
     $db->stmt->execute();
     return $db->single();
 }
Exemplo n.º 2
0
 public function deleteTopPost($toppostid)
 {
     $db = DbModel::getInstance();
     // First delete all childs of this toppost
     $db->query('DELETE FROM posts WHERE post_relation_id = :id ');
     $db->bind(':id', $toppostid);
     $db->stmt->execute();
     // Now delete the toppost itself
     $db->query('DELETE FROM posts WHERE id = :id ');
     $db->bind(':id', $toppostid);
     $db->stmt->execute();
     if ($db->rowCount() === 1) {
         // Remove the views file
         $filename = BASE_URI . 'views/' . $toppostid . '.txt';
         if (unlink($filename)) {
             // Views file is deleted as well as the toppost
             return true;
         } else {
             // Views file is not deleted (toppost also)
             return false;
         }
     } else {
         // Views file is not deleted (toppost also)
         return false;
     }
 }
Exemplo n.º 3
0
 static function getAllUsersPerPage($offset, $per_page)
 {
     $db = DbModel::getInstance();
     $db->query('SELECT * from users WHERE disabled != 1 LIMIT :per_page OFFSET :offset');
     $db->bind(':per_page', $per_page);
     $db->bind(':offset', $offset);
     $db->stmt->execute();
     return $db->resultSet();
 }
Exemplo n.º 4
0
 static function countCategories()
 {
     $db = DbModel::getInstance();
     $db->query('SELECT COUNT(*) FROM categories');
     $db->stmt->execute();
     $result = $db->single();
     return $result['COUNT(*)'];
 }