index.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <?php
  2. if (file_exists("install") && !file_exists("config.php")) {
  3. header("Location: install/");
  4. }
  5. if (!file_exists("config.php")) {
  6. print "<b>Fatal Error</b>: You forgot to copy
  7. <b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
  8. exit;
  9. }
  10. // we need a separate check here because functions.php might get parsed
  11. // incorrectly before 5.3 because of :: syntax.
  12. if (version_compare(PHP_VERSION, '5.6.0', '<')) {
  13. print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".\n";
  14. exit;
  15. }
  16. set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
  17. get_include_path());
  18. require_once "autoload.php";
  19. require_once "sessions.php";
  20. require_once "functions.php";
  21. require_once "sanity_check.php";
  22. require_once "version.php";
  23. require_once "config.php";
  24. require_once "db-prefs.php";
  25. if (!init_plugins()) return;
  26. login_sequence();
  27. header('Content-Type: text/html; charset=utf-8');
  28. ?>
  29. <!DOCTYPE html>
  30. <html>
  31. <head>
  32. <title>Tiny Tiny RSS</title>
  33. <meta name="viewport" content="initial-scale=1,width=device-width" />
  34. <script type="text/javascript">
  35. var __ttrss_version = "<?php echo VERSION ?>"
  36. </script>
  37. <?php if ($_SESSION["uid"]) {
  38. $theme = get_pref("USER_CSS_THEME", false, false);
  39. if ($theme && theme_exists("$theme")) {
  40. echo stylesheet_tag(get_theme_path($theme), 'theme_css');
  41. } else {
  42. echo stylesheet_tag("css/default.css", 'theme_css');
  43. }
  44. }
  45. ?>
  46. <?php print_user_stylesheet() ?>
  47. <style type="text/css">
  48. <?php
  49. foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
  50. if (method_exists($p, "get_css")) {
  51. echo $p->get_css();
  52. }
  53. }
  54. ?>
  55. </style>
  56. <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
  57. <link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />
  58. <script>
  59. dojoConfig = {
  60. async: true,
  61. cacheBust: "<?php echo get_scripts_timestamp(); ?>",
  62. packages: [
  63. { name: "fox", location: "../../js" },
  64. ]
  65. };
  66. </script>
  67. <?php
  68. foreach (array("lib/prototype.js",
  69. "lib/scriptaculous/scriptaculous.js?load=effects,controls",
  70. "lib/dojo/dojo.js",
  71. "lib/dojo/tt-rss-layer.js",
  72. "js/tt-rss.js",
  73. "js/common.js",
  74. "errors.php?mode=js") as $jsfile) {
  75. echo javascript_tag($jsfile);
  76. } ?>
  77. <script type="text/javascript">
  78. require({cache:{}});
  79. </script>
  80. <script type="text/javascript">
  81. <?php
  82. foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
  83. if (method_exists($p, "get_js")) {
  84. $script = $p->get_js();
  85. if ($script) {
  86. echo "try {
  87. $script
  88. } catch (e) {
  89. console.warn('failed to initialize plugin JS: $n', e);
  90. }";
  91. }
  92. }
  93. }
  94. init_js_translations();
  95. ?>
  96. </script>
  97. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  98. <meta name="referrer" content="no-referrer"/>
  99. </head>
  100. <body class="flat ttrss_main ttrss_index">
  101. <div id="overlay" style="display : block">
  102. <div id="overlay_inner">
  103. <?php echo __("Loading, please wait...") ?>
  104. <div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
  105. progress="0" maximum="100">
  106. </div>
  107. <noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
  108. </div>
  109. </div>
  110. <div id="notify" class="notify"></div>
  111. <div id="cmdline" style="display : none"></div>
  112. <div id="main" dojoType="dijit.layout.BorderContainer">
  113. <div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
  114. <div id="feedlistLoading">
  115. <img src='images/indicator_tiny.gif'/>
  116. <?php echo __("Loading, please wait..."); ?></div>
  117. <?php
  118. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_TREE) as $p) {
  119. echo $p->hook_feed_tree();
  120. }
  121. ?>
  122. <div id="feedTree"></div>
  123. </div>
  124. <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
  125. <div id="toolbar-frame" dojoType="dijit.layout.ContentPane" region="top">
  126. <div id="toolbar" dojoType="fox.Toolbar">
  127. <i class="material-icons net-alert" style="display : none"
  128. title="<?php echo __("Communication problem with server.") ?>">error_outline</i>
  129. <i class="material-icons log-alert" style="display : none"
  130. title="<?php echo __("Recent entries found in event log.") ?>">warning</i>
  131. <i id="updates-available" class="material-icons icon-new-version" style="display : none"
  132. title="<?php echo __('Updates are available from Git.') ?>">new_releases</i>
  133. <?php
  134. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_MAIN_TOOLBAR_BUTTON) as $p) {
  135. echo $p->hook_main_toolbar_button();
  136. }
  137. ?>
  138. <form id="toolbar-headlines" action="" style="order : 10" onsubmit='return false'>
  139. </form>
  140. <form id="toolbar-main" action="" style="order : 20" onsubmit='return false'>
  141. <select name="view_mode" title="<?php echo __('Show articles') ?>"
  142. onchange="App.onViewModeChanged()"
  143. dojoType="fox.form.Select">
  144. <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
  145. <option value="all_articles"><?php echo __('All Articles') ?></option>
  146. <option value="marked"><?php echo __('Starred') ?></option>
  147. <option value="published"><?php echo __('Published') ?></option>
  148. <option value="unread"><?php echo __('Unread') ?></option>
  149. <option value="has_note"><?php echo __('With Note') ?></option>
  150. <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
  151. </select>
  152. <select title="<?php echo __('Sort articles') ?>"
  153. onchange="App.onViewModeChanged()"
  154. dojoType="fox.form.Select" name="order_by">
  155. <option selected="selected" value="default"><?php echo __('Default') ?></option>
  156. <option value="feed_dates"><?php echo __('Newest first') ?></option>
  157. <option value="date_reverse"><?php echo __('Oldest first') ?></option>
  158. <option value="title"><?php echo __('Title') ?></option>
  159. </select>
  160. <div dojoType="fox.form.ComboButton" onclick="Feeds.catchupCurrent()">
  161. <span><?php echo __('Mark as read') ?></span>
  162. <div dojoType="dijit.DropDownMenu">
  163. <div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('1day')">
  164. <?php echo __('Older than one day') ?>
  165. </div>
  166. <div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('1week')">
  167. <?php echo __('Older than one week') ?>
  168. </div>
  169. <div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('2week')">
  170. <?php echo __('Older than two weeks') ?>
  171. </div>
  172. </div>
  173. </div>
  174. </form>
  175. <div class="action-chooser" style="order : 30">
  176. <?php
  177. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
  178. echo $p->hook_toolbar_button();
  179. }
  180. ?>
  181. <div dojoType="fox.form.DropDownButton" class="action-button" title="<?php echo __('Actions...') ?>">
  182. <span><i class="material-icons">menu</i></span>
  183. <div dojoType="dijit.Menu" style="display: none">
  184. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcPrefs')"><?php echo __('Preferences...') ?></div>
  185. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcSearch')"><?php echo __('Search...') ?></div>
  186. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
  187. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
  188. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
  189. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
  190. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
  191. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
  192. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
  193. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
  194. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
  195. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcToggleNightMode')"><?php echo __('Toggle night mode') ?></div>
  196. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
  197. <?php
  198. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
  199. echo $p->hook_action_item();
  200. }
  201. ?>
  202. <?php if (!$_SESSION["hide_logout"]) { ?>
  203. <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcLogout')"><?php echo __('Logout') ?></div>
  204. <?php } ?>
  205. </div>
  206. </div>
  207. </div>
  208. </div> <!-- toolbar -->
  209. </div> <!-- toolbar pane -->
  210. <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
  211. <div id="floatingTitle" style="display : none"></div>
  212. <div id="headlines-frame" dojoType="dijit.layout.ContentPane" tabindex="0"
  213. region="center">
  214. <div id="headlinesInnerContainer">
  215. <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
  216. </div>
  217. </div>
  218. <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
  219. style="height : 50%" splitter="true"></div>
  220. </div>
  221. </div>
  222. </div>
  223. </body>
  224. </html>