haskellblog / src / blog.php.tpl

Luke Plant 8d5b3db 













Luke Plant b9b31a4 
Luke Plant 8d5b3db 
Luke Plant b9b31a4 
Luke Plant 8d5b3db 
Luke Plant 312884a 
Luke Plant 8d5b3db 
Luke Plant 312884a 













Luke Plant b9b31a4 
<?php
  // DO NOT EDIT THE FILE blog.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 blog.php is produced from the blog.php.tpl file.  The
  // template language uses dollar substitutions, and dollar signs
  // must be escaped by doubling.

$$postMap = ${postIdsToUrls};

$$catMap = ${categoryIdsToUrls};

header ('HTTP/1.1 301 Moved Permanently');

$$id = $$_GET['id'];
$$cat = $$_GET['cat'];

if (!empty($$id)) {
   header('Location: ' . $$postMap[$$id]);
   exit();
}

if (!empty($$cat)) {
   header('Location: ' . $$catMap[$$cat]);
   exit();
}

header('Location: /blog/')
?>
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.