App_FrontController.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * MINZ - Copyright 2011 Marien Fressinaud
  4. * Sous licence AGPL3 <http://www.gnu.org/licenses/>
  5. */
  6. require ('FrontController.php');
  7. class App_FrontController extends FrontController {
  8. public function init () {
  9. $this->loadLibs ();
  10. $this->loadModels ();
  11. Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?)
  12. $this->loadParamsView ();
  13. $this->loadStylesAndScripts ();
  14. $this->loadNotifications ();
  15. Translate::init ();
  16. }
  17. private function loadLibs () {
  18. require (LIB_PATH . '/lib_phpQuery.php');
  19. require (LIB_PATH . '/lib_rss.php');
  20. require (LIB_PATH . '/SimplePie_autoloader.php');
  21. require (LIB_PATH . '/lib_text.php');
  22. }
  23. private function loadModels () {
  24. include (APP_PATH . '/models/Exception/FeedException.php');
  25. include (APP_PATH . '/models/Exception/EntriesGetterException.php');
  26. include (APP_PATH . '/models/RSSConfiguration.php');
  27. include (APP_PATH . '/models/Days.php');
  28. include (APP_PATH . '/models/Category.php');
  29. include (APP_PATH . '/models/Feed.php');
  30. include (APP_PATH . '/models/Entry.php');
  31. include (APP_PATH . '/models/EntriesGetter.php');
  32. include (APP_PATH . '/models/RSSPaginator.php');
  33. include (APP_PATH . '/models/Log.php');
  34. }
  35. private function loadParamsView () {
  36. $this->conf = Session::param ('conf', new RSSConfiguration ());
  37. View::_param ('conf', $this->conf);
  38. $entryDAO = new EntryDAO ();
  39. View::_param ('nb_not_read', $entryDAO->countNotRead ());
  40. Session::_param ('language', $this->conf->language ());
  41. }
  42. private function loadStylesAndScripts () {
  43. View::appendStyle (Url::display ('/theme/fallback.css'));
  44. View::appendStyle (Url::display ('/theme/global.css'));
  45. View::appendStyle (Url::display ('/theme/freshrss.css'));
  46. if (login_is_conf ($this->conf)) {
  47. View::appendScript ('https://login.persona.org/include.js');
  48. }
  49. View::appendScript (Url::display ('/scripts/jquery.js'));
  50. View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js'));
  51. View::appendScript (Url::display ('/scripts/notification.js'));
  52. }
  53. private function loadNotifications () {
  54. $notif = Session::param ('notification');
  55. if ($notif) {
  56. View::_param ('notification', $notif);
  57. Session::_param ('notification');
  58. }
  59. }
  60. }