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