/**
  * Récupère les genres d'un album
  */
 public function getGenres()
 {
     if (isset($this->id)) {
         $this->genres = App::getInstance()->getTable('Genres')->allByAlbum($this->id);
         $this->total_genres = count($this->genres);
     }
 }
 /**
  * Récupère les albums d'un artiste
  */
 public function getAlbums()
 {
     if (isset($this->id)) {
         $this->albums = App::getInstance()->getTable('Albums')->allByArtist($this->id);
         $this->total_albums = count($this->albums);
     }
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     $app = App::getInstance();
     $auth = new DBAuth($app->getDb());
     if (!$auth->logged()) {
         $this->forbidden();
     }
 }
Beispiel #4
0
 public function login()
 {
     $errors = false;
     if (!empty($_POST)) {
         $auth = new DBAuth(App::getInstance()->getDb());
         if ($auth->login($_POST['username'], $_POST['password'])) {
             header('Location: index.php?page=admin.post.index');
         } else {
             $errors = true;
         }
     }
     $form = new FoundationForm($_POST);
     $this->render('user.login', compact('form', 'errors'));
 }
Beispiel #5
0
<?php

use App\App;
$app = App::getInstance();
$app->title = $category->title;
?>

<div class="main">
    <h1><?php 
echo $category->title;
?>
</h1>
    <?php 
foreach ($posts as $post) {
    ?>
        <h2>
            <a href="<?php 
    echo $post->url;
    ?>
"><?php 
    echo $post->title;
    ?>
</a>
        </h2>
        <p>
            <?php 
    echo $post->extract;
    ?>
        </p>
    <?php 
}
Beispiel #6
0
 public static function IsAdmin($username, $uniqId)
 {
     $db = new Database('blog');
     $app = \App\App::getInstance();
     $username = $app::destroyHTML($username);
     $uniqId = $app::destroyHTML($uniqId);
     $isAdmin = $db->prepare("SELECT * FROM users WHERE username = :username AND uniqid = :uniqid", array("username" => $username, "uniqid" => $uniqId), "App\\Table\\User", true);
     if ($isAdmin) {
         return true;
     }
 }
Beispiel #7
0
 protected function loadModel($model)
 {
     $this->{$model} = App::getInstance()->getTable($model);
 }
 /**
  * App container
  * @return object
  */
 protected function app()
 {
     return App::getInstance();
 }
Beispiel #9
0
 /**
  * Run initialize after services were registered.
  */
 public function init()
 {
     $this->event->trigger('phifty.before_init');
     $self = $this;
     $this->web = function () use($self) {
         return new Web($self);
     };
     if (CLI) {
         CommandLine::init($this);
     } else {
         if (isset($this->session)) {
             $this->session;
         }
     }
     if (isset($this->locale)) {
         $this->locale;
     }
     $this->app = \App\App::getInstance($this, []);
     $this->app->init();
     $this->bundles->init();
     $this->event->trigger('phifty.after_init');
 }