]>
Commit | Line | Data |
---|---|---|
1cd17194 | 1 | <? |
4356293a | 2 | session_start(); |
090e250b | 3 | |
1c7f75ed AD |
4 | if (!$_SESSION["uid"]) { exit; } |
5 | ||
4356293a | 6 | define(SCHEMA_VERSION, 2); |
1cd17194 | 7 | |
82baad4a | 8 | require_once "config.php"; |
648472a7 | 9 | require_once "db.php"; |
3bac89ad | 10 | require_once "db-prefs.php"; |
82baad4a AD |
11 | require_once "functions.php"; |
12 | require_once "magpierss/rss_fetch.inc"; | |
1cd17194 | 13 | |
4356293a AD |
14 | $op = $_REQUEST["op"]; |
15 | ||
16 | if ($op == "rpc" || $op == "updateAllFeeds") { | |
17 | header("Content-Type: application/xml"); | |
18 | } | |
19 | ||
406d9489 AD |
20 | $script_started = getmicrotime(); |
21 | ||
648472a7 | 22 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); |
d76a3b03 | 23 | |
5136011e AD |
24 | if (!$link) { |
25 | if (DB_TYPE == "mysql") { | |
26 | print mysql_error(); | |
27 | } | |
28 | // PG seems to display its own errors just fine by default. | |
29 | return; | |
30 | } | |
31 | ||
648472a7 AD |
32 | if (DB_TYPE == "pgsql") { |
33 | pg_query("set client_encoding = 'utf-8'"); | |
34 | } | |
7ec2a838 | 35 | |
295f9b42 | 36 | /* |
7ec2a838 AD |
37 | $result = db_query($link, "SELECT schema_version FROM ttrss_version"); |
38 | ||
39 | $schema_version = db_fetch_result($result, 0, "schema_version"); | |
40 | ||
41 | if ($schema_version != SCHEMA_VERSION) { | |
42 | print "Error: database schema is invalid | |
43 | (got version $schema_version; expected ".SCHEMA_VERSION.")"; | |
44 | return; | |
45 | } | |
295f9b42 AD |
46 | */ |
47 | ||
331900c6 | 48 | $fetch = $_GET["fetch"]; |
175847de | 49 | |
8143ae1f AD |
50 | /* FIXME this needs reworking */ |
51 | ||
fc69e641 AD |
52 | function getGlobalCounters($link) { |
53 | $result = db_query($link, "SELECT count(id) as c_id FROM ttrss_entries | |
4356293a | 54 | WHERE unread = true AND owner_uid = " . $_SESSION["uid"]); |
fc69e641 AD |
55 | $c_id = db_fetch_result($result, 0, "c_id"); |
56 | print "<counter id='global-unread' counter='$c_id'/>"; | |
57 | } | |
58 | ||
8143ae1f AD |
59 | function getTagCounters($link) { |
60 | $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count | |
61 | FROM ttrss_tags,ttrss_entries WHERE | |
4356293a | 62 | ttrss_tags.owner_uid = ".$_SESSION["uid"]." AND |
8143ae1f AD |
63 | post_id = ttrss_entries.id AND unread = true GROUP BY tag_name |
64 | UNION | |
4356293a AD |
65 | select tag_name,0 as count FROM ttrss_tags |
66 | WHERE ttrss_tags.owner_uid = ".$_SESSION["uid"]); | |
8143ae1f AD |
67 | |
68 | $tags = array(); | |
69 | ||
70 | while ($line = db_fetch_assoc($result)) { | |
71 | $tags[$line["tag_name"]] += $line["count"]; | |
72 | } | |
73 | ||
74 | foreach (array_keys($tags) as $tag) { | |
75 | $unread = $tags[$tag]; | |
76 | ||
77 | $tag = htmlspecialchars($tag); | |
78 | print "<tag id=\"$tag\" counter=\"$unread\"/>"; | |
79 | } | |
80 | } | |
81 | ||
090e250b AD |
82 | function getLabelCounters($link) { |
83 | ||
84 | $result = db_query($link, "SELECT count(id) as count FROM ttrss_entries | |
4356293a | 85 | WHERE marked = true AND unread = true AND owner_uid = ".$_SESSION["uid"]); |
090e250b | 86 | |
d61fd764 | 87 | $count = db_fetch_result($result, 0, "count"); |
090e250b AD |
88 | |
89 | print "<label id=\"-1\" counter=\"$count\"/>"; | |
90 | ||
4356293a AD |
91 | $result = db_query($link, "SELECT owner_uid,id,sql_exp,description FROM |
92 | ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER by description"); | |
090e250b AD |
93 | |
94 | while ($line = db_fetch_assoc($result)) { | |
95 | ||
96 | $id = -$line["id"] - 11; | |
97 | ||
98 | error_reporting (0); | |
d61fd764 AD |
99 | |
100 | $tmp_result = db_query($link, "SELECT count(id) as count FROM ttrss_entries | |
655be073 AD |
101 | WHERE (" . $line["sql_exp"] . ") AND unread = true AND |
102 | owner_uid = ".$_SESSION["uid"]); | |
090e250b | 103 | |
d61fd764 | 104 | $count = db_fetch_result($tmp_result, 0, "count"); |
090e250b | 105 | |
ab3f3f72 | 106 | print "<label id=\"$id\" counter=\"$count\"/>"; |
090e250b AD |
107 | |
108 | error_reporting (E_ERROR | E_WARNING | E_PARSE); | |
109 | ||
110 | } | |
111 | } | |
112 | ||
8073cce7 AD |
113 | function getFeedCounter($link, $id) { |
114 | ||
115 | $result = db_query($link, "SELECT | |
116 | count(id) as count FROM ttrss_entries | |
4356293a | 117 | WHERE feed_id = '$id' AND unread = true"); |
8073cce7 AD |
118 | |
119 | $count = db_fetch_result($result, 0, "count"); | |
120 | ||
121 | print "<feed id=\"$id\" counter=\"$count\"/>"; | |
122 | } | |
090e250b | 123 | |
8073cce7 AD |
124 | function getFeedCounters($link) { |
125 | ||
090e250b AD |
126 | $result = db_query($link, "SELECT id, |
127 | (SELECT count(id) FROM ttrss_entries WHERE feed_id = ttrss_feeds.id | |
b88917af | 128 | AND unread = true AND owner_uid = ".$_SESSION["uid"].") as count |
4356293a | 129 | FROM ttrss_feeds WHERE owner_uid = ".$_SESSION["uid"]); |
090e250b AD |
130 | |
131 | while ($line = db_fetch_assoc($result)) { | |
132 | ||
133 | $id = $line["id"]; | |
134 | $count = $line["count"]; | |
135 | ||
136 | print "<feed id=\"$id\" counter=\"$count\"/>"; | |
137 | } | |
138 | } | |
139 | ||
8143ae1f | 140 | function outputFeedList($link, $tags = false) { |
175847de | 141 | |
1a66d16e AD |
142 | print "<html><head> |
143 | <title>Tiny Tiny RSS : Feedlist</title> | |
430bf183 AD |
144 | <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">"; |
145 | ||
4769ddaf | 146 | if (get_pref($link, 'USE_COMPACT_STYLESHEET')) { |
430bf183 AD |
147 | print "<link rel=\"stylesheet\" type=\"text/css\" |
148 | href=\"tt-rss_compact.css\"/>"; | |
149 | } else { | |
150 | print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\" | |
151 | type=\"text/css\" href=\"tt-rss_compact.css\"/>"; | |
152 | } | |
153 | ||
154 | print "<script type=\"text/javascript\" src=\"functions.js\"></script> | |
1a66d16e AD |
155 | <script type=\"text/javascript\" src=\"feedlist.js\"></script> |
156 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> | |
3745788e | 157 | </head><body onload=\"init()\">"; |
254e0e4b AD |
158 | |
159 | print "<ul class=\"feedList\" id=\"feedList\">"; | |
160 | ||
4356293a AD |
161 | $owner_uid = $_SESSION["uid"]; |
162 | ||
8143ae1f | 163 | if (!$tags) { |
254e0e4b | 164 | |
8143ae1f | 165 | /* virtual feeds */ |
254e0e4b | 166 | |
8143ae1f | 167 | $result = db_query($link, "SELECT count(id) as num_starred |
4356293a | 168 | FROM ttrss_entries WHERE marked = true AND unread = true AND owner_uid = '$owner_uid'"); |
8143ae1f | 169 | $num_starred = db_fetch_result($result, 0, "num_starred"); |
254e0e4b | 170 | |
3745788e | 171 | $class = "virt"; |
8add756a AD |
172 | |
173 | if ($num_starred > 0) $class .= "Unread"; | |
174 | ||
175 | printFeedEntry(-1, $class, "Starred articles", $num_starred, | |
4668523d | 176 | "images/mark_set.png", $link); |
48f0adb0 | 177 | |
4769ddaf | 178 | if (get_pref($link, 'ENABLE_LABELS')) { |
8143ae1f AD |
179 | |
180 | $result = db_query($link, "SELECT id,sql_exp,description FROM | |
4356293a | 181 | ttrss_labels WHERE owner_uid = '$owner_uid' ORDER by description"); |
8143ae1f AD |
182 | |
183 | if (db_num_rows($result) > 0) { | |
184 | print "<li><hr></li>"; | |
185 | } | |
186 | ||
187 | while ($line = db_fetch_assoc($result)) { | |
48f0adb0 | 188 | |
8143ae1f AD |
189 | error_reporting (0); |
190 | ||
191 | $tmp_result = db_query($link, "SELECT count(id) as count FROM ttrss_entries | |
655be073 AD |
192 | WHERE (" . $line["sql_exp"] . ") AND unread = true |
193 | AND owner_uid = '$owner_uid'"); | |
8143ae1f AD |
194 | |
195 | $count = db_fetch_result($tmp_result, 0, "count"); | |
196 | ||
3745788e | 197 | $class = "label"; |
8143ae1f AD |
198 | |
199 | if ($count > 0) { | |
200 | $class .= "Unread"; | |
201 | } | |
202 | ||
203 | error_reporting (E_ERROR | E_WARNING | E_PARSE); | |
204 | ||
205 | printFeedEntry(-$line["id"]-11, | |
4668523d | 206 | $class, $line["description"], $count, "images/label.png", $link); |
8143ae1f AD |
207 | |
208 | } | |
48f0adb0 AD |
209 | } |
210 | ||
8143ae1f AD |
211 | print "<li><hr></li>"; |
212 | ||
213 | $result = db_query($link, "SELECT *, | |
214 | (SELECT count(id) FROM ttrss_entries | |
b88917af | 215 | WHERE feed_id = ttrss_feeds.id AND owner_uid = '$owner_uid') AS total, |
8143ae1f | 216 | (SELECT count(id) FROM ttrss_entries |
b88917af AD |
217 | WHERE feed_id = ttrss_feeds.id AND unread = true |
218 | AND owner_uid = '$owner_uid') as unread | |
4356293a | 219 | FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY title"); |
8143ae1f AD |
220 | |
221 | $actid = $_GET["actid"]; | |
222 | ||
223 | /* real feeds */ | |
224 | ||
225 | $lnum = 0; | |
226 | ||
227 | $total_unread = 0; | |
228 | ||
48f0adb0 | 229 | while ($line = db_fetch_assoc($result)) { |
8143ae1f AD |
230 | |
231 | $feed = $line["title"]; | |
232 | $feed_id = $line["id"]; | |
233 | ||
234 | $subop = $_GET["subop"]; | |
235 | ||
236 | $total = $line["total"]; | |
237 | $unread = $line["unread"]; | |
238 | ||
239 | // $class = ($lnum % 2) ? "even" : "odd"; | |
48f0adb0 | 240 | |
3745788e | 241 | $class = "feed"; |
8143ae1f AD |
242 | |
243 | if ($unread > 0) $class .= "Unread"; | |
244 | ||
245 | if ($actid == $feed_id) { | |
246 | $class .= "Selected"; | |
392d4563 | 247 | } |
48f0adb0 | 248 | |
8143ae1f AD |
249 | $total_unread += $unread; |
250 | ||
4668523d | 251 | printFeedEntry($feed_id, $class, $feed, $unread, "icons/$feed_id.ico", $link); |
8143ae1f AD |
252 | |
253 | ++$lnum; | |
48f0adb0 | 254 | } |
8143ae1f | 255 | } else { |
a1a8a2be | 256 | |
8143ae1f | 257 | // tags |
a1a8a2be | 258 | |
8143ae1f AD |
259 | $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count |
260 | FROM ttrss_tags,ttrss_entries WHERE | |
4356293a | 261 | post_id = ttrss_entries.id AND unread = true |
3b0948c4 | 262 | AND ttrss_tags.owner_uid = '$owner_uid' GROUP BY tag_name |
8143ae1f | 263 | UNION |
3b0948c4 AD |
264 | select tag_name,0 as count FROM ttrss_tags WHERE owner_uid = '$owner_uid' |
265 | ORDER BY tag_name"); | |
8143ae1f AD |
266 | |
267 | $tags = array(); | |
268 | ||
269 | while ($line = db_fetch_assoc($result)) { | |
270 | $tags[$line["tag_name"]] += $line["count"]; | |
1a66d16e | 271 | } |
8143ae1f AD |
272 | |
273 | foreach (array_keys($tags) as $tag) { | |
274 | ||
275 | $unread = $tags[$tag]; | |
276 | ||
277 | $class = "odd"; | |
278 | ||
279 | if ($unread > 0) { | |
280 | $class .= "Unread"; | |
281 | } | |
282 | ||
4668523d | 283 | printFeedEntry($tag, $class, $tag, $unread, "images/tag.png", $link); |
8143ae1f AD |
284 | |
285 | } | |
1a66d16e | 286 | |
e828e31e | 287 | } |
82baad4a | 288 | |
dc33ec95 | 289 | if (db_num_rows($result) == 0) { |
4356293a | 290 | print "<li>No tags/feeds to display.</li>"; |
dc33ec95 AD |
291 | } |
292 | ||
8143ae1f | 293 | print "</ul>"; |
1cd17194 | 294 | |
caa4e57f AD |
295 | print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>"; |
296 | ||
c3b81db0 AD |
297 | } |
298 | ||
299 | ||
300 | if ($op == "rpc") { | |
301 | ||
302 | $subop = $_GET["subop"]; | |
303 | ||
090e250b | 304 | if ($subop == "getLabelCounters") { |
8073cce7 | 305 | $aid = $_GET["aid"]; |
090e250b AD |
306 | print "<rpc-reply>"; |
307 | getLabelCounters($link); | |
8073cce7 AD |
308 | if ($aid) { |
309 | getFeedCounter($link, $aid); | |
310 | } | |
090e250b AD |
311 | print "</rpc-reply>"; |
312 | } | |
313 | ||
314 | if ($subop == "getFeedCounters") { | |
315 | print "<rpc-reply>"; | |
316 | getFeedCounters($link); | |
317 | print "</rpc-reply>"; | |
318 | } | |
319 | ||
320 | if ($subop == "getAllCounters") { | |
321 | print "<rpc-reply>"; | |
322 | getLabelCounters($link); | |
323 | getFeedCounters($link); | |
8143ae1f | 324 | getTagCounters($link); |
fc69e641 | 325 | getGlobalCounters($link); |
090e250b | 326 | print "</rpc-reply>"; |
090e250b AD |
327 | } |
328 | ||
f4c10d44 AD |
329 | if ($subop == "mark") { |
330 | $mark = $_GET["mark"]; | |
648472a7 | 331 | $id = db_escape_string($_GET["id"]); |
f4c10d44 AD |
332 | |
333 | if ($mark == "1") { | |
334 | $mark = "true"; | |
335 | } else { | |
336 | $mark = "false"; | |
337 | } | |
338 | ||
648472a7 | 339 | $result = db_query($link, "UPDATE ttrss_entries SET marked = $mark |
f4c10d44 AD |
340 | WHERE id = '$id'"); |
341 | } | |
342 | ||
caa4e57f | 343 | if ($subop == "updateFeed") { |
648472a7 | 344 | $feed_id = db_escape_string($_GET["feed"]); |
9cfc649a | 345 | |
648472a7 | 346 | $result = db_query($link, |
caa4e57f | 347 | "SELECT feed_url FROM ttrss_feeds WHERE id = '$feed_id'"); |
9cfc649a | 348 | |
648472a7 AD |
349 | if (db_num_rows($result) > 0) { |
350 | $feed_url = db_fetch_result($result, 0, "feed_url"); | |
caa4e57f AD |
351 | // update_rss_feed($link, $feed_url, $feed_id); |
352 | } | |
9cfc649a | 353 | |
caa4e57f | 354 | print "DONE-$feed_id"; |
9cfc649a | 355 | |
caa4e57f | 356 | return; |
9cfc649a AD |
357 | } |
358 | ||
090e250b | 359 | if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") { |
c5142cca | 360 | |
c3b81db0 | 361 | update_all_feeds($link, true); |
c3b81db0 | 362 | |
ab3f3f72 AD |
363 | $omode = $_GET["omode"]; |
364 | ||
365 | if (!$omode) $omode = "tfl"; | |
366 | ||
090e250b | 367 | print "<rpc-reply>"; |
ab3f3f72 AD |
368 | if (strchr($omode, "l")) getLabelCounters($link); |
369 | if (strchr($omode, "f")) getFeedCounters($link); | |
370 | if (strchr($omode, "t")) getTagCounters($link); | |
fc69e641 | 371 | getGlobalCounters($link); |
090e250b | 372 | print "</rpc-reply>"; |
c3b81db0 AD |
373 | } |
374 | ||
375 | if ($subop == "catchupPage") { | |
376 | ||
377 | $ids = split(",", $_GET["ids"]); | |
378 | ||
379 | foreach ($ids as $id) { | |
380 | ||
648472a7 | 381 | db_query($link, "UPDATE ttrss_entries SET unread=false,last_read = NOW() |
c3b81db0 AD |
382 | WHERE id = '$id'"); |
383 | ||
384 | } | |
385 | ||
386 | print "Marked active page as read."; | |
387 | } | |
295f9b42 AD |
388 | |
389 | if ($subop == "sanityCheck") { | |
390 | ||
391 | $error_code = 0; | |
392 | ||
393 | $result = db_query($link, "SELECT schema_version FROM ttrss_version"); | |
394 | ||
395 | $schema_version = db_fetch_result($result, 0, "schema_version"); | |
396 | ||
397 | if ($schema_version != SCHEMA_VERSION) { | |
398 | $error_code = 5; | |
399 | } | |
400 | ||
401 | print "<error code='$error_code'/>"; | |
402 | } | |
fefa6ca3 AD |
403 | |
404 | if ($subop == "globalPurge") { | |
405 | ||
406 | print "<rpc-reply>"; | |
407 | global_purge_old_posts($link, true); | |
408 | print "</rpc-reply>"; | |
409 | ||
410 | } | |
411 | ||
c3b81db0 AD |
412 | } |
413 | ||
414 | if ($op == "feeds") { | |
415 | ||
8143ae1f AD |
416 | $tags = $_GET["tags"]; |
417 | ||
c3b81db0 AD |
418 | $subop = $_GET["subop"]; |
419 | ||
420 | if ($subop == "catchupAll") { | |
6d15e1ef AD |
421 | db_query($link, "UPDATE ttrss_entries SET |
422 | last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]); | |
c3b81db0 AD |
423 | } |
424 | ||
8143ae1f | 425 | outputFeedList($link, $tags); |
c3b81db0 | 426 | |
1cd17194 AD |
427 | } |
428 | ||
429 | if ($op == "view") { | |
430 | ||
d76a3b03 | 431 | $id = $_GET["id"]; |
8073cce7 | 432 | $feed_id = $_GET["feed"]; |
d76a3b03 | 433 | |
648472a7 | 434 | $result = db_query($link, "UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'"); |
a1a8a2be | 435 | |
70830c87 AD |
436 | $addheader = $_GET["addheader"]; |
437 | ||
648472a7 | 438 | $result = db_query($link, "SELECT title,link,content,feed_id,comments, |
b7f4bda2 AD |
439 | (SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url |
440 | FROM ttrss_entries | |
d76a3b03 | 441 | WHERE id = '$id'"); |
1cd17194 | 442 | |
70830c87 | 443 | if ($addheader) { |
f0601b87 | 444 | print "<html><head> |
70830c87 AD |
445 | <title>Tiny Tiny RSS : Article $id</title> |
446 | <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\"> | |
c05608c2 | 447 | <script type=\"text/javascript\" src=\"functions.js\"></script> |
70830c87 | 448 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> |
f0601b87 | 449 | </head><body>"; |
70830c87 AD |
450 | } |
451 | ||
d76a3b03 | 452 | if ($result) { |
1cd17194 | 453 | |
648472a7 | 454 | $line = db_fetch_assoc($result); |
1cd17194 | 455 | |
b7f4bda2 AD |
456 | if ($line["icon_url"]) { |
457 | $feed_icon = "<img class=\"feedIcon\" src=\"" . $line["icon_url"] . "\">"; | |
458 | } else { | |
459 | $feed_icon = " "; | |
460 | } | |
d76a3b03 | 461 | |
f7181e9b AD |
462 | if ($line["comments"] && $line["link"] != $line["comments"]) { |
463 | $entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)"; | |
464 | } else { | |
465 | $entry_comments = ""; | |
466 | } | |
467 | ||
e828e31e AD |
468 | print "<div class=\"postReply\">"; |
469 | ||
470 | print "<div class=\"postHeader\"><table>"; | |
471 | ||
472 | print "<tr><td><b>Title:</b></td> | |
473 | <td width='100%'>" . $line["title"] . "</td></tr>"; | |
f7181e9b | 474 | |
e828e31e | 475 | print "<tr><td><b>Link:</b></td> |
f7181e9b AD |
476 | <td width='100%'> |
477 | <a href=\"" . $line["link"] . "\">".$line["link"]."</a> | |
478 | $entry_comments</td></tr>"; | |
e828e31e AD |
479 | |
480 | print "</table></div>"; | |
481 | ||
482 | print "<div class=\"postIcon\">" . $feed_icon . "</div>"; | |
483 | print "<div class=\"postContent\">" . $line["content"] . "</div>"; | |
484 | ||
485 | print "</div>"; | |
486 | ||
090e250b | 487 | print "<script type=\"text/javascript\"> |
8143ae1f | 488 | update_label_counters('$feed_id'); |
090e250b | 489 | </script>"; |
d76a3b03 | 490 | } |
70830c87 AD |
491 | |
492 | if ($addheader) { | |
493 | print "</body></html>"; | |
494 | } | |
1cd17194 AD |
495 | } |
496 | ||
497 | if ($op == "viewfeed") { | |
498 | ||
499 | $feed = $_GET["feed"]; | |
d76a3b03 | 500 | $skip = $_GET["skip"]; |
476cac42 | 501 | $subop = $_GET["subop"]; |
f175937c | 502 | $view_mode = $_GET["view"]; |
f0601b87 | 503 | $addheader = $_GET["addheader"]; |
cb1083a1 | 504 | $limit = $_GET["limit"]; |
a1a8a2be | 505 | |
8d7008c7 AD |
506 | if (!$feed) { |
507 | print "Error: no feed to display."; | |
508 | return; | |
509 | } | |
510 | ||
ac53063a AD |
511 | if (!$skip) $skip = 0; |
512 | ||
476cac42 | 513 | if ($subop == "undefined") $subop = ""; |
1cd17194 | 514 | |
f0601b87 AD |
515 | if ($addheader) { |
516 | print "<html><head> | |
ac43eba1 | 517 | <title>Tiny Tiny RSS : Feed $feed</title> |
430bf183 AD |
518 | <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">"; |
519 | ||
4769ddaf | 520 | if (get_pref($link, 'USE_COMPACT_STYLESHEET')) { |
430bf183 AD |
521 | print "<link rel=\"stylesheet\" |
522 | type=\"text/css\" href=\"tt-rss_compact.css\"/>"; | |
523 | ||
524 | } else { | |
525 | print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\" | |
526 | type=\"text/css\" href=\"tt-rss_compact.css\"/>"; | |
527 | } | |
528 | print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> | |
f0601b87 AD |
529 | <script type=\"text/javascript\" src=\"functions.js\"></script> |
530 | <script type=\"text/javascript\" src=\"viewfeed.js\"></script> | |
b623b3ed | 531 | </head><body onload='init()'>"; |
f0601b87 AD |
532 | } |
533 | ||
dcee8f61 AD |
534 | if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) { |
535 | ||
536 | $tmp_result = db_query($link, "SELECT feed_url FROM ttrss_feeds | |
537 | WHERE id = '$feed'"); | |
538 | ||
539 | $feed_url = db_fetch_result($tmp_result, 0, "feed_url"); | |
540 | ||
541 | update_rss_feed($link, $feed_url, $feed); | |
542 | ||
543 | } | |
544 | ||
0e32076b | 545 | if ($subop == "MarkAllRead") { |
d76a3b03 | 546 | |
0e32076b AD |
547 | if (sprintf("%d", $feed) != 0) { |
548 | ||
549 | if ($feed > 0) { | |
550 | db_query($link, "UPDATE ttrss_entries | |
551 | SET unread = false,last_read = NOW() | |
254e0e4b | 552 | WHERE feed_id = '$feed'"); |
0e32076b AD |
553 | |
554 | } else if ($feed < 0 && $feed > -10) { // special, like starred | |
555 | ||
556 | if ($feed == -1) { | |
557 | db_query($link, "UPDATE ttrss_entries | |
558 | SET unread = false,last_read = NOW() | |
559 | WHERE marked = true"); | |
560 | } | |
561 | ||
562 | } else if ($feed < -10) { // label | |
563 | ||
7db95187 | 564 | $label_id = -$feed - 11; |
0e32076b | 565 | |
7db95187 AD |
566 | $tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels |
567 | WHERE id = '$label_id'"); | |
568 | ||
569 | if ($tmp_result) { | |
570 | $sql_exp = db_fetch_result($tmp_result, 0, "sql_exp"); | |
571 | ||
572 | db_query($link, "UPDATE ttrss_entries | |
573 | SET unread = false,last_read = NOW() | |
574 | WHERE $sql_exp"); | |
575 | } | |
254e0e4b | 576 | } |
0e32076b AD |
577 | } else { // tag |
578 | // FIXME, implement catchup for tags | |
a1a8a2be | 579 | } |
0e32076b | 580 | |
a1a8a2be | 581 | } |
d76a3b03 | 582 | |
175847de | 583 | print "<table class=\"headlinesList\" id=\"headlinesList\" width=\"100%\">"; |
ac53063a | 584 | |
c374a3fe AD |
585 | $search = $_GET["search"]; |
586 | ||
52b51244 AD |
587 | $search_mode = $_GET["smode"]; |
588 | ||
f175937c | 589 | if ($search) { |
ac53063a AD |
590 | $search_query_part = "(upper(title) LIKE upper('%$search%') |
591 | OR content LIKE '%$search%') AND"; | |
f175937c AD |
592 | } else { |
593 | $search_query_part = ""; | |
594 | } | |
595 | ||
596 | $view_query_part = ""; | |
597 | ||
598 | if ($view_mode == "Starred") { | |
599 | $view_query_part = " marked = true AND "; | |
ac53063a AD |
600 | } |
601 | ||
ac43eba1 AD |
602 | if ($view_mode == "Unread") { |
603 | $view_query_part = " unread = true AND "; | |
604 | } | |
605 | ||
b5aa95e7 AD |
606 | if ($view_mode == "Unread or Starred") { |
607 | $view_query_part = " (unread = true OR marked = true) AND "; | |
608 | } | |
609 | ||
bdd01d3f AD |
610 | if ($view_mode == "Unread or Updated") { |
611 | $view_query_part = " (unread = true OR last_read is NULL) AND "; | |
612 | } | |
613 | ||
254e0e4b | 614 | /* $result = db_query($link, "SELECT count(id) AS total_entries |
36bf7496 AD |
615 | FROM ttrss_entries WHERE |
616 | $search_query_part | |
617 | feed_id = '$feed'"); | |
e6d1c0a0 | 618 | |
254e0e4b | 619 | $total_entries = db_fetch_result($result, 0, "total_entries"); */ |
e6d1c0a0 | 620 | |
648472a7 | 621 | /* $result = db_query("SELECT count(id) AS unread_entries |
ac43eba1 AD |
622 | FROM ttrss_entries WHERE |
623 | $search_query_part | |
624 | unread = true AND | |
625 | feed_id = '$feed'"); | |
626 | ||
648472a7 | 627 | $unread_entries = db_fetch_result($result, 0, "unread_entries"); */ |
ac43eba1 | 628 | |
8d7008c7 | 629 | if ($limit && $limit != "All") { |
82c9223c | 630 | $limit_query_part = "LIMIT " . $limit; |
ad3cb710 | 631 | } |
f0601b87 | 632 | |
254e0e4b AD |
633 | $vfeed_query_part = ""; |
634 | ||
52b51244 AD |
635 | // override query strategy and enable feed display when searching globally |
636 | if ($search_mode == "All feeds") { | |
637 | $query_strategy_part = "id > 0"; | |
638 | $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE | |
639 | id = feed_id) as feed_title,"; | |
640 | } else if (sprintf("%d", $feed) == 0) { | |
8143ae1f AD |
641 | $query_strategy_part = "ttrss_entries.id > 0"; |
642 | $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE | |
643 | id = feed_id) as feed_title,"; | |
644 | } else if ($feed >= 0) { | |
254e0e4b | 645 | $query_strategy_part = "feed_id = '$feed'"; |
48f0adb0 | 646 | } else if ($feed == -1) { // starred virtual feed |
254e0e4b | 647 | $query_strategy_part = "marked = true"; |
48f0adb0 AD |
648 | $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE |
649 | id = feed_id) as feed_title,"; | |
650 | } else if ($feed <= -10) { // labels | |
651 | $label_id = -$feed - 11; | |
652 | ||
653 | $tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels | |
654 | WHERE id = '$label_id'"); | |
655 | ||
656 | $query_strategy_part = db_fetch_result($tmp_result, 0, "sql_exp"); | |
657 | ||
254e0e4b AD |
658 | $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE |
659 | id = feed_id) as feed_title,"; | |
660 | } else { | |
48f0adb0 | 661 | $query_strategy_part = "id > 0"; // dumb |
254e0e4b AD |
662 | } |
663 | ||
52b51244 | 664 | |
f99321a3 AD |
665 | $order_by = "updated DESC"; |
666 | ||
667 | // if ($feed < -10) { | |
668 | // $order_by = "feed_id,updated DESC"; | |
669 | // } | |
670 | ||
48f0adb0 AD |
671 | if ($feed < -10) error_reporting (0); |
672 | ||
8143ae1f AD |
673 | if (sprintf("%d", $feed) != 0) { |
674 | ||
675 | $result = db_query($link, "SELECT | |
676 | id,title,updated,unread,feed_id,marked,link,last_read, | |
677 | SUBSTRING(last_read,1,19) as last_read_noms, | |
678 | $vfeed_query_part | |
679 | SUBSTRING(updated,1,19) as updated_noms | |
680 | FROM | |
681 | ttrss_entries | |
682 | WHERE | |
aee86c2e | 683 | owner_uid = '".$_SESSION["uid"]."' AND |
8143ae1f AD |
684 | $search_query_part |
685 | $view_query_part | |
686 | $query_strategy_part ORDER BY $order_by | |
687 | $limit_query_part"); | |
688 | ||
689 | } else { | |
690 | // browsing by tag | |
691 | ||
692 | $result = db_query($link, "SELECT | |
693 | ttrss_entries.id as id,title,updated,unread,feed_id, | |
694 | marked,link,last_read, | |
c05a19f3 | 695 | SUBSTRING(last_read,1,19) as last_read_noms, |
254e0e4b | 696 | $vfeed_query_part |
c05a19f3 | 697 | SUBSTRING(updated,1,19) as updated_noms |
8143ae1f AD |
698 | FROM |
699 | ttrss_entries,ttrss_tags | |
700 | WHERE | |
aee86c2e | 701 | ttrss_entries.owner_uid = '".$_SESSION["uid"]."' AND |
8143ae1f AD |
702 | post_id = ttrss_entries.id AND tag_name = '$feed' AND |
703 | $view_query_part | |
704 | $search_query_part | |
705 | $query_strategy_part ORDER BY $order_by | |
706 | $limit_query_part"); | |
707 | } | |
d76a3b03 | 708 | |
48f0adb0 AD |
709 | if (!$result) { |
710 | print "<tr><td colspan='4' align='center'> | |
711 | Could not display feed (query failed). Please check match syntax or local configuration.</td></tr>"; | |
712 | return; | |
713 | } | |
714 | ||
a1a8a2be | 715 | $lnum = 0; |
48f0adb0 AD |
716 | |
717 | error_reporting (E_ERROR | E_WARNING | E_PARSE); | |
718 | ||
e1123aee | 719 | $num_unread = 0; |
d76a3b03 | 720 | |
648472a7 | 721 | while ($line = db_fetch_assoc($result)) { |
d76a3b03 | 722 | |
a1a8a2be | 723 | $class = ($lnum % 2) ? "even" : "odd"; |
d76a3b03 | 724 | |
ad99045e AD |
725 | $id = $line["id"]; |
726 | $feed_id = $line["feed_id"]; | |
727 | ||
c43f77f5 | 728 | // printf("L %d (%s) > U %d (%s) = %d<br>", |
c05a19f3 | 729 | // strtotime($line["last_read_noms"]), $line["last_read_noms"], |
c43f77f5 AD |
730 | // strtotime($line["updated"]), $line["updated"], |
731 | // strtotime($line["last_read"]) >= strtotime($line["updated"])); | |
732 | ||
ecb14114 | 733 | /* if ($line["last_read"] != "" && $line["updated"] != "" && |
c05a19f3 | 734 | strtotime($line["last_read_noms"]) < strtotime($line["updated_noms"])) { |
c43f77f5 AD |
735 | |
736 | $update_pic = "<img id='FUPDPIC-$id' src=\"images/updated.png\" | |
737 | alt=\"Updated\">"; | |
738 | ||
739 | } else { | |
740 | ||
5bfef089 | 741 | $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\" |
c43f77f5 AD |
742 | alt=\"Updated\">"; |
743 | ||
ecb14114 AD |
744 | } */ |
745 | ||
4cc6ea5e AD |
746 | if ($line["last_read"] == "" && |
747 | ($line["unread"] != "t" && $line["unread"] != "1")) { | |
748 | ||
ecb14114 AD |
749 | $update_pic = "<img id='FUPDPIC-$id' src=\"images/updated.png\" |
750 | alt=\"Updated\">"; | |
751 | } else { | |
752 | $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\" | |
753 | alt=\"Updated\">"; | |
c43f77f5 | 754 | } |
b197f117 | 755 | |
8158c57a | 756 | if ($line["unread"] == "t" || $line["unread"] == "1") { |
a1a8a2be | 757 | $class .= "Unread"; |
e1123aee AD |
758 | ++$num_unread; |
759 | } | |
d76a3b03 | 760 | |
8158c57a | 761 | if ($line["marked"] == "t" || $line["marked"] == "1") { |
f4c10d44 AD |
762 | $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_set.png\" |
763 | alt=\"Reset mark\" onclick='javascript:toggleMark($id, false)'>"; | |
764 | } else { | |
765 | $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_unset.png\" | |
766 | alt=\"Set mark\" onclick='javascript:toggleMark($id, true)'>"; | |
767 | } | |
768 | ||
ac43eba1 | 769 | $content_link = "<a id=\"FTITLE-$id\" href=\"javascript:view($id,$feed_id);\">" . |
b197f117 AD |
770 | $line["title"] . "</a>"; |
771 | ||
d5224f0d | 772 | print "<tr class='$class' id='RROW-$id'>"; |
5f89f780 | 773 | // onclick=\"javascript:view($id,$feed_id)\"> |
b197f117 | 774 | |
8d7008c7 AD |
775 | print "<td valign='center' align='center'>$update_pic</td>"; |
776 | print "<td valign='center' align='center'>$marked_pic</td>"; | |
b197f117 | 777 | |
8d7008c7 | 778 | print "<td width='25%'> |
a3ee2a38 | 779 | <a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>"; |
254e0e4b AD |
780 | |
781 | if ($line["feed_title"]) { | |
782 | print "<td width='50%'>$content_link</td>"; | |
2db4190c AD |
783 | print "<td width='20%'> |
784 | <a href='javascript:viewfeed($feed_id)'>".$line["feed_title"]."</a></td>"; | |
254e0e4b AD |
785 | } else { |
786 | print "<td width='70%'>$content_link</td>"; | |
787 | } | |
d76a3b03 | 788 | |
a1a8a2be | 789 | print "</tr>"; |
d76a3b03 | 790 | |
a1a8a2be AD |
791 | ++$lnum; |
792 | } | |
d76a3b03 | 793 | |
ac53063a | 794 | if ($lnum == 0) { |
a82065a1 | 795 | print "<tr><td align='center'>No articles found.</td></tr>"; |
047bae73 | 796 | } |
a2015351 | 797 | |
a1a8a2be | 798 | print "</table>"; |
6113ef7d AD |
799 | |
800 | print "<script type=\"text/javascript\"> | |
bb7cface | 801 | document.onkeydown = hotkey_handler; |
8143ae1f | 802 | update_label_counters('$feed'); |
6113ef7d | 803 | </script>"; |
d76a3b03 | 804 | |
f0601b87 AD |
805 | if ($addheader) { |
806 | print "</body></html>"; | |
807 | } | |
808 | ||
1cd17194 AD |
809 | } |
810 | ||
0e091d38 | 811 | if ($op == "pref-rpc") { |
331900c6 | 812 | |
0e091d38 | 813 | $subop = $_GET["subop"]; |
331900c6 | 814 | |
83fe4d6d AD |
815 | if ($subop == "unread") { |
816 | $ids = split(",", $_GET["ids"]); | |
817 | foreach ($ids as $id) { | |
648472a7 | 818 | db_query($link, "UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'"); |
83fe4d6d | 819 | } |
0e091d38 AD |
820 | |
821 | print "Marked selected feeds as read."; | |
83fe4d6d AD |
822 | } |
823 | ||
824 | if ($subop == "read") { | |
825 | $ids = split(",", $_GET["ids"]); | |
826 | foreach ($ids as $id) { | |
648472a7 | 827 | db_query($link, "UPDATE ttrss_entries |
b197f117 | 828 | SET unread = false,last_read = NOW() WHERE feed_id = '$id'"); |
83fe4d6d | 829 | } |
0e091d38 AD |
830 | |
831 | print "Marked selected feeds as unread."; | |
832 | ||
833 | } | |
834 | ||
835 | } | |
836 | ||
837 | if ($op == "pref-feeds") { | |
838 | ||
839 | $subop = $_GET["subop"]; | |
840 | ||
508a81e1 | 841 | if ($subop == "editSave") { |
648472a7 AD |
842 | $feed_title = db_escape_string($_GET["t"]); |
843 | $feed_link = db_escape_string($_GET["l"]); | |
d148926e | 844 | $upd_intl = db_escape_string($_GET["ui"]); |
5d73494a | 845 | $purge_intl = db_escape_string($_GET["pi"]); |
508a81e1 AD |
846 | $feed_id = $_GET["id"]; |
847 | ||
d148926e AD |
848 | if (strtoupper($upd_intl) == "DEFAULT") |
849 | $upd_intl = 0; | |
850 | ||
5d73494a AD |
851 | if (strtoupper($purge_intl) == "DEFAULT") |
852 | $purge_intl = 0; | |
853 | ||
140aae81 AD |
854 | if (strtoupper($purge_intl) == "DISABLED") |
855 | $purge_intl = -1; | |
856 | ||
648472a7 | 857 | $result = db_query($link, "UPDATE ttrss_feeds SET |
d148926e | 858 | title = '$feed_title', feed_url = '$feed_link', |
5d73494a AD |
859 | update_interval = '$upd_intl', |
860 | purge_interval = '$purge_intl' | |
861 | WHERE id = '$feed_id'"); | |
508a81e1 | 862 | |
83fe4d6d AD |
863 | } |
864 | ||
331900c6 | 865 | if ($subop == "remove") { |
331900c6 | 866 | |
b0b4abcf | 867 | if (!WEB_DEMO_MODE) { |
331900c6 | 868 | |
b0b4abcf AD |
869 | $ids = split(",", $_GET["ids"]); |
870 | ||
871 | foreach ($ids as $id) { | |
648472a7 | 872 | db_query($link, "DELETE FROM ttrss_feeds WHERE id = '$id'"); |
4769ddaf | 873 | |
273a2f6b | 874 | $icons_dir = ICONS_DIR; |
d5caaae5 | 875 | |
4769ddaf AD |
876 | if (file_exists($icons_dir . "/$id.ico")) { |
877 | unlink($icons_dir . "/$id.ico"); | |
d5caaae5 | 878 | } |
b0b4abcf | 879 | } |
331900c6 AD |
880 | } |
881 | } | |
882 | ||
883 | if ($subop == "add") { | |
b0b4abcf AD |
884 | |
885 | if (!WEB_DEMO_MODE) { | |
331900c6 | 886 | |
648472a7 | 887 | $feed_link = db_escape_string($_GET["link"]); |
b0b4abcf | 888 | |
648472a7 | 889 | $result = db_query($link, |
4356293a | 890 | "INSERT INTO ttrss_feeds (owner_uid,feed_url,title) VALUES ('".$_SESSION["uid"]."', '$feed_link', '')"); |
331900c6 | 891 | |
648472a7 | 892 | $result = db_query($link, |
e9c54861 | 893 | "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'"); |
331900c6 | 894 | |
648472a7 | 895 | $feed_id = db_fetch_result($result, 0, "id"); |
331900c6 | 896 | |
b0b4abcf AD |
897 | if ($feed_id) { |
898 | update_rss_feed($link, $feed_link, $feed_id); | |
899 | } | |
900 | } | |
331900c6 | 901 | } |
a0d53889 | 902 | |
ab3d0b99 AD |
903 | $result = db_query($link, "SELECT id,title,feed_url,last_error |
904 | FROM ttrss_feeds WHERE last_error != ''"); | |
905 | ||
906 | if (db_num_rows($result) > 0) { | |
907 | ||
908 | print "<div class=\"warning\">"; | |
909 | ||
910 | print "<b>Feeds with update errors:</b>"; | |
911 | ||
912 | print "<ul class=\"nomarks\">"; | |
913 | ||
914 | while ($line = db_fetch_assoc($result)) { | |
915 | print "<li>" . $line["title"] . " (" . $line["feed_url"] . "): " . | |
916 | $line["last_error"]; | |
917 | } | |
918 | ||
919 | print "</ul>"; | |
920 | print "</div>"; | |
921 | ||
922 | } | |
923 | ||
a0d53889 AD |
924 | print "<table class=\"prefAddFeed\"><tr> |
925 | <td><input id=\"fadd_link\"></td> | |
926 | <td colspan=\"4\" align=\"right\"> | |
927 | <a class=\"button\" href=\"javascript:addFeed()\">Add feed</a></td></tr> | |
928 | </table>"; | |
929 | ||
648472a7 | 930 | $result = db_query($link, "SELECT |
d148926e | 931 | id,title,feed_url,substring(last_updated,1,16) as last_updated, |
5d73494a | 932 | update_interval,purge_interval |
c0e5a40e | 933 | FROM |
4356293a | 934 | ttrss_feeds WHERE owner_uid = '".$_SESSION["uid"]."' ORDER by title"); |
1cd17194 | 935 | |
331900c6 | 936 | print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">"; |
007bda35 | 937 | print "<tr class=\"title\"> |
5d73494a AD |
938 | <td> </td><td>Select</td><td width=\"30%\">Title</td> |
939 | <td width=\"30%\">Link</td> | |
940 | <td width=\"10%\">Update Interval</td> | |
941 | <td width=\"10%\">Purge Days</td> | |
d148926e | 942 | <td>Last updated</td></tr>"; |
007bda35 AD |
943 | |
944 | $lnum = 0; | |
945 | ||
648472a7 | 946 | while ($line = db_fetch_assoc($result)) { |
007bda35 AD |
947 | |
948 | $class = ($lnum % 2) ? "even" : "odd"; | |
9b307248 | 949 | |
331900c6 | 950 | $feed_id = $line["id"]; |
603c27f8 AD |
951 | |
952 | $edit_feed_id = $_GET["id"]; | |
953 | ||
9b307248 AD |
954 | if ($subop == "edit" && $feed_id != $edit_feed_id) { |
955 | $class .= "Grayed"; | |
956 | } | |
957 | ||
331900c6 | 958 | print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">"; |
007bda35 | 959 | |
273a2f6b | 960 | $icon_file = ICONS_DIR . "/$feed_id.ico"; |
c0e5a40e AD |
961 | |
962 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
963 | $feed_icon = "<img width=\"16\" height=\"16\" | |
273a2f6b | 964 | src=\"" . ICONS_URL . "/$feed_id.ico\">"; |
c0e5a40e AD |
965 | } else { |
966 | $feed_icon = " "; | |
967 | } | |
968 | print "<td align='center'>$feed_icon</td>"; | |
969 | ||
6e0584e9 AD |
970 | $edit_title = htmlspecialchars(db_unescape_string($line["title"])); |
971 | $edit_link = htmlspecialchars(db_unescape_string($line["feed_url"])); | |
972 | ||
9b307248 | 973 | if (!$edit_feed_id || $subop != "edit") { |
603c27f8 AD |
974 | |
975 | print "<td><input onclick='toggleSelectRow(this);' | |
331900c6 | 976 | type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>"; |
603c27f8 AD |
977 | |
978 | print "<td><a href=\"javascript:editFeed($feed_id);\">" . | |
5d73494a | 979 | $edit_title . "</a></td>"; |
603c27f8 | 980 | print "<td><a href=\"javascript:editFeed($feed_id);\">" . |
5d73494a | 981 | $edit_link . "</a></td>"; |
d148926e AD |
982 | |
983 | if ($line["update_interval"] == "0") | |
984 | $line["update_interval"] = "Default"; | |
985 | ||
5d73494a AD |
986 | print "<td><a href=\"javascript:editFeed($feed_id);\">" . |
987 | $line["update_interval"] . "</a></td>"; | |
d148926e | 988 | |
5d73494a AD |
989 | if ($line["purge_interval"] == "0") |
990 | $line["purge_interval"] = "Default"; | |
991 | ||
140aae81 AD |
992 | if ($line["purge_interval"] < 0) |
993 | $line["purge_interval"] = "Disabled"; | |
994 | ||
5d73494a AD |
995 | print "<td><a href=\"javascript:editFeed($feed_id);\">" . |
996 | $line["purge_interval"] . "</a></td>"; | |
9b307248 AD |
997 | |
998 | } else if ($feed_id != $edit_feed_id) { | |
999 | ||
e9c54861 AD |
1000 | print "<td><input disabled=\"true\" type=\"checkbox\" |
1001 | id=\"FRCHK-".$line["id"]."\"></td>"; | |
9b307248 | 1002 | |
6e0584e9 AD |
1003 | print "<td>$edit_title</td>"; |
1004 | print "<td>$edit_link</td>"; | |
9b307248 | 1005 | |
d148926e AD |
1006 | if ($line["update_interval"] == "0") |
1007 | $line["update_interval"] = "Default"; | |
1008 | ||
1009 | print "<td>" . $line["update_interval"] . "</td>"; | |
1010 | ||
5d73494a AD |
1011 | if ($line["purge_interval"] == "0") |
1012 | $line["purge_interval"] = "Default"; | |
1013 | ||
140aae81 AD |
1014 | if ($line["purge_interval"] < 0) |
1015 | $line["purge_interval"] = "Disabled"; | |
1016 | ||
5d73494a AD |
1017 | print "<td>" . $line["purge_interval"] . "</td>"; |
1018 | ||
603c27f8 AD |
1019 | } else { |
1020 | ||
e6cb77a0 | 1021 | print "<td><input disabled=\"true\" type=\"checkbox\" checked></td>"; |
603c27f8 | 1022 | |
6e0584e9 AD |
1023 | print "<td><input id=\"iedit_title\" value=\"$edit_title\"></td>"; |
1024 | print "<td><input id=\"iedit_link\" value=\"$edit_link\"></td>"; | |
d148926e | 1025 | print "<td><input id=\"iedit_updintl\" value=\"".$line["update_interval"]."\"></td>"; |
5d73494a | 1026 | print "<td><input id=\"iedit_purgintl\" value=\"".$line["purge_interval"]."\"></td>"; |
d148926e | 1027 | |
603c27f8 | 1028 | } |
0afbd851 AD |
1029 | |
1030 | if (!$line["last_updated"]) $line["last_updated"] = "Never"; | |
1031 | ||
007bda35 | 1032 | print "<td>" . $line["last_updated"] . "</td>"; |
603c27f8 | 1033 | |
007bda35 AD |
1034 | print "</tr>"; |
1035 | ||
1036 | ++$lnum; | |
1037 | } | |
1038 | ||
0afbd851 AD |
1039 | if ($lnum == 0) { |
1040 | print "<tr><td colspan=\"5\" align=\"center\">No feeds defined.</td></tr>"; | |
1041 | } | |
1042 | ||
007bda35 AD |
1043 | print "</table>"; |
1044 | ||
603c27f8 AD |
1045 | print "<p>"; |
1046 | ||
1047 | if ($subop == "edit") { | |
1048 | print "Edit feed: | |
e828e31e AD |
1049 | <input type=\"submit\" class=\"button\" |
1050 | onclick=\"javascript:feedEditCancel()\" value=\"Cancel\"> | |
1051 | <input type=\"submit\" class=\"button\" | |
8158c57a | 1052 | onclick=\"javascript:feedEditSave()\" value=\"Save\">"; |
603c27f8 AD |
1053 | } else { |
1054 | ||
603c27f8 AD |
1055 | print " |
1056 | Selection: | |
e828e31e AD |
1057 | <input type=\"submit\" class=\"button\" |
1058 | onclick=\"javascript:editSelectedFeed()\" value=\"Edit\"> | |
1059 | <input type=\"submit\" class=\"button\" | |
1060 | onclick=\"javascript:removeSelectedFeeds()\" value=\"Remove\">"; | |
1061 | ||
4769ddaf | 1062 | if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) { |
f92db4f5 | 1063 | print " |
e828e31e AD |
1064 | <input type=\"submit\" class=\"button\" |
1065 | onclick=\"javascript:readSelectedFeeds()\" value=\"Mark as read\"> | |
1066 | <input type=\"submit\" class=\"button\" | |
1067 | onclick=\"javascript:unreadSelectedFeeds()\" value=\"Mark as unread\"> "; | |
f92db4f5 AD |
1068 | } |
1069 | print " | |
e828e31e AD |
1070 | All feeds: |
1071 | <input type=\"submit\" | |
8158c57a | 1072 | class=\"button\" onclick=\"gotoExportOpml()\" value=\"Export OPML\">"; |
10c5820d | 1073 | |
603c27f8 AD |
1074 | } |
1075 | ||
f5a50b25 AD |
1076 | print "<h3>OPML Import</h3> |
1077 | <form enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\"> | |
1078 | File: <input id=\"opml_file\" name=\"opml_file\" type=\"file\"> | |
1079 | <input class=\"button\" name=\"op\" onclick=\"return validateOpmlImport();\" | |
1080 | type=\"submit\" value=\"Import\"> | |
1081 | </form>"; | |
1082 | ||
007bda35 AD |
1083 | } |
1084 | ||
a0d53889 AD |
1085 | if ($op == "pref-filters") { |
1086 | ||
1087 | $subop = $_GET["subop"]; | |
1088 | ||
1089 | if ($subop == "editSave") { | |
a0d53889 | 1090 | |
648472a7 AD |
1091 | $regexp = db_escape_string($_GET["r"]); |
1092 | $descr = db_escape_string($_GET["d"]); | |
1093 | $match = db_escape_string($_GET["m"]); | |
1094 | $filter_id = db_escape_string($_GET["id"]); | |
0afbd851 | 1095 | |
648472a7 | 1096 | $result = db_query($link, "UPDATE ttrss_filters SET |
4b3dff6e | 1097 | reg_exp = '$regexp', |
0afbd851 AD |
1098 | description = '$descr', |
1099 | filter_type = (SELECT id FROM ttrss_filter_types WHERE | |
1100 | description = '$match') | |
1101 | WHERE id = '$filter_id'"); | |
a0d53889 AD |
1102 | } |
1103 | ||
1104 | if ($subop == "remove") { | |
1105 | ||
1106 | if (!WEB_DEMO_MODE) { | |
1107 | ||
1108 | $ids = split(",", $_GET["ids"]); | |
1109 | ||
1110 | foreach ($ids as $id) { | |
648472a7 | 1111 | db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id'"); |
a0d53889 AD |
1112 | |
1113 | } | |
1114 | } | |
1115 | } | |
1116 | ||
1117 | if ($subop == "add") { | |
1118 | ||
de435974 | 1119 | if (!WEB_DEMO_MODE) { |
a0d53889 | 1120 | |
8158c57a | 1121 | $regexp = db_escape_string($_GET["regexp"]); |
648472a7 | 1122 | $match = db_escape_string($_GET["match"]); |
a0d53889 | 1123 | |
648472a7 | 1124 | $result = db_query($link, |
4356293a | 1125 | "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid) VALUES |
de435974 | 1126 | ('$regexp', (SELECT id FROM ttrss_filter_types WHERE |
4356293a | 1127 | description = '$match'),'".$_SESSION["uid"]."')"); |
de435974 | 1128 | } |
a0d53889 AD |
1129 | } |
1130 | ||
648472a7 | 1131 | $result = db_query($link, "SELECT description |
a0d53889 AD |
1132 | FROM ttrss_filter_types ORDER BY description"); |
1133 | ||
1134 | $filter_types = array(); | |
1135 | ||
648472a7 | 1136 | while ($line = db_fetch_assoc($result)) { |
a0d53889 AD |
1137 | array_push($filter_types, $line["description"]); |
1138 | } | |
1139 | ||
1140 | print "<table class=\"prefAddFeed\"><tr> | |
ea6774cf | 1141 | <td><input id=\"fadd_regexp\"></td> |
a0d53889 | 1142 | <td>"; |
bdc00fe0 | 1143 | print_select("fadd_match", "Title", $filter_types); |
a0d53889 AD |
1144 | |
1145 | print"</td><td colspan=\"4\" align=\"right\"> | |
1146 | <a class=\"button\" href=\"javascript:addFilter()\">Add filter</a></td></tr> | |
1147 | </table>"; | |
1148 | ||
648472a7 | 1149 | $result = db_query($link, "SELECT |
4b3dff6e | 1150 | id,reg_exp,description, |
a0d53889 AD |
1151 | (SELECT name FROM ttrss_filter_types WHERE |
1152 | id = filter_type) as filter_type_name, | |
1153 | (SELECT description FROM ttrss_filter_types | |
1154 | WHERE id = filter_type) as filter_type_descr | |
1155 | FROM | |
4356293a AD |
1156 | ttrss_filters |
1157 | WHERE | |
1158 | owner_uid = ".$_SESSION["uid"]." | |
1159 | ORDER by reg_exp"); | |
a0d53889 AD |
1160 | |
1161 | print "<p><table width=\"100%\" class=\"prefFilterList\" id=\"prefFilterList\">"; | |
1162 | ||
1163 | print "<tr class=\"title\"> | |
0afbd851 AD |
1164 | <td width=\"5%\">Select</td><td width=\"40%\">Filter expression</td> |
1165 | <td width=\"40%\">Description</td><td width=\"10%\">Match</td></tr>"; | |
a0d53889 AD |
1166 | |
1167 | $lnum = 0; | |
1168 | ||
648472a7 | 1169 | while ($line = db_fetch_assoc($result)) { |
a0d53889 AD |
1170 | |
1171 | $class = ($lnum % 2) ? "even" : "odd"; | |
1172 | ||
1173 | $filter_id = $line["id"]; | |
1174 | $edit_filter_id = $_GET["id"]; | |
1175 | ||
1176 | if ($subop == "edit" && $filter_id != $edit_filter_id) { | |
1177 | $class .= "Grayed"; | |
1178 | } | |
1179 | ||
1180 | print "<tr class=\"$class\" id=\"FILRR-$filter_id\">"; | |
1181 | ||
4b3dff6e | 1182 | $line["regexp"] = htmlspecialchars($line["reg_exp"]); |
ea6774cf AD |
1183 | $line["description"] = htmlspecialchars($line["description"]); |
1184 | ||
a0d53889 AD |
1185 | if (!$edit_filter_id || $subop != "edit") { |
1186 | ||
0afbd851 AD |
1187 | if (!$line["description"]) $line["description"] = "[No description]"; |
1188 | ||
a0d53889 AD |
1189 | print "<td><input onclick='toggleSelectRow(this);' |
1190 | type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>"; | |
1191 | ||
1192 | print "<td><a href=\"javascript:editFilter($filter_id);\">" . | |
4b3dff6e | 1193 | $line["reg_exp"] . "</td>"; |
a0d53889 AD |
1194 | |
1195 | print "<td><a href=\"javascript:editFilter($filter_id);\">" . | |
1196 | $line["description"] . "</td>"; | |
1197 | ||
1198 | print "<td>".$line["filter_type_descr"]."</td>"; | |
1199 | ||
1200 | } else if ($filter_id != $edit_filter_id) { | |
1201 | ||
0afbd851 AD |
1202 | if (!$line["description"]) $line["description"] = "[No description]"; |
1203 | ||
a0d53889 AD |
1204 | print "<td><input disabled=\"true\" type=\"checkbox\" |
1205 | id=\"FICHK-".$line["id"]."\"></td>"; | |
1206 | ||
4b3dff6e | 1207 | print "<td>".$line["reg_exp"]."</td>"; |
a0d53889 AD |
1208 | print "<td>".$line["description"]."</td>"; |
1209 | print "<td>".$line["filter_type_descr"]."</td>"; | |
1210 | ||
1211 | } else { | |
1212 | ||
e6cb77a0 | 1213 | print "<td><input disabled=\"true\" type=\"checkbox\" checked></td>"; |
a0d53889 | 1214 | |
4b3dff6e | 1215 | print "<td><input id=\"iedit_regexp\" value=\"".$line["reg_exp"]. |
a0d53889 AD |
1216 | "\"></td>"; |
1217 | ||
1218 | print "<td><input id=\"iedit_descr\" value=\"".$line["description"]. | |
1219 | "\"></td>"; | |
1220 | ||
1221 | print "<td>"; | |
1222 | print_select("iedit_match", $line["filter_type_descr"], $filter_types); | |
1223 | print "</td>"; | |
1224 | ||
1225 | } | |
1226 | ||
1227 | ||
1228 | print "</tr>"; | |
1229 | ||
1230 | ++$lnum; | |
1231 | } | |
1232 | ||
0afbd851 AD |
1233 | if ($lnum == 0) { |
1234 | print "<tr><td colspan=\"4\" align=\"center\">No filters defined.</td></tr>"; | |
1235 | } | |
1236 | ||
a0d53889 AD |
1237 | print "</table>"; |
1238 | ||
1239 | print "<p>"; | |
1240 | ||
1241 | if ($subop == "edit") { | |
e828e31e AD |
1242 | print "Edit feed: |
1243 | <input type=\"submit\" class=\"button\" | |
1244 | onclick=\"javascript:filterEditCancel()\" value=\"Cancel\"> | |
1245 | <input type=\"submit\" class=\"button\" | |
1246 | onclick=\"javascript:filterEditSave()\" value=\"Save\">"; | |
a0d53889 AD |
1247 | |
1248 | } else { | |
1249 | ||
1250 | print " | |
e828e31e AD |
1251 | Selection: |
1252 | <input type=\"submit\" class=\"button\" | |
1253 | onclick=\"javascript:editSelectedFilter()\" value=\"Edit\"> | |
1254 | <input type=\"submit\" class=\"button\" | |
1255 | onclick=\"javascript:removeSelectedFilters()\" value=\"Remove\">"; | |
a0d53889 AD |
1256 | } |
1257 | } | |
1258 | ||
48f0adb0 AD |
1259 | if ($op == "pref-labels") { |
1260 | ||
1261 | $subop = $_GET["subop"]; | |
1262 | ||
1263 | if ($subop == "editSave") { | |
1264 | ||
1265 | $sql_exp = $_GET["s"]; | |
1266 | $descr = $_GET["d"]; | |
1267 | $label_id = db_escape_string($_GET["id"]); | |
1268 | ||
1269 | // print "$sql_exp : $descr : $label_id"; | |
1270 | ||
1271 | $result = db_query($link, "UPDATE ttrss_labels SET | |
1272 | sql_exp = '$sql_exp', | |
1273 | description = '$descr' | |
1274 | WHERE id = '$label_id'"); | |
1275 | } | |
1276 | ||
1277 | if ($subop == "remove") { | |
1278 | ||
1279 | if (!WEB_DEMO_MODE) { | |
1280 | ||
1281 | $ids = split(",", $_GET["ids"]); | |
1282 | ||
1283 | foreach ($ids as $id) { | |
1284 | db_query($link, "DELETE FROM ttrss_labels WHERE id = '$id'"); | |
1285 | ||
1286 | } | |
1287 | } | |
1288 | } | |
1289 | ||
1290 | if ($subop == "add") { | |
1291 | ||
1292 | if (!WEB_DEMO_MODE) { | |
1293 | ||
1294 | $exp = $_GET["exp"]; | |
1295 | ||
1296 | $result = db_query($link, | |
4356293a AD |
1297 | "INSERT INTO ttrss_labels (sql_exp,description,owner_uid) |
1298 | VALUES ('$exp', '$exp', '".$_SESSION["uid"]."')"); | |
48f0adb0 AD |
1299 | } |
1300 | } | |
1301 | ||
1302 | print "<table class=\"prefAddFeed\"><tr> | |
1303 | <td><input id=\"ladd_expr\"></td>"; | |
1304 | ||
1305 | print"<td colspan=\"4\" align=\"right\"> | |
1306 | <a class=\"button\" href=\"javascript:addLabel()\">Add label</a></td></tr> | |
1307 | </table>"; | |
1308 | ||
1309 | $result = db_query($link, "SELECT | |
1310 | id,sql_exp,description | |
1311 | FROM | |
4356293a AD |
1312 | ttrss_labels |
1313 | WHERE | |
1314 | owner_uid = ".$_SESSION["uid"]." | |
1315 | ORDER by description"); | |
48f0adb0 AD |
1316 | |
1317 | print "<p><table width=\"100%\" class=\"prefLabelList\" id=\"prefLabelList\">"; | |
1318 | ||
1319 | print "<tr class=\"title\"> | |
7dc66a61 AD |
1320 | <td width=\"5%\">Select</td><td width=\"40%\">SQL expression |
1321 | <a class=\"helpLink\" href=\"javascript:popupHelp(1)\">(?)</a> | |
1322 | </td> | |
48f0adb0 AD |
1323 | <td width=\"40%\">Caption</td></tr>"; |
1324 | ||
1325 | $lnum = 0; | |
1326 | ||
1327 | while ($line = db_fetch_assoc($result)) { | |
1328 | ||
1329 | $class = ($lnum % 2) ? "even" : "odd"; | |
1330 | ||
1331 | $label_id = $line["id"]; | |
1332 | $edit_label_id = $_GET["id"]; | |
1333 | ||
1334 | if ($subop == "edit" && $label_id != $edit_label_id) { | |
1335 | $class .= "Grayed"; | |
1336 | } | |
1337 | ||
1338 | print "<tr class=\"$class\" id=\"LILRR-$label_id\">"; | |
1339 | ||
1340 | $line["sql_exp"] = htmlspecialchars($line["sql_exp"]); | |
1341 | $line["description"] = htmlspecialchars($line["description"]); | |
1342 | ||
1343 | if (!$edit_label_id || $subop != "edit") { | |
1344 | ||
1345 | if (!$line["description"]) $line["description"] = "[No caption]"; | |
1346 | ||
1347 | print "<td><input onclick='toggleSelectRow(this);' | |
1348 | type=\"checkbox\" id=\"LICHK-".$line["id"]."\"></td>"; | |
1349 | ||
1350 | print "<td><a href=\"javascript:editLabel($label_id);\">" . | |
1351 | $line["sql_exp"] . "</td>"; | |
1352 | ||
1353 | print "<td><a href=\"javascript:editLabel($label_id);\">" . | |
1354 | $line["description"] . "</td>"; | |
1355 | ||
1356 | } else if ($label_id != $edit_label_id) { | |
1357 | ||
1358 | if (!$line["description"]) $line["description"] = "[No description]"; | |
1359 | ||
1360 | print "<td><input disabled=\"true\" type=\"checkbox\" | |
1361 | id=\"LICHK-".$line["id"]."\"></td>"; | |
1362 | ||
1363 | print "<td>".$line["sql_exp"]."</td>"; | |
1364 | print "<td>".$line["description"]."</td>"; | |
1365 | ||
1366 | } else { | |
1367 | ||
e6cb77a0 | 1368 | print "<td><input disabled=\"true\" type=\"checkbox\" checked></td>"; |
48f0adb0 AD |
1369 | |
1370 | print "<td><input id=\"iedit_expr\" value=\"".$line["sql_exp"]. | |
1371 | "\"></td>"; | |
1372 | ||
1373 | print "<td><input id=\"iedit_descr\" value=\"".$line["description"]. | |
1374 | "\"></td>"; | |
1375 | ||
1376 | } | |
1377 | ||
1378 | ||
1379 | print "</tr>"; | |
1380 | ||
1381 | ++$lnum; | |
1382 | } | |
1383 | ||
1384 | if ($lnum == 0) { | |
1385 | print "<tr><td colspan=\"4\" align=\"center\">No labels defined.</td></tr>"; | |
1386 | } | |
1387 | ||
1388 | print "</table>"; | |
1389 | ||
1390 | print "<p>"; | |
1391 | ||
1392 | if ($subop == "edit") { | |
1393 | print "Edit label: | |
1394 | <input type=\"submit\" class=\"button\" | |
1395 | onclick=\"javascript:labelEditCancel()\" value=\"Cancel\"> | |
1396 | <input type=\"submit\" class=\"button\" | |
1397 | onclick=\"javascript:labelEditSave()\" value=\"Save\">"; | |
1398 | ||
1399 | } else { | |
1400 | ||
1401 | print " | |
1402 | Selection: | |
1403 | <input type=\"submit\" class=\"button\" | |
1404 | onclick=\"javascript:editSelectedLabel()\" value=\"Edit\"> | |
1405 | <input type=\"submit\" class=\"button\" | |
1406 | onclick=\"javascript:removeSelectedLabels()\" value=\"Remove\">"; | |
1407 | } | |
1408 | } | |
1409 | ||
e828e31e AD |
1410 | if ($op == "error") { |
1411 | print "<div width=\"100%\" align='center'>"; | |
1412 | $msg = $_GET["msg"]; | |
1413 | print $msg; | |
1414 | print "</div>"; | |
1415 | } | |
1416 | ||
7dc66a61 AD |
1417 | if ($op == "help") { |
1418 | print "<html><head> | |
1419 | <title>Tiny Tiny RSS : Help</title> | |
1420 | <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\"> | |
1421 | <script type=\"text/javascript\" src=\"functions.js\"></script> | |
7dc66a61 AD |
1422 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> |
1423 | </head><body>"; | |
1424 | ||
1425 | $tid = sprintf("%d", $_GET["tid"]); | |
1426 | ||
1427 | /* FIXME this badly needs real implementation */ | |
1428 | ||
1429 | print "<div class='helpResponse'>"; | |
1430 | ||
1431 | ?> | |
1432 | ||
1433 | <h1>Help for SQL expressions</h1> | |
1434 | ||
1435 | <h2>Description</h2> | |
1436 | ||
1437 | <p>The «SQL expression» is added to WHERE clause of | |
d1f948d1 | 1438 | view feed query. You can match on ttrss_entries table fields |
7dc66a61 AD |
1439 | and even use subselect to query additional information. This |
1440 | functionality is considered to be advanced and requires basic | |
1441 | understanding of SQL.</p> | |
1442 | ||
1443 | <h2>Examples</h2> | |
1444 | ||
1445 | <pre>unread = true</pre> | |
1446 | ||
1447 | Matches all unread articles | |
1448 | ||
1449 | <pre>title like '%Linux%'</pre> | |
1450 | ||
1451 | Matches all articles which mention Linux in the title. You get the idea. | |
1452 | ||
1453 | <p>See the database schema included in the distribution package for gruesome | |
1454 | details.</p> | |
1455 | ||
1456 | <? | |
1457 | ||
1458 | print "<div align='center'> | |
1459 | <a class=\"helpLink\" | |
1460 | href=\"javascript:window.close()\">(Close this window)</a></div>"; | |
1461 | ||
1462 | print "</div>"; | |
1463 | ||
1464 | print "</body></html>"; | |
1465 | ||
1466 | } | |
1467 | ||
f84a97a3 AD |
1468 | if ($op == "dlg") { |
1469 | $id = $_GET["id"]; | |
6de5d056 | 1470 | $param = $_GET["param"]; |
f84a97a3 AD |
1471 | |
1472 | if ($id == "quickAddFeed") { | |
033e47e0 AD |
1473 | print "Feed URL: <input |
1474 | onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\" | |
1475 | id=\"qafInput\"> | |
f84a97a3 AD |
1476 | <input class=\"button\" |
1477 | type=\"submit\" onclick=\"javascript:qafAdd()\" value=\"Add feed\"> | |
1478 | <input class=\"button\" | |
1479 | type=\"submit\" onclick=\"javascript:closeDlg()\" | |
1480 | value=\"Cancel\">"; | |
1481 | } | |
6de5d056 AD |
1482 | |
1483 | if ($id == "quickDelFeed") { | |
1484 | ||
1485 | $param = db_escape_string($param); | |
1486 | ||
1487 | $result = db_query($link, "SELECT title FROM ttrss_feeds WHERE id = '$param'"); | |
1488 | ||
1489 | if ($result) { | |
1490 | ||
1491 | $f_title = db_fetch_result($result, 0, "title"); | |
1492 | ||
1493 | print "Remove current feed ($f_title)? | |
1494 | <input class=\"button\" | |
1495 | type=\"submit\" onclick=\"javascript:qfdDelete($param)\" value=\"Remove\"> | |
1496 | <input class=\"button\" | |
1497 | type=\"submit\" onclick=\"javascript:closeDlg()\" | |
1498 | value=\"Cancel\">"; | |
1499 | } else { | |
1500 | print "Error: Feed $param not found. | |
1501 | <input class=\"button\" | |
1502 | type=\"submit\" onclick=\"javascript:closeDlg()\" | |
1503 | value=\"Cancel\">"; | |
1504 | } | |
1505 | } | |
1506 | ||
033e47e0 AD |
1507 | if ($id == "search") { |
1508 | ||
1509 | print "<input id=\"searchbox\" class=\"extSearch\" | |
1510 | onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\" | |
1511 | onchange=\"javascript:search()\"> | |
1512 | <select id=\"searchmodebox\"> | |
1513 | <option selected>All feeds</option> | |
1514 | <option>This feed</option> | |
1515 | </select> | |
1516 | <input type=\"submit\" | |
1517 | class=\"button\" onclick=\"javascript:search()\" value=\"Search\"> | |
1518 | <input class=\"button\" | |
1519 | type=\"submit\" onclick=\"javascript:closeDlg()\" | |
1520 | value=\"Close\">"; | |
1521 | ||
1522 | } | |
1523 | ||
f84a97a3 AD |
1524 | } |
1525 | ||
e65af9c1 AD |
1526 | if ($op == "updateAllFeeds") { |
1527 | update_all_feeds($link, true); | |
1528 | ||
1529 | print "<rpc-reply>"; | |
1530 | getLabelCounters($link); | |
1531 | getFeedCounters($link); | |
1532 | getTagCounters($link); | |
1533 | getGlobalCounters($link); | |
1534 | print "</rpc-reply>"; | |
1535 | ||
1536 | } | |
1537 | ||
77e96719 AD |
1538 | if ($op == "pref-prefs") { |
1539 | ||
b1895692 | 1540 | $subop = $_REQUEST["subop"]; |
77e96719 AD |
1541 | |
1542 | if ($subop == "Save configuration") { | |
1543 | ||
01d68cf9 AD |
1544 | if (WEB_DEMO_MODE) return; |
1545 | ||
77e96719 AD |
1546 | foreach (array_keys($_POST) as $pref_name) { |
1547 | ||
1548 | $pref_name = db_escape_string($pref_name); | |
1549 | $value = db_escape_string($_POST[$pref_name]); | |
1550 | ||
1551 | $result = db_query($link, "SELECT type_name | |
1552 | FROM ttrss_prefs,ttrss_prefs_types | |
1553 | WHERE pref_name = '$pref_name' AND type_id = ttrss_prefs_types.id"); | |
1554 | ||
1555 | if (db_num_rows($result) > 0) { | |
1556 | ||
1557 | $type_name = db_fetch_result($result, 0, "type_name"); | |
1558 | ||
5da169d9 AD |
1559 | // print "$pref_name : $type_name : $value<br>"; |
1560 | ||
77e96719 | 1561 | if ($type_name == "bool") { |
5da169d9 | 1562 | if ($value == "1") { |
77e96719 AD |
1563 | $value = "true"; |
1564 | } else { | |
1565 | $value = "false"; | |
1566 | } | |
1567 | } else if ($type_name == "integer") { | |
1568 | $value = sprintf("%d", $value); | |
1569 | } | |
1570 | ||
1571 | // print "$pref_name : $type_name : $value<br>"; | |
1572 | ||
ff485f1d AD |
1573 | db_query($link, "UPDATE ttrss_user_prefs SET value = '$value' |
1574 | WHERE pref_name = '$pref_name' AND owner_uid = ".$_SESSION["uid"]); | |
77e96719 AD |
1575 | |
1576 | } | |
1577 | ||
1578 | header("Location: prefs.php"); | |
1579 | ||
1580 | } | |
1581 | ||
b1895692 AD |
1582 | } else if ($subop == "getHelp") { |
1583 | ||
1584 | $pref_name = db_escape_string($_GET["pn"]); | |
1585 | ||
1586 | $result = db_query($link, "SELECT help_text FROM ttrss_prefs | |
1587 | WHERE pref_name = '$pref_name'"); | |
1588 | ||
1589 | if (db_num_rows($result) > 0) { | |
1590 | $help_text = db_fetch_result($result, 0, "help_text"); | |
1591 | print $help_text; | |
1592 | } else { | |
1593 | print "Unknown option: $pref_name"; | |
1594 | } | |
1595 | ||
1c7f75ed AD |
1596 | } else if ($subop == "Change password") { |
1597 | ||
1598 | if (WEB_DEMO_MODE) return; | |
1599 | ||
1600 | $old_pw = $_POST["OLD_PASSWORD"]; | |
1601 | $new_pw = $_POST["OLD_PASSWORD"]; | |
1602 | ||
1603 | $old_pw_hash = 'SHA1:' . sha1($_POST["OLD_PASSWORD"]); | |
1604 | $new_pw_hash = 'SHA1:' . sha1($_POST["NEW_PASSWORD"]); | |
1605 | ||
1606 | $active_uid = $_SESSION["uid"]; | |
1607 | ||
1608 | if ($old_pw && $new_pw) { | |
1609 | ||
1610 | $login = db_escape_string($_SERVER['PHP_AUTH_USER']); | |
1611 | ||
1612 | $result = db_query($link, "SELECT id FROM ttrss_users WHERE | |
1613 | id = '$active_uid' AND (pwd_hash = '$old_pw' OR | |
1614 | pwd_hash = '$old_pw_hash')"); | |
1615 | ||
1616 | if (db_num_rows($result) == 1) { | |
1617 | db_query($link, "UPDATE ttrss_users SET pwd_hash = '$new_pw_hash' | |
1618 | WHERE id = '$active_uid'"); | |
1619 | } | |
1620 | } | |
1621 | ||
1622 | header("Location: prefs.php"); | |
1623 | ||
77e96719 AD |
1624 | } else if ($subop == "Reset to defaults") { |
1625 | ||
01d68cf9 AD |
1626 | if (WEB_DEMO_MODE) return; |
1627 | ||
e1aa0559 AD |
1628 | if (DB_TYPE == "pgsql") { |
1629 | db_query($link,"UPDATE ttrss_user_prefs | |
1630 | SET value = ttrss_prefs.def_value | |
1631 | WHERE owner_uid = '".$_SESSION["uid"]."' AND | |
1632 | ttrss_prefs.pref_name = ttrss_user_prefs.pref_name"); | |
1633 | } else { | |
1634 | db_query($link, "DELETE FROM ttrss_user_prefs | |
1635 | WHERE owner_uid = ".$_SESSION["uid"]); | |
1636 | initialize_user_prefs($link, $_SESSION["uid"]); | |
1637 | } | |
5da169d9 | 1638 | |
77e96719 AD |
1639 | header("Location: prefs.php"); |
1640 | ||
1641 | } else { | |
1642 | ||
7d4c898a | 1643 | if (!SINGLE_USER_MODE) { |
1c7f75ed | 1644 | |
7d4c898a AD |
1645 | print "<form action=\"backend.php\" method=\"POST\">"; |
1646 | ||
1647 | print "<table width=\"100%\" class=\"prefPrefsList\">"; | |
1648 | print "<tr><td colspan='3'><h3>Authentication</h3></tr></td>"; | |
1649 | ||
1650 | print "<tr><td width=\"40%\">Old password</td>"; | |
1651 | print "<td><input class=\"editbox\" type=\"password\" | |
1652 | name=\"OLD_PASSWORD\"></td></tr>"; | |
1653 | ||
1654 | print "<tr><td width=\"40%\">New password</td>"; | |
1655 | ||
1656 | print "<td><input class=\"editbox\" type=\"password\" | |
1657 | name=\"NEW_PASSWORD\"></td></tr>"; | |
1658 | ||
1659 | print "</table>"; | |
1660 | ||
1661 | print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">"; | |
1662 | ||
1663 | print "<p><input class=\"button\" type=\"submit\" | |
1664 | value=\"Change password\" name=\"subop\">"; | |
1665 | ||
1666 | print "</form>"; | |
1c7f75ed | 1667 | |
7d4c898a | 1668 | } |
1c7f75ed | 1669 | |
77e96719 | 1670 | $result = db_query($link, "SELECT |
ff485f1d | 1671 | ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name, |
77e96719 | 1672 | section_name,def_value |
ff485f1d | 1673 | FROM ttrss_prefs,ttrss_prefs_types,ttrss_prefs_sections,ttrss_user_prefs |
77e96719 | 1674 | WHERE type_id = ttrss_prefs_types.id AND |
ff485f1d | 1675 | section_id = ttrss_prefs_sections.id AND |
a2411bd9 AD |
1676 | ttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND |
1677 | owner_uid = ".$_SESSION["uid"]." | |
650bc435 | 1678 | ORDER BY section_id,short_desc"); |
77e96719 AD |
1679 | |
1680 | print "<form action=\"backend.php\" method=\"POST\">"; | |
1681 | ||
77e96719 AD |
1682 | $lnum = 0; |
1683 | ||
1684 | $active_section = ""; | |
1685 | ||
1686 | while ($line = db_fetch_assoc($result)) { | |
1687 | ||
1688 | if ($active_section != $line["section_name"]) { | |
59a654ba AD |
1689 | |
1690 | if ($active_section != "") { | |
1c7f75ed | 1691 | print "</table>"; |
59a654ba | 1692 | } |
1c7f75ed AD |
1693 | |
1694 | print "<p><table width=\"100%\" class=\"prefPrefsList\">"; | |
59a654ba AD |
1695 | |
1696 | $active_section = $line["section_name"]; | |
1697 | ||
77e96719 | 1698 | print "<tr><td colspan=\"3\"><h3>$active_section</h3></td></tr>"; |
59a654ba AD |
1699 | // print "<tr class=\"title\"> |
1700 | // <td width=\"25%\">Option</td><td>Value</td></tr>"; | |
7268adf7 AD |
1701 | |
1702 | $lnum = 0; | |
77e96719 AD |
1703 | } |
1704 | ||
650bc435 | 1705 | // $class = ($lnum % 2) ? "even" : "odd"; |
77e96719 | 1706 | |
650bc435 | 1707 | print "<tr>"; |
77e96719 | 1708 | |
77e96719 AD |
1709 | $type_name = $line["type_name"]; |
1710 | $pref_name = $line["pref_name"]; | |
1711 | $value = $line["value"]; | |
1712 | $def_value = $line["def_value"]; | |
b1895692 AD |
1713 | $help_text = $line["help_text"]; |
1714 | ||
1715 | print "<td width=\"40%\" id=\"$pref_name\">" . $line["short_desc"]; | |
1716 | ||
1717 | if ($help_text) print "<div class=\"prefHelp\">$help_text</div>"; | |
1718 | ||
1719 | print "</td>"; | |
77e96719 AD |
1720 | |
1721 | print "<td>"; | |
1722 | ||
1723 | if ($type_name == "bool") { | |
1724 | // print_select($pref_name, $value, array("true", "false")); | |
1725 | ||
1726 | if ($value == "true") { | |
1727 | $value = "Yes"; | |
1728 | } else { | |
1729 | $value = "No"; | |
1730 | } | |
1731 | ||
1732 | print_radio($pref_name, $value, array("Yes", "No")); | |
1733 | ||
1734 | } else { | |
1735 | print "<input class=\"editbox\" name=\"$pref_name\" value=\"$value\">"; | |
1736 | } | |
1737 | ||
1738 | print "</td>"; | |
1739 | ||
1740 | print "</tr>"; | |
1741 | ||
1742 | $lnum++; | |
1743 | } | |
1744 | ||
1745 | print "</table>"; | |
1746 | ||
1747 | print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">"; | |
1748 | ||
1749 | print "<p><input class=\"button\" type=\"submit\" | |
1750 | name=\"subop\" value=\"Save configuration\">"; | |
1751 | ||
1752 | print " <input class=\"button\" type=\"submit\" | |
1753 | name=\"subop\" value=\"Reset to defaults\"></p>"; | |
1754 | ||
1755 | print "</form>"; | |
1756 | ||
1757 | } | |
1758 | ||
1759 | } | |
1760 | ||
e6cb77a0 AD |
1761 | if ($op == "pref-users") { |
1762 | ||
1763 | $subop = $_GET["subop"]; | |
1764 | ||
1765 | if ($subop == "editSave") { | |
1766 | ||
1767 | if (!WEB_DEMO_MODE) { | |
1768 | ||
1769 | $login = db_escape_string($_GET["l"]); | |
1770 | $uid = db_escape_string($_GET["id"]); | |
1771 | $access_level = sprintf("%d", $_GET["al"]); | |
1772 | ||
1773 | db_query($link, "UPDATE ttrss_users SET login = '$login', access_level = '$access_level' WHERE id = '$uid'"); | |
1774 | ||
1775 | } | |
1776 | } else if ($subop == "remove") { | |
1777 | ||
1778 | if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { | |
1779 | ||
1780 | $ids = split(",", $_GET["ids"]); | |
1781 | ||
1782 | foreach ($ids as $id) { | |
1783 | db_query($link, "DELETE FROM ttrss_users WHERE id = '$id' AND id != " . $_SESSION["uid"]); | |
1784 | ||
1785 | } | |
1786 | } | |
1787 | } else if ($subop == "add") { | |
1788 | ||
1789 | if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { | |
1790 | ||
1791 | $login = db_escape_string($_GET["login"]); | |
1792 | $tmp_user_pwd = make_password(8); | |
1793 | $pwd_hash = 'SHA1:' . sha1($tmp_user_pwd); | |
1794 | ||
1795 | db_query($link, "INSERT INTO ttrss_users (login,pwd_hash,access_level) | |
1796 | VALUES ('$login', '$pwd_hash', 0)"); | |
1797 | ||
1798 | ||
1799 | $result = db_query($link, "SELECT id FROM ttrss_users WHERE | |
1800 | login = '$login' AND pwd_hash = '$pwd_hash'"); | |
1801 | ||
1802 | if (db_num_rows($result) == 1) { | |
1803 | ||
1804 | $new_uid = db_fetch_result($result, 0, "id"); | |
1805 | ||
1806 | print "<div class=\"notice\">Added user <b>".$_GET["login"]. | |
1807 | "</b> with password <b>$tmp_user_pwd</b>.</div>"; | |
1808 | ||
1809 | initialize_user($link, $new_uid); | |
1810 | ||
1811 | } else { | |
1812 | ||
1813 | print "<div class=\"warning\">Error while adding user <b>". | |
1814 | $_GET["login"].".</b></div>"; | |
1815 | ||
1816 | } | |
1817 | } | |
1818 | } else if ($subop == "resetPass") { | |
1819 | ||
1820 | if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { | |
1821 | ||
1822 | $uid = db_escape_string($_GET["id"]); | |
1823 | ||
1824 | $result = db_query($link, "SELECT login FROM ttrss_users WHERE id = '$uid'"); | |
1825 | ||
1826 | $login = db_fetch_result($result, 0, "login"); | |
1827 | $tmp_user_pwd = make_password(8); | |
1828 | $pwd_hash = 'SHA1:' . sha1($tmp_user_pwd); | |
1829 | ||
1830 | db_query($link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash' | |
1831 | WHERE id = '$uid'"); | |
1832 | ||
1833 | print "<div class=\"notice\">Changed password of | |
1834 | user <b>$login</b> to <b>$tmp_user_pwd</b>.</div>"; | |
1835 | ||
1836 | } | |
1837 | } | |
1838 | ||
1839 | print "<table class=\"prefAddFeed\"><tr> | |
1840 | <td><input id=\"uadd_box\"></td>"; | |
1841 | ||
1842 | print"<td colspan=\"4\" align=\"right\"> | |
1843 | <a class=\"button\" href=\"javascript:addUser()\">Add user</a></td></tr> | |
1844 | </table>"; | |
1845 | ||
1846 | $result = db_query($link, "SELECT | |
f6f32198 | 1847 | id,login,access_level,last_login |
e6cb77a0 AD |
1848 | FROM |
1849 | ttrss_users | |
1850 | ORDER by login"); | |
1851 | ||
1a7572cb AD |
1852 | print "<div id=\"prefUserDetails\">PLACEHOLDER</div>"; |
1853 | ||
e6cb77a0 AD |
1854 | print "<p><table width=\"100%\" class=\"prefUserList\" id=\"prefUserList\">"; |
1855 | ||
1856 | print "<tr class=\"title\"> | |
f6f32198 AD |
1857 | <td width=\"5%\">Select</td> |
1858 | <td width='30%'>Username</td> | |
1859 | <td width='30%'>Access Level</td> | |
1860 | <td width='30%'>Last login</td></tr>"; | |
e6cb77a0 AD |
1861 | |
1862 | $lnum = 0; | |
1863 | ||
1864 | while ($line = db_fetch_assoc($result)) { | |
1865 | ||
1866 | $class = ($lnum % 2) ? "even" : "odd"; | |
1867 | ||
1868 | $uid = $line["id"]; | |
1869 | $edit_uid = $_GET["id"]; | |
1870 | ||
1871 | if ($uid == $_SESSION["uid"] || ($subop == "edit" && $uid != $edit_uid)) { | |
1872 | $class .= "Grayed"; | |
1873 | } | |
1874 | ||
1875 | print "<tr class=\"$class\" id=\"UMRR-$uid\">"; | |
1876 | ||
1877 | $line["login"] = htmlspecialchars($line["login"]); | |
1878 | ||
1879 | if ($uid == $_SESSION["uid"]) { | |
1880 | ||
1881 | print "<td><input disabled=\"true\" type=\"checkbox\" | |
1882 | id=\"UMCHK-".$line["id"]."\"></td>"; | |
1883 | ||
1884 | print "<td>".$line["login"]."</td>"; | |
1885 | print "<td>".$line["access_level"]."</td>"; | |
e6cb77a0 AD |
1886 | |
1887 | } else if (!$edit_uid || $subop != "edit") { | |
1888 | ||
1889 | print "<td><input onclick='toggleSelectRow(this);' | |
1a7572cb | 1890 | type=\"checkbox\" id=\"UMCHK-$uid\"></td>"; |
e6cb77a0 AD |
1891 | |
1892 | print "<td><a href=\"javascript:editUser($uid);\">" . | |
1893 | $line["login"] . "</td>"; | |
1894 | ||
1895 | print "<td><a href=\"javascript:editUser($uid);\">" . | |
1896 | $line["access_level"] . "</td>"; | |
1897 | ||
1898 | } else if ($uid != $edit_uid) { | |
1899 | ||
1900 | print "<td><input disabled=\"true\" type=\"checkbox\" | |
1901 | id=\"UMCHK-".$line["id"]."\"></td>"; | |
1902 | ||
1903 | print "<td>".$line["login"]."</td>"; | |
1904 | print "<td>".$line["access_level"]."</td>"; | |
1905 | ||
1906 | } else { | |
1907 | ||
1908 | print "<td><input disabled=\"true\" type=\"checkbox\" checked></td>"; | |
1909 | ||
1910 | print "<td><input id=\"iedit_ulogin\" value=\"".$line["login"]. | |
1911 | "\"></td>"; | |
1912 | ||
1913 | print "<td><input id=\"iedit_ulevel\" value=\"".$line["access_level"]. | |
1914 | "\"></td>"; | |
1915 | ||
1916 | } | |
1917 | ||
f6f32198 AD |
1918 | print "<td>".$line["last_login"]."</td>"; |
1919 | ||
e6cb77a0 AD |
1920 | print "</tr>"; |
1921 | ||
1922 | ++$lnum; | |
1923 | } | |
1924 | ||
1925 | print "</table>"; | |
1926 | ||
1927 | print "<p>"; | |
1928 | ||
1929 | if ($subop == "edit") { | |
1930 | print "Edit label: | |
1931 | <input type=\"submit\" class=\"button\" | |
1932 | onclick=\"javascript:userEditCancel()\" value=\"Cancel\"> | |
1933 | <input type=\"submit\" class=\"button\" | |
1934 | onclick=\"javascript:userEditSave()\" value=\"Save\">"; | |
1935 | ||
1936 | } else { | |
1937 | ||
1938 | print " | |
1939 | Selection: | |
1940 | <input type=\"submit\" class=\"button\" | |
717f5e64 | 1941 | onclick=\"javascript:selectedUserDetails()\" value=\"User details\"> |
e6cb77a0 AD |
1942 | <input type=\"submit\" class=\"button\" |
1943 | onclick=\"javascript:editSelectedUser()\" value=\"Edit\"> | |
1944 | <input type=\"submit\" class=\"button\" | |
717f5e64 AD |
1945 | onclick=\"javascript:removeSelectedUsers()\" value=\"Remove\"> |
1946 | <input type=\"submit\" class=\"button\" | |
1947 | onclick=\"javascript:resetSelectedUserPass()\" value=\"Reset password\">"; | |
1948 | ||
1949 | } | |
1950 | } | |
1951 | ||
1952 | if ($op == "user-details") { | |
1953 | ||
1954 | if (WEB_DEMO_MODE || $_SESSION["access_level"] < 10) { | |
1955 | return; | |
1956 | } | |
1957 | ||
1a7572cb | 1958 | /* print "<html><head> |
717f5e64 AD |
1959 | <title>Tiny Tiny RSS : User Details</title> |
1960 | <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\"> | |
1961 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> | |
1a7572cb | 1962 | </head><body>"; */ |
717f5e64 AD |
1963 | |
1964 | $uid = sprintf("%d", $_GET["id"]); | |
1965 | ||
717f5e64 AD |
1966 | print "<div class='userDetails'>"; |
1967 | ||
1968 | $result = db_query($link, "SELECT login,last_login,access_level | |
1969 | FROM ttrss_users | |
1970 | WHERE id = '$uid'"); | |
1971 | ||
1972 | if (db_num_rows($result) == 0) { | |
1973 | print "<h1>User not found</h1>"; | |
1974 | return; | |
1975 | } | |
1976 | ||
1977 | print "<h1>User Details</h1>"; | |
1978 | ||
1979 | print "<table width='100%'>"; | |
1980 | ||
1981 | $login = db_fetch_result($result, 0, "login"); | |
1982 | $last_login = db_fetch_result($result, 0, "last_login"); | |
1983 | $access_level = db_fetch_result($result, 0, "access_level"); | |
1984 | ||
1985 | print "<tr><td>Username</td><td>$login</td></tr>"; | |
1986 | print "<tr><td>Access level</td><td>$access_level</td></tr>"; | |
1987 | print "<tr><td>Last logged in</td><td>$last_login</td></tr>"; | |
1988 | ||
1989 | $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds | |
1990 | WHERE owner_uid = '$uid'"); | |
1991 | ||
1992 | $num_feeds = db_fetch_result($result, 0, "num_feeds"); | |
1993 | ||
1994 | print "<tr><td>Subscribed feeds count</td><td>$num_feeds</td></tr>"; | |
1995 | ||
1996 | $result = db_query($link, "SELECT | |
1997 | SUM(LENGTH(content)+LENGTH(title)+LENGTH(link)+LENGTH(guid)) AS db_size | |
1998 | FROM ttrss_entries WHERE owner_uid = '$uid'"); | |
1999 | ||
d9f115c3 | 2000 | $db_size = round(db_fetch_result($result, 0, "db_size") / 1024); |
717f5e64 | 2001 | |
d9f115c3 | 2002 | print "<tr><td>Approx. DB size</td><td>$db_size KBytes</td></tr>"; |
717f5e64 AD |
2003 | |
2004 | print "</table>"; | |
2005 | ||
2006 | print "<h1>Subscribed feeds</h1>"; | |
2007 | ||
2008 | $result = db_query($link, "SELECT id,title,feed_url FROM ttrss_feeds | |
d9f115c3 | 2009 | WHERE owner_uid = '$uid' ORDER BY title"); |
717f5e64 AD |
2010 | |
2011 | print "<ul class=\"nomarks\">"; | |
2012 | ||
2013 | while ($line = db_fetch_assoc($result)) { | |
2014 | ||
2015 | $icon_file = ICONS_URL."/".$line["id"].".ico"; | |
2016 | ||
2017 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
2018 | $feed_icon = "<img class=\"feedIcon\" src=\"$icon_file\">"; | |
2019 | } else { | |
2020 | $feed_icon = "<img class=\"feedIcon\" src=\"images/blank_icon.gif\">"; | |
2021 | } | |
2022 | ||
2023 | print "<li>$feed_icon <a href=\"".$line["feed_url"]."\">".$line["title"]."</a></li>"; | |
e6cb77a0 | 2024 | } |
717f5e64 AD |
2025 | |
2026 | print "</ul>"; | |
2027 | ||
717f5e64 AD |
2028 | print "</div>"; |
2029 | ||
1a7572cb AD |
2030 | print "<div align='center'> |
2031 | <input type='submit' class='button' | |
2032 | onclick=\"closeUserDetails()\" value=\"Close this window\"></div>"; | |
2033 | ||
2034 | // print "</body></html>"; | |
717f5e64 | 2035 | |
e6cb77a0 AD |
2036 | } |
2037 | ||
4b3dff6e | 2038 | db_close($link); |
1cd17194 | 2039 | ?> |
406d9489 AD |
2040 | |
2041 | <!-- <?= sprintf("Backend execution time: %.4f seconds", getmicrotime() - $script_started) ?> --> | |
2042 |