index.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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.3.0', '<')) {
  13. print "<b>Fatal Error</b>: PHP version 5.3.0 or newer required.\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. require_once "lib/Mobile_Detect.php";
  26. $mobile = new Mobile_Detect();
  27. if (!init_plugins()) return;
  28. if (!$_REQUEST['mobile']) {
  29. if ($mobile->isTablet() && PluginHost::getInstance()->get_plugin("digest")) {
  30. header('Location: backend.php?op=digest');
  31. exit;
  32. } else if ($mobile->isMobile() && PluginHost::getInstance()->get_plugin("mobile")) {
  33. header('Location: backend.php?op=mobile');
  34. exit;
  35. } else if ($mobile->isMobile() && PluginHost::getInstance()->get_plugin("digest")) {
  36. header('Location: backend.php?op=digest');
  37. exit;
  38. }
  39. }
  40. login_sequence();
  41. header('Content-Type: text/html; charset=utf-8');
  42. ?>
  43. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  44. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  45. <html>
  46. <head>
  47. <title>Tiny Tiny RSS</title>
  48. <meta name="viewport" content="initial-scale=1,width=device-width" />
  49. <script type="text/javascript">
  50. var __ttrss_version = "<?php echo VERSION ?>"
  51. </script>
  52. <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
  53. <?php echo stylesheet_tag("css/layout.css"); ?>
  54. <?php if ($_SESSION["uid"]) {
  55. $theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
  56. if ($theme && theme_valid("$theme")) {
  57. echo stylesheet_tag(get_theme_path($theme));
  58. } else {
  59. echo stylesheet_tag("themes/default.php");
  60. }
  61. }
  62. ?>
  63. <?php print_user_stylesheet() ?>
  64. <style type="text/css">
  65. <?php
  66. foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
  67. if (method_exists($p, "get_css")) {
  68. echo $p->get_css();
  69. }
  70. }
  71. ?>
  72. </style>
  73. <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
  74. <link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />
  75. <script>
  76. dojoConfig = {
  77. async: true,
  78. cacheBust: new Date(),
  79. packages: [
  80. { name: "fox", location: "../../js" },
  81. ]
  82. };
  83. </script>
  84. <?php
  85. foreach (array("lib/prototype.js",
  86. "lib/scriptaculous/scriptaculous.js?load=effects,controls",
  87. "lib/dojo/dojo.js",
  88. "lib/dojo/tt-rss-layer.js",
  89. "errors.php?mode=js") as $jsfile) {
  90. echo javascript_tag($jsfile);
  91. } ?>
  92. <script type="text/javascript">
  93. require({cache:{}});
  94. <?php
  95. require_once 'lib/jshrink/Minifier.php';
  96. print get_minified_js(array("tt-rss",
  97. "functions", "feedlist", "viewfeed", "PluginHost"));
  98. foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
  99. if (method_exists($p, "get_js")) {
  100. echo "try {";
  101. echo JShrink\Minifier::minify($p->get_js());
  102. echo "} catch (e) {
  103. console.warn('failed to initialize plugin JS: $n');
  104. console.warn(e);
  105. }";
  106. }
  107. }
  108. init_js_translations();
  109. ?>
  110. </script>
  111. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  112. <meta name="referrer" content="no-referrer"/>
  113. <script type="text/javascript">
  114. Event.observe(window, 'load', function() {
  115. init();
  116. });
  117. </script>
  118. </head>
  119. <body id="ttrssMain" class="claro">
  120. <div id="overlay" style="display : block">
  121. <div id="overlay_inner">
  122. <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
  123. <div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
  124. progress="0" maximum="100">
  125. </div>
  126. <noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
  127. </div>
  128. </div>
  129. <div id="notify" class="notify"></div>
  130. <div id="cmdline" style="display : none"></div>
  131. <div id="main" dojoType="dijit.layout.BorderContainer">
  132. <div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
  133. <div id="feedlistLoading">
  134. <img src='images/indicator_tiny.gif'/>
  135. <?php echo __("Loading, please wait..."); ?></div>
  136. <div id="feedTree"></div>
  137. </div>
  138. <div dojoType="dijit.layout.BorderContainer" region="center" id="header-wrap" gutters="false">
  139. <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
  140. <div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
  141. <div id="main-toolbar" dojoType="dijit.Toolbar">
  142. <?php
  143. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_MAIN_TOOLBAR_BUTTON) as $p) {
  144. echo $p->hook_main_toolbar_button();
  145. }
  146. ?>
  147. <form id="headlines-toolbar" action="" onsubmit='return false'>
  148. </form>
  149. <form id="main_toolbar_form" action="" onsubmit='return false'>
  150. <select name="view_mode" title="<?php echo __('Show articles') ?>"
  151. onchange="viewModeChanged()"
  152. dojoType="dijit.form.Select">
  153. <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
  154. <option value="all_articles"><?php echo __('All Articles') ?></option>
  155. <option value="marked"><?php echo __('Starred') ?></option>
  156. <option value="published"><?php echo __('Published') ?></option>
  157. <option value="unread"><?php echo __('Unread') ?></option>
  158. <option value="has_note"><?php echo __('With Note') ?></option>
  159. <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
  160. </select>
  161. <select title="<?php echo __('Sort articles') ?>"
  162. onchange="viewModeChanged()"
  163. dojoType="dijit.form.Select" name="order_by">
  164. <option selected="selected" value="default"><?php echo __('Default') ?></option>
  165. <option value="feed_dates"><?php echo __('Newest first') ?></option>
  166. <option value="date_reverse"><?php echo __('Oldest first') ?></option>
  167. <option value="title"><?php echo __('Title') ?></option>
  168. </select>
  169. <div dojoType="dijit.form.ComboButton" onclick="catchupCurrentFeed()">
  170. <span><?php echo __('Mark as read') ?></span>
  171. <div dojoType="dijit.DropDownMenu">
  172. <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1day')">
  173. <?php echo __('Older than one day') ?>
  174. </div>
  175. <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1week')">
  176. <?php echo __('Older than one week') ?>
  177. </div>
  178. <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('2week')">
  179. <?php echo __('Older than two weeks') ?>
  180. </div>
  181. </div>
  182. </div>
  183. </form>
  184. <div class="actionChooser">
  185. <?php
  186. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
  187. echo $p->hook_toolbar_button();
  188. }
  189. ?>
  190. <button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
  191. title="<?php echo __("Communication problem with server.") ?>">
  192. <img src="images/error.png" />
  193. </button>
  194. <div dojoType="dijit.form.DropDownButton">
  195. <span><?php echo __('Actions...') ?></span>
  196. <div dojoType="dijit.Menu" style="display: none">
  197. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
  198. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
  199. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
  200. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
  201. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
  202. <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRescoreFeed')"><?php echo __('Rescore feed') ?></div> -->
  203. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
  204. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
  205. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
  206. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
  207. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
  208. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
  209. <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
  210. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
  211. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
  212. <?php
  213. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
  214. echo $p->hook_action_item();
  215. }
  216. ?>
  217. <?php if (!$_SESSION["hide_logout"]) { ?>
  218. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
  219. <?php } ?>
  220. </div>
  221. </div>
  222. <button id="updatesIcon" dojoType="dijit.form.Button" style="display : none">
  223. <img src="images/new_version.png" title="<?php echo __('Updates are available from Git.') ?>"/>
  224. </button>
  225. </div>
  226. </div> <!-- toolbar -->
  227. </div> <!-- toolbar pane -->
  228. <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
  229. <div id="floatingTitle" style="visibility : hidden"></div>
  230. <div id="headlines-frame" dojoType="dijit.layout.ContentPane" tabindex="0"
  231. onscroll="headlines_scroll_handler(this)" region="center">
  232. <div id="headlinesInnerContainer">
  233. <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
  234. </div>
  235. </div>
  236. <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
  237. style="height : 50%" splitter="true"></div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </body>
  243. </html>