App_FrontController.php 1.9 KB

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