Subversion Repositories ORC

Rev

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

Rev 7 Rev 9
Line 1... Line 1...
1
## RollerCon support functions...
1
## RollerCon support functions...
Line 2... Line 2...
2
 
2
 
-
 
3
use strict;
3
use strict;
4
use cPanelUserConfig;
4
use Exporter;
5
use Exporter;
5
use CGI qw/:standard :netscape/;
6
use CGI qw/:standard :netscape/;
6
use CGI::Cookie;
7
use CGI::Cookie;
7
use DBI;
8
use DBI;
Line 48... Line 49...
48
		($encpass) = $pwdhan->fetchrow();
49
		($encpass) = $pwdhan->fetchrow();
49
	} else {
50
	} else {
50
		$encpass = $pass;		
51
		$encpass = $pass;		
51
	}
52
	}
Line -... Line 53...
-
 
53
	
-
 
54
	my $tempDepartments = convertDepartments ($RCDBIDHASH->{department});
-
 
55
	my $MAXACCESS = scalar keys %{ $tempDepartments } ? max ($RCDBIDHASH->{'access'}, values %{ $tempDepartments }) : $RCDBIDHASH->{'access'};
52
	
56
	
53
	if (!$RCDBIDHASH) {
57
	if (!$RCDBIDHASH) {
54
		$result->{ERRMSG} = "User-ID/Email Address not found!";
58
		$result->{ERRMSG} = "User-ID/Email Address not found!";
55
		$result->{cookie_string} = '';
59
		$result->{cookie_string} = '';
56
		$result->{RCid} = '';
60
		$result->{RCid} = '';
Line 60... Line 64...
60
		$result->{ERRMSG} = "Incorrect Password!";
64
		$result->{ERRMSG} = "Incorrect Password!";
61
		$result->{cookie_string} = '';
65
		$result->{cookie_string} = '';
62
		$result->{RCid} = $RCDBIDHASH->{'RCid'};
66
		$result->{RCid} = $RCDBIDHASH->{'RCid'};
63
		logit($RCDBIDHASH->{'RCid'}, "Incorrect Password");
67
		logit($RCDBIDHASH->{'RCid'}, "Incorrect Password");
64
		$result->{authenticated} = 'false';
68
		$result->{authenticated} = 'false';
65
	} elsif (max ($RCDBIDHASH->{'access'}, values %{convertDepartments ($RCDBIDHASH->{department})}) < $level) {
69
	} elsif ($MAXACCESS < $level) {
66
	  if (getSetting ("MAINTENANCE")) {
70
	  if (getSetting ("MAINTENANCE")) {
67
	    $result->{ERRMSG} = "MAINTENANCE MODE: Logins are temporarily disabled.";
71
	    $result->{ERRMSG} = "MAINTENANCE MODE: Logins are temporarily disabled.";
68
	  } else {
72
	  } else {
69
		  $result->{ERRMSG} = "Your account either needs to be activated, or doesn't have access to this page!";
73
		  $result->{ERRMSG} = "Your account either needs to be activated, or doesn't have access to this page!";
70
  		logit($RCDBIDHASH->{'RCid'}, "Insufficient Privileges");
74
  		logit($RCDBIDHASH->{'RCid'}, "Insufficient Privileges");
Line 312... Line 316...
312
      }
316
      }
313
      $hours += $s->{volhours};
317
      $hours += $s->{volhours};
314
  	}
318
  	}
315
  	$s->{role} =~ s/\-\d$//;
319
  	$s->{role} =~ s/\-\d$//;
Line 316... Line 320...
316
  	
320
  	
-
 
321
#  	push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "nowrap highlighted" : "nowrap shaded" }, join '&nbsp;&nbsp;', $s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams}, $s->{buttons});
-
 
322
#  	push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, join '&nbsp;&nbsp;', $s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams}, $s->{buttons});
317
  	push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "nowrap highlighted" : "nowrap shaded" }, join '&nbsp;&nbsp;', $s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams}, $s->{buttons});
323
  	push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, $h->div ({ class=>"lisp0" }, [ $h->div ({ class=>"liLeft" }, join '&nbsp;&nbsp;', ($s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams})), $h->div ({ class=>"liRight" }, $s->{buttons}) ]));
Line 318... Line 324...
318
  }
324
  }
319
  
325
  
320
  if (scalar @shifts) {
326
  if (scalar @shifts) {
Line 374... Line 380...
374
	use CGI qw/start_html/;
380
	use CGI qw/start_html/;
375
	use HTML::Tiny;
381
	use HTML::Tiny;
376
  my $h = HTML::Tiny->new( mode => 'html' );
382
  my $h = HTML::Tiny->new( mode => 'html' );
Line 377... Line 383...
377
  
383
  
-
 
384
#  my $logout = $h->a ({ href=>"index.pl", onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;" }, "[Log Out]");
-
 
385
  my $referrer = param ("referrer") ? param ("referrer") : $ENV{HTTP_REFERER};
-
 
386
  my $logout = (!$referrer or $referrer eq url) ? "" : $h->button ({ onClick=>"window.location.href='$referrer';" }, "Back")."&nbsp;";
378
#  my $logout = $h->a ({ href=>"index.pl", onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;" }, "[Log Out]");
387
  $logout .= url =~ /\/(index.pl)?$/ ? "" : $h->button ({ onClick=>"window.location.href='/schedule/';" }, "Home")."&nbsp;";
379
my $logout = $h->button ({ onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/'; location.href='/';" }, "Log Out");
388
  $logout .= $h->button ({ onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/'; location.href='/';" }, "Log Out");
Line 380... Line 389...
380
	my $loggedinas = $ORCUSER ? "Currently logged in as: ".$h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$ORCUSER->{RCid}" }, $ORCUSER->{derby_name})." $logout" : "";
389
	my $loggedinas = $ORCUSER ? "Currently logged in as: ".$h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$ORCUSER->{RCid}" }, $ORCUSER->{derby_name}).$h->br.$logout : "";
Line 381... Line 390...
381
  
390
  
382
  print start_html (-title=>"vORC - $PAGE_TITLE", -style => {'src' => "/style.css"} );
391
  print start_html (-title=>"vORC - $PAGE_TITLE", -style => {'src' => "/style.css"} );