haskellblog / src / syndicate.php.tpl

<?php
  // DO NOT EDIT THE FILE syndicate.php DIRECTLY!

  // PHP file that does redirects to the new URLs.  This could be
  // implemented using a .htaccess redirect rule and a Haskell CGI
  // script that parsed and rewrote the URLs.  However, that script
  // would still need access to the mapping between old ids (not
  // stored in the new database) and the new URLs/ids.  So it is
  // simpler to do it in a single PHP file.

  // The file syndicate.php is produced from the syndicate.php.tpl file.  The
  // template language uses dollar substitutions, and dollar signs
  // must be escaped by doubling.

define('FEED_SELECTALL',1);
define('FEED_SELECTCATEGORIES',2);
define('FEED_SELECTEXCEPT',3);

define('FEED_FULLSTORY',1);
define('FEED_SHORTSTORY', 2);

$$catMap = ${categoryIdsToUrls};

@$$method = $$_GET['m']; // method of selection

@$$categories = $$_GET['c'];
$$categories = preg_replace("/[^\d,]/",'', $$categories);
$$categories = explode(',', $$categories);
if (count($$categories) > 1) {
    // don't support that any more
    header ('HTTP/1.1 404 Not Found');
    exit();
}

if ($$method == FEED_SELECTEXCEPT) {
    // don't support that any more
    header ('HTTP/1.1 404 Not Found');
    exit();
}

if ($$method == FEED_SELECTCATEGORIES) {
    header ('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $$catMap[$$categories[0]]);
    exit();
}

// default - FEED_SELECTALL

header ('HTTP/1.1 301 Moved Permanently');
header ('Location: /blog/atom/');
exit();

?>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.