index.php 10 KB

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