blob: 920e3baa857ee3401aff5806c7e5d836f28d1dfb (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<?php
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
require ('FrontController.php');
class App_FrontController extends FrontController {
public function init () {
$this->loadLibs ();
$this->loadModels ();
Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?)
$this->loadParamsView ();
$this->loadStylesAndScripts ();
$this->loadNotifications ();
Translate::init ();
}
private function loadLibs () {
require (LIB_PATH . '/lib_phpQuery.php');
require (LIB_PATH . '/lib_rss.php');
require (LIB_PATH . '/SimplePie_autoloader.php');
require (LIB_PATH . '/lib_text.php');
}
private function loadModels () {
include (APP_PATH . '/models/Exception/FeedException.php');
include (APP_PATH . '/models/Exception/EntriesGetterException.php');
include (APP_PATH . '/models/RSSConfiguration.php');
include (APP_PATH . '/models/RSSThemes.php');
include (APP_PATH . '/models/Days.php');
include (APP_PATH . '/models/Category.php');
include (APP_PATH . '/models/Feed.php');
include (APP_PATH . '/models/Entry.php');
include (APP_PATH . '/models/EntriesGetter.php');
include (APP_PATH . '/models/RSSPaginator.php');
include (APP_PATH . '/models/Log.php');
}
private function loadParamsView () {
$this->conf = Session::param ('conf', new RSSConfiguration ());
View::_param ('conf', $this->conf);
$entryDAO = new EntryDAO ();
View::_param ('nb_not_read', $entryDAO->countNotRead ());
Session::_param ('language', $this->conf->language ());
}
private function loadStylesAndScripts () {
$theme = $this->conf->theme();
View::appendStyle (Url::display ('/themes/' . $theme . '/style.css'));
View::appendStyle (Url::display ('/themes/printer/style.css'), 'print');
if (login_is_conf ($this->conf)) {
View::appendScript ('https://login.persona.org/include.js');
}
View::appendScript (Url::display ('/scripts/jquery.min.js'));
if ($this->conf->lazyload () === 'yes') {
View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js'));
}
View::appendScript (Url::display ('/scripts/notification.js'));
}
private function loadNotifications () {
$notif = Session::param ('notification');
if ($notif) {
View::_param ('notification', $notif);
Session::_param ('notification');
}
}
}
|