2003-03-03 07:27:41 PST
Here is a copy of the changes I made to Apache and Codestriker. These probably weren't the smartest way to get it to work, but I am new to web servers, and perl cgi scripts.
Shar archive text follows:
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2003-03-03 09:13 CST by <olen@hersheys>.
# Source directory was `/home/olen/codestrikerconf'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 670 -rw-r--r-- etc/httpd/conf/httpd.conf
# 711 -rwxr-xr-x var/www/perlstartup/perlstartup.pl
# 4117 -rwxr-xr-x var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh02531; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= etc/httpd/conf/httpd.conf ==============
if test ! -d 'etc'; then
$echo 'x -' 'creating directory' 'etc'
mkdir 'etc'
fi
if test ! -d 'etc/httpd'; then
$echo 'x -' 'creating directory' 'etc/httpd'
mkdir 'etc/httpd'
fi
if test ! -d 'etc/httpd/conf'; then
$echo 'x -' 'creating directory' 'etc/httpd/conf'
mkdir 'etc/httpd/conf'
fi
if test -f 'etc/httpd/conf/httpd.conf' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'etc/httpd/conf/httpd.conf' '(file already exists)'
else
$echo 'x -' extracting 'etc/httpd/conf/httpd.conf' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/httpd/conf/httpd.conf' &&
## httpd.conf - codestriker configuration for the Apache web server
## codestriker
PerlRequire "/var/www/perlstart/perlstartup.pl"
Alias /codestriker/ /var/www/codestriker/codestriker-1.6.4/cgi-bin/
Alias /codestrikerhtml/ /var/www/codestriker/codestriker-1.6.4/html/
PerlModule Apache2
<Directory "/var/www/codestriker/codestriker-1.6.4/cgi-bin/">
X # SetEnv PWD /var/www/codestriker/codestriker-1.6.4/lib/
X SetHandler perl-script
X PerlHandler ModPerl::Registry
X Options +ExecCGI
X Allow from all
</Directory>
X
<Directory "/var/www/codestriker/codestriker-1.6.4/html/">
X AllowOverride None
X Allow from all
</Directory>
X
PerlTaintCheck On
#end codestriker
SHAR_EOF
(set 20 03 02 26 11 28 44 'etc/httpd/conf/httpd.conf'; eval "$shar_touch") &&
chmod 0644 'etc/httpd/conf/httpd.conf' ||
$echo 'restore of' 'etc/httpd/conf/httpd.conf' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'etc/httpd/conf/httpd.conf:' 'MD5 check failed'
268bad8085adf7546112995e307615b0 etc/httpd/conf/httpd.conf
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'etc/httpd/conf/httpd.conf'`"
test 670 -eq "$shar_count" ||
$echo 'etc/httpd/conf/httpd.conf:' 'original size' '670,' 'current size' "$shar_count!"
fi
fi
# ============= var/www/perlstartup/perlstartup.pl ==============
if test ! -d 'var'; then
$echo 'x -' 'creating directory' 'var'
mkdir 'var'
fi
if test ! -d 'var/www'; then
$echo 'x -' 'creating directory' 'var/www'
mkdir 'var/www'
fi
if test ! -d 'var/www/perlstartup'; then
$echo 'x -' 'creating directory' 'var/www/perlstartup'
mkdir 'var/www/perlstartup'
fi
if test -f 'var/www/perlstartup/perlstartup.pl' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'var/www/perlstartup/perlstartup.pl' '(file already exists)'
else
$echo 'x -' extracting 'var/www/perlstartup/perlstartup.pl' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'var/www/perlstartup/perlstartup.pl' &&
use Apache2 ();
X use lib qw(/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/ModPerl/);
X use lib qw(/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/Apache/);
X use lib qw(/var/www/codestriker/codestriker-1.6.4/lib/);
X
X # enable if the mod_perl 1.0 compatibility is needed
X use Apache::compat ();
X use ModPerl::Util (); #for CORE::GLOBAL::exit
X use Apache::RequestRec ();
X use Apache::RequestIO ();
X use Apache::RequestUtil ();
X use Apache::Server ();
X use Apache::ServerUtil ();
X use Apache::Connection ();
X use Apache::Log ();
X use APR::Table ();
X use ModPerl::Registry ();
X use CGI();
X use Apache::Const -compile => ':common';
X use APR::Const -compile => ':common';
X 1;
SHAR_EOF
(set 20 03 02 26 11 28 53 'var/www/perlstartup/perlstartup.pl'; eval "$shar_touch") &&
chmod 0755 'var/www/perlstartup/perlstartup.pl' ||
$echo 'restore of' 'var/www/perlstartup/perlstartup.pl' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'var/www/perlstartup/perlstartup.pl:' 'MD5 check failed'
1b2cf64ad35e38c0959dfa51e7f38fc7 var/www/perlstartup/perlstartup.pl
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'var/www/perlstartup/perlstartup.pl'`"
test 711 -eq "$shar_count" ||
$echo 'var/www/perlstartup/perlstartup.pl:' 'original size' '711,' 'current size' "$shar_count!"
fi
fi
# ============= var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl ==============
if test ! -d 'var/www/codestriker'; then
$echo 'x -' 'creating directory' 'var/www/codestriker'
mkdir 'var/www/codestriker'
fi
if test ! -d 'var/www/codestriker/codestriker-1.6.4'; then
$echo 'x -' 'creating directory' 'var/www/codestriker/codestriker-1.6.4'
mkdir 'var/www/codestriker/codestriker-1.6.4'
fi
if test ! -d 'var/www/codestriker/codestriker-1.6.4/cgi-bin'; then
$echo 'x -' 'creating directory' 'var/www/codestriker/codestriker-1.6.4/cgi-bin'
mkdir 'var/www/codestriker/codestriker-1.6.4/cgi-bin'
fi
if test -f 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl' '(file already exists)'
else
$echo 'x -' extracting 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl' &&
#!/usr/bin/perl -wT
X
###############################################################################
# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
#
sits@users.sourceforge.net
# Version 1.5
#
# This program is free software; you can redistribute it and modify it under
# the terms of the GPL.
X
# This is the top level package which receives all HTTP requests, and
# delegates it to the appropriate Action module.
X
require 5.000;
X
use strict;
X
use CGI qw/:standard :html3/;
use CGI::Carp 'fatalsToBrowser';
X
use lib "../lib";
use Codestriker;
use Codestriker::Http::Input;
use Codestriker::Http::Response;
use Codestriker::Action::CreateTopic;
use Codestriker::Action::SubmitTopic;
use Codestriker::Action::ViewTopic;
use Codestriker::Action::EditTopic;
use Codestriker::Action::SubmitComment;
use Codestriker::Action::ViewFile;
use Codestriker::Action::ViewSearch;
use Codestriker::Action::SubmitSearch;
use Codestriker::Action::ListTopics;
use Codestriker::Action::DownloadTopic;
use Codestriker::Action::ChangeTopicState;
use Codestriker::Action::ChangeTopics;
use Codestriker::Action::ListComments;
use Codestriker::Action::ChangeComments;
X
# Set the PATH to something sane.
$ENV{'PATH'} = "/bin:/usr/bin";
X
# Don't allow posts larger than 500K.
$CGI::POST_MAX=1024 * 500;
X
# Prototypes of subroutines used in this module.
sub main();
#for apache2 and various perl modules to run in correct directory
chdir "/var/www/codestriker/codestriker-1.6.4/lib/";
#end change for apache2
main;
X
sub main() {
X # Initialise Codestriker, load up the configuration file.
X Codestriker->initialise();
X
X # Load the CGI object, and prepare the HTTP response.
X my $query = new CGI;
X my $http_response = Codestriker::Http::Response->new($query);
X
X # Process the HTTP input to ensure it is consistent.
X my $http_input = Codestriker::Http::Input->new($query, $http_response);
X $http_input->process();
X
X # Delegate the request to the appropriate Action module.
X my $action = $http_input->get("action");
X if ($action eq "create") {
X Codestriker::Action::CreateTopic->process($http_input, $http_response);
X } elsif ($action eq "submit_topic") {
X Codestriker::Action::SubmitTopic->process($http_input, $http_response);
X } elsif ($action eq "view") {
X Codestriker::Action::ViewTopic->process($http_input, $http_response);
X } elsif ($action eq "edit") {
X Codestriker::Action::EditTopic->process($http_input, $http_response);
X } elsif ($action eq "submit_comment") {
X Codestriker::Action::SubmitComment->process($http_input,
X $http_response);
X } elsif ($action eq "view_file") {
X Codestriker::Action::ViewFile->process($http_input, $http_response);
X } elsif ($action eq "search") {
X Codestriker::Action::ViewSearch->process($http_input, $http_response);
X } elsif ($action eq "submit_search") {
X Codestriker::Action::SubmitSearch->process($http_input,
X $http_response);
X } elsif ($action eq "list_topics") {
X Codestriker::Action::ListTopics->process($http_input, $http_response);
X } elsif ($action eq "download") {
X Codestriker::Action::DownloadTopic->process($http_input,
X $http_response);
X } elsif ($action eq "change_topic_state") {
X Codestriker::Action::ChangeTopicState->process($http_input,
X $http_response);
X } elsif ($action eq "change_topics") {
X Codestriker::Action::ChangeTopics->process($http_input,
X $http_response);
X } elsif ($action eq "list_comments") {
X Codestriker::Action::ListComments->process($http_input,
X $http_response);
X } elsif ($action eq "change_comments") {
X Codestriker::Action::ChangeComments->process($http_input,
X $http_response);
X } else {
X # Default action is to list topics that are in state open if the
X # list functionality is enabled, otherwise go to the create topic
X # screen.
X if ($Codestriker::allow_searchlist) {
X Codestriker::Action::ListTopics->process($http_input,
X $http_response);
X } else {
X Codestriker::Action::CreateTopic->process($http_input,
X $http_response);
X }
X }
}
SHAR_EOF
(set 20 03 03 03 09 09 10 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl'; eval "$shar_touch") &&
chmod 0755 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl' ||
$echo 'restore of' 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl:' 'MD5 check failed'
fba864a79ea108475eb267611bc17477 var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl'`"
test 4117 -eq "$shar_count" ||
$echo 'var/www/codestriker/codestriker-1.6.4/cgi-bin/codestriker.pl:' 'original size' '4117,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh02531
exit 0