2003-03-27 03:07:02 +03:00
|
|
|
#!/usr/bin/perl -wT
|
2000-01-25 10:54:57 +03:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public
|
|
|
|
# License Version 1.1 (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.
|
|
|
|
#
|
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
2000-03-29 01:31:24 +04:00
|
|
|
# Dan Mosedale <dmose@mozilla.org>
|
2001-01-24 23:26:24 +03:00
|
|
|
# Alan Raetz <al_raetz@yahoo.com>
|
2001-04-17 06:26:16 +04:00
|
|
|
# David Miller <justdave@syndicomm.com>
|
2001-09-23 21:20:50 +04:00
|
|
|
# Christopher Aillon <christopher@aillon.com>
|
2002-02-28 03:14:01 +03:00
|
|
|
# Gervase Markham <gerv@gerv.net>
|
2000-01-25 10:54:57 +03:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2002-01-20 04:44:52 +03:00
|
|
|
use lib qw(.);
|
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
use Bugzilla;
|
|
|
|
|
2000-01-25 10:54:57 +03:00
|
|
|
require "CGI.pl";
|
|
|
|
|
2000-03-29 01:31:24 +04:00
|
|
|
use RelationSet;
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Shut up misguided -w warnings about "used only once". "use vars" just
|
2000-02-05 03:38:15 +03:00
|
|
|
# doesn't work for me.
|
|
|
|
sub sillyness {
|
|
|
|
my $zz;
|
|
|
|
$zz = $::defaultqueryname;
|
|
|
|
}
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Use global template variables.
|
2002-03-05 02:38:55 +03:00
|
|
|
use vars qw($template $vars $userid);
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# The default email flags leave all email on.
|
|
|
|
my $defaultflagstring = "ExcludeSelf~on~";
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-03-01 16:20:07 +03:00
|
|
|
my @roles = ("Owner", "Reporter", "QAcontact", "CClist", "Voter");
|
|
|
|
my @reasons = ("Removeme", "Comments", "Attachments", "Status", "Resolved",
|
2002-07-03 02:18:49 +04:00
|
|
|
"Keywords", "CC", "Other", "Unconfirmed");
|
2002-03-01 16:20:07 +03:00
|
|
|
|
|
|
|
foreach my $role (@roles) {
|
|
|
|
foreach my $reason (@reasons) {
|
2002-02-28 03:14:01 +03:00
|
|
|
$defaultflagstring .= "email$role$reason~on~";
|
|
|
|
}
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Remove final "~".
|
|
|
|
chop $defaultflagstring;
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
###############################################################################
|
|
|
|
# Each panel has two functions - panel Foo has a DoFoo, to get the data
|
|
|
|
# necessary for displaying the panel, and a SaveFoo, to save the panel's
|
|
|
|
# contents from the form data (if appropriate.)
|
|
|
|
# SaveFoo may be called before DoFoo.
|
|
|
|
###############################################################################
|
|
|
|
sub DoAccount {
|
2000-01-25 10:54:57 +03:00
|
|
|
SendSQL("SELECT realname FROM profiles WHERE userid = $userid");
|
2002-02-28 03:14:01 +03:00
|
|
|
$vars->{'realname'} = FetchSQLData();
|
2002-04-02 02:52:40 +04:00
|
|
|
|
|
|
|
if(Param('allowemailchange')) {
|
|
|
|
SendSQL("SELECT tokentype, issuedate + INTERVAL 3 DAY, eventdata
|
|
|
|
FROM tokens
|
|
|
|
WHERE userid = $userid
|
|
|
|
AND tokentype LIKE 'email%'
|
|
|
|
ORDER BY tokentype ASC LIMIT 1");
|
|
|
|
if(MoreSQLData()) {
|
|
|
|
my ($tokentype, $change_date, $eventdata) = &::FetchSQLData();
|
|
|
|
$vars->{'login_change_date'} = $change_date;
|
|
|
|
|
|
|
|
if($tokentype eq 'emailnew') {
|
|
|
|
my ($oldemail,$newemail) = split(/:/,$eventdata);
|
|
|
|
$vars->{'new_login_name'} = $newemail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub SaveAccount {
|
2002-04-02 02:52:40 +04:00
|
|
|
my $pwd1 = $::FORM{'new_password1'};
|
|
|
|
my $pwd2 = $::FORM{'new_password2'};
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
if ($::FORM{'Bugzilla_password'} ne "" ||
|
2002-04-02 02:52:40 +04:00
|
|
|
$pwd1 ne "" || $pwd2 ne "")
|
2002-02-28 03:14:01 +03:00
|
|
|
{
|
2001-06-20 02:02:53 +04:00
|
|
|
my $old = SqlQuote($::FORM{'Bugzilla_password'});
|
2001-07-11 09:29:21 +04:00
|
|
|
SendSQL("SELECT cryptpassword FROM profiles WHERE userid = $userid");
|
|
|
|
my $oldcryptedpwd = FetchOneColumn();
|
2002-10-06 15:52:37 +04:00
|
|
|
$oldcryptedpwd || ThrowCodeError("unable_to_retrieve_password");
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
if (crypt($::FORM{'Bugzilla_password'}, $oldcryptedpwd) ne
|
|
|
|
$oldcryptedpwd)
|
|
|
|
{
|
2002-10-06 15:52:37 +04:00
|
|
|
ThrowUserError("old_password_incorrect");
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
2002-04-02 02:52:40 +04:00
|
|
|
|
|
|
|
if ($pwd1 ne "" || $pwd2 ne "")
|
|
|
|
{
|
2002-10-06 15:52:37 +04:00
|
|
|
($pwd1 eq $pwd2) || ThrowUserError("passwords_dont_match");
|
|
|
|
$::FORM{'new_password1'} || ThrowUserError("new_password_missing");
|
|
|
|
ValidatePassword($pwd1);
|
2002-04-02 02:52:40 +04:00
|
|
|
|
|
|
|
my $cryptedpassword = SqlQuote(Crypt($pwd1));
|
|
|
|
SendSQL("UPDATE profiles
|
|
|
|
SET cryptpassword = $cryptedpassword
|
|
|
|
WHERE userid = $userid");
|
|
|
|
# Invalidate all logins except for the current one
|
|
|
|
InvalidateLogins($userid, $::COOKIE{"Bugzilla_logincookie"});
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
2002-04-02 02:52:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(Param("allowemailchange") && $::FORM{'new_login_name'}) {
|
|
|
|
my $old_login_name = $::FORM{'Bugzilla_login'};
|
|
|
|
my $new_login_name = trim($::FORM{'new_login_name'});
|
|
|
|
|
|
|
|
if($old_login_name ne $new_login_name) {
|
2002-10-06 15:52:37 +04:00
|
|
|
$::FORM{'Bugzilla_password'}
|
|
|
|
|| ThrowCodeError("old_password_required");
|
2002-04-02 02:52:40 +04:00
|
|
|
|
|
|
|
use Token;
|
|
|
|
# Block multiple email changes for the same user.
|
|
|
|
if (Token::HasEmailChangeToken($userid)) {
|
2002-10-06 15:52:37 +04:00
|
|
|
ThrowUserError("email_change_in_progress");
|
2002-04-02 02:52:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Before changing an email address, confirm one does not exist.
|
|
|
|
CheckEmailSyntax($new_login_name);
|
|
|
|
trick_taint($new_login_name);
|
2002-10-06 15:52:37 +04:00
|
|
|
ValidateNewUser($new_login_name)
|
|
|
|
|| ThrowUserError("account_exists", {email => $new_login_name});
|
2002-04-02 02:52:40 +04:00
|
|
|
|
|
|
|
Token::IssueEmailChangeToken($userid,$old_login_name,
|
|
|
|
$new_login_name);
|
|
|
|
|
2002-10-10 23:02:36 +04:00
|
|
|
$vars->{'email_changes_saved'} = 1;
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
}
|
2002-02-28 03:14:01 +03:00
|
|
|
|
2000-01-25 10:54:57 +03:00
|
|
|
SendSQL("UPDATE profiles SET " .
|
2001-09-23 21:20:50 +04:00
|
|
|
"realname = " . SqlQuote(trim($::FORM{'realname'})) .
|
2000-01-25 10:54:57 +03:00
|
|
|
" WHERE userid = $userid");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
sub DoEmail {
|
2001-05-24 07:10:49 +04:00
|
|
|
if (Param("supportwatchers")) {
|
|
|
|
my $watcheduserSet = new RelationSet;
|
|
|
|
$watcheduserSet->mergeFromDB("SELECT watched FROM watch WHERE" .
|
2000-03-29 01:31:24 +04:00
|
|
|
" watcher=$userid");
|
2002-02-28 03:14:01 +03:00
|
|
|
$vars->{'watchedusers'} = $watcheduserSet->toString();
|
2001-05-24 07:10:49 +04:00
|
|
|
}
|
2001-01-24 23:26:24 +03:00
|
|
|
|
2001-05-24 07:10:49 +04:00
|
|
|
SendSQL("SELECT emailflags FROM profiles WHERE userid = $userid");
|
2001-01-24 23:26:24 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
my ($flagstring) = FetchSQLData();
|
2001-01-24 23:26:24 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# If the emailflags haven't been set before, that means that this user
|
|
|
|
# hasn't been to the email pane of userprefs.cgi since the change to
|
|
|
|
# use emailflags. Create a default flagset for them, based on
|
2001-05-24 07:10:49 +04:00
|
|
|
# static defaults.
|
2002-02-28 03:14:01 +03:00
|
|
|
if (!$flagstring) {
|
|
|
|
$flagstring = $defaultflagstring;
|
|
|
|
SendSQL("UPDATE profiles SET emailflags = " .
|
|
|
|
SqlQuote($flagstring) . " WHERE userid = $userid");
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
2000-03-29 01:31:24 +04:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# The 255 param is here, because without a third param, split will
|
|
|
|
# trim any trailing null fields, which causes Perl to eject lots of
|
|
|
|
# warnings. Any suitably large number would do.
|
|
|
|
my %emailflags = split(/~/, $flagstring, 255);
|
2001-01-24 23:26:24 +03:00
|
|
|
|
2002-03-01 16:59:59 +03:00
|
|
|
# Determine the value of the "excludeself" global email preference.
|
|
|
|
# Note that the value of "excludeself" is assumed to be off if the
|
|
|
|
# preference does not exist in the user's list, unlike other
|
|
|
|
# preferences whose value is assumed to be on if they do not exist.
|
2002-04-01 22:06:20 +04:00
|
|
|
if (exists($emailflags{'ExcludeSelf'})
|
|
|
|
&& $emailflags{'ExcludeSelf'} eq 'on')
|
2002-03-01 16:59:59 +03:00
|
|
|
{
|
|
|
|
$vars->{'excludeself'} = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$vars->{'excludeself'} = 0;
|
|
|
|
}
|
|
|
|
|
2002-09-28 23:12:25 +04:00
|
|
|
foreach my $flag (qw(FlagRequestee FlagRequester)) {
|
2002-09-28 22:42:54 +04:00
|
|
|
$vars->{$flag} =
|
|
|
|
!exists($emailflags{$flag}) || $emailflags{$flag} eq 'on';
|
|
|
|
}
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Parse the info into a hash of hashes; the first hash keyed by role,
|
2002-03-01 16:59:59 +03:00
|
|
|
# the second by reason, and the value being 1 or 0 for (on or off).
|
|
|
|
# Preferences not existing in the user's list are assumed to be on.
|
|
|
|
foreach my $role (@roles) {
|
|
|
|
$vars->{$role} = {};
|
|
|
|
foreach my $reason (@reasons) {
|
|
|
|
my $key = "email$role$reason";
|
|
|
|
if (!exists($emailflags{$key}) || $emailflags{$key} eq 'on') {
|
|
|
|
$vars->{$role}{$reason} = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$vars->{$role}{$reason} = 0;
|
|
|
|
}
|
2001-01-24 23:26:24 +03:00
|
|
|
}
|
2001-04-07 21:09:28 +04:00
|
|
|
}
|
2001-01-24 23:26:24 +03:00
|
|
|
}
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Note: we no longer store "off" values in the database.
|
|
|
|
sub SaveEmail {
|
|
|
|
my $updateString = "";
|
|
|
|
|
|
|
|
if (defined $::FORM{'ExcludeSelf'}) {
|
2001-05-24 07:10:49 +04:00
|
|
|
$updateString .= 'ExcludeSelf~on';
|
2001-01-24 23:26:24 +03:00
|
|
|
} else {
|
2001-05-24 07:10:49 +04:00
|
|
|
$updateString .= 'ExcludeSelf~';
|
|
|
|
}
|
2002-02-28 03:14:01 +03:00
|
|
|
|
2002-09-28 23:14:07 +04:00
|
|
|
foreach my $flag (qw(FlagRequestee FlagRequester)) {
|
2002-09-28 22:42:54 +04:00
|
|
|
$updateString .= "~$flag~" . (defined($::FORM{$flag}) ? "on" : "");
|
|
|
|
}
|
|
|
|
|
2002-03-01 16:20:07 +03:00
|
|
|
foreach my $role (@roles) {
|
|
|
|
foreach my $reason (@reasons) {
|
|
|
|
# Add this preference to the list without giving it a value,
|
|
|
|
# which is the equivalent of setting the value to "off."
|
|
|
|
$updateString .= "~email$role$reason~";
|
|
|
|
|
|
|
|
# If the form field for this preference is defined, then we
|
|
|
|
# know the checkbox was checked, so set the value to "on".
|
|
|
|
$updateString .= "on" if defined $::FORM{"email$role$reason"};
|
2001-05-24 07:10:49 +04:00
|
|
|
}
|
2001-01-24 23:26:24 +03:00
|
|
|
}
|
2002-02-28 03:14:01 +03:00
|
|
|
|
|
|
|
SendSQL("UPDATE profiles SET emailflags = " . SqlQuote($updateString) .
|
|
|
|
" WHERE userid = $userid");
|
|
|
|
|
|
|
|
if (Param("supportwatchers") && exists $::FORM{'watchedusers'}) {
|
|
|
|
# Just in case. Note that this much locking is actually overkill:
|
|
|
|
# we don't really care if anyone reads the watch table. So
|
|
|
|
# some small amount of contention could be gotten rid of by
|
|
|
|
# using user-defined locks rather than table locking.
|
|
|
|
SendSQL("LOCK TABLES watch WRITE, profiles READ");
|
|
|
|
|
|
|
|
# what the db looks like now
|
|
|
|
my $origWatchedUsers = new RelationSet;
|
|
|
|
$origWatchedUsers->mergeFromDB("SELECT watched FROM watch WHERE" .
|
|
|
|
" watcher=$userid");
|
|
|
|
|
|
|
|
# Update the database to look like the form
|
|
|
|
my $newWatchedUsers = new RelationSet($::FORM{'watchedusers'});
|
|
|
|
my @CCDELTAS = $origWatchedUsers->generateSqlDeltas(
|
|
|
|
$newWatchedUsers,
|
|
|
|
"watch",
|
|
|
|
"watcher",
|
|
|
|
$userid,
|
|
|
|
"watched");
|
|
|
|
($CCDELTAS[0] eq "") || SendSQL($CCDELTAS[0]);
|
|
|
|
($CCDELTAS[1] eq "") || SendSQL($CCDELTAS[1]);
|
|
|
|
|
|
|
|
SendSQL("UNLOCK TABLES");
|
2000-03-29 01:31:24 +04:00
|
|
|
}
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
sub DoFooter {
|
2000-01-25 10:54:57 +03:00
|
|
|
SendSQL("SELECT mybugslink FROM profiles " .
|
|
|
|
"WHERE userid = $userid");
|
2002-02-28 03:14:01 +03:00
|
|
|
$vars->{'mybugslink'} = FetchSQLData();
|
|
|
|
|
2000-01-25 10:54:57 +03:00
|
|
|
SendSQL("SELECT name, linkinfooter FROM namedqueries " .
|
|
|
|
"WHERE userid = $userid");
|
2002-02-28 03:14:01 +03:00
|
|
|
|
|
|
|
my @queries;
|
2000-01-25 10:54:57 +03:00
|
|
|
while (MoreSQLData()) {
|
2002-02-28 03:14:01 +03:00
|
|
|
my ($name, $footer) = (FetchSQLData());
|
|
|
|
next if ($name eq $::defaultqueryname);
|
|
|
|
|
|
|
|
push (@queries, { name => $name, footer => $footer });
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
2002-02-28 03:14:01 +03:00
|
|
|
|
|
|
|
$vars->{'queries'} = \@queries;
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub SaveFooter {
|
|
|
|
my %old;
|
|
|
|
SendSQL("SELECT name, linkinfooter FROM namedqueries " .
|
|
|
|
"WHERE userid = $userid");
|
|
|
|
while (MoreSQLData()) {
|
2002-02-28 03:14:01 +03:00
|
|
|
my ($name, $footer) = (FetchSQLData());
|
|
|
|
$old{$name} = $footer;
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
2000-02-05 03:38:15 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
for (my $c = 0; $c < $::FORM{'numqueries'}; $c++) {
|
2000-02-05 03:38:15 +03:00
|
|
|
my $name = $::FORM{"name-$c"};
|
|
|
|
if (exists $old{$name}) {
|
|
|
|
my $new = $::FORM{"query-$c"};
|
2000-01-25 10:54:57 +03:00
|
|
|
if ($new ne $old{$name}) {
|
2002-02-28 03:14:01 +03:00
|
|
|
detaint_natural($new);
|
2000-01-25 10:54:57 +03:00
|
|
|
SendSQL("UPDATE namedqueries SET linkinfooter = $new " .
|
|
|
|
"WHERE userid = $userid " .
|
|
|
|
"AND name = " . SqlQuote($name));
|
|
|
|
}
|
2000-02-05 03:38:15 +03:00
|
|
|
} else {
|
2002-10-06 15:52:37 +04:00
|
|
|
ThrowUserError("missing_query", {queryname => $name});
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
}
|
2002-02-28 03:14:01 +03:00
|
|
|
SendSQL("UPDATE profiles SET mybugslink = " .
|
|
|
|
SqlQuote($::FORM{'mybugslink'}) . " WHERE userid = $userid");
|
2002-05-08 01:28:52 +04:00
|
|
|
|
2003-06-03 13:48:15 +04:00
|
|
|
# Make sure that cached queries in the user object are invalidated
|
|
|
|
# so that the footer is correct
|
|
|
|
my $user = Bugzilla->user;
|
|
|
|
$user->flush_queries_cache();
|
|
|
|
|
|
|
|
# Also need to update showmybugslink
|
|
|
|
$user->{showmybugslink} = $::FORM{'mybugslink'} ? 1 : 0;
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
|
|
|
|
sub DoPermissions {
|
|
|
|
my (@has_bits, @set_bits);
|
|
|
|
|
2002-09-22 21:15:13 +04:00
|
|
|
SendSQL("SELECT DISTINCT name, description FROM groups, user_group_map " .
|
|
|
|
"WHERE user_group_map.group_id = groups.id " .
|
|
|
|
"AND user_id = $::userid " .
|
|
|
|
"AND isbless = 0 " .
|
|
|
|
"ORDER BY name");
|
2000-02-17 08:15:23 +03:00
|
|
|
while (MoreSQLData()) {
|
2002-09-22 21:15:13 +04:00
|
|
|
my ($nam, $desc) = FetchSQLData();
|
|
|
|
push(@has_bits, {"desc" => $desc, "name" => $nam});
|
2000-02-17 08:15:23 +03:00
|
|
|
}
|
2002-09-22 21:15:13 +04:00
|
|
|
my @set_ids = ();
|
|
|
|
SendSQL("SELECT DISTINCT name, description FROM groups " .
|
|
|
|
"ORDER BY name");
|
|
|
|
while (MoreSQLData()) {
|
|
|
|
my ($nam, $desc) = FetchSQLData();
|
|
|
|
if (UserCanBlessGroup($nam)) {
|
|
|
|
push(@set_bits, {"desc" => $desc, "name" => $nam});
|
2000-02-17 08:15:23 +03:00
|
|
|
}
|
|
|
|
}
|
2002-02-28 03:14:01 +03:00
|
|
|
|
|
|
|
$vars->{'has_bits'} = \@has_bits;
|
|
|
|
$vars->{'set_bits'} = \@set_bits;
|
2000-02-17 08:15:23 +03:00
|
|
|
}
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# No SavePermissions() because this panel has no changeable fields.
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
###############################################################################
|
|
|
|
# Live code (not subroutine definitions) starts here
|
|
|
|
###############################################################################
|
2002-06-17 13:39:00 +04:00
|
|
|
|
|
|
|
ConnectToDatabase();
|
2000-01-25 10:54:57 +03:00
|
|
|
confirm_login();
|
|
|
|
|
|
|
|
GetVersionTable();
|
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
my $cgi = Bugzilla->cgi;
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
$vars->{'login'} = $::COOKIE{'Bugzilla_login'};
|
|
|
|
$vars->{'changes_saved'} = $::FORM{'dosave'};
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
my $current_tab_name = $::FORM{'tab'} || "account";
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-08-13 10:54:38 +04:00
|
|
|
# The SWITCH below makes sure that this is valid
|
|
|
|
trick_taint($current_tab_name);
|
|
|
|
|
2002-04-25 02:21:59 +04:00
|
|
|
$vars->{'current_tab_name'} = $current_tab_name;
|
2000-01-25 10:54:57 +03:00
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Do any saving, and then display the current tab.
|
|
|
|
SWITCH: for ($current_tab_name) {
|
|
|
|
/^account$/ && do {
|
|
|
|
SaveAccount() if $::FORM{'dosave'};
|
|
|
|
DoAccount();
|
|
|
|
last SWITCH;
|
|
|
|
};
|
|
|
|
/^email$/ && do {
|
|
|
|
SaveEmail() if $::FORM{'dosave'};
|
|
|
|
DoEmail();
|
|
|
|
last SWITCH;
|
|
|
|
};
|
|
|
|
/^footer$/ && do {
|
|
|
|
SaveFooter() if $::FORM{'dosave'};
|
|
|
|
DoFooter();
|
|
|
|
last SWITCH;
|
|
|
|
};
|
|
|
|
/^permissions$/ && do {
|
|
|
|
DoPermissions();
|
|
|
|
last SWITCH;
|
|
|
|
};
|
2003-04-02 16:35:07 +04:00
|
|
|
ThrowUserError("unknown_tab",
|
|
|
|
{ current_tab_name => $current_tab_name });
|
2000-01-25 10:54:57 +03:00
|
|
|
}
|
|
|
|
|
2002-02-28 03:14:01 +03:00
|
|
|
# Generate and return the UI (HTML page) from the appropriate template.
|
2003-05-05 05:15:38 +04:00
|
|
|
print $cgi->header();
|
2002-04-24 11:24:50 +04:00
|
|
|
$template->process("account/prefs/prefs.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
2000-01-25 10:54:57 +03:00
|
|
|
|