]>
Commit | Line | Data |
---|---|---|
1d3a17c7 | 1 | <?php |
d65981e2 AD |
2 | error_reporting(E_ERROR | E_WARNING | E_PARSE); |
3 | ||
ce885e21 AD |
4 | /* remove ill effects of magic quotes */ |
5 | ||
6 | if (get_magic_quotes_gpc()) { | |
b4e75b2a | 7 | $_REQUEST = array_map('stripslashes', $_REQUEST); |
ce885e21 AD |
8 | $_POST = array_map('stripslashes', $_POST); |
9 | $_REQUEST = array_map('stripslashes', $_REQUEST); | |
10 | $_COOKIE = array_map('stripslashes', $_COOKIE); | |
11 | } | |
12 | ||
36bfab86 | 13 | require_once "sessions.php"; |
c339343b | 14 | require_once "modules/backend-rpc.php"; |
dc56b3b7 | 15 | |
b4e75b2a | 16 | /* if ($_REQUEST["debug"]) { |
cce28758 AD |
17 | define('DEFAULT_ERROR_LEVEL', E_ALL); |
18 | } else { | |
19 | define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE); | |
20 | } | |
894ebcf5 AD |
21 | |
22 | error_reporting(DEFAULT_ERROR_LEVEL); */ | |
cce28758 | 23 | |
657770a0 AD |
24 | require_once "sanity_check.php"; |
25 | require_once "config.php"; | |
af106b0e AD |
26 | |
27 | require_once "db.php"; | |
28 | require_once "db-prefs.php"; | |
29 | require_once "functions.php"; | |
657770a0 | 30 | |
dc56b3b7 | 31 | no_cache_incantation(); |
8d039718 AD |
32 | |
33 | if (ENABLE_TRANSLATIONS == true) { | |
34 | startup_gettext(); | |
35 | } | |
dc56b3b7 | 36 | |
7f0acba7 AD |
37 | $script_started = getmicrotime(); |
38 | ||
39 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); | |
40 | ||
41 | if (!$link) { | |
42 | if (DB_TYPE == "mysql") { | |
43 | print mysql_error(); | |
44 | } | |
45 | // PG seems to display its own errors just fine by default. | |
46 | return; | |
47 | } | |
48 | ||
f29ba148 | 49 | init_connection($link); |
7f0acba7 AD |
50 | |
51 | $op = $_REQUEST["op"]; | |
fac5e7d1 | 52 | $mode = $_REQUEST["mode"]; |
7f0acba7 | 53 | |
c339343b | 54 | $print_exec_time = false; |
7e3634d9 | 55 | |
fac5e7d1 AD |
56 | if ((!$op || $op == "rpc" || $op == "rss" || |
57 | ($op == "view" && $mode != "zoom") || | |
945c243e | 58 | $op == "digestSend" || $op == "viewfeed" || $op == "publish" || |
18664970 | 59 | $op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) { |
04fedbf5 AD |
60 | header("Content-Type: application/xml; charset=utf-8"); |
61 | ||
62 | if (ENABLE_GZIP_OUTPUT) { | |
63 | ob_start("ob_gzhandler"); | |
64 | } | |
65 | ||
9fdf7824 AD |
66 | } else { |
67 | if (!$_REQUEST["noxml"]) { | |
68 | header("Content-Type: text/html; charset=utf-8"); | |
69 | } else { | |
70 | header("Content-Type: text/plain; charset=utf-8"); | |
71 | } | |
262bd8ea AD |
72 | } |
73 | ||
f3acc32e AD |
74 | if (!$op) { |
75 | header("Content-Type: application/xml"); | |
76 | print_error_xml(7); exit; | |
77 | } | |
9c883208 AD |
78 | |
79 | if (SINGLE_USER_MODE) { | |
80 | authenticate_user($link, "admin", null); | |
81 | } | |
82 | ||
7f0acba7 | 83 | if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" |
945c243e | 84 | && $op != "rss" && $op != "getUnread" && $op != "publish") { |
262bd8ea | 85 | |
2e918d9d | 86 | if ($op == "rpc" || $op == "viewfeed" || $op == "view") { |
af106b0e | 87 | print_error_xml(6); die; |
04269460 AD |
88 | } else { |
89 | print " | |
90 | <html><body> | |
91 | <p>Error: Not logged in.</p> | |
92 | <script type=\"text/javascript\"> | |
93 | if (parent.window != 'undefined') { | |
01a87dff | 94 | parent.window.location = \"tt-rss.php\"; |
04269460 | 95 | } else { |
01a87dff | 96 | window.location = \"tt-rss.php\"; |
04269460 AD |
97 | } |
98 | </script> | |
99 | </body></html> | |
100 | "; | |
262bd8ea AD |
101 | } |
102 | exit; | |
103 | } | |
1c7f75ed | 104 | |
ad815c71 | 105 | $purge_intervals = array( |
d1db26aa AD |
106 | 0 => __("Use default"), |
107 | -1 => __("Never purge"), | |
108 | 5 => __("1 week old"), | |
109 | 14 => __("2 weeks old"), | |
110 | 31 => __("1 month old"), | |
111 | 60 => __("2 months old"), | |
112 | 90 => __("3 months old")); | |
ad815c71 AD |
113 | |
114 | $update_intervals = array( | |
ecace165 | 115 | 0 => __("Default interval"), |
d1db26aa | 116 | -1 => __("Disable updates"), |
1e7cbe16 | 117 | 15 => __("Each 15 minutes"), |
d1db26aa AD |
118 | 30 => __("Each 30 minutes"), |
119 | 60 => __("Hourly"), | |
120 | 240 => __("Each 4 hours"), | |
121 | 720 => __("Each 12 hours"), | |
122 | 1440 => __("Daily"), | |
123 | 10080 => __("Weekly")); | |
ad815c71 | 124 | |
16211ddb | 125 | $update_methods = array( |
ecace165 | 126 | 0 => __("Default"), |
0dd9c0cf AD |
127 | 1 => __("Magpie"), |
128 | 2 => __("SimplePie")); | |
16211ddb AD |
129 | |
130 | if (ENABLE_SIMPLEPIE) { | |
131 | $update_methods[0] .= ' (SimplePie)'; | |
132 | } else { | |
133 | $update_methods[0] .= ' (Magpie)'; | |
134 | } | |
135 | ||
3c5783b7 | 136 | $access_level_names = array( |
d1db26aa | 137 | 0 => __("User"), |
a88d37e5 | 138 | 5 => __("Power User"), |
d1db26aa | 139 | 10 => __("Administrator")); |
3c5783b7 | 140 | |
f27d955a | 141 | require_once "modules/pref-prefs.php"; |
ef8be8ea AD |
142 | require_once "modules/popup-dialog.php"; |
143 | require_once "modules/help.php"; | |
144 | require_once "modules/pref-feeds.php"; | |
145 | require_once "modules/pref-filters.php"; | |
146 | require_once "modules/pref-labels.php"; | |
147 | require_once "modules/pref-users.php"; | |
ef8be8ea | 148 | |
b2804af7 | 149 | if (!sanity_check($link)) { return; } |
023fe037 | 150 | |
45004d43 AD |
151 | switch($op) { // Select action according to $op value. |
152 | case "rpc": | |
153 | // Handle remote procedure calls. | |
154 | handle_rpc_request($link); | |
155 | break; // rpc | |
156 | ||
157 | case "feeds": | |
877be781 AD |
158 | if (ENABLE_GZIP_OUTPUT) { |
159 | ob_start("ob_gzhandler"); | |
160 | } | |
161 | ||
b4e75b2a | 162 | $tags = $_REQUEST["tags"]; |
45004d43 | 163 | |
b4e75b2a | 164 | $subop = $_REQUEST["subop"]; |
45004d43 AD |
165 | |
166 | switch($subop) { | |
167 | case "catchupAll": | |
168 | db_query($link, "UPDATE ttrss_user_entries SET | |
169 | last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]); | |
ad0056a8 AD |
170 | ccache_zero_all($link, $_SESSION["uid"]); |
171 | ||
45004d43 AD |
172 | break; |
173 | ||
174 | case "collapse": | |
b4e75b2a | 175 | $cat_id = db_escape_string($_REQUEST["cid"]); |
7f969260 | 176 | toggle_collapse_cat($link, $cat_id); |
45004d43 AD |
177 | return; |
178 | break; | |
9d393c84 AD |
179 | |
180 | case "catsortreset": | |
181 | db_query($link, "UPDATE ttrss_feed_categories | |
182 | SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]); | |
183 | return; | |
184 | break; | |
185 | ||
186 | case "catsort": | |
b4e75b2a | 187 | $corder = db_escape_string($_REQUEST["corder"]); |
9d393c84 AD |
188 | |
189 | $cats = split(",", $corder); | |
190 | ||
191 | for ($i = 0; $i < count($cats); $i++) { | |
192 | $cat_id = $cats[$i]; | |
193 | ||
194 | if ($cat_id > 0) { | |
195 | db_query($link, "UPDATE ttrss_feed_categories | |
196 | SET order_id = '$i' WHERE id = '$cat_id' AND | |
197 | owner_uid = " . $_SESSION["uid"]); | |
198 | } | |
199 | } | |
200 | ||
201 | return; | |
202 | break; | |
203 | ||
45004d43 | 204 | } |
c3b81db0 | 205 | |
45a15f78 AD |
206 | $_SESSION["viewfeed:counters_stamp"] = time(); |
207 | ||
45004d43 AD |
208 | outputFeedList($link, $tags); |
209 | break; // feeds | |
1cd17194 | 210 | |
45004d43 | 211 | case "view": |
e097e8be | 212 | |
b4e75b2a AD |
213 | $id = db_escape_string($_REQUEST["id"]); |
214 | $cids = split(",", db_escape_string($_REQUEST["cids"])); | |
215 | $mode = db_escape_string($_REQUEST["mode"]); | |
216 | $omode = db_escape_string($_REQUEST["omode"]); | |
e097e8be | 217 | |
b4e75b2a | 218 | $csync = $_REQUEST["csync"]; |
6cc1fab3 | 219 | |
45004d43 | 220 | print "<reply>"; |
e097e8be | 221 | |
45004d43 AD |
222 | // in prefetch mode we only output requested cids, main article |
223 | // just gets marked as read (it already exists in client cache) | |
e097e8be | 224 | |
ab197ae1 AD |
225 | $feed_id = false; |
226 | ||
45004d43 | 227 | if ($mode == "") { |
e04c18a2 | 228 | outputArticleXML($link, $id, false); |
eedfb635 | 229 | } else if ($mode == "zoom") { |
e04c18a2 | 230 | outputArticleXML($link, $id, false, true, true); |
45004d43 AD |
231 | } else { |
232 | catchupArticleById($link, $id, 0); | |
233 | } | |
e097e8be | 234 | |
a598370d AD |
235 | if (!$_SESSION["bw_limit"]) { |
236 | foreach ($cids as $cid) { | |
237 | if ($cid) { | |
e04c18a2 | 238 | outputArticleXML($link, $cid, false, false); |
a598370d | 239 | } |
45004d43 | 240 | } |
e097e8be | 241 | } |
e097e8be | 242 | |
bd090ab4 | 243 | // if (get_pref($link, "SYNC_COUNTERS") || ($mode == "prefetch" && $csync)) { |
3c204a8e | 244 | |
ab197ae1 | 245 | if (time() - $_SESSION["view:counters_stamp"] > 5 && $mode == "prefetch") { |
45004d43 AD |
246 | print "<counters>"; |
247 | getAllCounters($link, $omode); | |
248 | print "</counters>"; | |
3c204a8e AD |
249 | $_SESSION["view:counters_stamp"] = time(); |
250 | } | |
5a94a953 | 251 | |
45004d43 AD |
252 | print "</reply>"; |
253 | break; // view | |
1cd17194 | 254 | |
45004d43 | 255 | case "viewfeed": |
1cd17194 | 256 | |
45004d43 AD |
257 | $print_exec_time = true; |
258 | $timing_info = getmicrotime(); | |
46921916 | 259 | |
45004d43 | 260 | print "<reply>"; |
3de0261a | 261 | |
b4e75b2a | 262 | if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info); |
46921916 | 263 | |
b4e75b2a | 264 | $omode = db_escape_string($_REQUEST["omode"]); |
3de0261a | 265 | |
b4e75b2a AD |
266 | $feed = db_escape_string($_REQUEST["feed"]); |
267 | $subop = db_escape_string($_REQUEST["subop"]); | |
268 | $view_mode = db_escape_string($_REQUEST["view_mode"]); | |
269 | $limit = db_escape_string($_REQUEST["limit"]); | |
270 | $cat_view = db_escape_string($_REQUEST["cat"]); | |
271 | $next_unread_feed = db_escape_string($_REQUEST["nuf"]); | |
272 | $offset = db_escape_string($_REQUEST["skip"]); | |
273 | $vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]); | |
274 | $csync = $_REQUEST["csync"]; | |
275 | $order_by = db_escape_string($_REQUEST["order_by"]); | |
203de776 | 276 | |
51e196de AD |
277 | /* Updating a label ccache means recalculating all of the caches |
278 | * so for performance reasons we don't do that here */ | |
279 | ||
5c432ba4 | 280 | // if (time() - $_SESSION["viewfeed:ccache_update_stamp"] > 120) { |
34c30ac1 AD |
281 | if ($feed >= 0) { |
282 | ccache_update($link, $feed, $_SESSION["uid"], $cat_view); | |
283 | } | |
284 | $_SESSION["viewfeed:ccache_update_stamp"] = time(); | |
5c432ba4 | 285 | // } |
0737b95a | 286 | |
45004d43 AD |
287 | set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode); |
288 | set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit); | |
7b4d02a8 | 289 | set_pref($link, "_DEFAULT_VIEW_ORDER_BY", $order_by); |
40496720 | 290 | |
45004d43 AD |
291 | if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) { |
292 | db_query($link, "UPDATE ttrss_feeds SET last_viewed = NOW() | |
293 | WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]); | |
294 | } | |
7466dc6a | 295 | |
1098687a AD |
296 | if (!$next_unread_feed) { |
297 | print "<headlines id=\"$feed\" is_cat=\"$cat_view\"><![CDATA["; | |
298 | } else { | |
299 | print "<headlines id=\"$next_unread_feed\" is_cat=\"$cat_view\"><![CDATA["; | |
300 | } | |
a5c815d3 AD |
301 | |
302 | $override_order = false; | |
303 | ||
304 | switch ($order_by) { | |
305 | case "date": | |
306 | if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) { | |
307 | $override_order = "updated"; | |
308 | } else { | |
309 | $override_order = "updated DESC"; | |
310 | } | |
311 | break; | |
c50e2b30 | 312 | |
a5c815d3 AD |
313 | case "title": |
314 | $override_order = "updated DESC"; | |
315 | break; | |
d76a3b03 | 316 | |
a5c815d3 AD |
317 | case "score": |
318 | $override_order = "score DESC"; | |
319 | break; | |
320 | } | |
e19c1824 | 321 | |
a5c815d3 AD |
322 | $ret = outputHeadlinesList($link, $feed, $subop, |
323 | $view_mode, $limit, $cat_view, $next_unread_feed, $offset, | |
324 | $vgroup_last_feed, $override_order); | |
7b4d02a8 | 325 | |
a5c815d3 AD |
326 | $topmost_article_ids = $ret[0]; |
327 | $headlines_count = $ret[1]; | |
328 | $returned_feed = $ret[2]; | |
329 | $disable_cache = $ret[3]; | |
330 | $vgroup_last_feed = $ret[4]; | |
7b4d02a8 | 331 | |
a5c815d3 | 332 | print "]]></headlines>"; |
46921916 | 333 | |
a5c815d3 AD |
334 | print "<headlines-count value=\"$headlines_count\"/>"; |
335 | print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>"; | |
081e527d | 336 | |
cfcb7d42 | 337 | $headlines_unread = ccache_find($link, $returned_feed, $_SESSION["uid"], |
696a6850 AD |
338 | $cat_view, true); |
339 | ||
340 | if ($headlines_unread == -1) { | |
341 | $headlines_unread = getFeedUnread($link, $returned_feed, $cat_view); | |
342 | ||
343 | } | |
a5c815d3 AD |
344 | |
345 | print "<headlines-unread value=\"$headlines_unread\"/>"; | |
346 | printf("<disable-cache value=\"%d\"/>", $disable_cache); | |
347 | ||
b4e75b2a | 348 | if ($_REQUEST["debug"]) $timing_info = print_checkpoint("10", $timing_info); |
a5c815d3 AD |
349 | |
350 | if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) { | |
351 | print "<articles>"; | |
352 | foreach ($topmost_article_ids as $id) { | |
353 | outputArticleXML($link, $id, $feed, false); | |
45004d43 | 354 | } |
a5c815d3 | 355 | print "</articles>"; |
961f4c73 | 356 | } |
961f4c73 | 357 | |
b4e75b2a | 358 | if ($_REQUEST["debug"]) $timing_info = print_checkpoint("20", $timing_info); |
46921916 | 359 | |
6cc1fab3 | 360 | |
bd090ab4 AD |
361 | // if (get_pref($link, "SYNC_COUNTERS") || |
362 | // time() - $_SESSION["get_all_counters_stamp"] > $viewfeed_ctr_interval) { | |
0bdec456 AD |
363 | // print "<counters>"; |
364 | // getAllCounters($link, $omode, $feed); | |
365 | // print "</counters>"; | |
366 | // } | |
367 | ||
a06d0e5a | 368 | if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop || |
ab197ae1 | 369 | time() - $_SESSION["viewfeed:counters_stamp"] > 5) { |
b1676464 AD |
370 | if (!$offset) { |
371 | print "<counters>"; | |
372 | getAllCounters($link, $omode, $feed); | |
373 | print "</counters>"; | |
a06d0e5a | 374 | $_SESSION["viewfeed:counters_stamp"] = time(); |
b1676464 | 375 | } |
0bdec456 | 376 | } |
98bea1b1 | 377 | |
b4e75b2a | 378 | if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info); |
46921916 | 379 | |
45004d43 | 380 | print_runtime_info($link); |
03c88bdd | 381 | |
45004d43 AD |
382 | print "</reply>"; |
383 | break; // viewfeed | |
1cd17194 | 384 | |
45004d43 AD |
385 | case "pref-feeds": |
386 | module_pref_feeds($link); | |
387 | break; // pref-feeds | |
a7f22b70 | 388 | |
45004d43 AD |
389 | case "pref-filters": |
390 | module_pref_filters($link); | |
391 | break; // pref-filters | |
a0476535 | 392 | |
45004d43 AD |
393 | case "pref-labels": |
394 | module_pref_labels($link); | |
395 | break; // pref-labels | |
d0000401 | 396 | |
45004d43 AD |
397 | case "pref-prefs": |
398 | module_pref_prefs($link); | |
399 | break; // pref-prefs | |
f27d955a | 400 | |
45004d43 AD |
401 | case "pref-users": |
402 | module_pref_users($link); | |
403 | break; // prefs-users | |
a0476535 | 404 | |
45004d43 AD |
405 | case "help": |
406 | module_help($link); | |
407 | break; // help | |
a0476535 | 408 | |
45004d43 AD |
409 | case "dlg": |
410 | module_popup_dialog($link); | |
411 | break; // dlg | |
a7f22b70 | 412 | |
45004d43 AD |
413 | case "pref-pub-items": |
414 | module_pref_pub_items($link); | |
415 | break; // pref-pub-items | |
e4f4b46f | 416 | |
45004d43 AD |
417 | case "globalUpdateFeeds": |
418 | // update feeds of all users, may be used anonymously | |
e4f4b46f | 419 | |
5cbaf873 | 420 | print "<!--"; |
45004d43 | 421 | // Update all feeds needing a update. |
5cbaf873 AD |
422 | update_daemon_common($link, 0, true, true); |
423 | print " -->"; | |
a7f22b70 | 424 | |
45004d43 AD |
425 | print "<rpc-reply> |
426 | <message msg=\"All feeds updated\"/> | |
427 | </rpc-reply>"; | |
428 | break; // globalUpdateFeeds | |
e5d758e3 | 429 | |
45004d43 AD |
430 | case "pref-feed-browser": |
431 | module_pref_feed_browser($link); | |
432 | break; // pref-feed-browser | |
c6232e43 | 433 | |
45004d43 | 434 | case "publish": |
b4e75b2a AD |
435 | $key = db_escape_string($_REQUEST["key"]); |
436 | $limit = (int)db_escape_string($_REQUEST["limit"]); | |
945c243e | 437 | |
45004d43 AD |
438 | $result = db_query($link, "SELECT login, owner_uid |
439 | FROM ttrss_user_prefs, ttrss_users WHERE | |
440 | pref_name = '_PREFS_PUBLISH_KEY' AND | |
441 | value = '$key' AND | |
442 | ttrss_users.id = owner_uid"); | |
945c243e | 443 | |
45004d43 AD |
444 | if (db_num_rows($result) == 1) { |
445 | $owner = db_fetch_result($result, 0, "owner_uid"); | |
446 | $login = db_fetch_result($result, 0, "login"); | |
945c243e | 447 | |
ead2715d | 448 | generate_syndicated_feed($link, $owner, -2, false, $limit); |
945c243e | 449 | |
45004d43 AD |
450 | } else { |
451 | print "<error>User not found</error>"; | |
452 | } | |
453 | break; // publish | |
18664970 | 454 | |
45004d43 | 455 | case "rss": |
b4e75b2a AD |
456 | $feed = db_escape_string($_REQUEST["id"]); |
457 | $user = db_escape_string($_REQUEST["user"]); | |
458 | $pass = db_escape_string($_REQUEST["pass"]); | |
459 | $is_cat = $_REQUEST["is_cat"] != false; | |
460 | $limit = (int)db_escape_string($_REQUEST["limit"]); | |
e1eb2147 | 461 | |
b4e75b2a AD |
462 | $search = db_escape_string($_REQUEST["q"]); |
463 | $match_on = db_escape_string($_REQUEST["m"]); | |
464 | $search_mode = db_escape_string($_REQUEST["smode"]); | |
18664970 | 465 | |
b4798282 AD |
466 | if (SINGLE_USER_MODE) { |
467 | authenticate_user($link, "admin", null); | |
468 | } | |
469 | ||
45004d43 AD |
470 | if (!$_SESSION["uid"] && $user && $pass) { |
471 | authenticate_user($link, $user, $pass); | |
472 | } | |
18664970 | 473 | |
45004d43 AD |
474 | if ($_SESSION["uid"] || |
475 | http_authenticate_user($link)) { | |
945c243e | 476 | |
ead2715d | 477 | generate_syndicated_feed($link, 0, $feed, $is_cat, $limit, |
45004d43 AD |
478 | $search, $search_mode, $match_on); |
479 | } | |
480 | break; // rss | |
18664970 | 481 | |
45004d43 | 482 | case "getUnread": |
b4e75b2a | 483 | $login = db_escape_string($_REQUEST["login"]); |
f3acc32e | 484 | |
45004d43 | 485 | header("Content-Type: text/plain; charset=utf-8"); |
f3acc32e | 486 | |
45004d43 | 487 | $result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '$login'"); |
7e3634d9 | 488 | |
45004d43 AD |
489 | if (db_num_rows($result) == 1) { |
490 | $uid = db_fetch_result($result, 0, "id"); | |
491 | print getGlobalUnread($link, $uid); | |
492 | } else { | |
493 | print "-1;User not found"; | |
494 | } | |
7e3634d9 | 495 | |
45004d43 AD |
496 | $print_exec_time = false; |
497 | break; // getUnread | |
9cd7c995 | 498 | |
45004d43 AD |
499 | case "digestTest": |
500 | header("Content-Type: text/plain"); | |
501 | print_r(prepare_headlines_digest($link, $_SESSION["uid"])); | |
502 | $print_exec_time = false; | |
503 | break; // digestTest | |
448b0abd | 504 | |
45004d43 AD |
505 | case "digestSend": |
506 | header("Content-Type: text/plain"); | |
507 | send_headlines_digests($link); | |
508 | $print_exec_time = false; | |
509 | break; // digestSend | |
7e3634d9 | 510 | |
45004d43 | 511 | } // Select action according to $op value. |
f3acc32e | 512 | |
45004d43 | 513 | // We close the connection to database. |
4b3dff6e | 514 | db_close($link); |
1cd17194 | 515 | ?> |
406d9489 | 516 | |
7e3634d9 | 517 | <?php if ($print_exec_time) { ?> |
1d3a17c7 | 518 | <!-- <?php echo sprintf("Backend execution time: %.4f seconds", getmicrotime() - $script_started) ?> --> |
f3acc32e | 519 | <?php } ?> |