This commit is contained in:
Matthew Raymer
2024-07-21 09:09:40 +00:00
parent 729333d4f5
commit dc3bd7f715
10072 changed files with 2703 additions and 2707 deletions

View File

@@ -11,215 +11,220 @@ require 'testlib.pl';
&traceoutput("login.pl"); # TRACE IF ACTIVE
&app_initialize;
$SESSION{'temptime'} = time();
$SESSION{'temptime'} = time();
$SESSION{'clid'} = $FORM{'clid'};
$SESSION{'lang'} = $FORM{'lang'};
&get_client_configuration();
&traceoutput("login.pl:$FORM{'clid'}:$FORM{'uid'}:$FORM{'pwd'}"); # TRACE IF ACTIVE
&setbrowsertype();
## DED Patch for secure_html/tests dir permission problem 2006/10/11
if (! -x $testroot) {
print STDERR "PERMS: $testroot is not X\n";
chmod(0777, $testroot);
print STDERR "PERMS: $testroot is not X\n";
chmod(0777, $testroot);
}
if ($FORM{'selfregister'} eq "Y") {
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Form $FORM{'clid'} " ;
&show_illegal_access_warning("user");
exit();
}
&get_client_profile($SESSION{'clid'});
unless (%CLIENT) {
warn "ERROR: Invalid Client ID $FORM{'clid'} " ;
&show_illegal_access_warning("user");
exit();
}
$CANDIDATE{'new'}="Y";
print "Content-Type: text/html\n\n";
&show_template("regsas");
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Form $FORM{'clid'} " ;
print STDERR "ERROR: Empty Client ID in Form $FORM{'clid'} " ;
# &show_illegal_access_warning("user");
exit();
}
&get_client_profile($SESSION{'clid'});
unless (%CLIENT) {
warn "ERROR: Invalid Client ID $FORM{'clid'} " ;
print STDERR "ERROR: Invalid Client ID $FORM{'clid'} " ;
# &show_illegal_access_warning("user");
exit();
}
$CANDIDATE{'new'}="Y";
print "Content-Type: text/html\n\n";
&show_template("regsas");
} elsif (&verifyaccess) {
&init_session;
&LanguageSupportInit();
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "1");
$FORM{'notice'} = $SYSTEM{'message'};
&init_session;
&LanguageSupportInit();
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "1");
$FORM{'notice'} = $SYSTEM{'message'};
### For redirect to regcnd & regsas
$vars{'tid'} = $SESSION{'tid'};
$vars{'lang'} = $SESSION{'lang'};
$vars{'testid'} = $FORM{'testid'} if ($FORM{'testid'}) ;
$vars{'badid'} = $FORM{'badid'} unless !(defined($FORM{'badid'})); #This is used if badid is passed from regsas for autorefresh location trick
$vars{'direction'} = $FORM{'direction'} unless !(defined($FORM{'direction'}));
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Form $FORM{'clid'} " ;
&show_illegal_access_warning("user");
exit();
}
&get_client_profile($SESSION{'clid'});
unless (%CLIENT || $SESSION{'clid'} eq 'std') {
warn "ERROR: Invalid Client ID $FORM{'clid'} " ;
&show_illegal_access_warning("user");
exit();
}
if ($SESSION{'taclid'} ne '') {
print "Content-Type: text/html\n\n";
my $opts = { restrict_to_availability_window => 1 };
&set_session($SESSION{'tid'},'taclauthtests',$SESSION{'taclauthtests'});
&set_session($SESSION{'tid'},'uid',$SESSION{'taclid'});
if ($FORM{'pwd'} eq '_____') {
&get_tacl_profile("regauto");
&regdusr("regauto");
} else {
&get_tacl_profile();
&regdusr("regtacl");
}
} elsif ($FORM{'sas'} ne '') {
## ^ support for wilcard login
# register an account to the candidate
my $opts = { restrict_to_availability_window => 1 };
unless ($SESSION{'uid'}) {
warn "ERROR: Empty Candidate ID in Session data " ;
}
&get_candidate_profile($SESSION{'clid'}, $SESSION{'uid'}, $opts);
#&regdusr("regsas");
&redirect("regsas", \%vars);
} else {
if ($FORM{'sadm'} ne '') {
print "Content-Type: text/html\n\n";
if ($SESSION{'uac'} eq 'gadmin') {
# Site administration
$CLIENT{'active'} = "X";
$CLIENT{'logo'} = "<IMG SRC=\"$PATHS{'graphroot'}/logo.gif\" BORDER=0>\n";
$CLIENT{'clorg'} = "ACTS Corporation";
&regdusr("frsadmin");
} elsif ($SESSION{'uac'} =~ /txlatr./ ) {
($FORM{'uac'},$FORM{'lang'}) = split(/\./, $SESSION{'uac'});
$CLIENT{'active'} = "X";
$CLIENT{'logo'} = "<IMG SRC=\"$PATHS{'graphroot'}/logo.gif\" BORDER=0>\n";
$CLIENT{'clorg'} = "ACTS Corporation";
print "<HTML>\n";
print "<HEAD>\n";
print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=$PATHS{'cgiroot'}/Interpreter.pl?tid=$SESSION{'tid'}&lang=$FORM{'lang'}\">\n";
print "</HEAD>\n";
print "<BODY>\n";
print "</BODY>\n";
print "</HTML>\n";
} elsif ($SESSION{'uac'} eq 'madmin') {
# Multiple-client admin
&regdusr("madmin");
} else {
# Client Test Administration
&get_client_profile($SESSION{'clid'});
&regdusr("frsadmin");
}
} else {
if ($FORM{'tadm'} ne '') {
print "Content-Type: text/html\n\n";
if ($SESSION{'uac'} eq 'madmin') {
# Multiple-client admin
&regdusr("madmin");
} else {
# Client Test Administration
&get_client_profile($SESSION{'clid'});
&regdusr("frsadmin");
}
} else {
if (&checkinprogress($SESSION{'clid'}, $FORM{'uid'}) ) {
# resume test at point of pause
&resumetest;
} else {
if ($FORM{'cnd'} ne '') {
&get_client_profile($SESSION{'clid'});
my $opts = { restrict_to_availability_window => 1 };
&get_candidate_profile($SESSION{'clid'}, $FORM{'uid'}, $opts);
#print STDERR "clid: $SESSION{'clid'}, uid: $FORM{'uid'}, opts: $opts\n";
if ($CANDIDATE{'grpowner'} eq 'Y') {
print "Content-Type: text/html\n\n";
&show_template("frcnd");
} elsif ($CANDIDATE{'registrar'} eq 'Y') {
print "Content-Type: text/html\n\n";
&show_template("frcnd");
} else {
&redirect("regcnd", \%vars);
}
} else {
&get_candidate_profile($SESSION{'clid'}, $FORM{'uid'});
#&regdusr("regsas");
&redirect("regsas", \%vars);
}
}
}
}
}
} else {
# Load Index.html
### For redirect to regcnd & regsas
$vars{'tid'} = $SESSION{'tid'};
$vars{'lang'} = $SESSION{'lang'};
$vars{'testid'} = $FORM{'testid'} if ($FORM{'testid'}) ;
$vars{'badid'} = $FORM{'badid'} unless !(defined($FORM{'badid'})); #This is used if badid is passed from regsas for autorefresh location trick
$vars{'direction'} = $FORM{'direction'} unless !(defined($FORM{'direction'}));
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Form $FORM{'clid'} " ;
print STDERR "ERROR: Empty Client ID in Form $FORM{'clid'} " ;
# &show_illegal_access_warning("user");
exit();
}
&get_client_profile($SESSION{'clid'});
unless (%CLIENT || $SESSION{'clid'} eq 'std') {
warn "ERROR: Invalid Client ID $FORM{'clid'} " ;
print STDERR "ERROR: Invalid Client ID $FORM{'clid'} " ;
# &show_illegal_access_warning("user");
exit();
}
if ($SESSION{'taclid'} ne '') {
print "Content-Type: text/html\n\n";
if ($FORM{'home'} eq 'client') {
&get_client_profile($FORM{'clid'});
@lines = &get_template("cindex");
my $opts = { restrict_to_availability_window => 1 };
&set_session($SESSION{'tid'},'taclauthtests',$SESSION{'taclauthtests'});
&set_session($SESSION{'tid'},'uid',$SESSION{'taclid'});
if ($FORM{'pwd'} eq '_____') {
&get_tacl_profile("regauto");
&regdusr("regauto");
} else {
@lines = &get_template("shome");
&get_tacl_profile();
&regdusr("regtacl");
}
if ($ipfilter ne '') {
if ($ipfilter =~ /$ENV{'REMOTE_ADDR'}/ ) {
# ip blocked
if ($FORM{'sas'} eq '') {
# uid or password were incorrect
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgbpw.gif\" ALT=\"System Maintenance In Progress.\" BORDER=0>";
} else {
# uid is used
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgidu.gif\" ALT=\"Requested Login ID is not available.\" BORDER=0>";
}
} else {
&logger::loginfo("Incorrect passwd 4");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgipb.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
}
} elsif ($FORM{'sas'} ne '') {
## ^ support for wilcard login
# register an account to the candidate
my $opts = { restrict_to_availability_window => 1 };
unless ($SESSION{'uid'}) {
warn "ERROR: Empty Candidate ID in Session data " ;
}
&get_candidate_profile($SESSION{'clid'}, $SESSION{'uid'}, $opts);
#&regdusr("regsas");
&redirect("regsas", \%vars);
} else {
if ($FORM{'sadm'} ne '') {
print "Content-Type: text/html\n\n";
if ($SESSION{'uac'} eq 'gadmin') {
# Site administration
$CLIENT{'active'} = "X";
$CLIENT{'logo'} = "<IMG SRC=\"$PATHS{'graphroot'}/logo.gif\" BORDER=0>\n";
$CLIENT{'clorg'} = "ACTS Corporation";
&regdusr("frsadmin");
} elsif ($SESSION{'uac'} =~ /txlatr./ ) {
($FORM{'uac'},$FORM{'lang'}) = split(/\./, $SESSION{'uac'});
$CLIENT{'active'} = "X";
$CLIENT{'logo'} = "<IMG SRC=\"$PATHS{'graphroot'}/logo.gif\" BORDER=0>\n";
$CLIENT{'clorg'} = "ACTS Corporation";
print "<HTML>\n";
print "<HEAD>\n";
print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=$PATHS{'cgiroot'}/Interpreter.pl?tid=$SESSION{'tid'}&lang=$FORM{'lang'}\">\n";
print "</HEAD>\n";
print "<BODY>\n";
print "</BODY>\n";
print "</HTML>\n";
} elsif ($SESSION{'uac'} eq 'madmin') {
# Multiple-client admin
&regdusr("madmin");
} else {
# Client Test Administration
&get_client_profile($SESSION{'clid'});
&regdusr("frsadmin");
}
} else {
if ($SYSTEM{'IP_ACCESS_FILTER'} ne '') {
if ($SYSTEM{'IP_ACCESS_FILTER'} =~ /$ENV{'REMOTE_ADDR'}/ ) {
if ($FORM{'sas'} eq '') {
# uid or password were incorrect
&logger::loginfo("Incorrect passwd 3");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgbpw.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
} else {
# uid is used
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgidu.gif\" ALT=\"Requested Login ID is not available.\" BORDER=0>";
}
} else {
&logger::loginfo("Incorrect passwd 2");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgipb.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
}
if ($FORM{'tadm'} ne '') {
print "Content-Type: text/html\n\n";
if ($SESSION{'uac'} eq 'madmin') {
# Multiple-client admin
&regdusr("madmin");
} else {
if ($FORM{'sas'} eq '') {
# uid or password were incorrect
&logger::loginfo("Incorrect passwd 1");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgbpw.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
} else {
# uid is used
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgidu.gif\" ALT=\"Requested Login ID is not available.\" BORDER=0>";
}
# Client Test Administration
&get_client_profile($SESSION{'clid'});
&regdusr("frsadmin");
}
} else {
if (&checkinprogress($SESSION{'clid'}, $FORM{'uid'}) ) {
# resume test at point of pause
&resumetest;
} else {
if ($FORM{'cnd'} ne '') {
&get_client_profile($SESSION{'clid'});
my $opts = { restrict_to_availability_window => 1 };
&get_candidate_profile($SESSION{'clid'}, $FORM{'uid'}, $opts);
#print STDERR "clid: $SESSION{'clid'}, uid: $FORM{'uid'}, opts: $opts\n";
if ($CANDIDATE{'grpowner'} eq 'Y') {
print "Content-Type: text/html\n\n";
&show_template("frcnd");
} elsif ($CANDIDATE{'registrar'} eq 'Y') {
print "Content-Type: text/html\n\n";
&show_template("frcnd");
} else {
&redirect("regcnd", \%vars);
}
} else {
&get_candidate_profile($SESSION{'clid'}, $FORM{'uid'});
#&regdusr("regsas");
&redirect("regsas", \%vars);
}
}
}
}
foreach $line (@lines) {
$line = &xlatline($line);
}
} else {
# Load Index.html
print "Content-Type: text/html\n\n";
if ($FORM{'home'} eq 'client') {
&get_client_profile($FORM{'clid'});
@lines = &get_template("cindex");
} else {
@lines = &get_template("shome");
}
if ($ipfilter ne '') {
if ($ipfilter =~ /$ENV{'REMOTE_ADDR'}/ ) {
# ip blocked
if ($FORM{'sas'} eq '') {
# uid or password were incorrect
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgbpw.gif\" ALT=\"System Maintenance In Progress.\" BORDER=0>";
} else {
# uid is used
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgidu.gif\" ALT=\"Requested Login ID is not available.\" BORDER=0>";
}
} else {
&logger::loginfo("Incorrect passwd 4");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgipb.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
}
} else {
if ($SYSTEM{'IP_ACCESS_FILTER'} ne '') {
if ($SYSTEM{'IP_ACCESS_FILTER'} =~ /$ENV{'REMOTE_ADDR'}/ ) {
if ($FORM{'sas'} eq '') {
# uid or password were incorrect
&logger::loginfo("Incorrect passwd 3");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgbpw.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
} else {
# uid is used
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgidu.gif\" ALT=\"Requested Login ID is not available.\" BORDER=0>";
}
} else {
&logger::loginfo("Incorrect passwd 2");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgipb.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
}
} else {
if ($FORM{'sas'} eq '') {
# uid or password were incorrect
&logger::loginfo("Incorrect passwd 1");
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgbpw.gif\" ALT=\"Incorrect Password.\" BORDER=0>";
} else {
# uid is used
$SYSTEM{'message'} = "<IMG SRC=\"$graphroot/msgidu.gif\" ALT=\"Requested Login ID is not available.\" BORDER=0>";
}
}
}
foreach $line (@lines) {
$line = &xlatline($line);
}
}
sub resumetest {
print "RESUMING TEST<BR>\n";
print "<INPUT TYPE=TEXT NAME=\"tid\" VALUE=\"$FORM{'tid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uid\" VALUE=\"$FORM{'uid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"pwd\" VALUE=\"$FORM{'pwd'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uac\" VALUE=\"$FORM{'uac'}\"><BR>\n";
print "RESUMING TEST<BR>\n";
print "<INPUT TYPE=TEXT NAME=\"tid\" VALUE=\"$FORM{'tid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uid\" VALUE=\"$FORM{'uid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"pwd\" VALUE=\"$FORM{'pwd'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uac\" VALUE=\"$FORM{'uac'}\"><BR>\n";
}
sub test {
print "<INPUT TYPE=TEXT NAME=\"tid\" VALUE=\"$FORM{'tid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uid\" VALUE=\"$FORM{'uid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"pwd\" VALUE=\"$FORM{'pwd'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uac\" VALUE=\"$FORM{'uac'}\"><BR>\n";
&showenv;
print "<INPUT TYPE=TEXT NAME=\"tid\" VALUE=\"$FORM{'tid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uid\" VALUE=\"$FORM{'uid'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"pwd\" VALUE=\"$FORM{'pwd'}\"><BR>\n";
print "<INPUT TYPE=TEXT NAME=\"uac\" VALUE=\"$FORM{'uac'}\"><BR>\n";
&showenv;
}

View File

@@ -4,7 +4,15 @@
#
# Source File: sadmin.pl
#use strict;
use warnings;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
#warningsToBrowser(1);
#fatalsToBrowser(1);
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
@@ -12,120 +20,121 @@ require 'testlib.pl';
print "Content-Type: text/html\n\n";
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Session data for Session ID $FORM{'tid'} " ;
&show_illegal_access_warning("user");
exit();
}
if ($SESSION{'clid'} ne 'std') {
&get_client_profile($SESSION{'clid'});
unless (%CLIENT) {
warn "ERROR: Invalid Client ID $SESSION{'clid'} in Session ID $FORM{'tid'} " ;
&show_illegal_access_warning("user");
exit();
#print $logroot;
my $tid = $FORM{'tid'};
if (&get_session($tid)) {
&LanguageSupportInit();
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Session data for Session ID $FORM{'tid'} " ;
#&show_illegal_access_warning("user");
exit();
}
if ($SESSION{'clid'} ne 'std') {
&get_client_profile($SESSION{'clid'});
unless (%CLIENT) {
warn "ERROR: Invalid Client ID $SESSION{'clid'} in Session ID $FORM{'tid'} " ;
#&show_illegal_access_warning("user");
exit();
}
if ($SESSION{'uac'} eq 'admin' || $SESSION{'uac'} eq 'madmin') {
$FORM{'pageid'} = "Group";
$FORM{'PAGEID'} = "GROUP";
$mainttmplt = "frgrpadmin";
} else {
&get_candidate_profile($SESSION{'clid'}, $SESSION{'uid'});
unless (%CANDIDATE) {
if ($SESSION{'uac'} eq 'admin' || $SESSION{'uac'} eq 'madmin') {
$FORM{'pageid'} = "Group";
$FORM{'PAGEID'} = "GROUP";
$mainttmplt = "frgrpadmin";
} else {
&get_candidate_profile($SESSION{'clid'}, $SESSION{'uid'});
unless (%CANDIDATE) {
warn "ERROR: Invalid Candidate ID $SESSION{'uid'} for Client $SESSION{'clid'} in Session ID $FORM{'tid'} " ;
&show_illegal_access_warning("user");
#&show_illegal_access_warning("user");
exit();
}
$FORM{'pageid'} = "Gradebook";
$FORM{'PAGEID'} = "GRADEBOOK";
$mainttmplt = "frgradebooks";
}
}
$FORM{'pageid'} = "Gradebook";
$FORM{'PAGEID'} = "GRADEBOOK";
$mainttmplt = "frgradebooks";
}
}
my @tempacl = &popEmlAcl($SESSION{'clid'});
foreach (@tempacl) {
$CLIENT{'emlaclstr'} .= "$_,";
my @tempacl = &popEmlAcl($SESSION{'clid'});
foreach (@tempacl) {
$CLIENT{'emlaclstr'} .= "$_,";
}
$CLIENT{'emlaclstr'} =~ s/@//g;
$CLIENT{'emlaclstr'} =~ s/,$//g;
if ($FORM{'idx'} eq '1') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/I");
if ($SESSION{'uac'} eq 'admin' || $SESSION{'uac'} eq 'gadmin' || $SESSION{'uac'} eq 'madmin') {
&show_template("sadminidx");
} else {
&show_template("cndidx");
}
$CLIENT{'emlaclstr'} =~ s/@//g;
$CLIENT{'emlaclstr'} =~ s/,$//g;
if ($FORM{'idx'} eq '1') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/I");
if ($SESSION{'uac'} eq 'admin' || $SESSION{'uac'} eq 'gadmin' || $SESSION{'uac'} eq 'madmin') {
&show_template("sadminidx");
} else {
&show_template("cndidx");
}
} elsif ($FORM{'dtl'} eq '0') {
print "<HTML>\n$xlatphrase[539]<BR>$xlatphrase[540]</HTML>\n";
} elsif ($FORM{'dtl'} eq '1') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CM");
if ($SESSION{'uac'} eq 'gadmin') {
&show_admin_request("maintclient");
} else {
$FORM{'dbop'} = 'ccupd';
&show_admin_request("cdef");
}
} elsif ($FORM{'dtl'} eq '12') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TR");
&show_admin_request("treplicaframe");
} elsif ($FORM{'dtl'} eq '13') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TO");
&show_admin_request("tocrinpframe");
} elsif ($FORM{'dtl'} eq '2') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TM");
$TEST{'id'} = $FORM{'tstid'};
&show_admin_request("tdefframe");
} elsif ($FORM{'dtl'} eq '21') {
if ($SESSION{'uac'} eq 'cnd') {
$CANDIDATE{'ownedtests'} = &get_group_tests($SESSION{'clid'}, $SESSION{'uid'}, 0);
}
&show_admin_request("mainttest");
} elsif ($FORM{'dtl'} eq '99') {
&show_template("selectpg");
} elsif ($FORM{'dtl'} eq '3') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/R");
&show_admin_request("maintreport");
} elsif ($FORM{'dtl'} eq '4') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/DL");
&show_admin_downloads;
} elsif ($FORM{'dtl'} eq '5') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/DB");
&show_admin_request("maintdb");
} elsif ($FORM{'dtl'} eq '6') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CF");
# set FORM.colors
$trash = join( $pathsep, $dataroot, "config.$SESSION{'clid'}");
$omsg = "";
open( CFGFILE, "<$trash" ) or $omsg="not found";
if ($omsg eq 'not found') {
$trash = join( $pathsep, $dataroot, "config.std");
open( CFGFILE, "<$trash" ) or return;
}
@cfgentries = <CFGFILE>;
close CFGFILE;
$langdef = "enu";
$FORM{'colors'} = "";
for (0 .. $#cfgentries) {
chop ($cfgentries[$_]);
($entrykey,$entryvalue) = split(/=/, $cfgentries[$_]);
if ($entrykey eq 'DEFAULTLANG') {
$langdef = $entryvalue;
$langselfr = ($langdef eq 'fr') ? " SELECTED" : "";
$langselsp = ($langdef eq 'sp') ? " SELECTED" : "";
$langseldeu = ($langdef eq 'deu') ? " SELECTED" : "";
$langselenu = ($langdef eq 'enu') ? " SELECTED" : "";
$langselena = ($langdef eq 'ena') ? " SELECTED" : "";
$langseleuv = ($langdef eq 'euv') ? " SELECTED" : "";
$langselcyr = ($langdef eq 'cyr') ? " SELECTED" : "";
$langselmy = ($langdef eq 'my') ? " SELECTED" : "";
$langselkor = ($langdef eq 'kor') ? " SELECTED" : "";
$langselafr = ($langdef eq 'afr') ? " SELECTED" : "";
$langselhin = ($langdef eq 'hin') ? " SELECTED" : "";
$colortag = "<TR>
} elsif ($FORM{'dtl'} eq '0') {
print "<HTML>\n$xlatphrase[539]<BR>$xlatphrase[540]</HTML>\n";
} elsif ($FORM{'dtl'} eq '1') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CM");
if ($SESSION{'uac'} eq 'gadmin') {
&show_admin_request("maintclient");
} else {
$FORM{'dbop'} = 'ccupd';
&show_admin_request("cdef");
}
} elsif ($FORM{'dtl'} eq '12') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TR");
&show_admin_request("treplicaframe");
} elsif ($FORM{'dtl'} eq '13') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TO");
&show_admin_request("tocrinpframe");
} elsif ($FORM{'dtl'} eq '2') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/TM");
$TEST{'id'} = $FORM{'tstid'};
&show_admin_request("tdefframe");
} elsif ($FORM{'dtl'} eq '21') {
if ($SESSION{'uac'} eq 'cnd') {
$CANDIDATE{'ownedtests'} = &get_group_tests($SESSION{'clid'}, $SESSION{'uid'}, 0);
}
&show_admin_request("mainttest");
} elsif ($FORM{'dtl'} eq '99') {
&show_template("selectpg");
} elsif ($FORM{'dtl'} eq '3') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/R");
&show_admin_request("maintreport");
} elsif ($FORM{'dtl'} eq '4') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/DL");
&show_admin_downloads;
} elsif ($FORM{'dtl'} eq '5') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/DB");
&show_admin_request("maintdb");
} elsif ($FORM{'dtl'} eq '6') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CF");
# set FORM.colors
$trash = join( $pathsep, $dataroot, "config.$SESSION{'clid'}");
$omsg = "";
open( CFGFILE, "<$trash" ) or $omsg="not found";
if ($omsg eq 'not found') {
$trash = join( $pathsep, $dataroot, "config.std");
open( CFGFILE, "<$trash" ) or return;
}
@cfgentries = <CFGFILE>;
close CFGFILE;
$langdef = "enu";
$FORM{'colors'} = "";
for (0 .. $#cfgentries) {
chop ($cfgentries[$_]);
($entrykey,$entryvalue) = split(/=/, $cfgentries[$_]);
if ($entrykey eq 'DEFAULTLANG') {
$langdef = $entryvalue;
$langselfr = ($langdef eq 'fr') ? " SELECTED" : "";
$langselsp = ($langdef eq 'sp') ? " SELECTED" : "";
$langseldeu = ($langdef eq 'deu') ? " SELECTED" : "";
$langselenu = ($langdef eq 'enu') ? " SELECTED" : "";
$langselena = ($langdef eq 'ena') ? " SELECTED" : "";
$langseleuv = ($langdef eq 'euv') ? " SELECTED" : "";
$langselcyr = ($langdef eq 'cyr') ? " SELECTED" : "";
$langselmy = ($langdef eq 'my') ? " SELECTED" : "";
$langselkor = ($langdef eq 'kor') ? " SELECTED" : "";
$langselafr = ($langdef eq 'afr') ? " SELECTED" : "";
$langselhin = ($langdef eq 'hin') ? " SELECTED" : "";
$colortag = "<TR>
<TD align=right>
$xlatphrase[541]\&nbsp\;
</TD>
@@ -145,9 +154,9 @@ if (&get_session($FORM{'tid'})) {
</SELECT>
</TD>
</TR>\n";
$FORM{'language'} = join('', $colortag, $FORM{'language'});
} elsif ($entrykey eq 'IP_ACCESS_FILTER') {
$FORM{'language'} = " <TR>
$FORM{'language'} = join('', $colortag, $FORM{'language'});
} elsif ($entrykey eq 'IP_ACCESS_FILTER') {
$FORM{'language'} = " <TR>
<TD align=right width=50\%>
$xlatphrase[385]\&nbsp\;
</TD>
@@ -155,63 +164,63 @@ if (&get_session($FORM{'tid'})) {
<INPUT TYPE=TEXT NAME=\"C$entrykey\" VALUE=\"$entryvalue\" onChange=\"reset_autotimer()\">
</TD>
</TR>\n";
} else {
if ($entrykey eq 'BACKGROUND') {
$colortag = " <TR>
} else {
if ($entrykey eq 'BACKGROUND') {
$colortag = " <TR>
<TD align=right><font size=1>$entrykey:\&nbsp\;</font></TD>
<TD align=left><INPUT TYPE=FILE NAME=\"C$entrykey\" VALUE=\"$entryvalue\" onChange=\"reset_autotimer()\"></TD>
</TR>\n";
} else {
if (($entrykey =~ /COLOR/)
|| ($entrykey =~ 'LINK')
|| ($entrykey =~ 'ALINK')
|| ($entrykey =~ 'VLINK')
|| ($entrykey eq 'TEXT') ) {
$gotfocus = "onFocus=\"return tGotFocus(this)\"";
} else {
$gotfocus = "";
}
$colortag = " <TR>
} else {
if (($entrykey =~ /COLOR/)
|| ($entrykey =~ 'LINK')
|| ($entrykey =~ 'ALINK')
|| ($entrykey =~ 'VLINK')
|| ($entrykey eq 'TEXT') ) {
$gotfocus = "onFocus=\"return tGotFocus(this)\"";
} else {
$gotfocus = "";
}
$colortag = " <TR>
<TD align=right nowrap><font size=1>$entrykey:\&nbsp\;</font></TD>
<TD align=left><INPUT TYPE=TEXT NAME=\"C$entrykey\" SIZE=8 MAXLENGTH=7 VALUE=\"$entryvalue\" $gotfocus onChange=\"reset_autotimer()\"></TD>
</TR>\n";
}
$FORM{'colors'} = join('', $FORM{'colors'}, $colortag);
}
}
&show_admin_request("maintcfg");
} elsif ($FORM{'dtl'} eq '7') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/GP");
&show_admin_request($mainttmplt);
} elsif ($FORM{'dtl'} eq '8') {
#Begin filtering
$filterbydate = $FORM{'filterbydate'};
$day_filter = $FORM{'day_filter'};
$date_filter = $FORM{'date_filter'};
$cnd1_filter = $FORM{'cnd1'};
$cnd2_filter = $FORM{'cnd2'};
$cnd3_filter = $FORM{'cnd3'};
$cnd4_filter = $FORM{'cnd4'};
#End filtering
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CC");
&show_admin_request("maintcnd");
} elsif ($FORM{'dtl'} eq '9') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/RG");
&show_admin_request("regcnd");
} elsif ($FORM{'dtl'} eq '10') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/IM");
&show_admin_request("upimport");
} elsif ($FORM{'dtl'} eq '11') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/LC");
&show_admin_request("frlicadmin");
} elsif ($FORM{'dbop'} ne '') {
&show_dbop_response;
} else {
&show_illegal_access_warning;
$FORM{'colors'} = join('', $FORM{'colors'}, $colortag);
}
}
&show_admin_request("maintcfg");
} elsif ($FORM{'dtl'} eq '7') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/GP");
&show_admin_request($mainttmplt);
} elsif ($FORM{'dtl'} eq '8') {
#Begin filtering
$filterbydate = $FORM{'filterbydate'};
$day_filter = $FORM{'day_filter'};
$date_filter = $FORM{'date_filter'};
$cnd1_filter = $FORM{'cnd1'};
$cnd2_filter = $FORM{'cnd2'};
$cnd3_filter = $FORM{'cnd3'};
$cnd4_filter = $FORM{'cnd4'};
#End filtering
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/CC");
&show_admin_request("maintcnd");
} elsif ($FORM{'dtl'} eq '9') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/RG");
&show_admin_request("regcnd");
} elsif ($FORM{'dtl'} eq '10') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/IM");
&show_admin_request("upimport");
} elsif ($FORM{'dtl'} eq '11') {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "SA/LC");
&show_admin_request("frlicadmin");
} elsif ($FORM{'dbop'} ne '') {
&show_dbop_response;
} else {
#&show_illegal_access_warning("else1");
}
} else {
&logger::logerr("Unable to get session with &get_session($FORM{'tid'})");
&show_illegal_access_warning;
&logger::logerr("Unable to get session with &get_session($FORM{'tid'})");
&show_illegal_access_warning("else2");
}
sub show_license_request {
@@ -479,5 +488,5 @@ window.onmouseup=right;
}
sub close_results {
print "</BODY>\n</HTML>\n";
print "<DIV>HERE</DIV></BODY>\n</HTML>\n";
}

0
survey-nginx/cgi-bin/sdbtxt/de Normal file → Executable file
View File

0
survey-nginx/cgi-bin/sdbtxt/en Normal file → Executable file
View File

0
survey-nginx/cgi-bin/sdbtxt/es Normal file → Executable file
View File

0
survey-nginx/cgi-bin/sdbtxt/fr Normal file → Executable file
View File

0
survey-nginx/cgi-bin/sdbtxt/it Normal file → Executable file
View File

View File

@@ -75,14 +75,15 @@ $fieldsep = ';';
$idmax = 1000;
$hostid = 4;
require 'smilib.pl';
require 'cybertestlib.pl';
require 'maillib.pl';
#
# THIS IS DEVELOPMENT SETTING *ONLY*! DO NOT COMMIT THIS CHANGE!!
#
$docroot = $ENV{DOCUMENT_ROOT};
$docroot =~ s/\/htdocs\s*$//g;
$urlroot = "/cgi-bin";
@@ -115,7 +116,7 @@ $PATHS{'pubroot'} = $pubroot;
$PATHS{'logroot'} = $logroot;
$PATHS{'dataroot'} = $dataroot;
$PATHS{'secroot'} = $secroot;
$PATHS{'logroot'} = $logroot;
#$PATHS{'logroot'} = $logroot;
$PATHS{'resptmplt'} = $resptmplt;
$PATHS{'questionroot'} = $questionroot;
$PATHS{'testroot'} = $testroot;

File diff suppressed because it is too large Load Diff

View File

@@ -1,96 +1,70 @@
#!/usr/bin/perl
#use strict;
#use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
require 'sitecfg.pl';
require 'testlib.pl';
&traceoutput("visitor.pl:$ENV{'HTTP_REFERER'}"); # TRACE IF ACTIVE
&app_initialize;
print "Content-Type: text/html\n\n";
$mtime = time;
$today = &format_date_time("yyyy-mm-dd hh:nn:ss GMT", "1", "-10000", $mtime);
$stdvisitorlog = join($pathsep, $secroot, "visitsstd.dat");
$clidvisitorlog = join($pathsep, $secroot, "visits$FORM{'clid'}.dat");
$defaultvisitlog = join($pathsep, $secroot, "visits.dat");
$msg = "";
if (($FORM{'clid'} eq '') || ($FORM{'clid'} eq 'sacc') || ($FORM{'clid'} eq 'std')) {
open(VSTLOG,"<$stdvisitorlog") or $msg="not found";
if ($msg eq "not found") {
$makeok = &make_file($stdvisitorlog, $defaultvisitlog, 1);
$msg = ($makeok == 1) ? "" : "failed";
open(VSTLOG,"<$stdvisitorlog") or $msg="not found";
}
if ($msg eq '') {
@visits = <VSTLOG>;
close VSTLOG;
}
$litmplt = "shome";
} else {
open(VSTLOG,"<$clidvisitorlog") or $msg="not found";
if ($msg eq "not found") {
$makeok = &make_file($clidvisitorlog, $stdvisitorlog, 1);
$msg = ($makeok == 1) ? "" : "failed";
open(VSTLOG,"<$clidvisitorlog") or $msg="not found";
}
if ($msg eq '') {
@visits = <VSTLOG>;
close VSTLOG;
}
$litmplt = "cindex";
$SESSION{'clid'} = $FORM{'clid'};
&get_client_profile($FORM{'clid'});
}
print "Content-type: text/plain\n\n";
if ($FORM{'lang'} eq '') {
$lastvisit = -1;
for (1 .. $#visits) {
@entries = split(/&/, $visits[$_]);
if ($entries[1] eq $ENV{'REMOTE_ADDR'}) {
$lastvisit = $_;
}
}
if ($lastvisit == -1) {
@languages=split(/\,/,$ENV{'HTTP_ACCEPT_LANGUAGE'});
if ($languages[0] eq 'en') {$languages[0]="enu";}
if ($languages[0] eq 'en-us') {$languages[0]="enu";}
if ($languages[0] eq 'ar') {$languages[0]="arb";}
if ($LANGUAGE_ID{$languages[0]} ne '') {
$FORM{'lang'} = $languages[0];
}
} else {
@visitdata = split(/&/, $visits[$lastvisit]);
$idx = $#visitdata - 1;
$FORM{'lang'} = $visitdata[$idx];
@visitdata = ();
}
}
# Get user IDs
my $real_user_id = $<;
my $effective_user_id = $>;
@visits = ();
&LanguageSupportInit();
$visitrec = join('&',$today,$ENV{'REMOTE_ADDR'},$ENV{'REMOTE_PORT'},$ENV{'HTTP_ACCEPT_LANGUAGE'},$ENV{'HTTP_USER_AGENT'},$SESSION{'lang'},"");
if (($FORM{'clid'} eq '') || ($FORM{'clid'} eq 'sacc') || ($FORM{'clid'} eq 'std')) {
open(VSTLOG,">>$stdvisitorlog");
} else {
open(VSTLOG,">>$clidvisitorlog");
}
print VSTLOG "$visitrec\n";
close VSTLOG;
print "$litmplt\n";
print "--------------------------------------------------------------------------\n";
$SESSION{'browserapp'} = ($ENV{'HTTP_USER_AGENT'} =~ /MSIE/ ) ? "MSIE" : "NSNV";
&traceoutput("visitor.pl:$litmplt"); # TRACE IF ACTIVE
&show_template($litmplt);
print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
# Get group IDs
my $real_group_id = $(;
my $effective_group_id = $);
print "Content-type: text/html\n\n";
print "<html><body><h1>Test CGI Script</h1></body></html>\n\n";
print "\n\n";
print "$docroot\n";
print "$secroot\n";
print $resptmplt;
print "\n\n";
# Get group names
my $real_group_name = getgrgid($real_group_id);
my $effective_group_name = getgrgid($effective_group_id);
# Print user and group information
print "Real User ID: $real_user_id\n";
print "Effective User ID: $effective_user_id\n";
print "Real Group ID: $real_group_id ($real_group_name)\n";
print "Effective Group ID: $effective_group_id ($effective_group_name)\n";
my $cgi = CGI->new($ENV{'QUERY_STRING'});
my %FORM = $cgi->Vars;
my $session_id = $FORM{'tid'};
my $s_id = "sess.$session_id";
my $directory = join($pathsep, $logroot);
my $trash = join($pathsep, $directory, $s_id);
if (-d $directory) {
print "Directory '$directory' exists.\n";
# Check if the directory is readable
if (-r $directory) {
print "Directory '$directory' is readable.\n";
} else {
print "Directory '$directory' is not readable.\n";
}
# Check if the directory is writable
if (-w $directory) {
print "Directory '$directory' is writable.\n";
} else {
print "Directory '$directory' is not writable.\n";
}
} else {
print "Directory '$directory' does not exist.\n";
}
# eval {
# open (my $SESSFILE, '>', $trash) or die "Could not open file '$trash': $!";
# print $SESSFILE "This is a test.\n";
# close($SESSFILE) or die "Could not close file '$trash': $!";
# };
# if ($@) {
# print $@
# }
#while (my ($key, $value) = each %FORM) {
# print "$key: $value\n";
#}