]> git.wh0rd.org Git - tt-rss.git/blob - tt-rss.php
fix http basic authentication
[tt-rss.git] / tt-rss.php
1 <?
2         session_start();
3         
4         require_once "version.php"; 
5         require_once "config.php";
6         require_once "db-prefs.php";
7         require_once "functions.php"; 
8
9         $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
10
11         if (!SINGLE_USER_MODE) {
12
13                 if (!USE_HTTP_AUTH) {
14                         if (!$_SESSION["uid"]) {
15                                 header("Location: login.php?rt=tt-rss.php");
16                                 exit;
17                         }
18                 } else {
19                         $force_logout = $_POST["ForceLogout"];
20                         http_authenticate_user($link, $force_logout == "yes");
21                 }
22         } else {
23                 $_SESSION["uid"] = 1;
24                 $_SESSION["name"] = "admin";
25         }
26
27 ?>
28 <html>
29 <head>
30         <title>Tiny Tiny RSS</title>
31
32         <link rel="stylesheet" type="text/css" href="tt-rss.css">
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="functions.js"></script>
46         <script type="text/javascript" src="tt-rss.js"></script>
47         <!--[if gte IE 5.5000]>
48                 <script type="text/javascript" src="pngfix.js"></script>
49         <![endif]-->
50         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
51 </head>
52
53 <body onload="init()">
54
55 <? if (get_pref($link, 'ENABLE_SPLASH')) { ?>
56 <div id="splash">
57         <table width='100%' height='100%'><tr>
58                 <td class="innerSplash" valign="middle" align="center">
59                 <img src="images/ttrss_logo.png" alt="logo">            
60                 <p>Loading, please wait...</p>
61         </td></tr></table>
62 </div>
63 <? } ?>
64
65 <table width="100%" height="100%" cellspacing="0" cellpadding="0" class="main">
66 <? if (get_pref($link, 'DISPLAY_HEADER')) { ?>
67 <tr>
68         <td colspan="2">
69                 <table cellspacing="0" cellpadding="0" width="100%"><tr>
70                         <td rowspan="2" class="header" valign="middle"> 
71                                 <img src="images/ttrss_logo.png" alt="logo">    
72                         </td>
73                         <td align="right" valign="top">
74                                 <div id="notify"><span id="notify_body"></div>
75                         </td>
76
77                         <div id="userDlg">&nbsp;</div>
78
79                 </tr><tr><td class="welcomePrompt">
80                         <? if (!SINGLE_USER_MODE) { ?>
81                         <? if (USE_HTTP_AUTH) { ?>
82                                 <table align="right"><tr>
83                                 <td class="httpWelcomePrompt">Hello, <b><?= $_SESSION["name"] ?></b></td>
84                                 <td><form action="tt-rss.php" method="POST">
85                                         <input type="hidden" name="ForceLogout" value="yes">
86                                         <input type="submit" class="button" value="Logout">
87                                 </form>
88                                 </td></tr></table>
89                         <? } else { ?>
90                                 Hello, <b><?= $_SESSION["name"] ?></b>(<a href="logout.php">Logout</a>)
91                         <? } ?>
92                         </td>                   
93                         <? } ?>
94                 </tr></table>
95         </td>
96 </tr>
97 <? } else { ?>
98         <div id="userDlg">&nbsp;</div>
99 <? } ?>
100 <tr>
101         <td valign="top" rowspan="3" class="feeds"> 
102                 
103                 <!-- <div id="feeds">&nbsp;</div> -->
104
105                 <div id="dispSwitch"> 
106                         <a id="dispSwitchPrompt" href="javascript:toggleTags()">display tags</a>
107                 </div>
108
109                 <iframe frameborder="0" 
110                         src="backend.php?op=error&msg=Loading,%20please wait..."
111                         id="feeds-frame" name="feeds-frame" class="feedsFrame"> </iframe>
112
113                 <? if (get_pref($link, 'DISPLAY_FEEDLIST_ACTIONS')) { ?>
114
115                 <div align="center">All feeds: 
116                 
117                 <select id="allFeedsChooser">
118                         <option>Update</option>
119                         <option>Mark as read</option>
120                         <option>Show only unread</option>
121                 </select>
122
123                 <input type="submit" class="button" onclick="allFeedsMenuGo()" value="Go">
124
125                 </div>
126
127                 <? } ?>
128
129         </td>
130         <td valign="top" class="headlinesToolbarBox">
131                 <table width="100%" cellpadding="0" cellspacing="0">
132                 
133                 <tr><td class="headlinesToolbar" id="headlinesToolbar">
134                         <input id="searchbox"
135                         onblur="javascript:enableHotkeys()" onfocus="javascript:disableHotkeys()"
136                         onchange="javascript:search()">
137                 <select id="searchmodebox">
138                         <option>This feed</option>
139                         <option>All feeds</option>
140                 </select>
141                 
142                 <input type="submit" 
143                         class="button" onclick="javascript:search()" value="Search">
144
145                 &nbsp; 
146                 
147                 View: 
148                 
149                 <select id="viewbox" onchange="javascript:viewCurrentFeed(0, '')">
150                         <option>All Articles</option>
151                         <option>Starred</option>
152                         <option selected>Unread</option>
153                         <option>Unread or Starred</option>
154                         <option>Unread or Updated</option>
155                 </select>
156
157                 &nbsp;Limit:
158
159                 <select id="limitbox" onchange="javascript:viewCurrentFeed(0, '')">
160                 
161                 <?
162                         $limits = array(15 => 15, 30 => 30, 60 => 60);
163                         
164                         $def_art_limit = get_pref($link, 'DEFAULT_ARTICLE_LIMIT');
165
166                         print $def_art_limit;
167         
168                         if ($def_art_limit >= 0) {
169                                 $limits[$def_art_limit] = $def_art_limit; 
170                         }
171                         
172                         asort($limits);
173
174                         array_push($limits, 0);
175
176                         foreach ($limits as $key) {
177                                 print "<option";
178                                 if ($key == $def_art_limit) { print " selected"; }
179                                 print ">";
180                                 
181                                 if ($limits[$key] == 0) { print "All"; } else { print $limits[$key]; }
182                                 
183                                 print "</option>";
184                         } ?>
185                 
186                 </select>
187
188                 &nbsp;Feed: <input class="button" type="submit"
189                         onclick="javascript:viewCurrentFeed(0, 'ForceUpdate')" value="Update">
190
191                 <input class="button" type="submit" id="btnMarkFeedAsRead"
192                         onclick="javascript:viewCurrentFeed(0, 'MarkAllRead')" value="Mark as read">
193
194                 </td>
195                 <td align="right">
196                         Actions: <select id="quickMenuChooser">
197                                 <option id="qmcPrefs" selected>Preferences...</option>
198                                 <option disabled>--------</option>
199                                 <option style="color : #5050aa" disabled>Feed actions:</option>
200                                 <option id="qmcAddFeed">&nbsp;&nbsp;Add new feed</option>
201                                 <option id="qmcRemoveFeed">&nbsp;&nbsp;Remove this feed</option>
202                                 <!-- <option>Edit this feed</option> -->
203                                 <option disabled>--------</option>
204                                 <option style="color : #5050aa" disabled>All feeds:</option>
205                                 <option id="qmcUpdateFeeds">&nbsp;&nbsp;Update</option>
206                                 <option id="qmcCatchupAll">&nbsp;&nbsp;Mark as read</option>
207                                 <option id="qmcShowOnlyUnread">&nbsp;&nbsp;Show only unread</option>
208                         </select>
209                         <input type="submit" class="button" onclick="quickMenuGo()" value="Go">
210                 </td>
211                 </tr>
212                 </table>
213         </td> 
214 </tr><tr>
215         <td id="headlines" class="headlines" valign="top">
216                 <iframe frameborder="0" name="headlines-frame" 
217                         id="headlines-frame" class="headlinesFrame" 
218                                 src="backend.php?op=error&msg=No%20feed%20selected."></iframe>
219         </td>
220 </tr><tr>
221         <td class="content" id="content" valign="top">
222                 <iframe frameborder="0" name="content-frame" 
223                         id="content-frame" class="contentFrame"> </iframe>
224         </td>
225 </tr>
226 <? if (get_pref($link, 'DISPLAY_FOOTER')) { ?>
227 <tr>
228         <td colspan="2" class="footer">
229                 <a href="http://bah.spb.su/~fox/tt-rss/">Tiny-Tiny RSS</a> v<?= VERSION ?> &copy; 2005 Andrew Dolgov
230                 <? if (WEB_DEMO_MODE) { ?>
231                 <br>Running in demo mode, some functionality is disabled.
232                 <? } ?>
233         </td>
234 </td>
235 <? } ?>
236 </table>
237
238 <? db_close($link); ?>
239
240 </body>
241 </html>