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