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