160 lines
8.9 KiB
Perl
160 lines
8.9 KiB
Perl
#---------------------------------------------------------------------------------
|
|
require cfg_paths ;
|
|
#---------------------------------------------------------------------------------
|
|
|
|
$useropts{domain} = "https://$ENV{SERVER_NAME}" ;
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
use session ;
|
|
&check_session ;
|
|
&session_state ;
|
|
&config_set_vars;
|
|
&check_access;
|
|
&config_set_paths ;
|
|
&config_set_breadcrumbs ;
|
|
&config_common_html ;
|
|
# &check_ticket_inbox ;
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
sub check_ticket_inbox {
|
|
|
|
# return unless $useropts{super}{$username} || $useropts{boss}{$username} || $useropts{it}{$username} ;
|
|
|
|
my $xtra_sql_where = (!$useropts{super}{$username} && !$useropts{boss}{$username} && !$useropts{it}{$username} && !$useropts{tickets}{$username}) ? " AND staff_id = '$userid'" : '' ;
|
|
|
|
&db_min_ro('tickets','COUNT(unique_id) AS ActiveTickets',"completed = '0' AND responded = '0'$xtra_sql_where",'','') ;
|
|
|
|
foreach my $count (keys %{$db{tickets}}) {
|
|
our $activetickets = "$db{tickets}{$count}{ActiveTickets}" ;
|
|
}
|
|
|
|
} #------------------------------------------------------------------------------------
|
|
|
|
sub session_state {
|
|
|
|
if ($ENV{SCRIPT_NAME} =~ m/index.pl/gi) { return ; }
|
|
if ($ENV{SCRIPT_NAME} =~ m/cron/gi) { return ; }
|
|
if ($ENV{SCRIPT_NAME} =~ m/get/gi) { return ; }
|
|
|
|
unless ($session_state eq 'active') { print 'Status: 302 Moved', "\r\n", "Location: https://$ENV{SERVER_NAME}/", "\r\n\r\n" ; }
|
|
|
|
} #------------------------------------------------------------------------------------
|
|
|
|
sub config_session_state {
|
|
|
|
# if ($ENV{SCRIPT_NAME} eq '/index.pl') { return ; }
|
|
# if (($ENV{SCRIPT_NAME} =~ m/admin/g) or ($skip_relocate)) { $skip_relocate = 1 ; return ; }
|
|
|
|
# if (($session_state eq 'expired') or ($session_state eq 'empty')) {
|
|
# print 'Status: 302 Moved', "\r\n", "Location: http://$ENV{SERVER_NAME}/", "\r\n\r\n" ;
|
|
# }
|
|
|
|
} #------------------------------------------------------------------------------------
|
|
|
|
sub check_access {
|
|
|
|
# return unless $pixellot_limit{$username} || $events_limit{$username} || $is_operator || $usertype eq 'external' || $usertype eq 'schools_manager' ;
|
|
return if $glod_user_level >= 5 ;
|
|
|
|
# my $path_prefix_ = '/cgi-bin/scripts/' ;
|
|
my $path_prefix_ = $useropts{'scripts'} . '/' ;
|
|
|
|
if ($events_limit{$username} || $glod_user_level >= 4){
|
|
$exempt_script{$path_prefix_ . 'costings_detailed_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'costings_summary_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'events_detailed_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'events_summary_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'operators_summary_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'operators_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'event_quotes_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'pdf/event_quote_pdf.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'stock_report.pl'} = 1 ;
|
|
}
|
|
|
|
$exempt_script{$path_prefix_ . 'index.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'cameras.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
|
$exempt_script{$path_prefix_ . 'cameras_report.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
|
$exempt_script{$path_prefix_ . 'delivered_report.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
|
|
|
$exempt_query{''} = 1 ;
|
|
$exempt_query{'list'} = 1 ;
|
|
|
|
if ($glod_user_level > 0) {
|
|
$exempt_script{$path_prefix_ . 'logistics_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'logistics_report_test.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'calendar.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_db_cal_events.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'fixed_systems_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/events.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'calibration_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'calibration_report_test.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'calibration_status_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/calibration_status_report_uploads.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_logistics_item.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_poc.pl'} = 1 ;
|
|
$exempt_query{$ENV{QUERY_STRING}} = 1 ;
|
|
}
|
|
|
|
if ($glod_user_level > 1) {
|
|
$exempt_script{$path_prefix_ . 'event_quotes.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'event_quotes_test.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_event_quote_conflicts.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_event_quote_conflicts_test.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_venues_from_region.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_cities_from_region.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_delete_attach.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_roe.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_city.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_school.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_sport_type.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_club.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/add_operator.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/event_email.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'dialog/email.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'pdf/event_details_pdf.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_poc_or_recipient_contact_nr.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_country_from_region.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_region_country_from_client.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_sss_teams_from_client.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_regions_from_country.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_sss_teams_from_region.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_region_from_city.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'get/get_country_and_region_from_city.pl'} = 1 ;
|
|
# $exempt_script{$path_prefix_ . 'get/get_cities_from_country.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'set_up_groups_report.pl'} = 1 ;
|
|
|
|
$exempt_query{$ENV{QUERY_STRING}} = 1 ;
|
|
$exempt_query{'edit'} = 1 ;
|
|
$exempt_query{'add'} = 1 ;
|
|
$exempt_query{'view'} = 1 ;
|
|
$exempt_query{'copy'} = 1 ;
|
|
$exempt_query{'search'} = 1 ;
|
|
}
|
|
|
|
if ($glod_user_level > 2) {
|
|
$exempt_script{$path_prefix_ . 'operators.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'monitoring_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'temp_calibrator_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'mobile_site_surveys_report.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'mobile_system_tracking_report.pl'} = 1 ;
|
|
}
|
|
|
|
if ($usertype eq 'support') {
|
|
$exempt_script{$path_prefix_ . 'demos.pl'} = 1 ;
|
|
}
|
|
|
|
if ($is_dcb_partner) {
|
|
%exempt_script = () ;
|
|
$exempt_script{$path_prefix_ . 'index.pl'} = 1 ;
|
|
$exempt_script{$path_prefix_ . 'logistics_report.pl'} = 1 ;
|
|
}
|
|
|
|
unless ($exempt_script{$ENV{SCRIPT_NAME}}) { print "Content-type: text/html\n\n"; require '401.pm' ; exit ; }
|
|
unless ($exempt_query{$ENV{QUERY_STRING}} || length($ENV{QUERY_STRING}) > 10) { print "Content-type: text/html\n\n"; require '401.pm' ; exit ; }
|
|
|
|
} #------------------------------------------------------------------------------------
|
|
|
|
1;
|