#!/usr/bin/perl

# ---------------------------------------------------------------------------
#     CIWWEB.PL
#
#      Ver: 9_7_2
# ---------------------------------------------------------------------------
# Lighthouse Studio - Web Surveying System
# Copyright Sawtooth Software, Inc. 1998-2019. All rights reserved.
# Orem, UT  USA  (801) 477-4700
#
# Any modification of this script will be considered violation of
# copyright (with the exception of the first line which can be
# modified to reflect the correct path to the Perl interpreter)
# Any use of this script or its code for purposes outside of
# the systems created by Sawtooth Software is prohibited.
 use strict; package ssiwebciw9_7_2; if (exists($ENV{'MOD_PERL'}) && defined($ENV{'MOD_PERL'})) { ssiwebciw9_7_2::_bjl(); } else { $SIG{"ALRM"} = \&ssiwebciw9_7_2::_bjm; eval { alarm (180); ssiwebciw9_7_2::_bjl(); alarm (0); }; if($@) { my $error_msg = $@; eval { if ($error_msg =~ m/Sawtooth Software process time out/i) { my $long_msg = "Process timed out."; authlib9_7_2::_bst(312, $long_msg, $long_msg, $@, 0); } else { authlib9_7_2::_bst(313, "", "", $error_msg, 0); } }; if($@) { die("Sawtooth Software Error."); } } } sub _bjl { my $__a = 0; my $__b = ""; my $__c = ""; my $__d = 0; my $__e = 0; my $__f = 0; my $__g = 0; my $__h = 0; my $__i = ""; my $__j = ""; my $__k = ""; my $__l = 1; my $__m = ""; my $__n = 1; my $__o = 0; my $__p = ""; my $__q = 0; my $__r = 0; my $__s = 0; my $__t = 0; my $__u = 0; my $__v = ""; my $__w = 0; my $__x =0; my $__y = 0; if ($ENV{'PERLXS'} =~ m/PerlIS/i) { print "HTTP/1.1 200 OK\n"; } if ((exists($ENV{'SCRIPT_FILENAME'}) || (defined ($ENV{'SCRIPT_FILENAME'})))) { $__k = $ENV{'SCRIPT_FILENAME'}; } if ($__k eq "") { $__k = $ENV{'PATH_TRANSLATED'}; $__k =~ tr[\\][/]; } $__k =~ s/(.+)\/.+$/$1/; if ((exists($ENV{'SSI_UTF16'}) || (defined ($ENV{'SSI_UTF16'})))) { require Win32; utf8::decode($__k); $__k = Win32::GetShortPathName($__k); $__k =~ tr/\\/\//; } unshift @INC, $__k; _bjp("authlib9_7_2.pl", $__k); authlib9_7_2::_bpg(0); $authlib9_7_2::_cbz = $__k; _bjp("ciwlib9_7_2.pl", $__k); ciwlib9_7_2::_bjq(); authlib9_7_2::_bpz(); authlib9_7_2::_brn(); if(exists $authlib9_7_2::_cdn{"hid_preview"}) { $authlib9_7_2::_cfg = $authlib9_7_2::_cdn{"hid_preview"}; if(authlib9_7_2::_bxv()) { $__d = 1; $authlib9_7_2::_cdn{"hid_respnum"} = $__d; $ciwlib9_7_2::_bnb{'_dmw'} = $__d; } if(exists $authlib9_7_2::_cdn{"hid_preview_page"} && $authlib9_7_2::_cdn{"hid_preview_page"} > 1) { $__e = 1; } } if(!$authlib9_7_2::_cfg) { if ($authlib9_7_2::_cdn{"hid_previous"} == 1) { $authlib9_7_2::_ccq = 1; } elsif(exists $authlib9_7_2::_cdn{"sys_previous_button"} && $authlib9_7_2::_cdn{"sys_previous_button"} ne "") { $authlib9_7_2::_ccq = 1; } } if (keys(%authlib9_7_2::_cdn) == 1 || exists $authlib9_7_2::_cdn{"hid_url_restore"}) { if (exists $authlib9_7_2::_cdn{"hid_s"}) { my $__z = $authlib9_7_2::_cdn{"hid_s"}; if ($__z ne "") { my $__aa = 0; my $__ab = 0; my $__ac = 0; ($__v, $__s, $__i, $__t, $__aa, $__w, $__x, $__ab, $__ac) = authlib9_7_2::_bqg($__z); $authlib9_7_2::_cdn{"hid_studyname"} = $__i; if($__aa) { $authlib9_7_2::_cdn{"hid_test_mode"} = $__aa; } if($__ac) { $authlib9_7_2::_cdn{"hid_test_db"} = $__ac; } $__q = 1; } } } $__j = authlib9_7_2::_bqm(0); if ((exists $authlib9_7_2::_cdn{"hid_pagenum"}) && (defined $authlib9_7_2::_cdn{"hid_pagenum"})) { $__e = $authlib9_7_2::_cdn{"hid_pagenum"}; } if ($__e == 1 || $__e == 0) { my $__ad = ""; foreach $__ad (keys %authlib9_7_2::_cdn) { $authlib9_7_2::_car{uc($__ad)} = $authlib9_7_2::_cdn{$__ad}; } } if ((exists $authlib9_7_2::_cdn{"hid_studyname"}) && (defined $authlib9_7_2::_cdn{"hid_studyname"})) { $__i = $authlib9_7_2::_cdn{"hid_studyname"}; } elsif (exists $authlib9_7_2::_car{"STUDYNAME"}) { $__y = 1; $authlib9_7_2::_cdn{"hid_studyname"} = $authlib9_7_2::_car{"STUDYNAME"}; $__i = $authlib9_7_2::_cdn{"hid_studyname"}; } else { if ($__i eq "") { $__i = authlib9_7_2::_bvu("hid_studyname"); if ($__i eq "") { $__i = authlib9_7_2::_bsv(); if ($__i eq "") { authlib9_7_2::_bst(102, "", "Study name passed in is empty. Cannot find study name.", "", 1); } } } } if ($__i =~ m/\W/g) { authlib9_7_2::_bst(327, "Access error.", "The studyname passed in contains invalid characters.", "", 0); } authlib9_7_2::_bqc($__i); authlib9_7_2::_bso($__k); $authlib9_7_2::_ccw = authlib9_7_2::_bqw(); my($__ch, $__ci, $__cj) = authlib9_7_2::_bph($authlib9_7_2::_ccw); if (!$__ch) { authlib9_7_2::_bst(199, "Database error.", $__ci, $__cj); } my $__ae = 0; ($__ch, $__ci, $__cj, $__ae) = authlib9_7_2::_bqu(0); if (!$__ch) { authlib9_7_2::_bst(204, "Database error.", $__ci, $@); } if (!exists $authlib9_7_2::_cdn{"hid_javascript"} && !$authlib9_7_2::_cfg && !$__q && !exists $authlib9_7_2::_cdn{"sys_input"} && !exists $authlib9_7_2::_cdn{"sys_acbc_byo_request"}) { if($__y == 1) { $__e = 1; } else { $__e = authlib9_7_2::_bvu("hid_pagenum"); if ($__e eq "") { $__e = 0; } } ciwlib9_7_2::_bjr($__e, $__i); } if($__q) { if($__s) { my $__af = ciwlib9_7_2::_bli($__s); if(exists $__af->{"resp_num"}) { $authlib9_7_2::_cdn{"hid_respnum"} = $__af->{"resp_num"}; } if(exists $__af->{"last_question"}) { $__m = $__af->{"last_question"}; } else { $__m = authlib9_7_2::_bpw("sys_LastQuestion"); } if ($__t) { $authlib9_7_2::_cdn{"hid_checksum"} = $__t; } else { $authlib9_7_2::_cdn{"hid_checksum"} = authlib9_7_2::_bpw("sys_CheckSum"); } if (!exists $authlib9_7_2::_cdn{"hid_test_mode_settings"} && exists $__af->{"test_mode_settings"}) { $authlib9_7_2::_cdn{"hid_test_mode_settings"} = $__af->{"test_mode_settings"}; } if (exists $__af->{"preview"}) { $authlib9_7_2::_cdn{"hid_preview"} = $__af->{"preview"}; $authlib9_7_2::_cfg = $__af->{"preview"}; } if ($__v == 0xFF01) { if ($__t != $__af->{"checksum"} || $__w != $__af->{"timestamp"} || $__x != $__af->{"resp_num"} || $authlib9_7_2::_cdh != $__af->{"study_name"} || $authlib9_7_2::_cdn{"hid_test_mode"} != $__af->{"test_mode"}) { my $__ag = "Expected_checksum=" . $__af->{"checksum"} . ", actual_checksum=$__t"; $__ag .= ", expected_timestamp=" . $__af->{"timestamp"} . ", actual_timestamp=$__w"; $__ag .= ", expected_respnum=" . $__af->{"resp_num"} . ", actual_respnum=$__x"; $__ag .= ", expected_studyname=" . $__af->{"study_name"} . ", actual_studyname=$__i"; $__ag .= ", version=$__v, id=$__s"; authlib9_7_2::_bst(310, "URL values do not match expected values.", $__ag, ""); } } elsif ($__v == 0xFF02) { if ($__t != $__af->{"checksum"} || $__w != $__af->{"timestamp"} || $__x != $__af->{"resp_num"} || $authlib9_7_2::_cdh != $__af->{"study_name"} || $authlib9_7_2::_cdn{"hid_test_mode"} != $__af->{"test_mode"}) { my $__ag = "Expected_checksum=" . $__af->{"checksum"} . ", actual_checksum=$__t"; $__ag .= ", expected_timestamp=" . $__af->{"timestamp"} . ", actual_timestamp=$__w"; $__ag .= ", expected_respnum=" . $__af->{"resp_num"} . ", actual_respnum=$__x"; $__ag .= ", expected_studyname=" . $__af->{"study_name"} . ", actual_studyname=$__i"; $__ag .= ", version=$__v, id=$__s"; authlib9_7_2::_bst(326, "URL values do not match expected values.", $__ag, ""); } } } $__n = 0; $__l = 0; $__e = -1; $__d = $authlib9_7_2::_cdn{"hid_respnum"}; } if ($__j ne "") { authlib9_7_2::_bvj(&authlib9_7_2::_CHT, 0, $__j); } if (exists $authlib9_7_2::_cdn{"hid_test_mode"} && exists $authlib9_7_2::_cdn{"hid_test_mode_settings"}) { if ($authlib9_7_2::_cdn{"hid_test_mode_settings"} eq "") { ciwlib9_7_2::_bmg(); } if ($authlib9_7_2::_cdn{"hid_test_mode_settings"} ne "") { ciwlib9_7_2::_bmh(); } } if (exists $authlib9_7_2::_cdn{"hid_loadtest_mode"}) { $authlib9_7_2::_ccg = $authlib9_7_2::_cdn{"hid_loadtest_mode"}; } authlib9_7_2::_bro(0, 1, ""); if ($authlib9_7_2::_cdm->{"survey_paused"} == 1) { ciwlib9_7_2::_bkt('_fo', 1); } if ($authlib9_7_2::_ccq) { $__d = ciwlib9_7_2::_bko(); my @__ah = (); foreach my $__ai (grep(/hid_prev_/, (keys %authlib9_7_2::_cdn))) { my ($__ck,$__cl, $__ce, $__cm) = split(",", $authlib9_7_2::_cdn{$__ai}); push(@__ah, [ $__cl, $__ck ]); delete $authlib9_7_2::_cdn{$__ai}; } @__ah = sort {$a->[1] <=> $b->[1]} @__ah; my @__aj = reverse @{authlib9_7_2::_brb($__d)}; my @__ak = grep { $_->{"quest_version"} ne "0" } @__aj; @__aj = grep { $_->{"limbo"} == 0 } @__aj; if ($__e > 1 && exists $authlib9_7_2::_cdn{"hid_pagetime"} && !$authlib9_7_2::_cfg) { my @__al = (); ciwlib9_7_2::_bkq(\@__al, $__d, $__e, $authlib9_7_2::_cdn{"hid_pagetime"}); authlib9_7_2::_bqy(\@__al, $__d, 1, 1); authlib9_7_2::_bqn(\@__al, $__d, 0); } if (@__aj == 0 || @__ak == 0) { $__e = 0; } else { my $__am = -1; my $__an = 0; if ($__ak[0]->{"hop"} < $__ah[0]->[1]) { $__an = $__ak[0]; $__am = 0; } else { for (my $__ao = 0; $__ao < @__ak; $__ao++) { if ($__ak[$__ao]->{"hop"} <= $__ah[0]->[1]) { if ($__ao + 1 < @__ak) { $__an = $__ak[$__ao + 1]; $__am = $__ao + 1; last; } } } } if ($__an) { my $__ap = 0; if (exists $__an->{"hop"}) { $__ap = $__an->{"hop"}; } else { authlib9_7_2::_bst(260, "Backup Error.", "Error occured while backing up.", $@); } $__e = $__an->{"page_num"}; $__u = $authlib9_7_2::_cdo->[$__e - 1]; my @__aq = (); my $__ar = ""; if ($__e > 1) { while (1) { eval { $__ar = "SELECT `hop`,`quest_name` FROM `" . $authlib9_7_2::_cdj . "_history` WHERE `sys_RespNum`=" . $__d . " AND `page_num`=" . $__e . " AND `quest_version`!='0' AND `limbo`=0 AND `hop` <= $__ap ORDER BY `hop` ASC"; @__aq = @{$authlib9_7_2::_cde->selectall_arrayref(authlib9_7_2::_bpr($__ar, 0), { Slice => {} })}; }; if ($@) { authlib9_7_2::_bst(234, "Database error.", "Unable to read history data. " . $authlib9_7_2::_cde->errstr, $@); } if (@__aq == 0) { if ($__am < @__ak) { $__an = $__ak[++$__am]; if (exists $__an->{"hop"}) { $__ap = $__an->{"hop"}; $__e = $__an->{"page_num"}; $__u = $authlib9_7_2::_cdo->[$__e - 1]; } else { authlib9_7_2::_bst(260, "Backup Error.", "Error occured while backing up.", $@); } } else { last; } } else { last; } } if (@__aq == 0) { $__e = 0; } else { my $__as = 0; my $__at = $__u->{'_g'}; my $__au = @{$__at}; my %__av = (); my $__aw = 2147483648; my $__ax = $__aw; for (my $__ay = 0; $__ay < $__au; $__ay++) { my $__az = $__at->[$__ay]; $__av{$__az->{'_bji'}} = $__aw; } $__as = @__aq - 1; for (my $__ao = @__aq - 1; $__ao >= 0; $__ao--) { my $__ba = ""; if ($__aq[$__ao]->{"quest_name"} =~ m/^(.*?)\..*$/o) { $__ba = $1; } else { $__ba = $__aq[$__ao]->{"quest_name"}; } if (exists $__av{$__ba}) { if ($__av{$__ba} == $__aw) { $__av{$__ba} = $__aq[$__ao]->{"hop"}; } else { last; } if ($__aq[$__ao]->{"hop"} < $__ax) { $__ax = $__aq[$__ao]->{"hop"}; } } } for (my $__ao = 0; $__ao < $__au; $__ao++) { my $__bb = $__at->[$__ao]->{'_bji'}; if (exists $__av{$__bb} && $__av{$__bb} != $__aw) { $__m = $__bb; last; } } $authlib9_7_2::_cdn{"sys_prev_low_hop"} = $__ax; my @__bc = (); for (my $__ao = 0; $__ao < @__aj; $__ao++) { if ($__aj[$__ao]->{"hop"} eq $__ax) { @__bc = (@__bc, (0..$__ao)); last; } } my %__bd = (); if(&authlib9_7_2::_CFZ) { authlib9_7_2::_brr(); if ($authlib9_7_2::_cdy && exists $authlib9_7_2::_cdy->{'_bjf'}) { foreach my $__be(@{$authlib9_7_2::_cdy->{'_bjf'}}) { $__bd{$__be->{'_bji'}} = 1; } } } foreach my $__ao (@__bc) { foreach my $__bf (keys %{$__aj[$__ao]->{"data"}}) { if(&authlib9_7_2::_CFZ) { if(!exists $__bd{$__bf}) { $authlib9_7_2::_cat->{$__bf} = 1; } } else { $authlib9_7_2::_cat->{$__bf} = 1; } } } my $__bg = 0; eval { my $__ar = "SELECT * FROM `" . $authlib9_7_2::_cdj . "_history` WHERE `sys_RespNum`=" . $__d . " AND `page_num`=" . $__e . " AND `quest_name`='hid_page_vars_history' AND `limbo`=0 AND `hop`>= " . $__ap . " ORDER BY `hop` ASC"; my @__bh = @{$authlib9_7_2::_cde->selectall_arrayref(authlib9_7_2::_bpr($__ar, 0), { Slice => {} })}; if (@__bh > 0) { $__bg = $__bh[0]; } }; if ($@) { authlib9_7_2::_bst(279, "Database error.", "Unable to connect retrieve history data. " . $authlib9_7_2::_cde->errstr, $@); } delete $authlib9_7_2::_cdn{"hid_loops"}; delete $authlib9_7_2::_cdn{"hid_page_rand"}; if ($__bg) { eval { $__bg->{"data"} = eval(authlib9_7_2::_bpm($__bg->{"data"})); }; if ($@) { authlib9_7_2::_bst(280, "Database error.", "Database error while evaluating history.", $@); } if (exists $__bg->{"data"}->{"hid_SavedListNames"}) { my @__bi = split(",", $__bg->{"data"}->{"hid_SavedListNames"}); delete $__bg->{"data"}->{"hid_SavedListNames"}; my $__bj = ""; foreach $__bj (@__bi) { $authlib9_7_2::_cbt{$__bj} = $__bg->{"data"}->{$__bj}; delete $authlib9_7_2::_cat->{$__bj}; delete $__bg->{"data"}->{$__bj}; } } %authlib9_7_2::_ccn = (%authlib9_7_2::_ccn, %{$__bg->{"data"}}); if (exists $authlib9_7_2::_ccn{"hid_loops"}) { $authlib9_7_2::_cdn{"hid_loops"} = $authlib9_7_2::_ccn{"hid_loops"}; } if (exists $authlib9_7_2::_ccn{"hid_page_rand"}) { $authlib9_7_2::_cdn{"hid_page_rand"} = $authlib9_7_2::_ccn{"hid_page_rand"}; } } } } else { $__e = 0; } } else { $__e = 0; } } } if (exists $authlib9_7_2::_cdn{"sys_acbc_byo_request"}) { my $__bk = $authlib9_7_2::_cdn{"sys_acbc_name"}; $__d = ciwlib9_7_2::_bko(); my $__bl = authlib9_7_2::_btr($__bk); print acbclib9_7_2::_dbb($__bl); exit(); } if (exists $authlib9_7_2::_cdn{"sys_input"}) { print authlib9_7_2::_bse(); print authlib9_7_2::_brt(); exit(); } if ((exists $authlib9_7_2::_cdn{"hid_javascript"}) && (defined $authlib9_7_2::_cdn{"hid_javascript"})) { $__g = $authlib9_7_2::_cdn{"hid_javascript"}; } elsif($authlib9_7_2::_cfg) { $__g = 1; } else { $__g = authlib9_7_2::_bvu("hid_javascript"); if ($__g eq "") { $__g = 0; } } if(($__e == 0 || $__e == 1) && $authlib9_7_2::_ccg != 1) { if($__g == 0) { authlib9_7_2::_bvj(&authlib9_7_2::_CHT, 0, "Respondent denied survey access because their browser did not have JavaScript enabled (" . authlib9_7_2::_btc() . ")."); ciwlib9_7_2::_bkt('_fp', 0); } if(exists $authlib9_7_2::_cdn{"unsupported_browser"} && !exists $authlib9_7_2::_cdp->{'_bc'}) { authlib9_7_2::_bvj(&authlib9_7_2::_CHT, 0, "Respondent denied survey access because they were using an unsupported browser (" . authlib9_7_2::_btc() . ")."); ciwlib9_7_2::_bkt('_fq', 0); } } $authlib9_7_2::_cdn{"hid_javascript"} = $__g; if ($__e > 1 && $authlib9_7_2::_ccq == 0) { $__d = ciwlib9_7_2::_bko(); } elsif ($__e == 1) { my $__bm = ""; authlib9_7_2::_brk("enterlib9_7_2.pl"); if ($authlib9_7_2::_cdm->{"close_survey"} == 1) { enterlib9_7_2::_cio($__g, 0); } elsif($authlib9_7_2::_cdu && authlib9_7_2::_bsk(0) >= 250) { enterlib9_7_2::_cio($__g, 1); } elsif($authlib9_7_2::_cdv && authlib9_7_2::_bsk(1) >= 250) { $authlib9_7_2::_cdm->{"close_survey"} = 1; authlib9_7_2::_bqv(); enterlib9_7_2::_cio($__g, 0); } elsif($authlib9_7_2::_cdw && authlib9_7_2::_bsk(1) >= 100) { $authlib9_7_2::_cdm->{"close_survey"} = 1; authlib9_7_2::_bqv(); enterlib9_7_2::_cio($__g, 0); } authlib9_7_2::_brr(); if ($authlib9_7_2::_cdy && !$authlib9_7_2::_cfg) { if (exists $authlib9_7_2::_cdy->{'_bim'}) { my $__bn = 0; my $__bo = 0; ($__bn, $__bo, $__d, $__bm) = enterlib9_7_2::_cii($authlib9_7_2::_cdy->{'_bim'}); if (!$__bn) { authlib9_7_2::_bvj(&authlib9_7_2::_CHT, 0, "Respondent denied survey access because their password was wrong."); ciwlib9_7_2::_bkt('_ff', 0); } elsif (!$__bo) { if ($__d) { $authlib9_7_2::_cdn{"hid_respnum"} = $__d; } authlib9_7_2::_bvj(&authlib9_7_2::_CHT, 0, "Respondent denied survey access because the password had reached the maximum number of respondents allowed."); ciwlib9_7_2::_bkt('_fd', 0); } } if ($__d == 0 && exists $authlib9_7_2::_cdy->{'_bjk'}) { if (!exists $authlib9_7_2::_cdn{"hid_test_mode"}) { $__d = enterlib9_7_2::_cij($__k); } } } if (exists($authlib9_7_2::_cdp->{'_dp'}) && !exists($authlib9_7_2::_cdn{"hid_skip_simple_browser_transition"}) && $__g) { ciwlib9_7_2::_bmm($authlib9_7_2::_cdp->{'_dp'}); authlib9_7_2::_bvw(); } my $__bp = 0; if (exists $ciwlib9_7_2::_bnb{'_dmw'}) { $__bp = 1; } elsif ($__d) { $authlib9_7_2::_cdn{"hid_respnum"} = $__d; $__f = 1; } elsif (exists $authlib9_7_2::_cdn{"hid_respnum"}) { $__d = ciwlib9_7_2::_bko(); } else { $__bp = 1; } if ($__f) { $__m = authlib9_7_2::_bpw("sys_LastQuestion"); if (exists $authlib9_7_2::_car{"SYS_SKIPTO"}) { $__m = $authlib9_7_2::_car{"SYS_SKIPTO"}; $__m = ciwlib9_7_2::_blt($__m); $__n = 0; $__o = 1; } $__m = ciwlib9_7_2::_blr($__d, $__m); } elsif($__bp) { if (exists $ciwlib9_7_2::_bnb{'_dmw'}) { $__d = $ciwlib9_7_2::_bnb{'_dmw'}; } ($__d, $__r) = enterlib9_7_2::_cim($__d, $__bm, $__g); if ($authlib9_7_2::_cdy) { if (exists $authlib9_7_2::_cdy->{'_bjk'} && $__a != 1) { if (!exists $authlib9_7_2::_cdn{"hid_test_mode"}) { enterlib9_7_2::_cik($__d, $__r, $__k); } } } } if ($__d) { $authlib9_7_2::_cdn{"hid_respnum"} = $__d; } else { authlib9_7_2::_bst(271, "", "Respondent number is empty.", ""); } } elsif ($__e == 0) { $authlib9_7_2::_cdn{"hid_javascript"} = 1; ciwlib9_7_2::_bkw(1, "", 0, 1, $authlib9_7_2::_cdh, 0, 0); authlib9_7_2::_bvw(); } if ($__e == 1 && $__f) { $authlib9_7_2::_cdn{"hid_checksum"} = authlib9_7_2::_bpw("sys_CheckSum"); } if ($__q) { my $__bq = ""; my $__br = ""; if (exists $authlib9_7_2::_cdp->{'_bd'}) { $__bq = authlib9_7_2::_bte(); $__br = authlib9_7_2::_bpw("sys_UserAgent"); } my $__bs = ""; my $__bt = ""; if (exists $authlib9_7_2::_cdp->{'_be'}) { $__bs = authlib9_7_2::_btf(); $__bt = authlib9_7_2::_bpw("sys_IPAddress"); } if (!$authlib9_7_2::_cfg && ($__bq ne $__br || $__bs ne $__bt)) { authlib9_7_2::_bst(302, "The link to the survey that you are using will not work. Please enter the survey again using the original link that was given to you.", "A respondent attempted to use the survey page url with a different browser or IP address than they used originally. They were instructed to enter the survey using the original link that was sent to them.", "", 1); } if ($__m) { $__m = ciwlib9_7_2::_blr($__d, $__m); } } my $__bu = authlib9_7_2::_bpw("sys_RespStatus"); if ($__bu == &authlib9_7_2::_CHG || $__bu == &authlib9_7_2::_CHF) { ciwlib9_7_2::_bkt('_fe', 0); } if ($__g == 0) { if (authlib9_7_2::_bpw("sys_UserJavaScript") == 1) { $__g = 1; $authlib9_7_2::_cdn{"hid_javascript"} = $__g; } } if ($__e > 0 && $authlib9_7_2::_ccq == 0 && !$authlib9_7_2::_cfg) { authlib9_7_2::_brk("pverlib9_7_2.pl"); my $__bv = authlib9_7_2::_bvx(\%authlib9_7_2::_cbt); my $__bw = authlib9_7_2::_bvx($authlib9_7_2::_cdg); my $__bx = authlib9_7_2::_bvx(\%authlib9_7_2::_ccn); my $__by = authlib9_7_2::_bvx(\%authlib9_7_2::_cdn); pverlib9_7_2::_cjm($__e, $__d); %authlib9_7_2::_cbt = %{$__bv}; $authlib9_7_2::_cdg = $__bw; %authlib9_7_2::_ccn = %{$__bx}; %authlib9_7_2::_cdn = %{$__by}; $authlib9_7_2::_cci = ""; $authlib9_7_2::_cbx = 0; $authlib9_7_2::_cbn = {}; } my $__bz = []; my $__ca = []; if ($ciwlib9_7_2::_bnd && $authlib9_7_2::_ccq) { if ($__f) { $__m = ""; } if ($authlib9_7_2::_cdn{"hid_destination"}) { $__m = $authlib9_7_2::_cdn{"hid_destination"}; } } else { if ($__f) { if ($authlib9_7_2::_cca) { my $__cb = 0; my $__cc = ""; ($__cb, $__cc) = authlib9_7_2::_brz($__d); if ($__cb) { $__m = $__cc; delete $authlib9_7_2::_cdn{"hid_page_rand"}; } } if(&authlib9_7_2::_CFZ) { $__l = 1; } else { if (!$__o) { $__h = _bjn(); if ($__h) { $__m = ""; delete $authlib9_7_2::_cdn{"hid_page_rand"}; $__f = 0; } else { $__l = 0; } } } } if ($__l && $authlib9_7_2::_ccq == 0 && $ciwlib9_7_2::_bnd eq "" && !$authlib9_7_2::_cfg) { ($__bz, $__ca) = ciwlib9_7_2::_bkp($__e, $__f); } } my $__cd = 0; if($authlib9_7_2::_cfg) { if ($authlib9_7_2::_cdn{"hid_previous"} == 1) { $__e--; } else { $__e++; } } else { if ($ciwlib9_7_2::_bnd eq "" && $__n && $authlib9_7_2::_ccq == 0) { ($__m, $__e, $__cd) = ciwlib9_7_2::_bjs($__bz, $__ca, $__d, $__m, $__e, $__f); } } if(exists($ciwlib9_7_2::_bnb{'skip'})) { if ($ciwlib9_7_2::_bnd eq "") { $__m = $ciwlib9_7_2::_bnb{'skip'}; $__m = ciwlib9_7_2::_blr($__d, $__m); $authlib9_7_2::_cdn{"hid_test_mode_settings"} =~ s/(.*?),/,/; } } if ($authlib9_7_2::_ccq) { $authlib9_7_2::_cee = 0; $authlib9_7_2::_cef = 0; ($__e, $__m, $__cd) = ciwlib9_7_2::_bkw($__e, $__m, $__d, $__g, $authlib9_7_2::_cdh, 0, 0); if ($__e || $__m) { authlib9_7_2::_bst(308, "Backing up error.", "Backing up error. A destination was set while backing up. PageNum:" . $__e . " Destination:" . $__m, ""); } } else { my $__ce = $authlib9_7_2::_cdn{'hid_pagenum'}; while ($__e > 0 || $__m ne "") { $authlib9_7_2::_cef = 0; $authlib9_7_2::_cee = 0; if (!$authlib9_7_2::_cfg && !$__f && $ciwlib9_7_2::_bnd eq "") { ($__e, $__m) = ciwlib9_7_2::_bkv($__e, $__ce, $__m, $__d, $__cd); } elsif($authlib9_7_2::_cfg == &authlib9_7_2::_CHU && exists $authlib9_7_2::_cdn{"hid_preview_page"}) { $__e = $authlib9_7_2::_cdn{"hid_preview_page"}; } $__ce = $__e; ($__e, $__m, $__cd) = ciwlib9_7_2::_bkw($__e, $__m, $__d, $__g, $authlib9_7_2::_cdh, 0, 0); if (exists $authlib9_7_2::_cdn{'sys_autocompletes'}) { my $__cf = ciwlib9_7_2::_bkm($__ce); foreach my $__cg (@{$__cf}) { ($__bz, $__ca) = ciwlib9_7_2::_bkp($__cg, 0); ($__m, $__e, $__cd) = ciwlib9_7_2::_bjs($__bz, $__ca, $__d, $__m, $__cg, 0); } } elsif (($__e > 0 || $__m ne "") && (keys %authlib9_7_2::_ccn || keys %authlib9_7_2::_cbt)) { my $__cf = ciwlib9_7_2::_bkm($__ce); foreach my $__cg (@{$__cf}) { ciwlib9_7_2::_bkp($__cg, 0); } } } } authlib9_7_2::_bvw(); } sub _bjm { my $__cn = ""; my $__co = "Sawtooth Software process time out."; eval { if(!$authlib9_7_2::_cfg) { $__cn = $__co; } }; if ($@) { $__cn = $__co; } if($__cn) { die($__cn); } } sub _bjn { my $__cp = 0; my $__cq = ""; my $__cr = ""; my $__cs = ""; my $__ct = ""; my %__cu = (); my $__cv = $authlib9_7_2::_cdo->[0]; my $__cw = $__cv->{'_g'}; my $__cx = @{$__cw}; my $__cy = 0; my $__cz = 0; for($__cy = 0; $__cy < $__cx; $__cy++) { $__cz = $__cw->[$__cy]; if ($__cz->{'_bjj'} != 21) { $__cu{$__cz->{'_bji'}} = 1; } } if ($authlib9_7_2::_cdy) { if (exists $authlib9_7_2::_cdy->{'_bjf'}) { my $__da = $authlib9_7_2::_cdy->{'_bjf'}; my $__db = 0; my $__dc = ""; foreach $__db (@{$__da}) { $__dc = $__db->{'_bji'}; $__cu{$__dc} = 1; } } if (exists $authlib9_7_2::_cdy->{'_bim'}) { my $__dd = $authlib9_7_2::_cdy->{'_bim'}; if (exists $__dd->{'_biy'}) { my @__de = @{$__dd->{'_biy'}}; my $__df = 0; my $__dg = ""; foreach $__df (@__de) { $__dg = $__df->{'_bji'}; $__cu{$__dg} = 1; } } } } foreach $__cq (sort keys %authlib9_7_2::_cdn) { if ($__cq =~ m/^(.*?)_(.*?)$/) { $__cr = $1; } else { $__cr = $__cq; } if (exists $__cu{$__cr}) { $__cs = ""; $__ct = authlib9_7_2::_bpw($__cq); if (exists $authlib9_7_2::_cdn{$__cq}) { $__cs = $authlib9_7_2::_cdn{$__cq}; } my $__dh = authlib9_7_2::_bsr(uc($__cs)); my $__di = authlib9_7_2::_bsr(uc($__ct)); if ($__dh ne $__di) { $__cp = 1; if (authlib9_7_2::_bwx($__dh) && authlib9_7_2::_bwx($__di)) { $__dh = _bjo($__dh); $__di = _bjo($__di); if ($__dh eq $__di) { $__cp = 0; } } if ($__cp) { last; } } } } return $__cp; } sub _bjo { my($__dj) = @_; if($__dj =~ m/(\d*)(\.)(\d*?)(0+)$/) { if($3 eq "") { $__dj = $1; } else { $__dj = $1 . $2 . $3; } } return $__dj; } sub _bjp { my ($__dl, $__dm) = @_; my $__dk = ""; if (!(-e $__dm . "/" . $__dl)) { $__dk = "Cannot find library in " . $__dm; } eval { require $__dl; }; if ($@) { $__dk = $@; } if ($__dk ne "") { print "Content-type: text/html\r\n\r\n"; print "<html><body style=\"font-family: arial; margin: 20px;\">"; print "<span style=\"color: red; font-weight: bold; padding-right: 10px\">Error:</span>"; print "Cannot load library: <span style=\"color: blue;\">" . $__dl . "</span>"; print "</body></html>"; exit(); } } END { if($authlib9_7_2::_ccm) { close $authlib9_7_2::_ccm; } } return 1; 1;
