]> git.wh0rd.org - tt-rss.git/blob - index.php
pngcrush.sh
[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 "//ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js?load=effects,controls",
104 // "//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js",
105 "lib/dojo/dojo.js",
106 "lib/dojo/tt-rss-layer.js",
107 "errors.php?mode=js") as $jsfile) {
108
109 if ($jsfile == "klib/dojo/dojo.js") {?>
110 <script data-dojo-config="async: 1, dojoBlankHtmlUrl: '/lib/dojo/resources/blank.html',
111 packages: [ {
112 name: 'custom',
113 location: location.pathname.replace(/\/[^/]+$/, '') + '/js/custom'
114 } ]"
115 src="//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js"></script>
116 <?} else
117
118 echo javascript_tag($jsfile);
119
120 } ?>
121
122 <script type="text/javascript">
123 'use strict';
124 require({cache:{}});
125 <?php
126 print get_minified_js(["tt-rss.js",
127 "functions.js", "feedlist.js", "viewfeed.js", "PluginHost.js"]);
128 ?>
129 </script>
130 <script type="text/javascript">
131 <?php
132 foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
133 if (method_exists($p, "get_js")) {
134 echo "try {";
135 echo JShrink\Minifier::minify($p->get_js());
136 echo "} catch (e) {
137 console.warn('failed to initialize plugin JS: $n');
138 console.warn(e);
139 }";
140 }
141 }
142
143 init_js_translations();
144 ?>
145 </script>
146
147 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
148 <meta name="referrer" content="no-referrer"/>
149
150 <script type="text/javascript">
151 Event.observe(window, 'load', function() {
152 init();
153 });
154 </script>
155 </head>
156
157 <body class="claro ttrss_main">
158
159 <div id="overlay" style="display : block">
160 <div id="overlay_inner">
161 <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
162 <div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
163 progress="0" maximum="100">
164 </div>
165 <noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
166 </div>
167 </div>
168
169 <div id="notify" class="notify"></div>
170 <div id="cmdline" style="display : none"></div>
171
172 <div id="main" dojoType="dijit.layout.BorderContainer">
173
174 <div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
175 <div id="feedlistLoading">
176 <img src='images/indicator_tiny.gif'/>
177 <?php echo __("Loading, please wait..."); ?></div>
178 <div id="feedTree"></div>
179 </div>
180
181 <div dojoType="dijit.layout.BorderContainer" region="center" id="header-wrap" gutters="false">
182 <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
183
184 <div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
185 <div id="main-toolbar" dojoType="dijit.Toolbar">
186
187 <?php
188 foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_MAIN_TOOLBAR_BUTTON) as $p) {
189 echo $p->hook_main_toolbar_button();
190 }
191 ?>
192
193 <form id="headlines-toolbar" action="" onsubmit='return false'>
194
195 </form>
196
197 <form id="main_toolbar_form" action="" onsubmit='return false'>
198
199 <select name="view_mode" title="<?php echo __('Show articles') ?>"
200 onchange="viewModeChanged()"
201 dojoType="dijit.form.Select">
202 <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
203 <option value="all_articles"><?php echo __('All Articles') ?></option>
204 <option value="marked"><?php echo __('Starred') ?></option>
205 <option value="published"><?php echo __('Published') ?></option>
206 <option value="unread"><?php echo __('Unread') ?></option>
207 <option value="has_note"><?php echo __('With Note') ?></option>
208 <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
209 </select>
210
211 <select title="<?php echo __('Sort articles') ?>"
212 onchange="viewModeChanged()"
213 dojoType="dijit.form.Select" name="order_by">
214 <option selected="selected" value="default"><?php echo __('Default') ?></option>
215 <option value="feed_dates"><?php echo __('Newest first') ?></option>
216 <option value="date_reverse"><?php echo __('Oldest first') ?></option>
217 <option value="title"><?php echo __('Title') ?></option>
218 </select>
219
220 <div dojoType="dijit.form.ComboButton" onclick="catchupCurrentFeed()">
221 <span><?php echo __('Mark as read') ?></span>
222 <div dojoType="dijit.DropDownMenu">
223 <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1day')">
224 <?php echo __('Older than one day') ?>
225 </div>
226 <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1week')">
227 <?php echo __('Older than one week') ?>
228 </div>
229 <div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('2week')">
230 <?php echo __('Older than two weeks') ?>
231 </div>
232 </div>
233 </div>
234
235 </form>
236
237 <div class="actionChooser">
238
239 <?php
240 foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
241 echo $p->hook_toolbar_button();
242 }
243 ?>
244
245 <button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
246 title="<?php echo __("Communication problem with server.") ?>">
247 <img src="images/error.png" />
248 </button>
249
250 <div dojoType="dijit.form.DropDownButton">
251 <span><?php echo __('Actions...') ?></span>
252 <div dojoType="dijit.Menu" style="display: none">
253 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
254 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
255 <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
256 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
257 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
258 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
259 <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
260 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
261 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
262 <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
263 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
264 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
265
266 <?php
267 foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
268 echo $p->hook_action_item();
269 }
270 ?>
271
272 <?php if (!$_SESSION["hide_logout"]) { ?>
273 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
274 <?php } ?>
275 </div>
276 </div>
277
278 <button id="updatesIcon" dojoType="dijit.form.Button" style="display : none">
279 <img src="images/new_version.png" title="<?php echo __('Updates are available from Git.') ?>"/>
280 </button>
281 </div>
282 </div> <!-- toolbar -->
283 </div> <!-- toolbar pane -->
284
285 <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
286
287 <div id="floatingTitle" style="visibility : hidden"></div>
288
289 <div id="headlines-frame" dojoType="dijit.layout.ContentPane" tabindex="0"
290 onscroll="headlines_scroll_handler(this)" region="center">
291 <div id="headlinesInnerContainer">
292 <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
293 </div>
294 </div>
295
296 <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
297 style="height : 50%" splitter="true"></div>
298
299 </div>
300 </div>
301 </div>
302 </div>
303
304 </body>
305 </html>