index.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. <script type="text/javascript">
  49. var __ttrss_version = "<?php echo VERSION ?>"
  50. </script>
  51. <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
  52. <?php echo stylesheet_tag("css/layout.css"); ?>
  53. <?php if ($_SESSION["uid"]) {
  54. $theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
  55. if ($theme && theme_valid("$theme")) {
  56. echo stylesheet_tag(get_theme_path($theme));
  57. } else {
  58. echo stylesheet_tag("themes/default.css");
  59. }
  60. }
  61. ?>
  62. <?php print_user_stylesheet() ?>
  63. <style type="text/css">
  64. <?php
  65. foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
  66. if (method_exists($p, "get_css")) {
  67. echo $p->get_css();
  68. }
  69. }
  70. ?>
  71. </style>
  72. <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
  73. <link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />
  74. <?php
  75. foreach (array("lib/prototype.js",
  76. "lib/scriptaculous/scriptaculous.js?load=effects,controls",
  77. "lib/dojo/dojo.js",
  78. "lib/dojo/tt-rss-layer.js",
  79. "errors.php?mode=js") as $jsfile) {
  80. echo javascript_tag($jsfile);
  81. } ?>
  82. <script type="text/javascript">
  83. require({cache:{}});
  84. <?php
  85. require_once 'lib/jshrink/Minifier.php';
  86. print get_minified_js(array("tt-rss",
  87. "functions", "feedlist", "viewfeed", "FeedTree", "PluginHost"));
  88. foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
  89. if (method_exists($p, "get_js")) {
  90. echo JShrink\Minifier::minify($p->get_js());
  91. }
  92. }
  93. init_js_translations();
  94. ?>
  95. </script>
  96. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  97. <script type="text/javascript">
  98. Event.observe(window, 'load', function() {
  99. init();
  100. });
  101. </script>
  102. </head>
  103. <body id="ttrssMain" class="claro">
  104. <div id="overlay" style="display : block">
  105. <div id="overlay_inner">
  106. <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
  107. <div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
  108. progress="0" maximum="100">
  109. </div>
  110. <noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
  111. </div>
  112. </div>
  113. <div id="notify" class="notify"></div>
  114. <div id="cmdline" style="display : none"></div>
  115. <div id="headlines-tmp" 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. <div id="feedTree"></div>
  122. </div>
  123. <div dojoType="dijit.layout.BorderContainer" region="center" id="header-wrap" gutters="false">
  124. <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
  125. <div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
  126. <div id="main-toolbar" dojoType="dijit.Toolbar">
  127. <form id="headlines-toolbar" action="" onsubmit='return false'>
  128. </form>
  129. <form id="main_toolbar_form" action="" onsubmit='return false'>
  130. <button dojoType="dijit.form.Button" id="collapse_feeds_btn"
  131. onclick="collapse_feedlist()"
  132. title="<?php echo __('Collapse feedlist') ?>" style="display : none">
  133. &lt;&lt;</button>
  134. <select name="view_mode" title="<?php echo __('Show articles') ?>"
  135. onchange="viewModeChanged()"
  136. dojoType="dijit.form.Select">
  137. <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
  138. <option value="all_articles"><?php echo __('All Articles') ?></option>
  139. <option value="marked"><?php echo __('Starred') ?></option>
  140. <option value="published"><?php echo __('Published') ?></option>
  141. <option value="unread"><?php echo __('Unread') ?></option>
  142. <option value="has_note"><?php echo __('With Note') ?></option>
  143. <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
  144. </select>
  145. <select title="<?php echo __('Sort articles') ?>"
  146. onchange="viewModeChanged()"
  147. dojoType="dijit.form.Select" name="order_by">
  148. <option selected="selected" value="default"><?php echo __('Default') ?></option>
  149. <option value="feed_dates"><?php echo __('Newest first') ?></option>
  150. <option value="date_reverse"><?php echo __('Oldest first') ?></option>
  151. <option value="title"><?php echo __('Title') ?></option>
  152. </select>
  153. <div dojoType="dijit.form.ComboButton" onclick="catchupCurrentFeed()">
  154. <span><?php echo __('Mark as read') ?></span>
  155. <div dojoType="dijit.DropDownMenu">
  156. <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1day')">
  157. <?php echo __('Older than one day') ?>
  158. </div>
  159. <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1week')">
  160. <?php echo __('Older than one week') ?>
  161. </div>
  162. <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('2week')">
  163. <?php echo __('Older than two weeks') ?>
  164. </div>
  165. </div>
  166. </div>
  167. </form>
  168. <div class="actionChooser">
  169. <?php
  170. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
  171. echo $p->hook_toolbar_button();
  172. }
  173. ?>
  174. <button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
  175. title="<?php echo __("Communication problem with server.") ?>">
  176. <img
  177. src="images/error.png" />
  178. </button>
  179. <div dojoType="dijit.form.DropDownButton">
  180. <span><?php echo __('Actions...') ?></span>
  181. <div dojoType="dijit.Menu" style="display: none">
  182. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
  183. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
  184. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
  185. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
  186. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
  187. <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRescoreFeed')"><?php echo __('Rescore feed') ?></div> -->
  188. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
  189. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
  190. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
  191. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
  192. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
  193. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
  194. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagSelect')"><?php echo __('Select by tags...') ?></div>
  195. <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
  196. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
  197. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
  198. <?php
  199. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
  200. echo $p->hook_action_item();
  201. }
  202. ?>
  203. <?php if (!$_SESSION["hide_logout"]) { ?>
  204. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
  205. <?php } ?>
  206. </div>
  207. </div>
  208. <button id="updatesIcon" dojoType="dijit.form.Button" style="display : none">
  209. <img src="images/new_version.png" title="<?php echo __('Updates are available from Git.') ?>"/>
  210. </button>
  211. </div>
  212. </div> <!-- toolbar -->
  213. </div> <!-- toolbar pane -->
  214. <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
  215. <div id="floatingTitle" style="visibility : hidden"></div>
  216. <div id="headlines-frame" dojoType="dijit.layout.ContentPane"
  217. onscroll="headlines_scroll_handler(this)" region="center">
  218. <div id="headlinesInnerContainer">
  219. <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
  220. </div>
  221. </div>
  222. <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
  223. style="height : 50%" splitter="true"></div>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. </body>
  229. </html>