You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.8 KiB

#!/usr/bin/perl
#
# $Id: regcnd.pl,v 1.8 2006/10/19 17:35:29 psims Exp $
#
# Source File: regcnd.pl
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
&app_initialize;
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
if ($FORM{'lang'} eq "") { $FORM{'lang'} = $SESSION{'lang'}; }
if ($FORM{'dbop'} eq 'logout') {
$indextemplate = ($SESSION{'clid'} eq 'std') ? "shome" : "cindex";
if ($SESSION{'clid'} ne 'std') {&get_client_profile($SESSION{'clid'});}
print "Content-Type: text/html\n\n";
&show_template("$indextemplate");
} elsif ($FORM{'dbop'} eq 'save') {
$FORM{'uid'} = $SESSION{'uid'};
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'});
foreach (keys %CANDIDATE) {
if (!( defined($FORM{$_}) )) {
$FORM{$_} = $CANDIDATE{$_};
}
if ($CLIENT{'savechange'} eq "N") {
$FORM{$_} = $CANDIDATE{$_} unless $_ eq 'pwd';
}
if ($_ eq 'pwd') {
if ($FORM{'oldpwdval'} ne $CANDIDATE{'pwd'} && $FORM{'oldpwdval'} ne '') {
$errmess = "$xlatphrase[888]";
$direction = "password";
$FORM{$_} = $CANDIDATE{$_};
} else {
$errmess = "$xlatphrase[879]" unless $FORM{'oldpwdval'} eq '';
}
}
}
if ($FORM{'eml'} ne $CANDIDATE{'eml'}) {
$continue_eml_tests = 1;
&get_client_profile($SESSION{'clid'});
if ( ($CLIENT{'emlacl'} eq "Y") && ($continue_eml_tests == 1) ){
my @tempacl = &popEmlAcl($CLIENT{'clid'});
if ($CLIENT{'emlacllst'} eq "B") {
foreach (@tempacl) {
if ($FORM{'eml'} =~ /$_/g) {
$FORM{'eml'} = $CANDIDATE{'eml'};
$continue_eml_tests = 0;
$errmess = $xlatphrase[903];
}
}
}
if ($CLIENT{'emlacllst'} eq "W") {
foreach (@tempacl) {
$tempemlacltest .= $_;
}
$tmpemladr = $FORM{'eml'};
$tmpemladr =~ s/@/ /g;
$tmpemladr =~ /\w+\.\w+$/g;
$tmpemladr = $&;
if ( !($tempemlacltest =~ /$tmpemladr/) ) {
$FORM{'eml'} = $CANDIDATE{'eml'};
$continue_eml_tests = 0;
$errmess = $xlatphrase[903];
}
}
}
if ( ($CLIENT{'emlstrict'} eq "Y") && ($continue_eml_tests == 1) ) {
my $clid = $SESSION{'clid'};
my @cndcols = &get_data("cnd.$SESSION{'clid'}");
my @duplicates = grep(/$FORM{'eml'}/, @cndcols);
foreach (@duplicates) {
$errmess = $xlatphrase[904];
$continue_eml_tests = 0;
$FORM{'eml'} = $CANDIDATE{'eml'};
}
}
}
&put_candidate_profile($SESSION{'clid'}, $SESSION{'uid'}, $SESSION{'uac'});
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'});
#&show_template("regcnd");
if ($CANDIDATE{'badid'} eq "$xlatphrase[758]") {
#print "Content-Type: text/html\n\n";
&show_template("regsas");
} else {
$vars{'home'} = "client";
$vars{'lang'} = "$FORM{'lang'}";
$vars{'uid'} = "$FORM{'uid'}";
$vars{'pwd'} = "$FORM{'pwd'}";
$vars{'clid'} = "$SESSION{'clid'}";
$vars{'cnd'} = "Login";
$vars{'badid'} = "$errmess";
$vars{'direction'} = $direction unless $direction eq '';
&redirect("login", \%vars);
}
} elsif ($FORM{'dbop'} eq 'resend') {
if ( $SESSION{'clid'} ) {&get_client_profile($SESSION{'clid'});} ;
&resend_exit_emails($SESSION{'clid'}, $SESSION{'uid'}, $FORM{'tstid'});
$vars{'tid'} = $SESSION{'tid'};
$vars{'lang'} = $SESSION{'lang'};
$vars{'testid'} = $FORM{'testid'} if ($FORM{'testid'}) ;
&redirect("regcnd", \%vars);
} else {
&get_client_profile($SESSION{'clid'});
my $opts = { restrict_to_availability_window => 1 };
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'}, $opts);
print "Content-Type: text/html\n\n";
&show_template("regcnd");
}
}