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. --- doeditparams.cgi | 67 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 27 deletions(-) (limited to 'doeditparams.cgi') diff --git a/doeditparams.cgi b/doeditparams.cgi index b214ff750..e43fd73ce 100755 --- a/doeditparams.cgi +++ b/doeditparams.cgi @@ -1,5 +1,5 @@ -#! /usr/bonsaitools/bin/mysqltcl -# -*- Mode: tcl; indent-tabs-mode: nil -*- +#!/usr/bonsaitools/bin/perl -w +# -*- 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 @@ -19,44 +19,57 @@ # # Contributor(s): Terry Weissman -source "CGI.tcl" -source "defparams.tcl" +use diagnostics; +use strict; -confirm_login +require "CGI.pl"; +require "defparams.pl"; -puts "Content-type: text/html\n" +# Shut up misguided -w warnings about "used only once": +use vars %::param, + %::param_default, + @::param_list, + %::COOKIE; -if {![cequal [Param "maintainer"] $COOKIE(Bugzilla_login)]} { - puts "

Sorry, you aren't the maintainer of this system.

" - puts "And so, you aren't allowed to edit the parameters of it." - exit + +confirm_login(); + +print "Content-type: text/html\n\n"; + +if (Param("maintainer") ne $::COOKIE{'Bugzilla_login'}) { + print "

Sorry, you aren't the maintainer of this system.

\n"; + print "And so, you aren't allowed to edit the parameters of it.\n"; + exit; } -PutHeader "Saving new parameters" "Saving new parameters" +PutHeader("Saving new parameters"); -foreach i $param_list { - if {[info exists FORM(reset-$i)]} { - set FORM($i) $param_default($i) +foreach my $i (@::param_list) { +# print "Processing $i...
\n"; + if (exists $::FORM{"reset-$i"}) { + $::FORM{$i} = $::param_default{$i}; } - if {![cequal $FORM($i) [Param $i]]} { - if {![cequal $param_checker($i) ""]} { - set ok [$param_checker($i) $FORM($i)] - if {![cequal $ok ""]} { - puts "New value for $i is invalid: $ok

" - puts "Please hit Back and try again." - exit + $::FORM{$i} =~ s/\r\n/\n/; # Get rid of windows-style line endings. + if ($::FORM{$i} ne Param($i)) { + if (defined $::param_checker{$i}) { + my $ref = $::param_checker{$i}; + my $ok = &$ref($::FORM{$i}); + if ($ok ne "") { + print "New value for $i is invalid: $ok

\n"; + print "Please hit Back and try again.\n"; + exit; } } - puts "Changed $i.
" - set param($i) $FORM($i) + print "Changed $i.
\n"; + $::param{$i} = $::FORM{$i} } } -WriteParams +WriteParams(); -puts "OK, done.

" -puts "Edit the params some more.

" -puts "Go back to the query page." +print "OK, done.

\n"; +print "Edit the params some more.

\n"; +print "Go back to the query page.\n"; -- cgit v1.2.1