index.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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 "sessions.php";
  19. require_once "functions.php";
  20. require_once "sanity_check.php";
  21. require_once "version.php";
  22. require_once "config.php";
  23. require_once "db-prefs.php";
  24. require_once "lib/Mobile_Detect.php";
  25. $mobile = new Mobile_Detect();
  26. $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
  27. if (!init_connection($link)) return;
  28. global $pluginhost;
  29. if (!$_REQUEST['mobile']) {
  30. if ($mobile->isTablet() && $pluginhost->get_plugin("digest")) {
  31. header('Location: backend.php?op=digest');
  32. exit;
  33. } else if ($mobile->isMobile() && $pluginhost->get_plugin("mobile")) {
  34. header('Location: backend.php?op=mobile');
  35. exit;
  36. } else if ($mobile->isMobile() && $pluginhost->get_plugin("digest")) {
  37. header('Location: backend.php?op=digest');
  38. exit;
  39. }
  40. }
  41. login_sequence($link);
  42. no_cache_incantation();
  43. header('Content-Type: text/html; charset=utf-8');
  44. ?>
  45. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  46. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  47. <html>
  48. <head>
  49. <title>Tiny Tiny RSS</title>
  50. <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
  51. <?php echo stylesheet_tag("tt-rss.css"); ?>
  52. <?php echo stylesheet_tag("cdm.css"); ?>
  53. <?php print_user_stylesheet($link) ?>
  54. <style type="text/css">
  55. <?php
  56. foreach ($pluginhost->get_plugins() as $n => $p) {
  57. if (method_exists($p, "get_css")) {
  58. echo $p->get_css();
  59. }
  60. }
  61. ?>
  62. </style>
  63. <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
  64. <link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />
  65. <?php
  66. foreach (array("lib/prototype.js",
  67. "lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls",
  68. "lib/dojo/dojo.js",
  69. "lib/dijit/dijit.js",
  70. "lib/dojo/tt-rss-layer.js",
  71. "errors.php?mode=js") as $jsfile) {
  72. echo javascript_tag($jsfile);
  73. } ?>
  74. <script type="text/javascript">
  75. <?php
  76. require 'lib/jshrink/Minifier.php';
  77. global $pluginhost;
  78. foreach ($pluginhost->get_plugins() as $n => $p) {
  79. if (method_exists($p, "get_js")) {
  80. echo JShrink\Minifier::minify($p->get_js());
  81. }
  82. }
  83. print get_minified_js(array("tt-rss",
  84. "functions", "feedlist", "viewfeed", "FeedTree"));
  85. init_js_translations();
  86. ?>
  87. </script>
  88. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  89. <script type="text/javascript">
  90. Event.observe(window, 'load', function() {
  91. init();
  92. });
  93. </script>
  94. </head>
  95. <body id="ttrssMain" class="claro">
  96. <div id="overlay" style="display : block">
  97. <div id="overlay_inner">
  98. <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
  99. <div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
  100. progress="0" maximum="100">
  101. </div>
  102. <noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
  103. </div>
  104. </div>
  105. <div style="display : none" onclick="Element.hide(this)" id="small_article_preview"></div>
  106. <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
  107. <div id="cmdline" style="display : none"></div>
  108. <div id="auxDlg" style="display : none"></div>
  109. <div id="headlines-tmp" style="display : none"></div>
  110. <div id="main" dojoType="dijit.layout.BorderContainer">
  111. <div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
  112. <div id="feedlistLoading">
  113. <img src='images/indicator_tiny.gif'/>
  114. <?php echo __("Loading, please wait..."); ?></div>
  115. <div id="feedTree"></div>
  116. </div>
  117. <div dojoType="dijit.layout.BorderContainer" region="center" id="header-wrap" gutters="false">
  118. <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
  119. <div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
  120. <div id="main-toolbar" dojoType="dijit.Toolbar">
  121. <form id="main_toolbar_form" action="" onsubmit='return false'>
  122. <button dojoType="dijit.form.Button" id="collapse_feeds_btn"
  123. onclick="collapse_feedlist()"
  124. title="<?php echo __('Collapse feedlist') ?>" style="display : inline">
  125. &lt;&lt;</button>
  126. <select name="view_mode" title="<?php echo __('Show articles') ?>"
  127. onchange="viewModeChanged()"
  128. dojoType="dijit.form.Select">
  129. <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
  130. <option value="all_articles"><?php echo __('All Articles') ?></option>
  131. <option value="marked"><?php echo __('Starred') ?></option>
  132. <option value="published"><?php echo __('Published') ?></option>
  133. <option value="unread"><?php echo __('Unread') ?></option>
  134. <option value="unread_first"><?php echo __('Unread First') ?></option>
  135. <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
  136. </select>
  137. <select title="<?php echo __('Sort articles') ?>"
  138. onchange="viewModeChanged()"
  139. dojoType="dijit.form.Select" name="order_by">
  140. <option selected="selected" value="default"><?php echo __('Default') ?></option>
  141. <option value="date"><?php echo __('Date') ?></option>
  142. <option value="title"><?php echo __('Title') ?></option>
  143. <option value="score"><?php echo __('Score') ?></option>
  144. </select>
  145. <!-- deprecated -->
  146. <button dojoType="dijit.form.Button" name="update" style="display : none"
  147. onclick="viewCurrentFeed()">
  148. <?php echo __('Update') ?></button>
  149. <button dojoType="dijit.form.Button"
  150. onclick="catchupCurrentFeed()">
  151. <?php echo __('Mark as read') ?></button>
  152. </form>
  153. <div class="actionChooser">
  154. <button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
  155. title="<?php echo __("Communication problem with server.") ?>">
  156. <img
  157. src="images/alert.png" />
  158. </button>
  159. <button id="newVersionIcon" dojoType="dijit.form.Button" style="display : none">
  160. <img onclick="newVersionDlg()"
  161. src="images/new_version.png"
  162. title="<?php echo __('New version of Tiny Tiny RSS is available!') ?>" />
  163. </button>
  164. <div dojoType="dijit.form.DropDownButton">
  165. <span><?php echo __('Actions...') ?></span>
  166. <div dojoType="dijit.Menu" style="display: none">
  167. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
  168. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
  169. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
  170. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
  171. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
  172. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRescoreFeed')"><?php echo __('Rescore feed') ?></div>
  173. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
  174. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
  175. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
  176. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
  177. <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
  178. <?php if ($pluginhost->get_plugin("digest")) { ?>
  179. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcDigest')"><?php echo __('Switch to digest...') ?></div>
  180. <?php } ?>
  181. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagCloud')"><?php echo __('Show tag cloud...') ?></div>
  182. <?php if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?>
  183. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
  184. <?php } ?>
  185. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagSelect')"><?php echo __('Select by tags...') ?></div>
  186. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
  187. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div>
  188. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
  189. <?php if (!$_SESSION["hide_logout"]) { ?>
  190. <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
  191. <?php } ?>
  192. </div>
  193. </div>
  194. </div>
  195. </div> <!-- toolbar -->
  196. </div> <!-- toolbar pane -->
  197. <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
  198. <div id="headlines-toolbar" dojoType="dijit.layout.ContentPane" region="top">
  199. </div>
  200. <div id="headlines-frame" dojoType="dijit.layout.ContentPane"
  201. onscroll="headlines_scroll_handler(this)" region="center">
  202. <div id="headlinesInnerContainer">
  203. <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
  204. </div>
  205. </div>
  206. <?php if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?>
  207. <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
  208. style="height : 50%" splitter="true"></div>
  209. <?php } ?>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. <?php db_close($link); ?>
  215. </body>
  216. </html>