#!/usr/bin/perl -wT # # TWiki Collaboration Platform, http://TWiki.org/ # # Copyright (C) 1999-2003 Peter Thoeny, peter@thoeny.com # # 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 # # For licensing info read license.txt file in the TWiki root. # 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 # Set library paths in @INC, at compile time BEGIN { unshift @INC, '.'; require 'setlib.cfg' } use CGI::Carp qw( fatalsToBrowser ); use CGI; use TWiki; use strict; &main(); # Uncomment the body of either routine to enable debugging sub writeDebug { my( $text ) = @_; # TWiki::writeDebug( $text ); } sub writeDebugTimes { my( $text ) = @_; # TWiki::writeDebugTimes( $text ); } sub main { my $query= new CGI; ##### for debug only: Remove next 2 comments (but redirect does not work) #print "Content-type: text/html\n\n"; #open(STDERR,'>&STDOUT'); # redirect error to browser #$| = 1; # no buffering my $thePathInfo = $query->path_info(); my $theRemoteUser = $query->remote_user(); my $theTopic = $query->param( 'topic' ); my $theUrl = $query->url; writeDebugTimes( "view - start $thePathInfo" ); my( $topic, $webName, $scriptUrlPath, $userName ) = &TWiki::initialize( $thePathInfo, $theRemoteUser, $theTopic, $theUrl, $query ); writeDebugTimes( "view - initialized" ); my $tmpl = ""; my $text = ""; my $meta = ""; my $rev = $query->param( "rev" ); my $maxrev = 1; my $extra = ""; my $wikiUserName = &TWiki::userToWikiName( $userName ); my $revdate = ""; my $revuser = ""; my $viewRaw = $query->param( "raw" ) || ""; my $unlock = $query->param( "unlock" ) || ""; my $skin = $query->param( "skin" ) || &TWiki::Prefs::getPreferencesValue( "SKIN" ); # Set page generation mode to RSS if using an RSS skin if( $skin =~ /^rss/ ) { TWiki::setPageMode( 'rss' ); } # get view template, standard view or a view with a different skin $tmpl = &TWiki::Store::readTemplate( "view", $skin ); if( ! $tmpl ) { TWiki::writeHeader( $query ); print "
\n" . "