home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / FAQ / discus_admin_1357211388 / source / ui-prfle.pl < prev    next >
Text File  |  2009-11-06  |  17KB  |  453 lines

  1. # FILE: ui-prfle.pl
  2. # DESCRIPTION: User Interface Profile Editor/Manager
  3. #-------------------------------------------------------------------------------
  4. # DISCUS COPYRIGHT NOTICE
  5. #
  6. # Discus is copyright (c) 2002 by DiscusWare, LLC, all rights reserved.
  7. # The use of Discus is governed by the Discus License Agreement which is
  8. # available from the Discus WWW site at:
  9. #    http://www.discusware.com/discus/license
  10. #
  11. # Pursuant to the Discus License Agreement, this copyright notice may not be
  12. # removed or altered in any way.
  13. #-------------------------------------------------------------------------------
  14.  
  15. use strict;
  16. use vars qw($GLOBAL_OPTIONS $PARAMS $DCONF);
  17.  
  18. ###
  19. ### user_interface_profile_control
  20. ###
  21. ### Controls the "Edit Profile" aspect of the user interface as well as the
  22. ### appropriate related items when editing one's profile through Administration
  23. ###
  24.  
  25. sub user_interface_profile_control {
  26.     my $FORMref = parse_form($ENV{'QUERY_STRING'}, $ENV{'CONTENT_LENGTH'});
  27.     dreq("template", "authpass");
  28.     uiprfle_login($FORMref) if ! $FORMref->{action};
  29.     uiprfle_logout($FORMref) if $FORMref->{action} eq "logout";
  30.     if ($FORMref->{action} =~ m%^(edit|del)post%) {
  31.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  32.         dreq("fcn-edt-PRO");
  33.         fcn_edt_main($FORMref);
  34.     }
  35.     if ($FORMref->{action} =~ m%^rate%) {
  36.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  37.         dreq("fcn-vote-PRO");
  38.         fcn_vote_main($FORMref);
  39.     }
  40.     if ($FORMref->{action} =~ m|^register|) {
  41.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  42.         dreq("selfreg-PRO"); self_registration_control($FORMref);
  43.     }
  44.     if ($FORMref->{action} eq "pict") {
  45.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  46.         dreq("fcn-prfl-PRO");
  47.         enhanced_profile_picture_show($FORMref->{file}, 0);
  48.     }
  49.     if ($FORMref->{action} eq "view_profile") {
  50.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  51.         dreq("fcn-prfl-PRO"); enhanced_profile_profile_show($FORMref->{profile}, $FORMref);
  52.     }
  53.     if ($FORMref->{action} eq "emsel") {
  54.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  55.         dreq("fcn-prfl-PRO"); email_by_subtopic_select($FORMref);
  56.     }
  57.     if ($FORMref->{action} =~ m|^forgot|) {
  58.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  59.         dreq("forgotpw-PRO"); forgotten_password_manager($FORMref);
  60.     }
  61.     if ($FORMref->{action} eq "profile_activate") {
  62.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  63.         dreq("suspend-PRO"); suspend_activation($FORMref);
  64.     }
  65.     if ($FORMref->{action} =~ m|^send|) {
  66.         error_message(read_language()->{FEATURE_NOT_SUPPORTED}, read_language()->{FEATURE_NOT_SUPPORTED_DESCR}, 0, 1) if ! $DCONF->{pro};
  67.         dreq("pvtmsg-PRO"); private_messaging($FORMref);
  68.     }
  69.     if ($FORMref->{action} eq 'quick') {
  70.         dreq("quickadm-PRO");
  71.         quick_admin_handler($FORMref);
  72.     }
  73.     undef my $result;
  74.     if ($FORMref->{username} && ! $FORMref->{password} && $FORMref->{encpass} && $GLOBAL_OPTIONS->{email_edit_profile_link}) {
  75.         $result = check_password($FORMref->{username}, undef, undef, { cpwd => $FORMref->{encpass}, rpwd => "x" });
  76.     } else {
  77.         $result = check_password($FORMref->{username}, $FORMref->{password}, { nocookies => 1 }, $FORMref->{COOKIE});
  78.     }
  79.     error_message(read_language()->{PROFILE_AUTHERROR}, read_language()->{PROFILE_AUTHERROR_DESCR_V4}, 0, 1) if (ref $result ne "ARRAY" || scalar @{$result} == 0);
  80.     if ($result->[0]->{database} ne "passwd" || $result->[0]->{user} ne $DCONF->{superuser}) {
  81.         error_message(read_language()->{PROFILE_EDITING_PROHIBITED}, read_language()->{PROFILE_EDITING_EXPLANATION}, 0, 1) if $result->[0]->{edit} == 0;
  82.     }
  83.     uiprfle_delete_yourself($result) if $FORMref->{action} eq "delacct";
  84.     uiprfle_save_changes($FORMref, $result) if $FORMref->{action} eq "profile_save";
  85.     my $cookie_str = "";
  86.     if ($DCONF->{pro}) {
  87.         dreq("fcn-prfl-PRO");
  88.         $result = enhance_result_profile($result);
  89.         my $prefstr = join("", grep { length($_) == 1 } keys %{$result->[0]->{enhanced}->{pref}});
  90.         if ($prefstr =~ /[ab]/i) {
  91.             dreq("authwrap-PRO");
  92.             $cookie_str .= create_user_access_cookies($FORMref, {}, $result, $prefstr);
  93.         }
  94.     }
  95.     uiprfle_edit_yourself($FORMref, $result, undef, $cookie_str);
  96. }
  97.  
  98. ###
  99. ### email_notification_to_hash
  100. ###
  101. ### Converts the e-mail notification string (as stored in the file) into a hash
  102. ### of topics and/or subtopics for notification
  103. ###
  104.  
  105. sub email_notification_to_hash {
  106.     my ($string) = @_;
  107.     my $s = {};
  108.     my @t = split(/,/, $string);
  109.     foreach my $t (@t) {
  110.         if ($t eq "0") {
  111.             $s->{own_post} = 1;
  112.         } elsif ($t eq "00") {
  113.             $s->{reply_post} = 1;
  114.         } elsif ($t eq "000") {
  115.             $s->{format_html} = 1;
  116.         } elsif ($t =~ m|^(\d+)/(.*)|) {
  117.             my ($topic, $subs) = ($1, $2);
  118.             my @u = split(/&/, $subs);
  119.             foreach my $u (@u) {
  120.                 $s->{$topic}->{$u} = 1;
  121.             }
  122.         } elsif ($t =~ m|^(\d+)$|) {
  123.             $s->{$1}->{'*'} = 1;
  124.         }
  125.     }
  126.     return $s;
  127. }
  128.  
  129. ###
  130. ### email_notification_hash_to_line
  131. ###
  132. ### Converts an e-mail notification hash to a line
  133. ###
  134.  
  135. sub email_notification_hash_to_line {
  136.     my ($hash) = @_;
  137.     my @t = ();
  138.     push @t, "0" if $hash->{own_post} == 1;
  139.     push @t, "00" if $hash->{reply_post} == 1;
  140.     push @t, "000" if $hash->{format_html} == 1;
  141.     foreach my $t (keys(%{ $hash })) {
  142.         next if $t !~ m|^\d+$|;
  143.         if ($hash->{$t}->{'*'}) {
  144.             push @t, $t;
  145.         } else {
  146.             push @t, join("/", $t, join("&", keys(%{ $hash->{$t} })));
  147.         }
  148.     }
  149.     return join(",", @t);
  150. }
  151.  
  152. ###
  153. ### uiprfle_save_changes
  154. ###
  155. ### Saves changes to your profile
  156. ###
  157.  
  158. sub uiprfle_save_changes {
  159.     my ($FORMref, $result) = @_;
  160.     dreq("fcn-acct");
  161.     my $cookie_str = "";
  162.     my @rn = ();
  163.     if ($DCONF->{pro}) {
  164.         dreq("authwrap-PRO", "fcn-prfl-PRO");
  165.         my $f = read_profile_fields();
  166.         foreach my $ff (@{ $f }) {
  167.             if ($ff->{require} && $ff->{descr} ne "") {
  168.                 my $k = join("", "field", $ff->{var}, "_value");
  169.                 if ($FORMref->{$k} !~ m|\S|) {
  170.                     my $l = read_language()->{PROFILE_NOT_FILLED_IN_REQUIRED};
  171.                     $l =~ s/\\n//g;
  172.                     $l =~ s/\%fieldname/$ff->{descr}/g;
  173.                     error_message(read_language()->{PROFEDIT_TITLE}, $l, 0, 1);
  174.                 }
  175.             }
  176.         }
  177.         enhanced_profile_update($FORMref, $result);
  178. #        my ($ckstr, $frcook) = uiprfle_logout($FORMref, 1);
  179. #        $cookie_str .= $ckstr;
  180. #        $FORMref->{COOKIE} = $frcook;
  181.         my $cache = acs_update_account_info(undef, $result, $FORMref);
  182.         my $ckstr2 = create_user_access_cookies($FORMref, $cache, $result);
  183.         $cookie_str .= $ckstr2;
  184.     }
  185.     my @rs = @{ $result };
  186.     my $is_mod = 0;
  187.     $is_mod = 1 if grep { $_->{database} eq "passwd" } @rs;
  188.     foreach my $r (@rs) {
  189.         my $s = {};
  190.         $s->{user} = $r->{user};
  191.         $s->{fullname} = $GLOBAL_OPTIONS->{name_length_limit} ? substr($FORMref->{fullname}, 0, $GLOBAL_OPTIONS->{name_length_limit_number}) : $FORMref->{fullname};
  192.         if (($GLOBAL_OPTIONS->{pwchange} || $is_mod) && $FORMref->{new_pass_1} ne "") {
  193.             my ($pw1, $pw2) = prepare_userpass_p($FORMref->{new_pass_1}, $FORMref->{new_pass_2});
  194.             if ($pw1 ne $pw2 || length($pw1) < 1) {
  195.                 error_message(read_language()->{PROFILE_CHPASS_ERROR}, read_language()->{PROFILE_CHPASS_ERROR_MATCH});
  196.             }
  197.             $s->{new_password} = $pw1;
  198.             $FORMref->{password} = $pw1;
  199.         }
  200.         if (! $DCONF->{pro} || $GLOBAL_OPTIONS->{emchange} == 1 || $r->{database} eq "passwd") {
  201.             $s->{email} = $FORMref->{email};
  202.         } elsif ($DCONF->{pro} && $FORMref->{email} ne $r->{email} && $GLOBAL_OPTIONS->{emchange} == 2) {
  203.             my ($act_key, $force_pass) = email_change_effect($FORMref->{password}, $FORMref->{email}, $r->{pass}, $s->{new_password}, $r->{user});
  204.             $s->{force_pass} = $force_pass;
  205.             $s->{email} = $FORMref->{email};
  206.             $FORMref->{activ8} = 1;
  207.         } elsif ($DCONF->{pro} && $FORMref->{force_resend_key}) {
  208.             my ($act_key, $force_pass) = email_change_effect($FORMref->{password}, $r->{email}, $r->{pass}, $s->{new_password}, $r->{user});
  209.             $s->{force_pass} = $force_pass;
  210.             $FORMref->{activ8} = 1;
  211.         } elsif ($DCONF->{pro} && $FORMref->{email_activation}) {
  212.             my $force_pass = email_change_activate($r->{pass}, $s->{new_password}, $FORMref->{email_activation});
  213.             $s->{force_pass} = $force_pass;
  214.         } else {
  215.             $s->{email} = $r->{email};
  216.         }
  217.         if ($FORMref->{email_included} == 1) {
  218.             my $h = {}; my $rr = {};
  219.             my @r = split(/,/, $FORMref->{bysub});
  220.             foreach my $_r (@r) {
  221.                 if ($_r =~ m|^(\d+):(.*)|) {
  222.                     my ($topic, $splits) = ($1, $2);
  223.                     my @sp = split(/&/, $splits);
  224.                     foreach my $sp (@sp) {
  225.                         $rr->{$topic}->{$sp} = 1;
  226.                     }
  227.                 }
  228.             }
  229.             my @s = split(/,/, $FORMref->{notify});
  230.             foreach my $s (@s) {
  231.                 if ($s =~ m|^0+$|) {
  232.                     $h->{own_post} = 1 if $s eq "0";
  233.                     $h->{reply_post} = 1 if $s eq "00";
  234.                     $h->{format_html} = 1 if $s eq "000";
  235.                 } elsif (defined $rr->{$s}) {
  236.                     $h->{$s} = $rr->{$s};
  237.                 } else {
  238.                     $h->{$s}->{'*'} = 1 if ! defined $rr->{$s};
  239.                 }
  240.             }
  241.             if ($DCONF->{pro}) {
  242.                 dreq("fcn-prfl-PRO");
  243.                 ($h, $cookie_str) = notification_simple_prune($h, $FORMref, undef, $result);
  244.             }
  245.             $s->{notify} = email_notification_hash_to_line($h);
  246.         }
  247.         if ($r->{database} eq "passwd" && $r->{user} eq $DCONF->{superuser} && defined $FORMref->{cmonth}) {
  248.             my $k = eval '
  249.                 use Time::Local;
  250.                 my $x = timelocal(0,0,12,$FORMref->{cday},$FORMref->{cmonth},$FORMref->{cyear});
  251.                 $x;
  252.             ';
  253.             if ($@ eq "" && $k > 0) {
  254.                 $s->{ctime} = $k;
  255.             }
  256.         }
  257.         my ($success, $failure) = update_account($s, $r->{database}, undef);
  258.         my $Z = \%{$r}; $Z = hash_merge($Z, $s, 1);
  259.         push @rn, $Z;
  260.         $r = $success->[0] if ref $success eq "ARRAY" && ref $success->[0] eq "HASH";
  261.         if (ref $r eq "HASH" && $r->{database} eq "passwd" && $FORMref->{new_pass_1} ne "") {
  262.             $cookie_str .= cookie_string_format("pass", crypt($r->{pass}, "cookie"));
  263.         }
  264.         if ($DCONF->{pro} && ref $r eq "HASH") {
  265.             dreq("fcn-prfl-PRO", "authwrap-PRO");
  266.             my $l = enhance_result_profile($r);
  267.             my $prefstr = join("", grep { length($_) == 1 } keys %{$l->[0]->{enhanced}->{pref}});
  268.             if ($prefstr =~ /[ab]/i) {
  269.                 dreq("authwrap-PRO");
  270.                 $cookie_str .= create_user_access_cookies($FORMref, {}, [$Z], $prefstr);
  271.             } elsif ($prefstr !~ /[ab]/i && $FORMref->{COOKIE}->{user} ne "") {
  272.                 $cookie_str .= uiprfle_logout($FORMref, 3);
  273.             }
  274.         }
  275.     }
  276.     uiprfle_edit_yourself($FORMref, \@rn, { saved => 1 }, $cookie_str);
  277. }
  278.  
  279. ###
  280. ### uiprfle_delete_yourself
  281. ###
  282. ### Handles deleting of your own profile (i.e., commit suicide)
  283. ###
  284.  
  285. sub uiprfle_delete_yourself {
  286.     my ($result) = @_;
  287.     error_message("Permission Denied", "You cannot delete your own account on this board.", 0, 1) if ! $GLOBAL_OPTIONS->{user_selfdel};
  288.     foreach my $r (@{ $result }) {
  289.         error_message("Permission Denied", "The superuser account cannot be deleted.", 0, 1) if $r->{user} eq $DCONF->{superuser} && $r->{database} eq "passwd";
  290.     }
  291.     dreq("fcn-acct");
  292.     dreq("fcn-prfl-PRO") if $DCONF->{pro};
  293.     my $succ_total = 0;
  294.     foreach my $r (@{ $result }) {
  295.         my ($success, $failure) = delete_account({$r->{user} => 1}, undef, $r->{database});
  296.         $succ_total += 1 if $success;
  297.         if ($DCONF->{pro}) {
  298.             delete_enhanced_profile_record({$r->{user} => 1}, $r->{database});
  299.         }
  300.     }
  301.     if ($succ_total == scalar(@{ $result })) {
  302.         screen_out("acctdel", {}, undef);
  303.     } else {
  304.         error_message(read_language()->{PROFILE_DELETE_FAILED}, read_language()->{PROFILE_DELETE_FAILED_EXPLANATION}, 0, 1);
  305.     }
  306. }
  307.  
  308. ###
  309. ### profile_editor_email_notification_freeware
  310. ###
  311. ### Sets up Discus freeware e-mail notification fields
  312. ###
  313.  
  314. sub profile_editor_email_notification_freeware {
  315.     my ($subst, $FORMref, $cookie_str, $current, $h) = @_;
  316.     my $notify = email_notification_to_hash($h->{notify});
  317.     my $topic_list = board_topics();
  318.     my @f2 = ();
  319.     foreach my $topic (@{ $topic_list }) {
  320.         next if $topic->{type} != 1;
  321.         my $sel = 0;
  322.         $sel = 1 if defined $notify->{$topic->{number}};
  323.         push @f2, { number => $topic->{number}, name => $topic->{name}, sel => $sel };
  324.     }
  325.     $subst->{notify_topics} = \@f2;
  326.     $subst->{notify} = $notify;
  327.     return ($subst, $cookie_str);
  328. }
  329.  
  330. ###
  331. ### uiprfle_edit_yourself
  332. ###
  333. ### Allows you to edit your own profile
  334. ###
  335.  
  336. sub uiprfle_edit_yourself {
  337.     my ($FORMref, $result, $stuff, $cookie_str) = @_;
  338.     maintenance_mode_error() if ($GLOBAL_OPTIONS->{maintenance} && ($result->[0]->{user} ne $DCONF->{superuser} || $result->[0]->{database} ne "passwd"));
  339.     my $subst = {};
  340.     my $in_cookie_str = "";
  341.     my $current = undef;
  342.     my $h = $result->[0];
  343.     $subst->{general}->{account_type} = $result->[0]->{database} eq "passwd" ? "moderator" : "user";
  344.     $subst->{general}->{allow_edit_posts} = 1;
  345.     $subst->{general}->{allow_delete_posts} = 1;
  346.     $subst->{general}->{changed_email} = $h->{changed_email};
  347.     $subst->{general}->{spell_checking_enabled} = (-e "$DCONF->{admin_dir}/msg_index/wordlist.txt") * $GLOBAL_OPTIONS->{spell_check};
  348.     if ($FORMref->{activ8}) {
  349.         $subst->{general}->{username} = $h->{user};
  350.         $subst->{general}->{password} = $FORMref->{password};
  351.         screen_out("chgd_eml", $subst);
  352.     }
  353.     $subst->{stuff} = $stuff;
  354.     my @m = ();
  355.     $subst->{messages} = \@m;
  356.     if ($DCONF->{pro}) {
  357.         dreq("fcn-prfl-PRO", "authwrap-PRO");
  358.         ($subst, $in_cookie_str) = profile_editor_variables($subst, $FORMref, $cookie_str, $current, $h, $result);
  359.     } else {
  360.         ($subst, $in_cookie_str) = profile_editor_email_notification_freeware($subst, $FORMref, $cookie_str, $current, $h);
  361.     }
  362.     $cookie_str .= $in_cookie_str;
  363.     my @l = localtime($h->{ctime} + $GLOBAL_OPTIONS->{'timezone'}*3600);
  364.     $subst->{creation}->{month} = $l[4];
  365.     $subst->{creation}->{day} = $l[3];
  366.     $subst->{creation}->{year} = 1900 + $l[5];
  367.     $subst->{creation}->{curryear} = 1900 + (localtime(time))[5];
  368.     $subst->{general}->{groups} = $result->[0]->{groups};
  369.     my @grps = map { { group => $_ } } grep { /\S/ } split(/\//, $result->[0]->{groups});
  370.     $subst->{groups} = \@grps;
  371.     $subst->{general}->{editing} = 0;
  372.     $subst->{general}->{username} = $h->{user};
  373.     $subst->{general}->{password} = $FORMref->{password};
  374.     $subst->{general}->{encpass} = $FORMref->{encpass};
  375.     $subst->{general}->{action} = "profile_save";
  376.     $subst->{general}->{action_url} = join("/", $DCONF->{script_url}, "board-profile.$DCONF->{cgi_extension}");
  377.     $subst->{general}->{is_superuser} = 1 if $h->{database} eq "passwd" && $h->{user} eq $DCONF->{superuser};
  378.     $subst->{ffield}->{fullname} = $h->{fullname};
  379.     $subst->{ffield}->{email} = $h->{email};
  380.     $subst->{general}->{email_notification} = 0;
  381.     if ($GLOBAL_OPTIONS->{email}) {
  382.         if ($GLOBAL_OPTIONS->{send_mail_only_admins} == 0) {
  383.             $subst->{general}->{email_notification} = 1;
  384.         } else {
  385.             foreach my $r (@{ $result }) {
  386.                 $subst->{general}->{email_notification} = 1 if $r->{database} eq "passwd";
  387.             }
  388.         }
  389.     }
  390.     if ($GLOBAL_OPTIONS->{emchange} == 0 && $DCONF->{pro}) {
  391.         $subst->{general}->{prevent_change_email} = 1 if $h->{database} eq "users";
  392.     }
  393.     $subst->{general}->{adminprog} = 1 if $FORMref->{adminprog} == 1;
  394.     screen_out("profile", $subst, $cookie_str);
  395. }
  396.  
  397.  
  398. ###
  399. ### uiprfle_logout
  400. ###
  401. ### Clears cookies to log someone out
  402. ###
  403.  
  404. sub uiprfle_logout {
  405.     my ($FORMref, $cancel) = @_;
  406.     my $cookie_out = "";
  407.     my %formrefcookie = %{ $FORMref->{COOKIE} };
  408.     foreach my $cookie (keys(%{$FORMref->{COOKIE}})) {
  409.         next if $cookie =~ m%^(lastvisit|offset|lastsession)$%;
  410.         next if $cookie =~ m%^(uid|admuser|pass)$% && $cancel == 3;
  411.         $cookie_out .= cookie_string_format($cookie, "undef", "Wednesday, 16-Aug-2000 00:00:00 GMT");
  412.         $formrefcookie{$cookie} = undef;
  413.     }
  414.     return ($cookie_out, \%formrefcookie) if $cancel == 1;
  415.     if ($FORMref->{COOKIE}->{uid} && $DCONF->{pro}) {
  416.         dreq("authwrap-PRO");
  417.         acs_delete_token($FORMref->{COOKIE}->{uid});
  418.     }
  419.     return $cookie_out if $cancel >= 2;
  420.     $FORMref->{COOKIE} = \%formrefcookie;
  421.     dreq("ui-main");
  422.     user_interface_main_control($FORMref, $cookie_out);
  423. }
  424.  
  425. ###
  426. ### uiprfle_login
  427. ###
  428. ### Presents the traditional "Log In" screen for the profile editor
  429. ###
  430.  
  431. sub uiprfle_login {
  432.     my ($FORMref, $messagecode, $arg) = @_;
  433.     my $subst = {};
  434.     $subst->{fill}->{user} = (defined $FORMref->{COOKIE}->{"user$DCONF->{COOKIE_ID}"} ? $FORMref->{COOKIE}->{"user$DCONF->{COOKIE_ID}"} : (defined $FORMref->{COOKIE}->{"admuser$DCONF->{COOKIE_ID}"} ? $FORMref->{COOKIE}->{"admuser$DCONF->{COOKIE_ID}"} : ""));
  435.     foreach my $c (keys(%{ $FORMref->{COOKIE} })) {
  436.         $subst->{fill}->{is_logged_in} = 1 if $c =~ m|^user|;
  437.         $subst->{fill}->{is_logged_in} = 1 if $c =~ m|^cpwd|;
  438.         $subst->{fill}->{is_logged_in} = 1 if $c =~ m|^rpwd|;
  439.         $subst->{fill}->{is_logged_in} = 1 if $c =~ m|^pass|;
  440.         $subst->{fill}->{is_logged_in} = 1 if $c =~ m|^admuser|;
  441.         $subst->{fill}->{is_logged_in} = 1 if $c =~ m|^uid|;
  442.     }
  443.     $subst->{general}->{messagecode} = $messagecode->{code};
  444.     $subst->{editor} = $messagecode;
  445.     $subst->{arg} = $arg;
  446.     $subst->{general}->{authentication_error} = defined $messagecode->{autherr} ? 0 + $messagecode->{autherr} : $FORMref->{username} ne "" || $FORMref->{password} ne "" ? 1 : 0;
  447.     screen_out("usrlogin", $subst);
  448. }
  449.  
  450.  
  451.  
  452. 1;
  453.