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