]> git.wh0rd.org Git - tt-rss.git/blob - tt-rss.php
2906241ab39e63b006a8bb1394bb858cac596c56
[tt-rss.git] / tt-rss.php
1 <?
2         require_once "functions.php"; 
3
4         basic_nosid_redirect_check();
5
6         require_once "sessions.php";
7
8         require_once "sanity_check.php";
9         require_once "version.php"; 
10         require_once "config.php";
11         require_once "db-prefs.php";
12
13         $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
14
15         login_sequence($link);
16
17         $dt_add = get_script_dt_add();
18
19 ?>
20 <html>
21 <head>
22         <title>Tiny Tiny RSS</title>
23
24         <link rel="stylesheet" type="text/css" href="tt-rss.css">
25
26         <?      $user_theme = $_SESSION["theme"];
27                 if ($user_theme) { ?>
28                 <link rel="stylesheet" type="text/css" href="themes/<?= $user_theme ?>/theme.css">
29         <? } ?>
30
31         <? $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
32         <? if ($user_css_url) { ?>
33                 <link type="text/css" href="<?= $user_css_url ?>"/> 
34         <? } ?>
35
36         <? if (get_pref($link, 'USE_COMPACT_STYLESHEET')) { ?>
37
38                 <link rel="stylesheet" href="tt-rss_compact.css" type="text/css">
39
40         <? } else { ?>
41
42                 <link title="Compact Stylesheet" rel="alternate stylesheet" 
43                         type="text/css" href="tt-rss_compact.css"/> 
44
45         <? } ?>
46
47         <script type="text/javascript" src="tt-rss.js?<?= $dt_add ?>"></script>
48         <script type="text/javascript" src="functions.js?<?= $dt_add ?>"></script>
49         <!--[if gte IE 5.5000]>
50                 <script type="text/javascript" src="pngfix.js"></script>
51                 <link rel="stylesheet" type="text/css" href="tt-rss-ie.css">
52         <![endif]-->
53         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
54
55         <script type="text/javascript">
56                 if (navigator.userAgent.match("Opera")) {
57                         document.write('<link rel="stylesheet" type="text/css" href="opera.css">');
58                 }
59         </script>
60 </head>
61
62 <body>
63
64 <div id="overlay"><div id="overlay_inner">Loading, please wait...</div></div>
65
66 <script type="text/javascript">
67 if (document.addEventListener) {
68         document.addEventListener("DOMContentLoaded", init, null);
69 }
70 window.onload = init;
71 </script>
72
73 <? if (ENABLE_UPDATE_DAEMON && !file_is_locked("update_daemon.lock")) { ?>
74         <div class="warning">
75                 <b>Warning:</b> Update daemon is enabled in configuration, but daemon
76                 process is not running, which prevents all feeds from updating. Please
77                 start the daemon process or contact instance owner.
78         </div>
79 <? } ?>
80
81 <ul id="debug_output"></ul>
82
83 <table width="100%" height="100%" cellspacing="0" cellpadding="0" class="main">
84 <? if (get_pref($link, 'DISPLAY_HEADER')) { ?>
85 <tr>
86         <td colspan="2" class="headerBox" id="mainHeader">
87                 <table cellspacing="0" cellpadding="0" width="100%"><tr>
88                         <td rowspan="2" class="header" valign="middle"> 
89                                 <img src="images/ttrss_logo.png" alt="logo">    
90                         </td>
91                         <td valign="top" class="notifyBox">
92                                 <div id="notify"><span id="notify_body">&nbsp;</span></div>
93                         </td>
94
95                         <div id="userDlgShadow"><div id="userDlg">&nbsp;</div></div>
96
97                 </tr><tr><td class="welcomePrompt">
98                         <? if (!SINGLE_USER_MODE) { ?>
99                                 Hello, <b><?= $_SESSION["name"] ?></b>
100                                 (<a href="logout.php">Logout</a>)
101                         <? } ?>
102                         </td>                   
103                 </tr></table>
104         </td>
105 </tr>
106 <? } else { ?>
107 <tr>
108         <td class="small" id="mainHeader">
109                 <div id="notify"><span id="notify_body">&nbsp;</span></div>
110                 <div id="userDlgShadow"><div id="userDlg">&nbsp;</div></div>
111         </td><td class="welcomePrompt">
112                 <? if (!SINGLE_USER_MODE) { ?>
113                         Hello, <b><?= $_SESSION["name"] ?></b>
114                         (<a href="logout.php">Logout</a>)
115                 <? } ?>
116 </td></tr>
117 <? } ?>
118 <tr>
119         <? if (get_pref($link, 'COMBINED_DISPLAY_MODE')) 
120                         $feeds_rowspan = 2;
121                 else 
122                         $feeds_rowspan = 3; ?>
123         <td valign="top" rowspan="<?= $feeds_rowspan ?>" class="feeds"> 
124                 <table class="innerFeedTable" 
125                         cellspacing="0" cellpadding="0" height="100%" width="100%">
126                 <tr><td>
127                         <div id="dispSwitch"> 
128                         <a id="dispSwitchPrompt" href="javascript:toggleTags()">display tags</a>
129                 </div>
130                 </td></tr>      
131                 <tr><td height="100%" width="100%" valign="top">
132
133                 <iframe frameborder="0" 
134                         src="backend.php?op=error&msg=Loading,%20please wait..."
135                         id="feeds-frame" name="feeds-frame" class="feedsFrame"> </iframe>
136
137                 </td></tr></table>
138
139         </td>
140         <td valign="top" class="headlinesToolbarBox">
141                 <table width="100%" cellpadding="0" cellspacing="0">
142
143                 <tr><td class="headlinesToolbar" id="headlinesToolbar">
144
145                 <? if (get_pref($link, 'ENABLE_SEARCH_TOOLBAR')) { ?>
146
147                 <input id="searchbox"
148                         onblur="javascript:enableHotkeys();" onfocus="javascript:disableHotkeys();">
149                 <select id="searchmodebox">
150                         <option>This feed</option>
151                         <? if (get_pref($link, 'ENABLE_FEED_CATS')) { ?>
152                         <option>This category</option>
153                         <? } ?>
154                         <option>All feeds</option>
155                 </select>
156                 
157                 <input type="submit" 
158                         class="button" onclick="javascript:search()" value="Search">
159
160                 &nbsp;
161                 
162                 <? } ?>
163                 
164                 View: 
165                 
166                 <select id="viewbox" onchange="javascript:viewCurrentFeed(0, '')">
167                         <option selected>Adaptive</option>
168                         <option>All Articles</option>
169                         <option>Starred</option>
170                         <option>Unread</option>
171                 </select>
172
173                 &nbsp;Limit:
174
175                 <select id="limitbox" onchange="javascript:viewCurrentFeed(0, '')">
176                 
177                 <?
178                         $limits = array(15 => 15, 30 => 30, 60 => 60);
179                         
180                         $def_art_limit = get_pref($link, 'DEFAULT_ARTICLE_LIMIT');
181
182                         if ($def_art_limit >= 0 && !array_key_exists($def_art_limit, $limits)) {
183                                 $limits[$def_art_limit] = $def_art_limit; 
184                         }
185
186                         asort($limits);
187                         array_push($limits, 0);
188
189                         if (!$def_art_limit) {
190                                 $def_art_limit = 30;
191                         }
192
193                         foreach ($limits as $key) {
194                                 print "<option";
195                                 if ($key == $def_art_limit) { print " selected"; }
196                                 print ">";
197                                 
198                                 if ($limits[$key] == 0) { print "All"; } else { print $limits[$key]; }
199                                 
200                                 print "</option>";
201                         } ?>
202                 
203                 </select>
204
205 <!--            &nbsp;Selection:
206
207                 <select id="headopbox">
208                         <option id="hopToggleRead">Toggle (un)read</option>
209                 </select>
210
211                 <input class="button" type="submit" onclick="headopGo()" value="Go"> -->
212
213                 &nbsp;Feed: <input class="button" type="submit"
214                         onclick="javascript:viewCurrentFeed(0, 'ForceUpdate')" value="Update">
215
216                 <input class="button" type="submit" id="btnMarkFeedAsRead"
217                         onclick="javascript:viewCurrentFeed(0, 'MarkAllRead')" value="Mark as read"> 
218
219                 </td>
220                 <td align="right">
221                         <select id="quickMenuChooser" onchange="quickMenuChange()">
222                                 <option id="qmcDefault" selected>Actions...</option>
223                                 <option id="qmcPrefs">Preferences</option>
224                                 <option id="qmcSearch">Search</option>
225                                 <option disabled>--------</option>
226                                 <option style="color : #5050aa" disabled>Feed actions:</option>
227                                 <option id="qmcAddFeed">&nbsp;&nbsp;Add new feed</option>
228                                 <option id="qmcRemoveFeed">&nbsp;&nbsp;Remove this feed</option>
229                                 <!-- <option>Edit this feed</option> -->
230                                 <option disabled>--------</option>
231                                 <option style="color : #5050aa" disabled>All feeds:</option>
232                                 <? if (!ENABLE_UPDATE_DAEMON) { ?>
233                                 <option id="qmcUpdateFeeds">&nbsp;&nbsp;Update</option>
234                                 <? } ?>
235                                 <option id="qmcCatchupAll">&nbsp;&nbsp;Mark as read</option>                            
236                                 <option id="qmcShowOnlyUnread">&nbsp;&nbsp;Show only unread</option>
237                                 <option disabled>--------</option>
238                                 <option style="color : #5050aa" disabled>Other actions:</option>                                
239                                 <option id="qmcAddFilter">&nbsp;&nbsp;Add filter</option>
240                         </select>
241                 </td>
242                 </tr>
243                 </table>
244         </td>
245 </tr>
246 <? if (get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?>
247 <tr>
248         <td id="headlines" class="headlines2" valign="top">
249                 <iframe frameborder="0" name="headlines-frame" 
250                         id="headlines-frame" class="headlinesFrame" 
251                                 src="backend.php?op=error&msg=No%20feed%20selected."></iframe>
252         </td>
253 </tr>
254 <? } else { ?>
255 <tr>
256         <td id="headlines" class="headlines" valign="top">
257                 <iframe frameborder="0" name="headlines-frame" 
258                         id="headlines-frame" class="headlinesFrame" 
259                                 src="backend.php?op=error&msg=No%20feed%20selected."></iframe>
260         </td>
261 </tr><tr>
262         <td class="content" id="content" valign="top">
263                 <iframe frameborder="0" name="content-frame" 
264                         id="content-frame" class="contentFrame"> </iframe>
265         </td>
266 </tr>
267 <? } ?>
268 <? if (get_pref($link, 'DISPLAY_FOOTER')) { ?>
269 <tr>
270         <td colspan="2" class="footer" id="mainFooter">
271                 <a href="http://tt-rss.spb.ru/">Tiny-Tiny RSS</a> v<?= VERSION ?> &copy; 2005-2006 Andrew Dolgov
272                 <? if (WEB_DEMO_MODE) { ?>
273                 <br>Running in demo mode, some functionality is disabled.
274                 <? } ?>
275         </td>
276 </td>
277 <? } ?>
278 </table>
279
280 <? db_close($link); ?>
281
282 <script type="text/javascript">
283         /* for IE */
284         function statechange() {
285                 if (document.readyState == "interactive") init();
286         }
287
288         if (document.readyState) {      
289                 if (document.readyState == "interactive" || document.readyState == "complete") {
290                         init();
291                 } else {
292                         document.onreadystatechange = statechange;
293                 }
294         }
295 </script>
296
297 </body>
298 </html>