FreshRSS.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. class FreshRSS extends Minz_FrontController {
  3. public function init () {
  4. Minz_Session::init ('FreshRSS');
  5. $this->loadParamsView ();
  6. $this->loadStylesAndScripts ();
  7. $this->loadNotifications ();
  8. }
  9. private function loadParamsView () {
  10. try {
  11. $this->conf = new FreshRSS_Configuration();
  12. } catch (Minz_Exception $e) {
  13. // Permission denied or conf file does not exist
  14. // it's critical!
  15. die($e->getMessage());
  16. }
  17. Minz_View::_param ('conf', $this->conf);
  18. Minz_Session::_param ('language', $this->conf->language);
  19. Minz_Translate::init();
  20. $output = Minz_Request::param ('output');
  21. if (!$output) {
  22. $output = $this->conf->view_mode;
  23. Minz_Request::_param ('output', $output);
  24. }
  25. }
  26. private function loadStylesAndScripts () {
  27. $theme = FreshRSS_Themes::get_infos($this->conf->theme);
  28. if ($theme) {
  29. foreach($theme["files"] as $file) {
  30. Minz_View::appendStyle (Minz_Url::display ('/themes/' . $theme['path'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['path'] . '/' . $file)));
  31. }
  32. }
  33. if (login_is_conf ($this->conf)) {
  34. Minz_View::appendScript ('https://login.persona.org/include.js');
  35. }
  36. $includeLazyLoad = $this->conf->lazyload && ($this->conf->display_posts || Minz_Request::param ('output') === 'reader');
  37. Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')), false, !$includeLazyLoad, !$includeLazyLoad);
  38. if ($includeLazyLoad) {
  39. Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.lazyload.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.lazyload.min.js')));
  40. }
  41. Minz_View::appendScript (Minz_Url::display ('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js')));
  42. }
  43. private function loadNotifications () {
  44. $notif = Minz_Session::param ('notification');
  45. if ($notif) {
  46. Minz_View::_param ('notification', $notif);
  47. Minz_Session::_param ('notification');
  48. }
  49. }
  50. }