Exemplo n.º 1
0
 /**
  * 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);
     }
 }
Exemplo n.º 2
0
 /**
  * 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);
     }
 }
Exemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     $app = App::getInstance();
     $auth = new DBAuth($app->getDb());
     if (!$auth->logged()) {
         $this->forbidden();
     }
 }
Exemplo n.º 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'));
 }
Exemplo n.º 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 
}
Exemplo n.º 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;
     }
 }
Exemplo n.º 7
0
 protected function loadModel($model)
 {
     $this->{$model} = App::getInstance()->getTable($model);
 }
Exemplo n.º 8
0
 /**
  * App container
  * @return object
  */
 protected function app()
 {
     return App::getInstance();
 }
Exemplo n.º 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');
 }