Subversion Repositories VORC

Rev

Rev 63 | Rev 68 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 63 Rev 65
Line 7... Line 7...
7
use CGI qw/param header start_html url/;
7
use CGI qw/param header start_html url/;
8
use CGI::Cookie;
8
use CGI::Cookie;
9
use DBI;
9
use DBI;
10
use WebDB;
10
use WebDB;
Line 11... Line 11...
11
 
11
 
Line 12... Line 12...
12
our @EXPORT = qw( $ORCUSER getRCDBH getAccessLevels authDB max authenticate canView getShiftDepartment getClassID getDepartments convertDepartments convertTime getSchedule getRCid getSetting getUser getUserEmail getUserDerbyName getYears printRCHeader changeShift modShiftTime signUpCount signUpEligible findConflict changeLeadShift sendNewUserEMail logit);
12
our @EXPORT = qw( $ORCUSER $SYSTEM_EMAIL getRCDBH getAccessLevels authDB max authenticate canView getShiftDepartment getClassID getDepartments convertDepartments convertTime getSchedule getRCid getSetting getUser getUserEmail getUserDerbyName getYears printRCHeader changeShift modShiftTime signUpCount signUpEligible findConflict changeLeadShift sendNewUserEMail logit);
13
 
13
 
14
my $dbh = WebDB->connect ();
14
my $dbh = WebDB->connect ();
15
sub getRCDBH {
15
sub getRCDBH {
16
  return $dbh;
16
  return $dbh;
-
 
17
}
17
}
18
our $ORCUSER;
18
our $ORCUSER;
19
our $SYSTEM_EMAIL = 'rollercon.vorc@gmail.com';
19
use constant {
20
use constant {
20
    NOONE     => 0,
21
    NOONE     => 0,
21
    USER      => 1,
22
    USER      => 1,
Line 29... Line 30...
29
 
30
 
30
sub getAccessLevels {
31
sub getAccessLevels {
31
  my %AccessLevels = (
32
  my %AccessLevels = (
32
    -1 => "Locked",
33
    -1 => "Locked",
33
    0 => "Pending",
34
    0 => "Pending",
-
 
35
#    1 => "Volunteer",
34
    1 => "Volunteer",
36
    1 => "User",
35
    2 => "Lead",
37
    2 => "Lead",
36
    3 => "Manager",
38
    3 => "Manager",
37
    4 => "Director",
39
    4 => "Director",
38
    5 => "SysAdmin"
40
    5 => "SysAdmin"
Line 90... Line 92...
90
  		return $result;        
92
  		return $result;        
91
    } elsif ($activationcode) {
93
    } elsif ($activationcode) {
92
      # They sent an activation code
94
      # They sent an activation code
93
      if ($activationcode eq $RCDBIDHASH->{'activation'}) {
95
      if ($activationcode eq $RCDBIDHASH->{'activation'}) {
94
        # ...and it was good.
96
        # ...and it was good.
95
        $dbh->do ("update official set activation = 'active', access = 1 where RCid = ? and activation = ?", undef, $RCDBIDHASH->{'RCid'}, $activationcode);
97
        $dbh->do ("update official set activation = 'active', access = 1, last_login = now() where RCid = ? and activation = ?", undef, $RCDBIDHASH->{'RCid'}, $activationcode);
96
        logit($RCDBIDHASH->{'RCid'}, "Activated their account and logged In");
98
        logit($RCDBIDHASH->{'RCid'}, "Activated their account and logged In");
97
        # sendNewUserEMail ("Activate", $RCDBIDHASH);
99
        # sendNewUserEMail ("Activate", $RCDBIDHASH);
98
        $RCDBIDHASH->{'access'} = 1;
100
        $RCDBIDHASH->{'access'} = 1;
99
        $RCDBIDHASH->{'activation'} = "active";
101
        $RCDBIDHASH->{'activation'} = "active";
100
        $MAXACCESS = max ($MAXACCESS, 1);
102
        $MAXACCESS = max ($MAXACCESS, 1);
Line 382... Line 384...
382
  if ($time =~ / - /) {
384
  if ($time =~ / - /) {
383
    return join " - ", map { convertTime ($_) } split / - /, $time;
385
    return join " - ", map { convertTime ($_) } split / - /, $time;
384
  }
386
  }
Line 385... Line 387...
385
  
387
  
-
 
388
  $time =~ s/^(\d{1,2}:\d{2}):\d{2}$/$1/;
386
  $time =~ s/^(\d{1,2}:\d{2}):\d{2}$/$1/;
389
  $time =~ s/^0//;
387
  
390
 
388
  if ($ORCUSER->{timeformat} eq "24hr") {
391
  if ($ORCUSER->{timeformat} eq "24hr") {
389
    if ($time =~ /^\d{1,2}:\d{2}$/) { return $time; }    
392
    if ($time =~ /^\d{1,2}:\d{2}$/) { return $time; }    
390
  } else {
393
  } else {
391
    my ($hr, $min) = split /:/, $time;
394
    my ($hr, $min) = split /:/, $time;
Line 519... Line 522...
519
  }
522
  }
520
	$sth->execute($ID);
523
	$sth->execute($ID);
Line 521... Line 524...
521
	
524
	
522
	my $user = $sth->fetchrow_hashref;
525
	my $user = $sth->fetchrow_hashref;
523
	map { $user->{$_} = "" unless $user->{$_} } keys %{$user};
526
	map { $user->{$_} = "" unless $user->{$_} } keys %{$user};
524
	return $user;
527
	return $user->{RCid} ? $user : "";
Line 525... Line 528...
525
}
528
}
526
 
529
 
527
sub getUserEmail {
530
sub getUserEmail {