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