forked from galichvitaliy/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controller.php
39 lines (30 loc) · 1011 Bytes
/
Controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php namespace Mirage;
class Controller {
protected $tpl;
function __construct() {
HTTP::setRouting();
$this->tpl = App::get('view');
$this->tpl->assign('bmd', '/'.App::get('layout'));
$this->tpl->assign('site_url', Config::get('web.base_http'));
$this->tpl->assign('controller', strtolower(get_called_class()));
if(Config::get('web.langs')) {
$this->tpl->assign('lang', App::get('lang'));//curent application language
$this->tpl->assign('d_lang', Config::get('web.lang'));//default application language
}
if(Auth::check()) {
$this->tpl->assign('logged_in', true);
$this->tpl->assign('user', Auth::data());//curent application language
} else {
if(!empty($_COOKIE['lli'])) {
$this->tpl->assign('last_visit', unserialize(base64_decode($_COOKIE['lli'])));
}
}
if(Config::get('web.dev')) {
if(!empty($_COOKIE['tmp_menu_hide'])) {
$this->tpl->assign('tmp_menu_hide', $_COOKIE['tmp_menu_hide']);
}
}
$this->init();
}
public function init() {}
}