#!/usr/bin/perl

=head1 wiki.pl

this is a fake wiki script that is here because there are still URLs on the web
(and in some versions of POPFile) that point to the _old_ wiki that was located
at getpopfile.org/cgi-bin/wiki.pl

To make these links work, we catch any requests here and redirect them to the
new new wiki.

=cut


use strict;
use warnings;

use CGI;

my $q = CGI->new();
my @keywords = $q->keywords();
my $target = 'http://getpopfile.org/docs/';

if ( @keywords ) {
    my $page = $keywords[0];
    $page =~ s|/|:|g;
    
    $page =~ s/JP_POPFileDocumentationProject/jp/;
    
    if ( $page =~ m/^JP_(.+)/ ) {
        $target .= 'JP:' . $1;
    }
    else {
        $target .= $page;
    }
    
    $target =~ s/FrequentlyAskedQuestions/FAQ/;
    $target =~ s/POPFileDocumentationProject/Welcome/;
}
print $q->redirect($target);

