]> git.wh0rd.org Git - tt-rss.git/blob - index.php
No more "tunables.php" defaults dumped into "functions.php"
[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.3.0', '<')) {
15                 print "<b>Fatal Error</b>: PHP version 5.3.0 or newer required.\n";
16                 exit;
17         }
18
19         set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
20                 get_include_path());
21
22         require_once "sessions.php";
23         require_once "functions.php";
24         require_once "sanity_check.php";
25         require_once "version.php";
26         require_once "config.php";
27         require_once "db-prefs.php";
28         require_once "lib/Mobile_Detect.php";
29
30         $mobile = new Mobile_Detect();
31
32         $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
33
34         if (!init_connection($link)) return;
35
36         global $pluginhost;
37
38         if (!$_REQUEST['mobile']) {
39                 if ($mobile->isTablet() && $pluginhost->get_plugin("digest")) {
40                         header('Location: backend.php?op=digest');
41                         exit;
42                 } else if ($mobile->isMobile() && $pluginhost->get_plugin("mobile")) {
43                         header('Location: backend.php?op=mobile');
44                         exit;
45                 } else if ($mobile->isMobile() && $pluginhost->get_plugin("digest")) {
46                         header('Location: backend.php?op=digest');
47                         exit;
48                 }
49         }
50
51         login_sequence($link);
52
53         no_cache_incantation();
54
55         header('Content-Type: text/html; charset=utf-8');
56
57 ?>
58 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
59         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
60 <html>
61 <head>
62         <title>Tiny Tiny RSS</title>
63
64         <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
65         <?php echo stylesheet_tag("tt-rss.css"); ?>
66         <?php echo stylesheet_tag("cdm.css"); ?>
67
68         <?php if ($_SESSION["uid"]) {
69                 $theme = get_pref($link, "USER_CSS_THEME", $_SESSION["uid"], false);
70                 if ($theme) {
71                         echo stylesheet_tag("themes/$theme");
72                 }
73         }
74         ?>
75
76         <?php print_user_stylesheet($link) ?>
77
78         <style type="text/css">
79         <?php
80                 foreach ($pluginhost->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         <?php
92         foreach (array("lib/prototype.js",
93                                 "lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls",
94                                 "lib/dojo/dojo.js",
95                                 "lib/dijit/dijit.js",
96                                 "lib/dojo/tt-rss-layer.js",
97                                 "errors.php?mode=js") as $jsfile) {
98
99                 echo javascript_tag($jsfile);
100
101         } ?>
102
103         <script type="text/javascript">
104         <?php
105                 require 'lib/jshrink/Minifier.php';
106
107                 print get_minified_js(array("tt-rss",
108                         "functions", "feedlist", "viewfeed", "FeedTree"));
109
110                 global $pluginhost;
111
112                 foreach ($pluginhost->get_plugins() as $n => $p) {
113                         if (method_exists($p, "get_js")) {
114                                 echo JShrink\Minifier::minify($p->get_js());
115                         }
116                 }
117
118                 init_js_translations();
119         ?>
120         </script>
121
122         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
123
124         <script type="text/javascript">
125                 Event.observe(window, 'load', function() {
126                         init();
127                 });
128         </script>
129 </head>
130
131 <body id="ttrssMain" class="claro">
132
133 <div id="overlay" style="display : block">
134         <div id="overlay_inner">
135                 <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
136                 <div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
137              progress="0" maximum="100">
138                 </div>
139                 <noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
140         </div>
141 </div>
142
143 <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
144 <div id="cmdline" style="display : none"></div>
145 <div id="headlines-tmp" style="display : none"></div>
146
147 <div id="main" dojoType="dijit.layout.BorderContainer">
148
149 <div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
150         <div id="feedlistLoading">
151                 <img src='images/indicator_tiny.gif'/>
152                 <?php echo  __("Loading, please wait..."); ?></div>
153         <div id="feedTree"></div>
154 </div>
155
156 <div dojoType="dijit.layout.BorderContainer" region="center" id="header-wrap" gutters="false">
157 <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
158
159 <div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
160         <div id="main-toolbar" dojoType="dijit.Toolbar">
161
162                 <form id="main_toolbar_form" action="" onsubmit='return false'>
163
164                 <button dojoType="dijit.form.Button" id="collapse_feeds_btn"
165                         onclick="collapse_feedlist()"
166                         title="<?php echo __('Collapse feedlist') ?>" style="display : inline">
167                         &lt;&lt;</button>
168
169                 <select name="view_mode" title="<?php echo __('Show articles') ?>"
170                         onchange="viewModeChanged()"
171                         dojoType="dijit.form.Select">
172                         <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
173                         <option value="all_articles"><?php echo __('All Articles') ?></option>
174                         <option value="marked"><?php echo __('Starred') ?></option>
175                         <option value="published"><?php echo __('Published') ?></option>
176                         <option value="unread"><?php echo __('Unread') ?></option>
177                         <option value="unread_first"><?php echo __('Unread First') ?></option>
178                         <option value="has_note"><?php echo __('With Note') ?></option>
179                         <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
180                 </select>
181
182                 <select title="<?php echo __('Sort articles') ?>"
183                         onchange="viewModeChanged()"
184                         dojoType="dijit.form.Select" name="order_by">
185                         <option selected="selected" value="default"><?php echo __('Default') ?></option>
186                         <option value="feed_dates"><?php echo __('Newest first') ?></option>
187                         <option value="date_reverse"><?php echo __('Oldest first') ?></option>
188                 </select>
189
190                 <select title="<?php echo __('Mark feed as read') ?>"
191                         onchange="catchupCurrentFeed(this)"
192                         dojoType="dijit.form.Select" name="catchup_feed">
193                         <option selected="selected" value="default"><?php echo __('Mark as read') ?></option>
194                         <option value="all"><?php echo __('All articles') ?></option>
195                         <option value="1day"><?php echo __('Older than one day') ?></option>
196                         <option value="1week"><?php echo __('Older than one week') ?></option>
197                         <option value="2weeks"><?php echo __('Older than two weeks') ?></option>
198                 </select>
199
200                 </form>
201
202                 <div class="actionChooser">
203
204                         <?php
205                                 global $pluginhost;
206                                 foreach ($pluginhost->get_hooks($pluginhost::HOOK_TOOLBAR_BUTTON) as $p) {
207                                          echo $p->hook_toolbar_button();
208                                 }
209                         ?>
210
211                         <button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
212                                 title="<?php echo __("Communication problem with server.") ?>">
213                         <img
214                                 src="images/alert.png" />
215                         </button>
216
217                         <button id="newVersionIcon" dojoType="dijit.form.Button" style="display : none">
218                         <img onclick="newVersionDlg()"
219                                 src="images/new_version.png"
220                                 title="<?php echo __('New version of Tiny Tiny RSS is available!') ?>" />
221                         </button>
222
223
224                         <div dojoType="dijit.form.DropDownButton">
225                                 <span><?php echo __('Actions...') ?></span>
226                                 <div dojoType="dijit.Menu" style="display: none">
227                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
228                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
229                                         <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
230                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
231                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
232                                         <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRescoreFeed')"><?php echo __('Rescore feed') ?></div> -->
233                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
234                                         <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
235                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
236                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
237                                         <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
238                                         <!-- <?php if ($pluginhost->get_plugin("digest")) { ?>
239                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcDigest')"><?php echo __('Switch to digest...') ?></div>
240                                         <?php } ?> -->
241                                                 <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagCloud')"><?php echo __('Show tag cloud...') ?></div> -->
242                                                 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
243                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagSelect')"><?php echo __('Select by tags...') ?></div>
244                                         <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
245                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
246                                         <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
247
248                                         <?php
249                                                 foreach ($pluginhost->get_hooks($pluginhost::HOOK_ACTION_ITEM) as $p) {
250                                                  echo $p->hook_action_item();
251                                                 }
252                                         ?>
253
254                                         <?php if (!$_SESSION["hide_logout"]) { ?>
255                                                 <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
256                                         <?php } ?>
257                                 </div>
258                         </div>
259                 </div>
260         </div> <!-- toolbar -->
261 </div> <!-- toolbar pane -->
262
263         <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
264
265                 <div id="headlines-toolbar" dojoType="dijit.layout.ContentPane" region="top">
266                 </div>
267
268                 <div id="headlines-frame" dojoType="dijit.layout.ContentPane"
269                                 onscroll="headlines_scroll_handler(this)" region="center">
270                         <div id="headlinesInnerContainer">
271                                 <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
272                         </div>
273                 </div>
274
275                 <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
276                         style="height : 50%" splitter="true"></div>
277
278         </div>
279 </div>
280 </div>
281 </div>
282
283 <?php db_close($link); ?>
284
285 </body>
286 </html>