#!/usr/bin/perl -wTI. # # TWiki WikiClone (see wiki.pm for $wikiversion and other info) # # Based on parts of Ward Cunninghams original Wiki and JosWiki. # Copyright (C) 1998 Markus Peter - SPiN GmbH (warpi@spin.de) # Some changes by Dave Harris (drh@bhresearch.co.uk) incorporated # Copyright (C) 1999-2000 Peter Thoeny, peter@thoeny.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details, published at # http://www.gnu.org/copyleft/gpl.html use CGI; use wiki; $query = new CGI; &main(); sub main { my $thePathInfo = $query->path_info(); my $theRemoteUser = $query->remote_user(); my $theTopic = $query->param( 'topic' ) || ""; my $theUrl = $query->url; ( $topic, $webName, $dummy, $userName ) = &wiki::initialize( $thePathInfo, $theRemoteUser, $theTopic, $theUrl ); $dummy = ""; # to suppress warning my $tmpl = ""; my $text = ""; my $rev = $query->param( "rev" ); if( ! &wiki::webExists( $webName ) ) { print "Content-type: text/html\n\n"; $tmpl= &wiki::readTemplate( "noweb" ); $tmpl = &wiki::handleCommonTags( $tmpl, $topic ); print $tmpl; return; } if( &wiki::topicExists( $webName, $topic ) ) { if( $rev ) { $text= &wiki::readVersion( $topic, "$rev" ); } else { $text= &wiki::readTopic( $topic ); $rev= $maxrev; } } print "Content-type: text/html\n\n"; $tmpl= &wiki::readTemplate( "viewsource", $topic ); $text =~ s/&/&\;/go; $text =~ s/\t/ /go; $tmpl = &wiki::handleCommonTags( $tmpl, $topic ); if( $rev ) { $tmpl =~ s/\(viewsource\)/\(viewsource rev=$rev\)/go; } $tmpl =~ s/%TEXT%/$text/go; print $tmpl; }