#!/usr/local/bin/perl -w use lib "/home/heineman/public_html/cgi-bin/meeting/2.0/"; use CGI ":standard"; use DBI; use private::config; use private::system; use private::security::htaccess; # The main task of this script is to allow users to set up appointments # based upon a given calendar file. The format of the input files are: # # Day Start End Person Attributes Entry # # for example: # # Apr 15|9:00|9:20|conf=983 email=heineman@cs.wpi.edu|George Heineman # # stands for a meeting at 9:00 lasting until 9:20 that George Heineman has # placed on the schedule. Some other entity is responsible for known that # this is Matt Ward's schedule. # # attribute for a meeting can be: # free (0 for free, 1 for not free) # conf (confirmation number) # email (email of person with appointment) # # Users can 1) query for free slots (by day, by time) # 2) make an appointment (day/time) # 3) remove an appointment (if they know the confirmation #) # 4) Ask sysadmin to clear an appointment # # Sysadmins can 1) generate schedule for day or week # 2) remove an appointment (day/time); this will send email # to the participant # 3) #===========REQUIRED FILES============== use private::globals; use private::scheduleD; use private::unschedule; use private::template; use private::meeting; use private::show; use private::close; use private::sysadmin; use private::search; use db::mysql; #=========== SECURITY CHECK ================================ ## security_require(); #=========== REQUIRED VARIABLES ============================ $CGI::POST_MAX=100000; # limit upload size #=========== DATABASE CONNECT ============================== database_connect () or die ('Error: Could not connect to the database.'); #=========== LOAD DATA ===================================== my $action = param('action'); # Everything must start with this # ------------------------------- mimeHeader(); standardHeader(); # connect to database ##database_connect(); # DETERMINE if active software (i.e., are we being patched/repaired?) # print "action:$action\n"; if (!&isActiveSoftware()) { print "

Site is inactive

"; print "The Meeting Scheduler Software has been temporarily disabled while important maintance is being performed. We aplogize for any inconvenience. Please contact the meeting administrator."; my ($msg) = &systemMessage(); my ($ts) = &systemMessage(); print "
"; print "Deactivation Message:$msg ($ts)

"; print "

Current time:"; $t = localtime; print "$t"; print "
\n"; &standardTrailer(); database_disconnect(); exit(0); } # Now see if we can configure. Sets up $private::globals::Gmeeting # ------------------------------------------------------------------- &configure() || die "\n"; # These commands present an interface to the user, but do not update # any information. Thus there is no need to check for the setupcode # ------------------------------------------------------------------ if ($action eq $GScheduleD) { &unscheduleD($private::scheduleD::RealScheduleD); &standardTrailer(); exit(0); } elsif ( $action eq $GUnScheduleD) { &unscheduleD($private::scheduleD::RealUnScheduleD); &standardTrailer(); exit(0); } elsif ($action eq $GShow) { &showSchedule($private::globals::Gmeeting, param('participant'), param('month')); &standardTrailer(); exit(0); } elsif ($action eq $GSearchA) { &searchA(); &standardTrailer(); exit(0); } elsif ($action eq $GSearchM) { &searchM(); &standardTrailer(); exit(0); } # administrator stuff: Only check if the meeting HAS an administrator code # AND the user has it within their form. ###if (($private::globals::GadminCode ne "") && param($private::globals::GAdminCodeKey) ne "") { ### # check it against parameter ### # -------------------- ### if (param($private::globals::GAdminCodeKey) ne $private::globals::GadminCode) { ### ### &contactAdmin($GBadCode); ### ### print "You have entered an invalid administrator code. This code is used to prevent unauthorized access to the given meeting scheduler.

"; ### ### &standardTrailer(); ### database_disconnect(); ### exit (0); ### } ### ### ### if ($action eq "editWeekly") { ### &editWeekly(); ### } elsif ($action eq $private::globals::GCloseTime) { ### &showClose(); ### } elsif ($action eq $private::template::EditTemplate) { ### &realEditTemplate(param('participant')); ### } elsif ($action eq $private::template::UpdateTemplate) { ### &realUpdateTemplate(); ### } elsif ($action eq $GRealCloseTime) { ### &closeParticularTime(param('participant'), param($GMonth), param($GDay)); ### } elsif ($action eq $private::close::CloseOnlyTheseTimes) { ### &specialClose(param('participant'),param($private::globals::GMonth), ### param($private::globals::GDay)); ### } elsif ($action eq $private::close::SpecialDayClose) { ### &specialDayClose(param('participant'), ### param($private::globals::GMonth), ### param($private::globals::GDay)); ### } elsif ($action eq $private::close::SpecialWeekClose) { ### &specialWeekClose(param('participant')); ### } elsif ($action eq $GOpenSlot) { ### &openSlot(); ### } elsif ($action eq $GCloseSlot) { ### &closeSlot(); ### } ### ### &standardTrailer(); ### database_disconnect(); ### exit(0); ###} # From now on out, must check for setup code if ($private::globals::Gsetupcode) { if (param($private::globals::GCode) ne $private::globals::Gsetupcode) { &contactAdmin($GBadCode); print "You have entered an invalid setup code. This code is used to prevent unauthorized access to the given meeting scheduler.

"; &standardTrailer(); exit (0); } } $private::globals::includeHiddenForm = 1; ##print "$action,$private::scheduleD::RealUnScheduleD\n"; # Now the "inner" interface # ---------------------------------------- if ($action eq $GFindPrevious) { &findPrevious(); } elsif ($action eq $GFindAvailable) { &findAvailable(param('participant'), param('timeslot'), param('weekday'), param('month'), param('year'), param('singleday')); } elsif ($action eq $private::show::RealShowSchedule) { &showRealSchedule(param('meetingid'), param('participant'), param($GMonth), param($GWeekIndex)); } elsif ($action eq $private::scheduleD::SelectWeek) { &jumpScheduleD(param('meetingid'), param($GIntent), param($private::globals::GMonth), param($private::globals::GWeekIndex)); } elsif ($action eq $private::scheduleD::JumpWeek) { &jumpScheduleD(param('meetingid'), param($GIntent), param($private::globals::GMonth), param($private::globals::GWeekIndex)); } elsif ($action eq $private::scheduleD::RealScheduleD) { &realScheduleD(param('meetingid'), $GFree, param($private::globals::GWeekIndex)); } elsif ($action eq $private::scheduleD::RealUnScheduleD) { &realScheduleD(param('meetingid'), $GCancel, param($private::globals::GWeekIndex)); } elsif ($action eq $GFree) { # user clicked on a free slot &askUserToConfirmSchedule(param('meetingid'), param('participant')); } elsif ($action eq $GCancel) { # user wants to cancel a meeting &askUserToConfirmUnSchedule(param('participant')); } elsif ($action eq $private::scheduleD::MakeMeeting) { # Make the meeting now &makeMeeting(param('meetingid'), param('participant'), param($private::globals::GDayslot), escapeHTML(param('name')), escapeHTML(param($private::globals::GEmail))); } elsif ($action eq $private::unschedule::UnScheduleMeeting) { # Cancel the meeting now &unscheduleMeeting(param('participant')); } elsif ($action eq $private::unschedule::UnScheduleMeetingAdmin) { # Cancel by admin &unscheduleMeetingAdmin(param('participant')); } else { print "Unrecognized arguments passed to MAIN web script
"; print $#ARGV . " arguments
"; foreach $i (0..$#ARGV) { print "$ARGV[$i]
\n"; } print "action: " . $action . "
\n"; } # Always ends with this # --------------------- &standardTrailer(); # terminate connections database_disconnect(); exit(0);