3 * Request that a feed shall get updated, marks it as "requires update"
6 * Has to be called via POST, url given in parameter "url".
8 require_once 'www-header.php';
10 if (!isset($_POST['url'])) {
11 header('HTTP/1.0 400 Bad Request');
12 echo "HTTP POST 'url' parameter missing\n";
17 header('HTTP/1.0 400 Bad Request');
18 echo "'url' parameter is empty\n";
21 if (filter_var($url, FILTER_VALIDATE_URL) === false) {
22 header('HTTP/1.0 400 Bad Request');
23 echo "Invalid URL given\n";
29 'SELECT f_id, f_needs_update FROM feeds WHERE f_url = ' . $db->quote($url)
31 $row = $res->fetch(PDO::FETCH_OBJ);
33 header('HTTP/1.0 404 Not Found');
34 echo "Feed URL could not be found in database\n";
37 if ($row->f_needs_update == 1) {
38 header('HTTP/1.0 200 OK');
39 echo "Already in the queue\n";
44 'UPDATE feeds SET f_needs_update = 1'
45 . ' WHERE f_id = ' . $db->quote($row->f_id)
48 header('HTTP/1.0 202 Accepted');
49 echo "Feed has been put into the queue\n";