]> git.wh0rd.org - tt-rss.git/blame - backend.php
add another example label in default schema
[tt-rss.git] / backend.php
CommitLineData
1cd17194 1<?
090e250b
AD
2 $op = $_GET["op"];
3
4 if ($op == "rpc") {
5 header("Content-Type: application/xml");
6 }
1cd17194 7
82baad4a 8 require_once "config.php";
648472a7 9 require_once "db.php";
82baad4a
AD
10 require_once "functions.php";
11 require_once "magpierss/rss_fetch.inc";
1cd17194 12
648472a7 13 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
d76a3b03 14
5136011e
AD
15 if (!$link) {
16 if (DB_TYPE == "mysql") {
17 print mysql_error();
18 }
19 // PG seems to display its own errors just fine by default.
20 return;
21 }
22
648472a7
AD
23 if (DB_TYPE == "pgsql") {
24 pg_query("set client_encoding = 'utf-8'");
25 }
090e250b 26
331900c6 27 $fetch = $_GET["fetch"];
175847de 28
8143ae1f
AD
29 /* FIXME this needs reworking */
30
31 function getTagCounters($link) {
32 $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
33 FROM ttrss_tags,ttrss_entries WHERE
34 post_id = ttrss_entries.id AND unread = true GROUP BY tag_name
35 UNION
36 select tag_name,0 as count FROM ttrss_tags");
37
38 $tags = array();
39
40 while ($line = db_fetch_assoc($result)) {
41 $tags[$line["tag_name"]] += $line["count"];
42 }
43
44 foreach (array_keys($tags) as $tag) {
45 $unread = $tags[$tag];
46
47 $tag = htmlspecialchars($tag);
48 print "<tag id=\"$tag\" counter=\"$unread\"/>";
49 }
50 }
51
090e250b
AD
52 function getLabelCounters($link) {
53
54 $result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
8073cce7 55 WHERE marked = true AND unread = true");
090e250b 56
d61fd764 57 $count = db_fetch_result($result, 0, "count");
090e250b
AD
58
59 print "<label id=\"-1\" counter=\"$count\"/>";
60
61 $result = db_query($link, "SELECT id,sql_exp,description FROM
62 ttrss_labels ORDER by description");
63
64 while ($line = db_fetch_assoc($result)) {
65
66 $id = -$line["id"] - 11;
67
68 error_reporting (0);
d61fd764
AD
69
70 $tmp_result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
392d4563 71 WHERE (" . $line["sql_exp"] . ") AND unread = true");
090e250b 72
d61fd764 73 $count = db_fetch_result($tmp_result, 0, "count");
090e250b 74
ab3f3f72 75 print "<label id=\"$id\" counter=\"$count\"/>";
090e250b
AD
76
77 error_reporting (E_ERROR | E_WARNING | E_PARSE);
78
79 }
80 }
81
8073cce7
AD
82 function getFeedCounter($link, $id) {
83
84 $result = db_query($link, "SELECT
85 count(id) as count FROM ttrss_entries
86 WHERE feed_id = '$id' AND unread = true");
87
88 $count = db_fetch_result($result, 0, "count");
89
90 print "<feed id=\"$id\" counter=\"$count\"/>";
91 }
090e250b 92
8073cce7
AD
93 function getFeedCounters($link) {
94
090e250b
AD
95 $result = db_query($link, "SELECT id,
96 (SELECT count(id) FROM ttrss_entries WHERE feed_id = ttrss_feeds.id
97 AND unread = true) as count
98 FROM ttrss_feeds");
99
100 while ($line = db_fetch_assoc($result)) {
101
102 $id = $line["id"];
103 $count = $line["count"];
104
105 print "<feed id=\"$id\" counter=\"$count\"/>";
106 }
107 }
108
8143ae1f 109 function outputFeedList($link, $tags = false) {
175847de 110
1a66d16e
AD
111 print "<html><head>
112 <title>Tiny Tiny RSS : Feedlist</title>
113 <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
114 <script type=\"text/javascript\" src=\"functions.js\"></script>
115 <script type=\"text/javascript\" src=\"feedlist.js\"></script>
116 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
117 </head><body>";
254e0e4b
AD
118
119 print "<ul class=\"feedList\" id=\"feedList\">";
120
8143ae1f 121 if (!$tags) {
254e0e4b 122
8143ae1f 123 /* virtual feeds */
254e0e4b 124
8143ae1f
AD
125 $result = db_query($link, "SELECT count(id) as num_starred
126 FROM ttrss_entries WHERE marked = true AND unread = true");
127 $num_starred = db_fetch_result($result, 0, "num_starred");
254e0e4b 128
8add756a
AD
129 $class = "odd";
130
131 if ($num_starred > 0) $class .= "Unread";
132
133 printFeedEntry(-1, $class, "Starred articles", $num_starred,
8143ae1f 134 "images/mark_set.png");
48f0adb0 135
8143ae1f
AD
136 if (ENABLE_LABELS) {
137
138 $result = db_query($link, "SELECT id,sql_exp,description FROM
139 ttrss_labels ORDER by description");
140
141 if (db_num_rows($result) > 0) {
142 print "<li><hr></li>";
143 }
144
145 while ($line = db_fetch_assoc($result)) {
48f0adb0 146
8143ae1f
AD
147 error_reporting (0);
148
149 $tmp_result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
150 WHERE (" . $line["sql_exp"] . ") AND unread = true");
151
152 $count = db_fetch_result($tmp_result, 0, "count");
153
154 $class = "odd";
155
156 if ($count > 0) {
157 $class .= "Unread";
158 }
159
160 error_reporting (E_ERROR | E_WARNING | E_PARSE);
161
162 printFeedEntry(-$line["id"]-11,
163 $class, $line["description"], $count, "images/label.png");
164
165 }
48f0adb0
AD
166 }
167
8143ae1f
AD
168 print "<li><hr></li>";
169
170 $result = db_query($link, "SELECT *,
171 (SELECT count(id) FROM ttrss_entries
172 WHERE feed_id = ttrss_feeds.id) AS total,
173 (SELECT count(id) FROM ttrss_entries
174 WHERE feed_id = ttrss_feeds.id AND unread = true) as unread
175 FROM ttrss_feeds ORDER BY title");
176
177 $actid = $_GET["actid"];
178
179 /* real feeds */
180
181 $lnum = 0;
182
183 $total_unread = 0;
184
48f0adb0 185 while ($line = db_fetch_assoc($result)) {
8143ae1f
AD
186
187 $feed = $line["title"];
188 $feed_id = $line["id"];
189
190 $subop = $_GET["subop"];
191
192 $total = $line["total"];
193 $unread = $line["unread"];
194
195 // $class = ($lnum % 2) ? "even" : "odd";
48f0adb0 196
392d4563 197 $class = "odd";
8143ae1f
AD
198
199 if ($unread > 0) $class .= "Unread";
200
201 if ($actid == $feed_id) {
202 $class .= "Selected";
392d4563 203 }
48f0adb0 204
8143ae1f
AD
205 $total_unread += $unread;
206
207 printFeedEntry($feed_id, $class, $feed, $unread, "icons/$feed_id.ico");
208
209 ++$lnum;
48f0adb0 210 }
8143ae1f 211 } else {
a1a8a2be 212
8143ae1f 213 // tags
a1a8a2be 214
8143ae1f
AD
215 $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
216 FROM ttrss_tags,ttrss_entries WHERE
217 post_id = ttrss_entries.id AND unread = true GROUP BY tag_name
218 UNION
219 select tag_name,0 as count FROM ttrss_tags");
220
221 $tags = array();
222
223 while ($line = db_fetch_assoc($result)) {
224 $tags[$line["tag_name"]] += $line["count"];
1a66d16e 225 }
8143ae1f
AD
226
227 foreach (array_keys($tags) as $tag) {
228
229 $unread = $tags[$tag];
230
231 $class = "odd";
232
233 if ($unread > 0) {
234 $class .= "Unread";
235 }
236
237 printFeedEntry($tag, $class, $tag, $unread, "images/tag.png");
238
239 }
1a66d16e 240
e828e31e 241 }
82baad4a 242
dc33ec95
AD
243 if (db_num_rows($result) == 0) {
244 print "<li>No tags to display.</li>";
245 }
246
8143ae1f 247 print "</ul>";
1cd17194 248
caa4e57f
AD
249 print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
250
c3b81db0
AD
251 }
252
253
254 if ($op == "rpc") {
255
256 $subop = $_GET["subop"];
257
090e250b 258 if ($subop == "getLabelCounters") {
8073cce7 259 $aid = $_GET["aid"];
090e250b
AD
260 print "<rpc-reply>";
261 getLabelCounters($link);
8073cce7
AD
262 if ($aid) {
263 getFeedCounter($link, $aid);
264 }
090e250b
AD
265 print "</rpc-reply>";
266 }
267
268 if ($subop == "getFeedCounters") {
269 print "<rpc-reply>";
270 getFeedCounters($link);
271 print "</rpc-reply>";
272 }
273
274 if ($subop == "getAllCounters") {
275 print "<rpc-reply>";
276 getLabelCounters($link);
277 getFeedCounters($link);
8143ae1f 278 getTagCounters($link);
090e250b
AD
279 print "</rpc-reply>";
280
281 }
282
f4c10d44
AD
283 if ($subop == "mark") {
284 $mark = $_GET["mark"];
648472a7 285 $id = db_escape_string($_GET["id"]);
f4c10d44
AD
286
287 if ($mark == "1") {
288 $mark = "true";
289 } else {
290 $mark = "false";
291 }
292
648472a7 293 $result = db_query($link, "UPDATE ttrss_entries SET marked = $mark
f4c10d44
AD
294 WHERE id = '$id'");
295 }
296
caa4e57f 297 if ($subop == "updateFeed") {
648472a7 298 $feed_id = db_escape_string($_GET["feed"]);
9cfc649a 299
648472a7 300 $result = db_query($link,
caa4e57f 301 "SELECT feed_url FROM ttrss_feeds WHERE id = '$feed_id'");
9cfc649a 302
648472a7
AD
303 if (db_num_rows($result) > 0) {
304 $feed_url = db_fetch_result($result, 0, "feed_url");
caa4e57f
AD
305// update_rss_feed($link, $feed_url, $feed_id);
306 }
9cfc649a 307
caa4e57f 308 print "DONE-$feed_id";
9cfc649a 309
caa4e57f 310 return;
9cfc649a
AD
311 }
312
090e250b 313 if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") {
c3b81db0 314 update_all_feeds($link, true);
c3b81db0 315
ab3f3f72
AD
316 $omode = $_GET["omode"];
317
318 if (!$omode) $omode = "tfl";
319
090e250b 320 print "<rpc-reply>";
ab3f3f72
AD
321 if (strchr($omode, "l")) getLabelCounters($link);
322 if (strchr($omode, "f")) getFeedCounters($link);
323 if (strchr($omode, "t")) getTagCounters($link);
090e250b 324 print "</rpc-reply>";
c3b81db0
AD
325 }
326
327 if ($subop == "catchupPage") {
328
329 $ids = split(",", $_GET["ids"]);
330
331 foreach ($ids as $id) {
332
648472a7 333 db_query($link, "UPDATE ttrss_entries SET unread=false,last_read = NOW()
c3b81db0
AD
334 WHERE id = '$id'");
335
336 }
337
338 print "Marked active page as read.";
339 }
c3b81db0
AD
340 }
341
342 if ($op == "feeds") {
343
8143ae1f
AD
344 $tags = $_GET["tags"];
345
c3b81db0
AD
346 $subop = $_GET["subop"];
347
348 if ($subop == "catchupAll") {
648472a7 349 db_query($link, "UPDATE ttrss_entries SET last_read = NOW(),unread = false");
c3b81db0
AD
350 }
351
8143ae1f 352 outputFeedList($link, $tags);
c3b81db0 353
1cd17194
AD
354 }
355
356 if ($op == "view") {
357
d76a3b03 358 $id = $_GET["id"];
8073cce7 359 $feed_id = $_GET["feed"];
d76a3b03 360
648472a7 361 $result = db_query($link, "UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'");
a1a8a2be 362
70830c87
AD
363 $addheader = $_GET["addheader"];
364
648472a7 365 $result = db_query($link, "SELECT title,link,content,feed_id,comments,
b7f4bda2
AD
366 (SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url
367 FROM ttrss_entries
d76a3b03 368 WHERE id = '$id'");
1cd17194 369
70830c87 370 if ($addheader) {
f0601b87 371 print "<html><head>
70830c87
AD
372 <title>Tiny Tiny RSS : Article $id</title>
373 <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
c05608c2 374 <script type=\"text/javascript\" src=\"functions.js\"></script>
70830c87 375 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
f0601b87 376 </head><body>";
70830c87
AD
377 }
378
d76a3b03 379 if ($result) {
1cd17194 380
648472a7 381 $line = db_fetch_assoc($result);
1cd17194 382
b7f4bda2
AD
383 if ($line["icon_url"]) {
384 $feed_icon = "<img class=\"feedIcon\" src=\"" . $line["icon_url"] . "\">";
385 } else {
386 $feed_icon = "&nbsp;";
387 }
d76a3b03 388
f7181e9b
AD
389 if ($line["comments"] && $line["link"] != $line["comments"]) {
390 $entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)";
391 } else {
392 $entry_comments = "";
393 }
394
e828e31e
AD
395 print "<div class=\"postReply\">";
396
397 print "<div class=\"postHeader\"><table>";
398
399 print "<tr><td><b>Title:</b></td>
400 <td width='100%'>" . $line["title"] . "</td></tr>";
f7181e9b 401
e828e31e 402 print "<tr><td><b>Link:</b></td>
f7181e9b
AD
403 <td width='100%'>
404 <a href=\"" . $line["link"] . "\">".$line["link"]."</a>
405 $entry_comments</td></tr>";
e828e31e
AD
406
407 print "</table></div>";
408
409 print "<div class=\"postIcon\">" . $feed_icon . "</div>";
410 print "<div class=\"postContent\">" . $line["content"] . "</div>";
411
412 print "</div>";
413
090e250b 414 print "<script type=\"text/javascript\">
8143ae1f 415 update_label_counters('$feed_id');
090e250b 416 </script>";
d76a3b03 417 }
70830c87
AD
418
419 if ($addheader) {
420 print "</body></html>";
421 }
1cd17194
AD
422 }
423
424 if ($op == "viewfeed") {
425
426 $feed = $_GET["feed"];
d76a3b03 427 $skip = $_GET["skip"];
476cac42 428 $subop = $_GET["subop"];
f175937c 429 $view_mode = $_GET["view"];
f0601b87 430 $addheader = $_GET["addheader"];
cb1083a1 431 $limit = $_GET["limit"];
a1a8a2be 432
8d7008c7
AD
433 if (!$feed) {
434 print "Error: no feed to display.";
435 return;
436 }
437
ac53063a
AD
438 if (!$skip) $skip = 0;
439
476cac42 440 if ($subop == "undefined") $subop = "";
1cd17194 441
f0601b87
AD
442 if ($addheader) {
443 print "<html><head>
ac43eba1 444 <title>Tiny Tiny RSS : Feed $feed</title>
f0601b87
AD
445 <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
446 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
447 <script type=\"text/javascript\" src=\"functions.js\"></script>
448 <script type=\"text/javascript\" src=\"viewfeed.js\"></script>
449 </head><body>";
450 }
451
8143ae1f 452 if (sprintf("%d", $feed) != 0 && $feed >= 0) {
d76a3b03 453
254e0e4b
AD
454 $result = db_query($link,
455 "SELECT *,SUBSTRING(last_updated,1,16) as last_updated_s
456 FROM ttrss_feeds WHERE id = '$feed'");
457
458 if ($result) {
459
571c7f23
AD
460// $line = db_fetch_assoc($result);
461// update_rss_feed($link, $line["feed_url"], $feed);
462
254e0e4b
AD
463 if ($subop == "MarkAllRead") {
464
465 db_query($link, "UPDATE ttrss_entries SET unread = false,last_read = NOW()
466 WHERE feed_id = '$feed'");
467 }
a1a8a2be
AD
468 }
469 }
d76a3b03 470
175847de 471 print "<table class=\"headlinesList\" id=\"headlinesList\" width=\"100%\">";
ac53063a 472
c374a3fe
AD
473 $search = $_GET["search"];
474
52b51244
AD
475 $search_mode = $_GET["smode"];
476
f175937c 477 if ($search) {
ac53063a
AD
478 $search_query_part = "(upper(title) LIKE upper('%$search%')
479 OR content LIKE '%$search%') AND";
f175937c
AD
480 } else {
481 $search_query_part = "";
482 }
483
484 $view_query_part = "";
485
486 if ($view_mode == "Starred") {
487 $view_query_part = " marked = true AND ";
ac53063a
AD
488 }
489
ac43eba1
AD
490 if ($view_mode == "Unread") {
491 $view_query_part = " unread = true AND ";
492 }
493
b5aa95e7
AD
494 if ($view_mode == "Unread or Starred") {
495 $view_query_part = " (unread = true OR marked = true) AND ";
496 }
497
254e0e4b 498/* $result = db_query($link, "SELECT count(id) AS total_entries
36bf7496
AD
499 FROM ttrss_entries WHERE
500 $search_query_part
501 feed_id = '$feed'");
e6d1c0a0 502
254e0e4b 503 $total_entries = db_fetch_result($result, 0, "total_entries"); */
e6d1c0a0 504
648472a7 505/* $result = db_query("SELECT count(id) AS unread_entries
ac43eba1
AD
506 FROM ttrss_entries WHERE
507 $search_query_part
508 unread = true AND
509 feed_id = '$feed'");
510
648472a7 511 $unread_entries = db_fetch_result($result, 0, "unread_entries"); */
ac43eba1 512
8d7008c7 513 if ($limit && $limit != "All") {
82c9223c 514 $limit_query_part = "LIMIT " . $limit;
ad3cb710 515 }
f0601b87 516
254e0e4b
AD
517 $vfeed_query_part = "";
518
52b51244
AD
519 // override query strategy and enable feed display when searching globally
520 if ($search_mode == "All feeds") {
521 $query_strategy_part = "id > 0";
522 $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
523 id = feed_id) as feed_title,";
524 } else if (sprintf("%d", $feed) == 0) {
8143ae1f
AD
525 $query_strategy_part = "ttrss_entries.id > 0";
526 $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
527 id = feed_id) as feed_title,";
528 } else if ($feed >= 0) {
254e0e4b 529 $query_strategy_part = "feed_id = '$feed'";
48f0adb0 530 } else if ($feed == -1) { // starred virtual feed
254e0e4b 531 $query_strategy_part = "marked = true";
48f0adb0
AD
532 $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
533 id = feed_id) as feed_title,";
534 } else if ($feed <= -10) { // labels
535 $label_id = -$feed - 11;
536
537 $tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels
538 WHERE id = '$label_id'");
539
540 $query_strategy_part = db_fetch_result($tmp_result, 0, "sql_exp");
541
254e0e4b
AD
542 $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
543 id = feed_id) as feed_title,";
544 } else {
48f0adb0 545 $query_strategy_part = "id > 0"; // dumb
254e0e4b
AD
546 }
547
52b51244 548
f99321a3
AD
549 $order_by = "updated DESC";
550
551// if ($feed < -10) {
552// $order_by = "feed_id,updated DESC";
553// }
554
48f0adb0
AD
555 if ($feed < -10) error_reporting (0);
556
8143ae1f
AD
557 if (sprintf("%d", $feed) != 0) {
558
559 $result = db_query($link, "SELECT
560 id,title,updated,unread,feed_id,marked,link,last_read,
561 SUBSTRING(last_read,1,19) as last_read_noms,
562 $vfeed_query_part
563 SUBSTRING(updated,1,19) as updated_noms
564 FROM
565 ttrss_entries
566 WHERE
567 $search_query_part
568 $view_query_part
569 $query_strategy_part ORDER BY $order_by
570 $limit_query_part");
571
572 } else {
573 // browsing by tag
574
575 $result = db_query($link, "SELECT
576 ttrss_entries.id as id,title,updated,unread,feed_id,
577 marked,link,last_read,
c05a19f3 578 SUBSTRING(last_read,1,19) as last_read_noms,
254e0e4b 579 $vfeed_query_part
c05a19f3 580 SUBSTRING(updated,1,19) as updated_noms
8143ae1f
AD
581 FROM
582 ttrss_entries,ttrss_tags
583 WHERE
584 post_id = ttrss_entries.id AND tag_name = '$feed' AND
585 $view_query_part
586 $search_query_part
587 $query_strategy_part ORDER BY $order_by
588 $limit_query_part");
589 }
d76a3b03 590
48f0adb0
AD
591 if (!$result) {
592 print "<tr><td colspan='4' align='center'>
593 Could not display feed (query failed). Please check match syntax or local configuration.</td></tr>";
594 return;
595 }
596
a1a8a2be 597 $lnum = 0;
48f0adb0
AD
598
599 error_reporting (E_ERROR | E_WARNING | E_PARSE);
600
e1123aee 601 $num_unread = 0;
d76a3b03 602
648472a7 603 while ($line = db_fetch_assoc($result)) {
d76a3b03 604
a1a8a2be 605 $class = ($lnum % 2) ? "even" : "odd";
d76a3b03 606
ad99045e
AD
607 $id = $line["id"];
608 $feed_id = $line["feed_id"];
609
c43f77f5 610// printf("L %d (%s) &gt; U %d (%s) = %d<br>",
c05a19f3 611// strtotime($line["last_read_noms"]), $line["last_read_noms"],
c43f77f5
AD
612// strtotime($line["updated"]), $line["updated"],
613// strtotime($line["last_read"]) >= strtotime($line["updated"]));
614
ecb14114 615/* if ($line["last_read"] != "" && $line["updated"] != "" &&
c05a19f3 616 strtotime($line["last_read_noms"]) < strtotime($line["updated_noms"])) {
c43f77f5
AD
617
618 $update_pic = "<img id='FUPDPIC-$id' src=\"images/updated.png\"
619 alt=\"Updated\">";
620
621 } else {
622
5bfef089 623 $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\"
c43f77f5
AD
624 alt=\"Updated\">";
625
ecb14114
AD
626 } */
627
4cc6ea5e
AD
628 if ($line["last_read"] == "" &&
629 ($line["unread"] != "t" && $line["unread"] != "1")) {
630
ecb14114
AD
631 $update_pic = "<img id='FUPDPIC-$id' src=\"images/updated.png\"
632 alt=\"Updated\">";
633 } else {
634 $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\"
635 alt=\"Updated\">";
c43f77f5 636 }
b197f117 637
8158c57a 638 if ($line["unread"] == "t" || $line["unread"] == "1") {
a1a8a2be 639 $class .= "Unread";
e1123aee
AD
640 ++$num_unread;
641 }
d76a3b03 642
8158c57a 643 if ($line["marked"] == "t" || $line["marked"] == "1") {
f4c10d44
AD
644 $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_set.png\"
645 alt=\"Reset mark\" onclick='javascript:toggleMark($id, false)'>";
646 } else {
647 $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_unset.png\"
648 alt=\"Set mark\" onclick='javascript:toggleMark($id, true)'>";
649 }
650
ac43eba1 651 $content_link = "<a id=\"FTITLE-$id\" href=\"javascript:view($id,$feed_id);\">" .
b197f117
AD
652 $line["title"] . "</a>";
653
d5224f0d 654 print "<tr class='$class' id='RROW-$id'>";
5f89f780 655 // onclick=\"javascript:view($id,$feed_id)\">
b197f117 656
8d7008c7
AD
657 print "<td valign='center' align='center'>$update_pic</td>";
658 print "<td valign='center' align='center'>$marked_pic</td>";
b197f117 659
8d7008c7 660 print "<td width='25%'>
a3ee2a38 661 <a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>";
254e0e4b
AD
662
663 if ($line["feed_title"]) {
664 print "<td width='50%'>$content_link</td>";
665 print "<td width='20%'>".$line["feed_title"]."</td>";
666 } else {
667 print "<td width='70%'>$content_link</td>";
668 }
d76a3b03 669
a1a8a2be 670 print "</tr>";
d76a3b03 671
a1a8a2be
AD
672 ++$lnum;
673 }
d76a3b03 674
ac53063a 675 if ($lnum == 0) {
a82065a1 676 print "<tr><td align='center'>No articles found.</td></tr>";
047bae73 677 }
a2015351 678
a1a8a2be 679 print "</table>";
6113ef7d
AD
680
681 print "<script type=\"text/javascript\">
bb7cface 682 document.onkeydown = hotkey_handler;
8143ae1f 683 update_label_counters('$feed');
6113ef7d 684 </script>";
d76a3b03 685
f0601b87
AD
686 if ($addheader) {
687 print "</body></html>";
688 }
689
1cd17194
AD
690 }
691
0e091d38 692 if ($op == "pref-rpc") {
331900c6 693
0e091d38 694 $subop = $_GET["subop"];
331900c6 695
83fe4d6d
AD
696 if ($subop == "unread") {
697 $ids = split(",", $_GET["ids"]);
698 foreach ($ids as $id) {
648472a7 699 db_query($link, "UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
83fe4d6d 700 }
0e091d38
AD
701
702 print "Marked selected feeds as read.";
83fe4d6d
AD
703 }
704
705 if ($subop == "read") {
706 $ids = split(",", $_GET["ids"]);
707 foreach ($ids as $id) {
648472a7 708 db_query($link, "UPDATE ttrss_entries
b197f117 709 SET unread = false,last_read = NOW() WHERE feed_id = '$id'");
83fe4d6d 710 }
0e091d38
AD
711
712 print "Marked selected feeds as unread.";
713
714 }
715
716 }
717
718 if ($op == "pref-feeds") {
719
720 $subop = $_GET["subop"];
721
508a81e1 722 if ($subop == "editSave") {
648472a7
AD
723 $feed_title = db_escape_string($_GET["t"]);
724 $feed_link = db_escape_string($_GET["l"]);
d148926e 725 $upd_intl = db_escape_string($_GET["ui"]);
508a81e1
AD
726 $feed_id = $_GET["id"];
727
d148926e
AD
728 if (strtoupper($upd_intl) == "DEFAULT")
729 $upd_intl = 0;
730
648472a7 731 $result = db_query($link, "UPDATE ttrss_feeds SET
d148926e
AD
732 title = '$feed_title', feed_url = '$feed_link',
733 update_interval = '$upd_intl' WHERE id = '$feed_id'");
508a81e1 734
83fe4d6d
AD
735 }
736
331900c6 737 if ($subop == "remove") {
331900c6 738
b0b4abcf 739 if (!WEB_DEMO_MODE) {
331900c6 740
b0b4abcf
AD
741 $ids = split(",", $_GET["ids"]);
742
743 foreach ($ids as $id) {
648472a7 744 db_query($link, "DELETE FROM ttrss_feeds WHERE id = '$id'");
d5caaae5
AD
745
746 if (file_exists(ICONS_DIR . "/$id.ico")) {
747 unlink(ICONS_DIR . "/$id.ico");
748 }
b0b4abcf 749 }
331900c6
AD
750 }
751 }
752
753 if ($subop == "add") {
b0b4abcf
AD
754
755 if (!WEB_DEMO_MODE) {
331900c6 756
648472a7 757 $feed_link = db_escape_string($_GET["link"]);
b0b4abcf 758
648472a7 759 $result = db_query($link,
b0b4abcf 760 "INSERT INTO ttrss_feeds (feed_url,title) VALUES ('$feed_link', '')");
331900c6 761
648472a7 762 $result = db_query($link,
e9c54861 763 "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'");
331900c6 764
648472a7 765 $feed_id = db_fetch_result($result, 0, "id");
331900c6 766
b0b4abcf
AD
767 if ($feed_id) {
768 update_rss_feed($link, $feed_link, $feed_id);
769 }
770 }
331900c6 771 }
a0d53889
AD
772
773 print "<table class=\"prefAddFeed\"><tr>
774 <td><input id=\"fadd_link\"></td>
775 <td colspan=\"4\" align=\"right\">
776 <a class=\"button\" href=\"javascript:addFeed()\">Add feed</a></td></tr>
777 </table>";
778
648472a7 779 $result = db_query($link, "SELECT
d148926e
AD
780 id,title,feed_url,substring(last_updated,1,16) as last_updated,
781 update_interval
c0e5a40e
AD
782 FROM
783 ttrss_feeds ORDER by title");
1cd17194 784
331900c6 785 print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
007bda35 786 print "<tr class=\"title\">
603c27f8 787 <td>&nbsp;</td><td>Select</td><td width=\"40%\">Title</td>
d148926e
AD
788 <td width=\"30%\">Link</td><td width=\"10%\">Update Interval</td>
789 <td>Last updated</td></tr>";
007bda35
AD
790
791 $lnum = 0;
792
648472a7 793 while ($line = db_fetch_assoc($result)) {
007bda35
AD
794
795 $class = ($lnum % 2) ? "even" : "odd";
9b307248 796
331900c6 797 $feed_id = $line["id"];
603c27f8
AD
798
799 $edit_feed_id = $_GET["id"];
800
9b307248
AD
801 if ($subop == "edit" && $feed_id != $edit_feed_id) {
802 $class .= "Grayed";
803 }
804
331900c6 805 print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
007bda35 806
c0e5a40e
AD
807 $icon_file = ICONS_DIR . "/$feed_id.ico";
808
809 if (file_exists($icon_file) && filesize($icon_file) > 0) {
810 $feed_icon = "<img width=\"16\" height=\"16\"
811 src=\"" . ICONS_URL . "/$feed_id.ico\">";
812 } else {
813 $feed_icon = "&nbsp;";
814 }
815 print "<td align='center'>$feed_icon</td>";
816
6e0584e9
AD
817 $edit_title = htmlspecialchars(db_unescape_string($line["title"]));
818 $edit_link = htmlspecialchars(db_unescape_string($line["feed_url"]));
819
9b307248 820 if (!$edit_feed_id || $subop != "edit") {
603c27f8
AD
821
822 print "<td><input onclick='toggleSelectRow(this);'
331900c6 823 type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
603c27f8
AD
824
825 print "<td><a href=\"javascript:editFeed($feed_id);\">" .
6e0584e9 826 $edit_title . "</td>";
603c27f8 827 print "<td><a href=\"javascript:editFeed($feed_id);\">" .
6e0584e9 828 $edit_link . "</td>";
d148926e
AD
829
830 if ($line["update_interval"] == "0")
831 $line["update_interval"] = "Default";
832
833 print "<td>" . $line["update_interval"] . "</td>";
834
9b307248
AD
835
836 } else if ($feed_id != $edit_feed_id) {
837
e9c54861
AD
838 print "<td><input disabled=\"true\" type=\"checkbox\"
839 id=\"FRCHK-".$line["id"]."\"></td>";
9b307248 840
6e0584e9
AD
841 print "<td>$edit_title</td>";
842 print "<td>$edit_link</td>";
9b307248 843
d148926e
AD
844 if ($line["update_interval"] == "0")
845 $line["update_interval"] = "Default";
846
847 print "<td>" . $line["update_interval"] . "</td>";
848
603c27f8
AD
849 } else {
850
e9c54861 851 print "<td><input disabled=\"true\" type=\"checkbox\"></td>";
603c27f8 852
6e0584e9
AD
853 print "<td><input id=\"iedit_title\" value=\"$edit_title\"></td>";
854 print "<td><input id=\"iedit_link\" value=\"$edit_link\"></td>";
d148926e
AD
855 print "<td><input id=\"iedit_updintl\" value=\"".$line["update_interval"]."\"></td>";
856
603c27f8 857 }
0afbd851
AD
858
859 if (!$line["last_updated"]) $line["last_updated"] = "Never";
860
007bda35 861 print "<td>" . $line["last_updated"] . "</td>";
603c27f8 862
007bda35
AD
863 print "</tr>";
864
865 ++$lnum;
866 }
867
0afbd851
AD
868 if ($lnum == 0) {
869 print "<tr><td colspan=\"5\" align=\"center\">No feeds defined.</td></tr>";
870 }
871
007bda35
AD
872 print "</table>";
873
603c27f8
AD
874 print "<p>";
875
876 if ($subop == "edit") {
877 print "Edit feed:&nbsp;
e828e31e
AD
878 <input type=\"submit\" class=\"button\"
879 onclick=\"javascript:feedEditCancel()\" value=\"Cancel\">
880 <input type=\"submit\" class=\"button\"
8158c57a 881 onclick=\"javascript:feedEditSave()\" value=\"Save\">";
603c27f8
AD
882 } else {
883
603c27f8
AD
884 print "
885 Selection:&nbsp;
e828e31e
AD
886 <input type=\"submit\" class=\"button\"
887 onclick=\"javascript:editSelectedFeed()\" value=\"Edit\">
888 <input type=\"submit\" class=\"button\"
889 onclick=\"javascript:removeSelectedFeeds()\" value=\"Remove\">";
890
f92db4f5
AD
891 if (ENABLE_PREFS_CATCHUP_UNCATCHUP) {
892 print "
e828e31e
AD
893 <input type=\"submit\" class=\"button\"
894 onclick=\"javascript:readSelectedFeeds()\" value=\"Mark as read\">
895 <input type=\"submit\" class=\"button\"
896 onclick=\"javascript:unreadSelectedFeeds()\" value=\"Mark as unread\">&nbsp;";
f92db4f5
AD
897 }
898 print "
e828e31e
AD
899 All feeds:
900 <input type=\"submit\"
8158c57a 901 class=\"button\" onclick=\"gotoExportOpml()\" value=\"Export OPML\">";
10c5820d 902
603c27f8
AD
903 }
904
007bda35
AD
905 }
906
a0d53889
AD
907 if ($op == "pref-filters") {
908
909 $subop = $_GET["subop"];
910
911 if ($subop == "editSave") {
a0d53889 912
648472a7
AD
913 $regexp = db_escape_string($_GET["r"]);
914 $descr = db_escape_string($_GET["d"]);
915 $match = db_escape_string($_GET["m"]);
916 $filter_id = db_escape_string($_GET["id"]);
0afbd851 917
648472a7 918 $result = db_query($link, "UPDATE ttrss_filters SET
4b3dff6e 919 reg_exp = '$regexp',
0afbd851
AD
920 description = '$descr',
921 filter_type = (SELECT id FROM ttrss_filter_types WHERE
922 description = '$match')
923 WHERE id = '$filter_id'");
a0d53889
AD
924 }
925
926 if ($subop == "remove") {
927
928 if (!WEB_DEMO_MODE) {
929
930 $ids = split(",", $_GET["ids"]);
931
932 foreach ($ids as $id) {
648472a7 933 db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id'");
a0d53889
AD
934
935 }
936 }
937 }
938
939 if ($subop == "add") {
940
de435974 941 if (!WEB_DEMO_MODE) {
a0d53889 942
8158c57a 943 $regexp = db_escape_string($_GET["regexp"]);
648472a7 944 $match = db_escape_string($_GET["match"]);
a0d53889 945
648472a7 946 $result = db_query($link,
4b3dff6e 947 "INSERT INTO ttrss_filters (reg_exp,filter_type) VALUES
de435974
AD
948 ('$regexp', (SELECT id FROM ttrss_filter_types WHERE
949 description = '$match'))");
950 }
a0d53889
AD
951 }
952
648472a7 953 $result = db_query($link, "SELECT description
a0d53889
AD
954 FROM ttrss_filter_types ORDER BY description");
955
956 $filter_types = array();
957
648472a7 958 while ($line = db_fetch_assoc($result)) {
a0d53889
AD
959 array_push($filter_types, $line["description"]);
960 }
961
962 print "<table class=\"prefAddFeed\"><tr>
ea6774cf 963 <td><input id=\"fadd_regexp\"></td>
a0d53889 964 <td>";
bdc00fe0 965 print_select("fadd_match", "Title", $filter_types);
a0d53889
AD
966
967 print"</td><td colspan=\"4\" align=\"right\">
968 <a class=\"button\" href=\"javascript:addFilter()\">Add filter</a></td></tr>
969 </table>";
970
648472a7 971 $result = db_query($link, "SELECT
4b3dff6e 972 id,reg_exp,description,
a0d53889
AD
973 (SELECT name FROM ttrss_filter_types WHERE
974 id = filter_type) as filter_type_name,
975 (SELECT description FROM ttrss_filter_types
976 WHERE id = filter_type) as filter_type_descr
977 FROM
4b3dff6e 978 ttrss_filters ORDER by reg_exp");
a0d53889
AD
979
980 print "<p><table width=\"100%\" class=\"prefFilterList\" id=\"prefFilterList\">";
981
982 print "<tr class=\"title\">
0afbd851
AD
983 <td width=\"5%\">Select</td><td width=\"40%\">Filter expression</td>
984 <td width=\"40%\">Description</td><td width=\"10%\">Match</td></tr>";
a0d53889
AD
985
986 $lnum = 0;
987
648472a7 988 while ($line = db_fetch_assoc($result)) {
a0d53889
AD
989
990 $class = ($lnum % 2) ? "even" : "odd";
991
992 $filter_id = $line["id"];
993 $edit_filter_id = $_GET["id"];
994
995 if ($subop == "edit" && $filter_id != $edit_filter_id) {
996 $class .= "Grayed";
997 }
998
999 print "<tr class=\"$class\" id=\"FILRR-$filter_id\">";
1000
4b3dff6e 1001 $line["regexp"] = htmlspecialchars($line["reg_exp"]);
ea6774cf
AD
1002 $line["description"] = htmlspecialchars($line["description"]);
1003
a0d53889
AD
1004 if (!$edit_filter_id || $subop != "edit") {
1005
0afbd851
AD
1006 if (!$line["description"]) $line["description"] = "[No description]";
1007
a0d53889
AD
1008 print "<td><input onclick='toggleSelectRow(this);'
1009 type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>";
1010
1011 print "<td><a href=\"javascript:editFilter($filter_id);\">" .
4b3dff6e 1012 $line["reg_exp"] . "</td>";
a0d53889
AD
1013
1014 print "<td><a href=\"javascript:editFilter($filter_id);\">" .
1015 $line["description"] . "</td>";
1016
1017 print "<td>".$line["filter_type_descr"]."</td>";
1018
1019 } else if ($filter_id != $edit_filter_id) {
1020
0afbd851
AD
1021 if (!$line["description"]) $line["description"] = "[No description]";
1022
a0d53889
AD
1023 print "<td><input disabled=\"true\" type=\"checkbox\"
1024 id=\"FICHK-".$line["id"]."\"></td>";
1025
4b3dff6e 1026 print "<td>".$line["reg_exp"]."</td>";
a0d53889
AD
1027 print "<td>".$line["description"]."</td>";
1028 print "<td>".$line["filter_type_descr"]."</td>";
1029
1030 } else {
1031
1032 print "<td><input disabled=\"true\" type=\"checkbox\"></td>";
1033
4b3dff6e 1034 print "<td><input id=\"iedit_regexp\" value=\"".$line["reg_exp"].
a0d53889
AD
1035 "\"></td>";
1036
1037 print "<td><input id=\"iedit_descr\" value=\"".$line["description"].
1038 "\"></td>";
1039
1040 print "<td>";
1041 print_select("iedit_match", $line["filter_type_descr"], $filter_types);
1042 print "</td>";
1043
1044 }
1045
1046
1047 print "</tr>";
1048
1049 ++$lnum;
1050 }
1051
0afbd851
AD
1052 if ($lnum == 0) {
1053 print "<tr><td colspan=\"4\" align=\"center\">No filters defined.</td></tr>";
1054 }
1055
a0d53889
AD
1056 print "</table>";
1057
1058 print "<p>";
1059
1060 if ($subop == "edit") {
e828e31e
AD
1061 print "Edit feed:
1062 <input type=\"submit\" class=\"button\"
1063 onclick=\"javascript:filterEditCancel()\" value=\"Cancel\">
1064 <input type=\"submit\" class=\"button\"
1065 onclick=\"javascript:filterEditSave()\" value=\"Save\">";
a0d53889
AD
1066
1067 } else {
1068
1069 print "
e828e31e
AD
1070 Selection:
1071 <input type=\"submit\" class=\"button\"
1072 onclick=\"javascript:editSelectedFilter()\" value=\"Edit\">
1073 <input type=\"submit\" class=\"button\"
1074 onclick=\"javascript:removeSelectedFilters()\" value=\"Remove\">";
a0d53889
AD
1075 }
1076 }
1077
48f0adb0
AD
1078 if ($op == "pref-labels") {
1079
1080 $subop = $_GET["subop"];
1081
1082 if ($subop == "editSave") {
1083
1084 $sql_exp = $_GET["s"];
1085 $descr = $_GET["d"];
1086 $label_id = db_escape_string($_GET["id"]);
1087
1088// print "$sql_exp : $descr : $label_id";
1089
1090 $result = db_query($link, "UPDATE ttrss_labels SET
1091 sql_exp = '$sql_exp',
1092 description = '$descr'
1093 WHERE id = '$label_id'");
1094 }
1095
1096 if ($subop == "remove") {
1097
1098 if (!WEB_DEMO_MODE) {
1099
1100 $ids = split(",", $_GET["ids"]);
1101
1102 foreach ($ids as $id) {
1103 db_query($link, "DELETE FROM ttrss_labels WHERE id = '$id'");
1104
1105 }
1106 }
1107 }
1108
1109 if ($subop == "add") {
1110
1111 if (!WEB_DEMO_MODE) {
1112
1113 $exp = $_GET["exp"];
1114
1115 $result = db_query($link,
1116 "INSERT INTO ttrss_labels (sql_exp,description)
1117 VALUES ('$exp', '$exp')");
1118 }
1119 }
1120
1121 print "<table class=\"prefAddFeed\"><tr>
1122 <td><input id=\"ladd_expr\"></td>";
1123
1124 print"<td colspan=\"4\" align=\"right\">
1125 <a class=\"button\" href=\"javascript:addLabel()\">Add label</a></td></tr>
1126 </table>";
1127
1128 $result = db_query($link, "SELECT
1129 id,sql_exp,description
1130 FROM
1131 ttrss_labels ORDER by description");
1132
1133 print "<p><table width=\"100%\" class=\"prefLabelList\" id=\"prefLabelList\">";
1134
1135 print "<tr class=\"title\">
7dc66a61
AD
1136 <td width=\"5%\">Select</td><td width=\"40%\">SQL expression
1137 <a class=\"helpLink\" href=\"javascript:popupHelp(1)\">(?)</a>
1138 </td>
48f0adb0
AD
1139 <td width=\"40%\">Caption</td></tr>";
1140
1141 $lnum = 0;
1142
1143 while ($line = db_fetch_assoc($result)) {
1144
1145 $class = ($lnum % 2) ? "even" : "odd";
1146
1147 $label_id = $line["id"];
1148 $edit_label_id = $_GET["id"];
1149
1150 if ($subop == "edit" && $label_id != $edit_label_id) {
1151 $class .= "Grayed";
1152 }
1153
1154 print "<tr class=\"$class\" id=\"LILRR-$label_id\">";
1155
1156 $line["sql_exp"] = htmlspecialchars($line["sql_exp"]);
1157 $line["description"] = htmlspecialchars($line["description"]);
1158
1159 if (!$edit_label_id || $subop != "edit") {
1160
1161 if (!$line["description"]) $line["description"] = "[No caption]";
1162
1163 print "<td><input onclick='toggleSelectRow(this);'
1164 type=\"checkbox\" id=\"LICHK-".$line["id"]."\"></td>";
1165
1166 print "<td><a href=\"javascript:editLabel($label_id);\">" .
1167 $line["sql_exp"] . "</td>";
1168
1169 print "<td><a href=\"javascript:editLabel($label_id);\">" .
1170 $line["description"] . "</td>";
1171
1172 } else if ($label_id != $edit_label_id) {
1173
1174 if (!$line["description"]) $line["description"] = "[No description]";
1175
1176 print "<td><input disabled=\"true\" type=\"checkbox\"
1177 id=\"LICHK-".$line["id"]."\"></td>";
1178
1179 print "<td>".$line["sql_exp"]."</td>";
1180 print "<td>".$line["description"]."</td>";
1181
1182 } else {
1183
1184 print "<td><input disabled=\"true\" type=\"checkbox\"></td>";
1185
1186 print "<td><input id=\"iedit_expr\" value=\"".$line["sql_exp"].
1187 "\"></td>";
1188
1189 print "<td><input id=\"iedit_descr\" value=\"".$line["description"].
1190 "\"></td>";
1191
1192 }
1193
1194
1195 print "</tr>";
1196
1197 ++$lnum;
1198 }
1199
1200 if ($lnum == 0) {
1201 print "<tr><td colspan=\"4\" align=\"center\">No labels defined.</td></tr>";
1202 }
1203
1204 print "</table>";
1205
1206 print "<p>";
1207
1208 if ($subop == "edit") {
1209 print "Edit label:
1210 <input type=\"submit\" class=\"button\"
1211 onclick=\"javascript:labelEditCancel()\" value=\"Cancel\">
1212 <input type=\"submit\" class=\"button\"
1213 onclick=\"javascript:labelEditSave()\" value=\"Save\">";
1214
1215 } else {
1216
1217 print "
1218 Selection:
1219 <input type=\"submit\" class=\"button\"
1220 onclick=\"javascript:editSelectedLabel()\" value=\"Edit\">
1221 <input type=\"submit\" class=\"button\"
1222 onclick=\"javascript:removeSelectedLabels()\" value=\"Remove\">";
1223 }
1224 }
1225
e828e31e
AD
1226 if ($op == "error") {
1227 print "<div width=\"100%\" align='center'>";
1228 $msg = $_GET["msg"];
1229 print $msg;
1230 print "</div>";
1231 }
1232
7dc66a61
AD
1233 if ($op == "help") {
1234 print "<html><head>
1235 <title>Tiny Tiny RSS : Help</title>
1236 <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
1237 <script type=\"text/javascript\" src=\"functions.js\"></script>
1238 <script type=\"text/javascript\" src=\"feedlist.js\"></script>
1239 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
1240 </head><body>";
1241
1242 $tid = sprintf("%d", $_GET["tid"]);
1243
1244 /* FIXME this badly needs real implementation */
1245
1246 print "<div class='helpResponse'>";
1247
1248 ?>
1249
1250 <h1>Help for SQL expressions</h1>
1251
1252 <h2>Description</h2>
1253
1254 <p>The &laquo;SQL expression&raquo; is added to WHERE clause of
d1f948d1 1255 view feed query. You can match on ttrss_entries table fields
7dc66a61
AD
1256 and even use subselect to query additional information. This
1257 functionality is considered to be advanced and requires basic
1258 understanding of SQL.</p>
1259
1260 <h2>Examples</h2>
1261
1262 <pre>unread = true</pre>
1263
1264 Matches all unread articles
1265
1266 <pre>title like '%Linux%'</pre>
1267
1268 Matches all articles which mention Linux in the title. You get the idea.
1269
1270 <p>See the database schema included in the distribution package for gruesome
1271 details.</p>
1272
1273 <?
1274
1275 print "<div align='center'>
1276 <a class=\"helpLink\"
1277 href=\"javascript:window.close()\">(Close this window)</a></div>";
1278
1279 print "</div>";
1280
1281 print "</body></html>";
1282
1283 }
1284
4b3dff6e 1285 db_close($link);
1cd17194 1286?>