From 4727e6c09f88e63f02e6c8f359862d0c0942ed36 Mon Sep 17 00:00:00 2001 From: "terry%netscape.com" <> Date: Wed, 16 Sep 1998 04:49:23 +0000 Subject: Everything has been ported to now run under Perl. --- CGI.pl | 467 ++++++++++++++++++++++++++++++++ CHANGES | 20 ++ README | 176 +----------- bug_form.pl | 239 +++++++++++++++++ buglist.cgi | 764 ++++++++++++++++++++++++++--------------------------- changepassword.cgi | 63 +++-- colchange.cgi | 99 +++---- defparams.pl | 234 ++++++++++++++++ defparams.tcl | 21 ++ doeditparams.cgi | 67 +++-- editparams.cgi | 117 ++++---- enter_bug.cgi | 210 ++++++++------- globals.pl | 495 ++++++++++++++++++++++++++++++++++ globals.tcl | 1 - long_list.cgi | 78 +++--- new_comment.cgi | 2 +- newquip.html | 2 +- post_bug.cgi | 148 +++++------ process_bug.cgi | 442 +++++++++++++++---------------- processmail | 350 +++++++++++++----------- query.cgi | 158 ++++++----- relogin.cgi | 32 +-- sanitycheck.cgi | 115 ++++---- show_activity.cgi | 69 ++--- show_bug.cgi | 43 +-- whineatnews.pl | 66 +++++ 26 files changed, 3003 insertions(+), 1475 deletions(-) create mode 100644 CGI.pl create mode 100644 bug_form.pl create mode 100644 defparams.pl create mode 100644 globals.pl create mode 100755 whineatnews.pl diff --git a/CGI.pl b/CGI.pl new file mode 100644 index 000000000..0a2fc9723 --- /dev/null +++ b/CGI.pl @@ -0,0 +1,467 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public License +# Version 1.0 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are Copyright (C) 1998 +# Netscape Communications Corporation. All Rights Reserved. +# +# Contributor(s): Terry Weissman + +# Contains some global routines used throughout the CGI scripts of Bugzilla. + +use diagnostics; +use strict; + +use CGI::Carp qw(fatalsToBrowser); + +require 'globals.pl'; + +sub GeneratePersonInput { + my ($field, $required, $def_value, $extraJavaScript) = (@_); + if (!defined $extraJavaScript) { + $extraJavaScript = ""; + } + if ($extraJavaScript ne "") { + $extraJavaScript = "onChange=\" $extraJavaScript \""; + } + return ""; +} + +sub GeneratePeopleInput { + my ($field, $def_value) = (@_); + return ""; +} + + + + +# Implementations of several of the below were blatently stolen from CGI.pm, +# by Lincoln D. Stein. + + +# Get rid of all the %xx encoding and the like from the given URL. + +sub url_decode { + my ($todecode) = (@_); + $todecode =~ tr/+/ /; # pluses become spaces + $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; + return $todecode; +} + + +# Quotify a string, suitable for putting into a URL. + +sub url_quote { + my($toencode) = (@_); + $toencode=~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg; + return $toencode; +} + + +sub ProcessFormFields { + my ($buffer) = (@_); + undef %::FORM; + undef %::MFORM; + + my %isnull; + my $remaining = $buffer; + while ($remaining ne "") { + my $item; + if ($remaining =~ /^([^&]*)&(.*)$/) { + $item = $1; + $remaining = $2; + } else { + $item = $remaining; + $remaining = ""; + } + + my $name; + my $value; + if ($item =~ /^([^=]*)=(.*)$/) { + $name = $1; + $value = url_decode($2); + } else { + $name = $item; + $value = ""; + } + if ($value ne "") { + if (defined $::FORM{$name}) { + $::FORM{$name} .= $value; + my $ref = $::MFORM{$name}; + push @$ref, $value; + } else { + $::FORM{$name} = $value; + $::MFORM{$name} = [$value]; + } + } else { + $isnull{$name} = 1; + } + } + if (defined %isnull) { + foreach my $name (keys(%isnull)) { + if (!defined $::FORM{$name}) { + $::FORM{$name} = ""; + $::MFORM{$name} = []; + } + } + } +} + + +sub FormData { + my ($field) = (@_); + return $::FORM{$field}; +} + +sub html_quote { + my ($var) = (@_); + $var =~ s/\&/\&/g; + $var =~ s//\>/g; + return $var; +} + +sub value_quote { + my ($var) = (@_); + $var =~ s/\&/\&/g; + $var =~ s//\>/g; + $var =~ s/"/\"/g; + return $var; +} + +sub value_unquote { + my ($var) = (@_); + $var =~ s/\"/\"/g; + $var =~ s/\<//g; + $var =~ s/\&/\&/g; + return $var; +} + + +sub navigation_header { + if (defined $::COOKIE{"BUGLIST"} && $::COOKIE{"BUGLIST"} ne "") { + my @bugs = split(/:/, $::COOKIE{"BUGLIST"}); + my $cur = lsearch(\@bugs, $::FORM{"id"}); + print "Bug List: (@{[$cur + 1]} of @{[$#bugs + 1]})\n"; + print "First\n"; + print "Last\n"; + if ($cur > 0) { + print "Prev\n"; + } else { + print "Prev\n"; + } + if ($cur < $#bugs) { + $::next_bug = $bugs[$cur + 1]; + print "Next\n"; + } else { + print "Next\n"; + } + } + print "     Query page\n"; + print "     Enter new bug\n" +} + + +sub make_options { + my ($src,$default,$isregexp) = (@_); + my $last = ""; + my $popup = ""; + my $found = 0; + foreach my $item (@$src) { + if ($item eq "-blank-" || $item ne $last) { + if ($item eq "-blank-") { + $item = ""; + } + $last = $item; + if ($isregexp ? $item =~ $default : $default eq $item) { + $popup .= "