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