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