]> git.wh0rd.org Git - tt-rss.git/blob - tt-rss.php
add lib/
[tt-rss.git] / tt-rss.php
1 <?php
2         error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
4         require_once "functions.php"; 
5         require_once "sessions.php";
6         require_once "sanity_check.php";
7         require_once "version.php"; 
8         require_once "config.php";
9         require_once "db-prefs.php";
10
11         $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
12
13         login_sequence($link);
14
15         $dt_add = get_script_dt_add();
16
17         no_cache_incantation();
18
19         header('Content-Type: text/html; charset=utf-8');
20         
21 ?>
22 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
23         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
24 <html>
25 <head>
26         <title>Tiny Tiny RSS</title>
27
28         <link rel="stylesheet" type="text/css" href="tt-rss.css?<?php echo $dt_add ?>"/>
29
30         <?php   $user_theme = $_SESSION["theme"];
31                 if ($user_theme) { ?>
32                         <link rel="stylesheet" type="text/css" href="themes/<?php echo $user_theme ?>/theme.css?<?php echo $dt_add ?>">
33         <?php } ?>
34
35         <?php if ($user_theme) { $theme_image_path = "themes/$user_theme/"; } ?>
36
37         <?php $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
38         <?php if ($user_css_url) { ?>
39                 <link rel="stylesheet" type="text/css" href="<?php echo $user_css_url ?>"/> 
40         <?php } ?>
41
42         <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
43
44         <script type="text/javascript" src="prototype.js"></script>
45         <script type="text/javascript" src="scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
46         <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
47         <script type="text/javascript" charset="utf-8" src="tt-rss.js?<?php echo $dt_add ?>"></script>
48         <script type="text/javascript" charset="utf-8" src="functions.js?<?php echo $dt_add ?>"></script>
49         <script type="text/javascript" charset="utf-8" src="feedlist.js?<?php echo $dt_add ?>"></script>
50         <script type="text/javascript" charset="utf-8" src="viewfeed.js?<?php echo $dt_add ?>"></script>
51
52         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
53
54         <script type="text/javascript">
55         //<![CDATA[
56                 if (navigator.userAgent.match("Opera")) {
57                         document.write('<link rel="stylesheet" type="text/css" href="opera.css">');
58                 }
59                 if (navigator.userAgent.match("Gecko") && !navigator.userAgent.match("KHTML")) {
60                         document.write('<link rel="stylesheet" type="text/css" href="gecko.css">');
61                 }
62                 window.onresize=resize_headlines;
63         //]]>
64         </script>
65 </head>
66
67 <body id="ttrssMain">
68
69 <div id="overlay" style="display : block">
70         <div id="overlay_inner">
71                 <?php echo __("Loading, please wait...") ?>
72
73                 <div id="l_progress_o">
74                         <div id="l_progress_i"></div>
75                 </div>
76
77         <noscript>
78                 <div class="error"><?php echo
79                 __("Your browser doesn't support Javascript, which is required
80                 for this application to function properly. Please check your
81                 browser settings.") ?></div>
82         </noscript>
83         </div>
84 </div> 
85
86 <div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
87         <?php rounded_table_start("hho"); ?>
88         <?php include "help/3.php" ?>
89         <?php rounded_table_end(); ?>
90 </div>
91
92 <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
93
94 <div id="fatal_error"><div id="fatal_error_inner">
95         <h1>Fatal Error</h1>
96         <div id="fatal_error_msg">Unknown Error</div>
97 </div></div>
98
99 <div id="dialog_overlay" style="display : none"> </div>
100
101 <script type="text/javascript">
102 if (document.addEventListener) {
103         document.addEventListener("DOMContentLoaded", init, null);
104 }
105 window.onload = init;
106 </script>
107
108 <ul id="debug_output" style='display : none'><li>&nbsp;</li></ul>
109
110 <div id="infoBoxShadow"><div id="infoBox">&nbsp;</div></div>
111
112 <div id="header">
113         <div class="topLinks">
114         <?php if (!SINGLE_USER_MODE) { ?>
115                         <?php echo __('Hello,') ?> <b><?php echo $_SESSION["name"] ?></b> |
116         <?php } ?>
117         <a href="prefs.php"><?php echo __('Preferences') ?></a>
118
119         <?php if (defined('FEEDBACK_URL') && FEEDBACK_URL) { ?>
120                 | <a target="_blank" class="feedback" href="<?php echo FEEDBACK_URL ?>">
121                                 <?php echo __('Comments?') ?></a>
122         <?php } ?>
123
124         <?php if (!SINGLE_USER_MODE) { ?>
125                         | <a href="logout.php"><?php echo __('Logout') ?></a>
126         <?php } ?>
127
128         <img id="newVersionIcon" style="display:none;" onclick="javascript:explainError(2)" 
129                 src="images/new_version.png" title="New version is available!" 
130                 alt="new_version_icon"/>
131         </div>
132         <img src="<?php echo $theme_image_path ?>images/ttrss_logo.png" alt="Tiny Tiny RSS"/>   
133 </div>
134
135 <div id="feeds-holder">
136         <div id="dispSwitch"> 
137                 <a id="dispSwitchPrompt" 
138                         href="javascript:toggleTags()"><?php echo __("tag cloud") ?></a>
139                 <?php if (!SINGLE_USER_MODE) { ?>
140                 <br/>
141                 <a id="feedBrowserPrompt" href="prefs.php?tab=feedBrowser" 
142                         title="<?php echo __('More feeds...') ?>">+</a>
143                 <?php } ?>
144         </div>
145         <div id="feeds-frame">&nbsp;</div>
146 </div>
147
148 <div id="toolbar">
149
150                 <div style="float : right">
151                         <select id="quickMenuChooser" onchange="quickMenuChange()">
152                                         <option value="qmcDefault" selected="selected"><?php echo __('Actions...') ?></option>
153                                         <option value="qmcSearch"><?php echo __('Search...') ?></option>
154                                         <!-- <option value="qmcPrefs"><?php echo __('Preferences') ?></option> -->
155                                         <option disabled="disabled">--------</option>
156                                         <option style="color : #5050aa" disabled="disabled"><?php echo __('Feed actions:') ?></option>
157                                         <option value="qmcAddFeed">&nbsp;&nbsp;<?php echo __('Subscribe to feed...') ?></option>
158                                         <option value="qmcEditFeed">&nbsp;&nbsp;<?php echo __('Edit this feed...') ?></option>
159                                         <!-- <option value="qmcClearFeed">&nbsp;&nbsp;<?php echo __('Clear articles') ?></option> -->
160                                         <option value="qmcRescoreFeed">&nbsp;&nbsp;<?php echo __('Rescore feed') ?></option>
161                                         <option value="qmcRemoveFeed">&nbsp;&nbsp;<?php echo __('Unsubscribe') ?></option>
162                                         <option disabled="disabled">--------</option>
163                                         <option style="color : #5050aa" disabled="disabled"><?php echo __('All feeds:') ?></option>
164                                         <option value="qmcCatchupAll">&nbsp;&nbsp;<?php echo __('Mark as read') ?></option>
165                                         <option value="qmcShowOnlyUnread">&nbsp;&nbsp;<?php echo __('(Un)hide read feeds') ?></option>
166                                         <option disabled="disabled">--------</option>
167                                         <option style="color : #5050aa" disabled="disabled"><?php echo __('Other actions:') ?></option>                         
168
169                                         <option value="qmcAddLabel">&nbsp;&nbsp;<?php echo __('Create label...') ?></option>
170                                         <option value="qmcAddFilter">&nbsp;&nbsp;<?php echo __('Create filter...') ?></option>
171                                         <option value="qmcResetUI">&nbsp;&nbsp;<?php echo __('Reset UI layout') ?></option>
172                                         <option value="qmcResetCats">&nbsp;&nbsp;<?php echo __('Reset category order') ?></option>
173
174                                         <option value="qmcHKhelp"><?php echo __('&nbsp;&nbsp;Keyboard shortcuts') ?></option>
175                         </select>
176                 </div>
177
178                 <form id="main_toolbar_form" action="" onsubmit='return false'>
179
180                 <input type="submit" value="&lt;&lt;" 
181                         id="collapse_feeds_btn" onclick="collapse_feedlist()" class="button"
182                         title="<?php echo __('Collapse feedlist') ?>" style="display : none"/>
183
184                 <input type="submit" value="<?php echo __("Toggle Feedlist") ?>" 
185                         id="toggle_feeds_btn" class="button"
186                         onclick="toggle_feedlist()" style="display : none"/>
187
188                 &nbsp;
189
190                 <?php if (get_pref($link, 'ENABLE_SEARCH_TOOLBAR')) { ?>
191
192                 <?php echo __('Search:') ?>
193                 <input name="query" type="text"
194                         onkeypress="return filterCR(event, viewCurrentFeed)"
195                         onblur="javascript:enableHotkeys();" onfocus="javascript:disableHotkeys();"/>
196
197                 <?php } ?>
198
199                 <select name="view_mode" onchange="viewModeChanged()">
200                         <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
201                         <option value="all_articles"><?php echo __('All Articles') ?></option>
202                         <option value="marked"><?php echo __('Starred') ?></option>
203                         <option value="unread"><?php echo __('Unread') ?></option>
204                         <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
205                         <option value="updated"><?php echo __('Updated') ?></option>
206                 </select>
207
208                 <?php echo __('Order:') ?>
209
210                 <select name="order_by" onchange="viewModeChanged()">
211                         <option selected="selected" value="default"><?php echo __('Default') ?></option>
212                         <option value="date"><?php echo __('Date') ?></option>
213                         <option value="title"><?php echo __('Title') ?></option>
214                         <option value="score"><?php echo __('Score') ?></option>
215                 </select>
216
217
218                 <?php echo __('Limit:') ?>
219                 <?php
220                 $limits = array(15 => 15, 30 => 30, 60 => 60, 0 => "All");
221                         
222                 $def_art_limit = get_pref($link, 'DEFAULT_ARTICLE_LIMIT');
223
224                 if ($def_art_limit >= 0 && !array_key_exists($def_art_limit, $limits)) {
225                         $limits[$def_art_limit] = $def_art_limit; 
226                 }
227
228                 asort($limits);
229
230                 if (!$def_art_limit) {
231                         $def_art_limit = 30;
232                 }
233
234                 print_select_hash("limit", $def_art_limit, $limits, 
235                         'onchange="viewLimitChanged()"');
236         
237                 ?>              
238
239                 &nbsp;
240
241                 <input class="button" type="submit"
242                         onclick="return viewCurrentFeed('ForceUpdate')" 
243                         value="<?php echo __('Update') ?>"/>
244
245                 </form>
246
247                 <!-- &nbsp;<input class="button" type="submit"
248                         onclick="quickMenuGo('qmcSearch')" value="Search (tmp)"> -->
249
250                 <!-- <input class="button" type="submit"
251                         onclick="catchupCurrentFeed()" value="Mark as read">  -->
252
253         </div>
254
255 <?php if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?>
256         <div id="headlines-frame" class="headlines_normal">
257                 <div class="whiteBox"><?php echo __('No feed selected.') ?></div></div>
258         <div id="content-frame">
259         <div id="resize-grabber"
260                 onmouseover="enable_resize(true)" onmouseout="enable_resize(false)"
261                 title="<?php echo __('Drag me to resize panels') ?>"> 
262                 <img src="images/resize_handle_horiz.png" id="resize-handle" 
263                         onmouseover="enable_resize(true)" onmouseout="enable_resize(false)"
264                         alt=""/>
265                 </div>
266         <div id="content-insert">&nbsp;</div>
267         <!-- <div class="whiteBox">&nbsp;</div> --> </div>
268 <?php } else { ?>
269         <div id="headlines-frame" class="headlines_cdm">
270                 <div class="whiteBox"><?php echo __('No feed selected.') ?></div></div>
271 <?php } ?>
272
273 <div id="footer">
274         <?php if (defined('_DEBUG_USER_SWITCH')) { ?>
275                 <select id="userSwitch" onchange="userSwitch()">
276                 <?php 
277                         foreach (array('admin', 'fox', 'test') as $u) {
278                                 $op_sel = ($u == $_SESSION["name"]) ? "selected" : "";
279                                 print "<option $op_sel>$u</option>";
280                         }
281                 ?>
282                 </select>
283         <?php } ?>
284         <a href="http://tt-rss.org/">Tiny Tiny RSS</a>
285         <?php if (!defined('HIDE_VERSION')) { ?>
286                  v<?php echo VERSION ?> 
287         <?php } ?>
288         &copy; 2005&ndash;2009 <a href="http://bah.org.ru/">Andrew Dolgov</a>
289 </div>
290
291 <?php db_close($link); ?>
292
293 <script type="text/javascript">
294         /* for IE */
295         function statechange() {
296                 if (document.readyState == "interactive") init();
297         }
298
299         if (document.readyState) {      
300                 if (document.readyState == "interactive" || document.readyState == "complete") {
301                         init();
302                 } else {
303                         document.onreadystatechange = statechange;
304                 }
305         }
306 </script>
307
308 </body>
309 </html>