App_FrontController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. }
  16. private function loadLibs () {
  17. require (LIB_PATH . '/lib_phpQuery.php');
  18. require (LIB_PATH . '/lib_rss.php');
  19. require (LIB_PATH . '/SimplePie_autoloader.php');
  20. require (LIB_PATH . '/lib_text.php');
  21. }
  22. private function loadModels () {
  23. include (APP_PATH . '/models/Exception/FeedException.php');
  24. include (APP_PATH . '/models/RSSConfiguration.php');
  25. include (APP_PATH . '/models/Days.php');
  26. include (APP_PATH . '/models/Category.php');
  27. include (APP_PATH . '/models/Feed.php');
  28. include (APP_PATH . '/models/Entry.php');
  29. }
  30. private function loadParamsView () {
  31. $this->conf = Session::param ('conf', new RSSConfiguration ());
  32. View::_param ('conf', $this->conf);
  33. $entryDAO = new EntryDAO ();
  34. View::_param ('nb_not_read', $entryDAO->countNotRead ());
  35. }
  36. private function loadStylesAndScripts () {
  37. View::appendStyle (Url::display ('/theme/global.css'));
  38. View::appendStyle (Url::display ('/theme/freshrss.css'));
  39. if (login_is_conf ($this->conf)) {
  40. View::appendScript ('https://login.persona.org/include.js');
  41. }
  42. View::appendScript (Url::display ('/scripts/jquery.js'));
  43. View::appendScript (Url::display ('/scripts/notification.js'));
  44. }
  45. private function loadNotifications () {
  46. $notif = Session::param ('notification');
  47. if ($notif) {
  48. View::_param ('notification', $notif);
  49. Session::_param ('notification');
  50. }
  51. }
  52. }