function add_invitee() { global $log, $conference_id, $_POST,$data; $msgs = array(); $msgs[] = "no dice"; if ($_POST[invitee_flag] =='C'){ $msgs[] = "Company"; $invitee = new Invitee($data->db,$_POST[conference_id]) ; $invitee->username = $_POST[invitee_username] ; if (!$invitee->getInfoFromUserName() ) { $msgs[] = "Could not find all Invitee info by username, please enter info by hand."; return $msgs; } } elseif ($_POST[invitee_flag] =='O') { if (!$_POST[invitee_email] ) { $msgs[] = "No Invitee email"; return $msgs; } $invitee = new Invitee($data->db,$_POST[conference_id]) ; $invitee->inviteeName = $_POST[invitee_name] ; $invitee->inviteeEmail = $_POST[invitee_email] ; } if ($invitee->isMaxInvitee()) { $msgs[] = "This Invitee is exceeds the maximum capacity of " . $invitee->companyMaxInvitee . " for your company."; return $msgs; } $invitee->generateInviteeCode(); $invitee->create(); $invitee->sendNotify(); header("Location: cdetails.php?conference_id=$conference_id&func=view"); return $msgs; }
function create_conference() { global $log, $spUser,$_POST,$data; $msgs = array(); // check the title if (!$_POST[conference_name] ) { $msgs[] = "Conference must have a title"; return $msgs ; } // validate the date ... if (($conference_uts = strtotime($_POST[conference_date]))===false ) { $msgs[] = "Conference date is an Invalid date."; return $msgs ; } list ($m,$d,$y) = split('-',$_POST[conference_date]); // Make date objects... $confDate = new Date(); $confDate->setMonth($m); $confDate->setYear($y); $confDate->setDay($d); $confDate->setHour(0); $confDate->setMinute(0); $confDate->setSecond(0); $beginTime = $confDate; $endTime = $confDate; list ($beginHour,$beginMinute) = split(':', $_POST[begin_time] ); list ($endHour,$endMinute) = split(':', $_POST[end_time] ); $beginTime->setHour($beginHour); $beginTime->setMinute($beginMinute); $endTime->setHour($endHour); $endTime->setMinute($endMinute); // see if it's the past if ($endTime->isPast() ){ $msgs[] = "Conference date is in the Past."; return $msgs ; } // Make sure the end time is not less than the begin time if (Date::compare($endTime, $beginTime) != 1 ){ $msgs[] = "Start time must be before end time."; return $msgs ; } // create a new Conference object $conference = new Conference($data->db, $spUser->username,$spUser->domain); // get the user's company Id and load the companies constraints $conference->getCompanyId(); $conference->loadConstraints() ; // set the date objects. $conference->conferenceDate = $confDate; $conference->beginTime = $beginTime; $conference->endTime = $endTime; $conference->conferenceName = $_POST[conference_name] ; // Is the conference too long if (!$conference->isMaxTime()) { $msgs[] = "Your conference exceeds the maximum amount of minutes."; return $msgs ; } // Are there other conferences scheduled for this time. if (!$conference->isMaxConcurrent()) { $msgs[] = "Your company has other conferences scheduled for this time."; return $msgs ; } $error = "nay!"; if ($conference->create($error) ) { $msgs[] = "Conference created id = " . $conference->conferenceId; Header("Location: conference.php?msg=Conference created ") ; } else { $msgs[] = "Failed to create conference. "; $msgs[] = "$error"; } $owner = new Invitee($data->db, $conference->conferenceId); $owner->domain = $spUser->domain; $owner->username = $spUser->username; $owner->companyId = $conference->companyId; $owner->inviteeEmail = $spUser->dbFields[email_address] ; $owner->ownerFlag = 1; $owner->inviteeName = $spUser->dbFields[first_name] . " " . $spUser->dbFields[last_name] ; // genereate that unique code $owner->generateInviteeCode(); $owner->create(); $owner->sendNotify(); return $msgs ; }
return $msgs; } put_headers(); // get db connect if ($_POST[conference_id]) { $conference_id = $_POST[conference_id]; $invitee_id = $_POST[invitee_id]; } else { $conference_id = $_GET[conference_id]; $invitee_id = $_GET[invitee_id]; } $data = CData_Layer::create($errors) ; $invitee = new Invitee($data->db, $_GET[conference_id], $_GET[invitee_id] ); $invitee->get(); // get the sess, auth and perm vars page_open (array("sess" => "phplib_Session_Pre_Auth", "auth" => "phplib_Pre_Auth", "perm" => "phplib_Perm")); ## do this in every file after the page_open $perm->check('USER'); if ($perm->have_perm('SUPER')) { change_domain(); }
<? /* */ require 'prepend.php'; require 'Smarty.class.php'; require 'lib/nav.php'; require_once 'data_layer/Invitee.php'; require_once 'data_layer/Conference.php'; $data = CData_Layer::create($errors) ; $invitee = new Invitee($data->db, $_GET[conference_id], $_GET[invitee_id] ); $invitee->get(); $invitee->sendNotify(); put_headers(); header('Location: cdetails.php?conference_id='.$_GET[conference_id].'&func=view'); exit ; // get db connect // get the sess, auth and perm vars page_open (array("sess" => "phplib_Session_Pre_Auth", "auth" => "phplib_Pre_Auth", "perm" => "phplib_Perm"));