'; return $string; } } /** * Return links for ticketing buttons * * @version 20051130 - some reduction of junk code has been attempted by dave - no change to functionality */ /////////////////////////////////////////////////////////////////////todo $showlist may be replaced because of serial data function showTicketingButtons($testcode,$oldStatCode,$ScreeningOrder,$buyNow = FALSE, $XSL = FALSE){ global $FestShortName,$Today,$TimeNow, $OnlineStart, $CURRENT_TIMESTAMP, $PACKAGE_ONLINE_START_TIMESTAMP, $MEMBER_ONLINE_START_TIMESTAMP, $ONLINE_START_TIMESTAMP; global $TicketMode,$PkgData,$PkgTixAllowed,$TX_CONFIG,$FG_TIXTYPES; static $btcount = 0; $btcount++; $ButtonImage = "images/actions/"; // set a default gif path to which we will add our gif $HrefLink = '#'; // default href - makes it easier to code rollovers in future $oldStatCode = "junk"; // we set this below anyways (used to be called $StatusCode) // test the status to make sure tickets are available //$FestYear = '2006'; $FestYear = date('Y'); //$FestYear = date('Y')-1; $sql = "SELECT FG_SCHEDULE.ScreeningDate, FG_SCHEDULE.ScreeningTime, FG_SCHEDULE.TicketType, FG_SCHEDULE.Status, FG_SCHEDULE.Venue FROM FG_SCHEDULE WHERE FG_SCHEDULE.ProgCode='". substr($testcode,0,5) ."' AND FG_SCHEDULE.ScreeningDate='". $FestYear . substr($testcode,5,2) . substr($testcode,7,2) ."' AND FG_SCHEDULE.Sequence='".substr($testcode,9)."'"; $tres = mysql_query($sql)or niceDie(__FILE__,__LINE__,__FUNCTION__,mysql_error()); $avail = mysql_fetch_assoc($tres); // print_r($avail);die('testing'); $TType = $avail['TicketType']; $TDesc = $avail['TicketDesc']; $StatusCode = $avail['Status']; $AMCShowVenue = $avail['Venue']; $AMCShowDate = substr($testcode,5,2) . substr($testcode,7,2); if( $avail['ScreeningTime'] == '24:00' ) { $avail['ScreeningTime'] = '23:59'; } if( strtotime($avail['ScreeningTime']) == -1 && intval(substr($avail['ScreeningTime'],0,2)) >= 24 ) { //Not in an understandable format for strtotime. $ExpTime = explode(':',$avail['ScreeningTime']); $avail['ScreeningDate'] = date('Y-m-d', strtotime($avail['ScreeningDate'].' +1 day') ); $avail['ScreeningTime'] = intval($ExpTime[0] - 24).':'.$ExpTime[1]; } $ShowStartTime = strtotime("{$avail['ScreeningDate']} {$avail['ScreeningTime']}"); $TNow = strtotime("$Today $TimeNow"); $ButtonImagePKG = ''; // DEBUG STUFF //if($_SERVER['REMOTE_ADDR'] == '205.250.249.253') { //echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; //echo "\n\n"; //} //echo ""; $test_messages['TStatus'] = $TNow.' > '.$ShowStartTime; if($TNow > $ShowStartTime){ $ButtonImage .= "past.gif"; $alttext = "This event is already past"; } else { if($StatusCode == "0") { //make sure that the user has not already added the ticket to the planner $scrn_added = false; global $CartData; if( count($CartData['Screenings']) ) { foreach( $CartData['Screenings'] as $key => $value ) { if( strstr($key,$testcode) ) $scrn_added = true; } } //if(count(preg_grep("/$testcode/",$showlist))){ if( $scrn_added ) { $ButtonImage .= ""; $ButtonImage .= "added.gif"; $alttext = "This show has already been added to your cart"; $HrefLink = "#"; } // make sure we are not past cut off else if($TNow > $ShowStartTime){ $ButtonImage .= "past.gif"; $alttext = "This event is already past"; //$alttext = "Day of show tickets are for sale exclusively at the venue box office, subject to availability. Venue box offices open 1 hour prior to the first screening of the day. Cash or vouchers only"; } // if the show is not past, but we are beyond cut off time //else if($TNow > $Cutoff){ else if(showIsCutoff($avail['ScreeningDate'],$avail['ScreeningTime'])){ $ButtonImage .= "cutoff.gif"; $alttext = "It is past the cut off time to purchase tickets for this event"; } // if everything else checks out, the ticket should be made available else { if( $TicketMode == 'PKG' ) { // check each allocation type for this order to make // sure that this ticket is available to this order if(in_array($TType,$PkgTixAllowed)){ // format should be // Add To Cart $ButtonImagePKG = "images/tixtype/". strtoupper($TType). ".gif"; $ButtonImage .= "add.gif"; $alttext = $TDesc; $pagefrom = urlencode(basename($_SERVER['PHP_SELF'])); // TRIBECA SPECIAL - PKG FILL USES 'NORMAL' CART //$HrefLink = "Javascript:AddToPkg('$testcode','$pagefrom')"; $HrefLink = "Javascript:AddToCart('$testcode')"; } else { $ButtonImage = "images/actions/na.gif"; $alttext = "Not available to your package type"; $HrefLink = "#"; } } else { /*if( intval($FG_TIXTYPES[$TType]['TicketPrice']) == 0 && !$TX_CONFIG['FreeTixTicketed'] ) { $ButtonImage = "images/actions/na.gif"; $alttext = "Not Ticketed FREE event --"; $HrefLink = "#"; } else { */ $ButtonImage .= "add.gif"; $alttext = "Click add this show to your cart"; $HrefLink = "Javascript:AddToCart('$testcode')"; //} } } } else if($StatusCode == "1") { // Sold Out if($TNow > $ShowStartTime){ $ButtonImage .= "past.gif"; $alttext = "This event is already past"; //$alttext = "Day of show tickets are for sale exclusively at the venue box office, subject to availability. Venue box offices open 1 hour prior to the first screening of the day. Cash or vouchers only"; } else { $ButtonImage .= "soldout.gif"; $alttext = "Door Only"; //$alttext = "Advance tickets for this film are now sold out. Rush lines will form one hour prior to scheduled screening start time at the venue. Admission will begin five minutes prior to the start time on a space available basis. Cash or vouchers only."; } } else if($StatusCode == "2") { // On Hold $ButtonImage .= "onhold.gif"; $alttext = "Ticketing for this event is on hold"; } else if($StatusCode == "3") { // Cancelled $ButtonImage .= "cancelled.gif"; $alttext = "Event has been cancelled"; } else if($StatusCode == "4") { // Cancelled $ButtonImage .= "na.gif"; $alttext = "Not Ticketed; Tickets at the door, first-come, first-served"; } else if($StatusCode == "5"){ $ButtonImage .= "passesonly.gif"; $alttext = "Passes Only"; } else if($StatusCode == "6"){ $ButtonImage .= "phoneonly.gif"; $alttext = "Phone Orders Only"; } else if($StatusCode == "7"){ return; } else if($StatusCode == "8"){ $ButtonImage .= "amc.gif"; $alttext .= "Event is ticketed by AMC"; $HrefLink .= "javascript:AMCTickets('".$AMCShowVenue."','".$AMCShowDate."')"; } else if($StatusCode == "9") { $ButtonImage .= "info.gif"; $alttext = "Click for more info"; $HrefLink = "javascript:AddToCart('$testcode');"; } } $imgname = $testcode.$ScreeningOrder.$btcount; // EARLY PURCHASE STUFF $MemCookie = $FestShortName . "MEM"; $PkgCookie = $FestShortName . "PKG"; $PkgUserIDCookie = $FestShortName. 'PKGMEMBERID'; $target = ''; if($CURRENT_TIMESTAMP < $PACKAGE_ONLINE_START_TIMESTAMP && $CURRENT_TIMESTAMP < $MEMBER_ONLINE_START_TIMESTAMP){ $HrefLink = "order_error.php?ErrorCode=TOOEARLY"; } else if($CURRENT_TIMESTAMP < $PACKAGE_ONLINE_START_TIMESTAMP){ $HrefLink = "order_error.php?ErrorCode=TOOEARLY"; } $FilmNote = 0; if(basename($_SERVER['PHP_SELF']) == 'filmnote.php'){ $FilmNote = 1; } if(basename($_SERVER['PHP_SELF']) == 'eventnote.php'){ $FilmNote = 1; } if(basename($_SERVER['PHP_SELF']) == 'prognote.php'){ $FilmNote = 1; } // if($CURRENT_TIMESTAMP >= $PACKAGE_ONLINE_START_TIMESTAMP){ // if(!isset($_COOKIE[$PkgUserIDCookie])){ // $HrefLink = "packagelogin.php?AddCode=$testcode"; // if($FilmNote){ // $HrefLink = "javascript:goParent('$HrefLink')"; // } // } else if($_COOKIE[$PkgUserIDCookieName] == 'DELETED'){ // $HrefLink = "packagelogin.php?AddCode=$testcode"; // if($FilmNote){ // $HrefLink = "javascript:goParent('$HrefLink')"; // } // } // } // else if ($CURRENT_TIMESTAMP >= $MEMBER_ONLINE_START_TIMESTAMP){ // if(!isset($_COOKIE[$MemCookie])){ // $HrefLink = "memberlogin.php?AddCode=$testcode"; // if($FilmNote){ // $HrefLink = "javascript:goParent('$HrefLink')"; // } // } else if($_COOKIE[$PkgUserIDCookieName] == 'DELETED'){ // $HrefLink = "memberlogin.php?AddCode=$testcode"; // if($FilmNote){ // $HrefLink = "javascript:goParent('$HrefLink')"; // } // } // } if($ButtonImagePKG){ $ButtonImagePKG = "\"$alttext\""; } //Nantucket override //$ButtonImagePKG = ""; $ButtonImage = $TX_CONFIG['ABS_PATH'].$ButtonImage; //die($ButtonImage); $buffer = ""; if(basename($_SERVER['PHP_SELF']) == 'grid.php'){ $ButtonImagePKG = ''; $buffer='';} //if($_COOKIE["$FestShortName"] != 'DELETED'){ if( $XSL ) { if($HrefLink != "#") { $OUTPUT = "$HrefLink\n"; $OUTPUT .= "$ButtonImagePKG\n"; $OUTPUT .= "$ButtonImage\n"; $OUTPUT .= "$imgname\n"; $OUTPUT .= "$alttext\n"; return $OUTPUT; //return "$buffer"."$ButtonImagePKG\"$alttext\""."$buffer"; } else { $OUTPUT = "$HrefLink\n"; $OUTPUT .= "$ButtonImagePKG\n"; $OUTPUT .= "$ButtonImage\n"; $OUTPUT .= "$imgname\n"; $OUTPUT .= "$alttext\n"; return $OUTPUT; //return "$buffer"."$ButtonImagePKG\"$alttext\"$buffer\n"; } } if($HrefLink != "#") { //$text = "click to add to cart"; return "$buffer"."$ButtonImagePKG\"$alttext\""."$buffer"; } else { return "$buffer"."$ButtonImagePKG\"$alttext\"$buffer\n"; } } function CnvtDate($indate,$dtype = ''){ //$date in MM/DD/YYYY format //$dtype Output Type; S for Short, L for Long; X for extra long $retval = ''; $indatec = strtotime($indate); // cast as unix timestamp $thisdate = getdate($indatec); $seconds = $thisdate["seconds"]; $minutes = $thisdate["minutes"]; $hours = $thisdate["hours"]; $mday = $thisdate["mday"]; // day of month $wday = $thisdate["wday"]; // numeric weekday 0(sun) to 6(sat) $mon = $thisdate["mon"]; // numeric month 1=january $year = $thisdate["year"]; // year - numeric $yday = $thisdate["yday"]; // day of year $weekday = $thisdate["weekday"]; // full text ie Friday $month = $thisdate["month"]; // full text ie January if ($dtype == 'X') { //$retval = "$weekday, $month $mday, $year"; $retval = "$weekday, $month $mday"; } else if ($dtype == 'XL'){ $retval = "$weekday, $month $mday"; } else if($dtype == 'L'){ $weekday = substr($weekday,0,3); $month = substr($month,0,3); $retval = "$weekday $month $mday"; } else if($dtype == 'MD'){ $weekday = substr($weekday,0,3); $month = substr($month,0,3); $retval = $weekday .", " . $month . " " . $mday; } else if($dtype == 'M.D.Y'){ if(strlen($mon) == 1){ $mon = '0' . $mon; } if(strlen($mday) == 1){ $mday = '0' . $mday; } $year = substr($year, -2); $retval = "$mon.$mday.$year"; } else{ $retval = date("l, F jS",$indatec); } return $retval; } function CnvtTime($Tx) { //$Tx in HH:MM format $T = substr($Tx,0,2); $HH = substr($Tx,0,2); $MM = substr($Tx,3,2); //return($HH.":".$MM); $Tim = ""; if (($Tx == "23:59") || ($Tx == "24:00")) { return "Midnight"; } if ($Tx == "12:00") { return "Noon"; } if ($HH > 12) { $Tim = $HH - 12; $Tim = $Tim . substr($Tx,2,3); } else { $Tim = $HH . substr($Tx,2,3); } if ($HH > 11) { $Tim = $Tim . "pm"; } else { $Tim = $Tim . "am"; } if ($HH > 24 or $HH==0) { if( $HH == 24 ) { $HH = "12"; } if( $HH > 24 ) { $HH = $HH - 24; } $Tim = $HH.":".$MM."am
(after midnight)"; } if (substr($HH,0,1) == 0){ $Tim = substr($Tim,1); } return $Tim; } /// additional functions function SchedHeader() { echo "\n"; echo "

Time

\n"; echo "

Show Title

\n"; echo "

Venue

\n"; echo "

Tickets

\n"; echo "\n"; } function getNumericDate($inDate,$type){ $ShowDate = strtotime($inDate); $thisdate = getdate($ShowDate); $disp_mday = $thisdate["mday"]; if($disp_mday < 10){ $disp_mday = '0'.$disp_mday; } $disp_weekday = $thisdate["weekday"]; $disp_mon = $thisdate["mon"]; if($disp_mon < 10){ $disp_mon = '0'.$disp_mon; } $disp_year = $thisdate["year"]; $type = trim(strtolower($type)); if($type == 'year'){ return "$disp_year"; } if($type == 'month'){ return "$disp_mon"; } if($type == 'day'){ return "$disp_mday"; } else{ die('\nCall to getNumerciDate must be of the form ("(DATE STRING]","month" or "day" or "year"'); } } function printHelpButtons($from){ global $PkgFill, $SystemActive, $HTTP_COOKIE_VARS, $FestShortName,$TX_CONFIG; if ($PkgFill) { echo "\n"; } else { echo "\"Online\n"; } echo 'Go To Checkout'."\n"; /* $memcookie = $HTTP_COOKIE_VARS[$FestShortName."MEM"]; if($memcookie && $memcookie != 'DELETED'){ echo "\n"; } else { echo "\n"; } */ } /*function getUserShowList(){ global $FestShortName,$PkgFill,$CryptKey,$HTTP_COOKIE_VARS; $UserShowList = array(); if($PkgFill) { $PkgCookie = $FestShortName . "PKG"; $OrderNum = $HTTP_COOKIE_VARS[$PkgCookie]; if(strlen($CryptKey) > 0){ $OrderNum = decrypt_value($OrderNum); } $sql = "SELECT Screening FROM PKGTX_ORDERB where OrderNum='$OrderNum' order by Screening"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { array_push ($UserShowList,trim($row["Screening"])); } } else { $OrderNum = $HTTP_COOKIE_VARS["$FestShortName"]; if(strlen($CryptKey) > 0){ $OrderNum = decrypt_value($OrderNum); } $sql = "SELECT Screening FROM TX_ORDERB where OrderNum='$OrderNum' order by Screening"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { array_push ($UserShowList,trim($row["Screening"])); } } return $UserShowList; }*/ //////////////////////////////////////////////////////////////////////////////// //FILM NOTE SPECIFIC FUNCTIONS /** * DEPRECATED: use admin_populate_countries to populate countries * into EVENTS.Country, then display that. Prevents several extra * SQL queries. dt - 20060321 */ function GetCountryList($EventNumber) { $Country=''; $cnresult = mysql_query("SELECT FG_EVENTCOUNTRY.Country FROM FG_EVENTCOUNTRY WHERE FG_EVENTCOUNTRY.EventNumber='$EventNumber' ORDER BY FG_EVENTCOUNTRY.CountryDispOrder") or die(mysql_error()); $Cnt = 0; while($row = mysql_fetch_assoc($cnresult)){ $Cnt++; if ($Cnt > 1) {$Country .= ", ";} $Country .= $row["Country"]; } return $Country; } function GetCreditList($EventNumber) { $CreditList=''; $cnresult = mysql_query("SELECT FG_CASTCREDIT.CreditCaption,FG_CASTCREDIT.CreditValue FROM FG_CASTCREDIT WHERE FG_CASTCREDIT.EventNumber='$EventNumber' ORDER BY FG_CASTCREDIT.CreditOrder") or die(mysql_error()); while($row = mysql_fetch_assoc($cnresult)){ $CreditList .= "" . $row["CreditCaption"] . ": " . $row["CreditValue"] ."
"; } return $CreditList; } function GetDirectorList($EventNumber) { $DirectorList = ""; $sql = "SELECT FG_DIRECTOR.DirectorName, FG_DIRECTOR.DirBio, FG_DIRECTOR.DirectorID, FG_DIRECTOR.DirectorIMDB, FG_DIRXREF.DisplayOrder, if(LEFT(DirectorIMDB,2) = 'nm', SUBSTRING(DirectorIMDB,3), DirectorIMDB) as DirectorImdbNumber FROM FG_DIRXREF, FG_DIRECTOR WHERE FG_DIRXREF.EventNumber = '$EventNumber' AND FG_DIRECTOR.DirectorID = FG_DIRXREF.DirectorID ORDER BY FG_DIRXREF.DisplayOrder"; //echo ""; $result = mysql_query($sql) or die(mysql_error()); $director_count = mysql_num_rows($result); //OUTFEST/AFF SPECIAL FOR DIR $DirTerm = 'Created By: '; //VIFF //$DirTerm = 'Created By: '; //if($director_count > 1){ //$DirTerm = 'Directors '; //$DirTerm = 'DIR: '; //} if($director_count > 0){ $DirectorList = "$DirTerm"; } $cnt = 0; while($row = mysql_fetch_array($result)){ $cnt++; $DirectorName = trim($row["DirectorName"]); $DirBio = trim($row["DirBio"]); $DirectorID = trim($row["DirectorID"]); $DirectorIMDB = trim($row["DirectorImdbNumber"]); if( strlen( $DirBio) ) { $DirectorList .= "$DirectorName"; } else { $DirectorList .= "$DirectorName"; } //NEED TO IMPLEMENT DIRECTOR IMDB LINKS HERE... if($DirectorIMDB){ $DirectorList .= " (IMDB)"; } if($cnt < $director_count){ $DirectorList .= ",
"; } } return $DirectorList; } function EventDirectorBio($EventNumber) { $has_bio = 0; $sql = "SELECT FG_DIRECTOR.DirectorName, FG_DIRECTOR.DirBio FROM FG_DIRXREF, FG_DIRECTOR WHERE FG_DIRXREF.EventNumber = '$EventNumber' AND DIRECTOR.DirectorID = FG_DIRXREF.DirectorID ORDER BY FG_DIRXREF.DisplayOrder"; $result = mysql_query($sql) or die(mysql_error()); $director_count = mysql_num_rows($result); while($row = mysql_fetch_array($result)){ if($row['DirBio']){ $has_bio++; } } return $has_bio; } function GetLanguage($Language,$Dubbed) { trim($Language); if ($Language == 'No Dialogue') { return "(No Dialogue)"; } if ($Dubbed) { $DispLang = " (Dubbed in English)
"; } else { if ($Language and $Language != 'English'){ $DispLang = " (in $Language with English Subtitles)"; } } return $DispLang; } function simplesort ($a, $b) { if ($a == $b) return 0; return ($a < $b) ? -1 : 1; } function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "''"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "''"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "''"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "''"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } function data_fetch_assoc(&$this){ list($key,$value) = each($this); return $value; } /** * Functions for outputting the page title. * - note these are now deprecated - we should simply use the config vars * $TX_CONFIG['PAGE_TITLES'][$pagename] now. Be sure to strtolower() * your pagename before using them. * - One of these functions is simply an alias of the other * * @param string $pagename * @return string page title */ function getPageTitle($pagename){ if(empty($pagename)) { return false; } global $TX_CONFIG; $pagename = strtolower($pagename); return (!empty($TX_CONFIG['PAGE_TITLES'][$pagename])) ? $TX_CONFIG['PAGE_TITLES'][$pagename] : ""; } /** * :NOTE: this returns a completely different number than microtime(), * or even microtime(true). It returns the finest 10 digits of microtime * as an integer. */ function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); $ret = ((float)$usec + (float)$sec) * 10000; $ret = substr($ret,-10,10); return $ret; } /** * Returns BOOL cutoff status for showdate and time, date and time must work with strtotime($showdate." ".$showtime) * * @param string $showdate * @param string $showtime * @return bool * @author Dave Turner * @since 20060113 * @version original */ function showIsCutoff($showdate,$showtime) { // see these in config.php: $TX_CONFIG['CUTOFF_... // get relevant global scope vars global $TX_CONFIG, $Today, $TimeNow; // script time, adjusted if in test group $current_time = strtotime("{$Today} {$TimeNow}"); // set ref time (we assume it is showtime, but if SHOWDAY then we use 00:00 on date of show $ref_time = ($TX_CONFIG['CUTOFF_TYPE'] == "SHOWDAY") ? "00:00" : $showtime; $cutoff_time = strtotime($showdate." ".$ref_time) + $TX_CONFIG['CUTOFF_VECTOR']; //echo "time:{$current_time}:".date("r",$current_time)."
"; //echo "cutoff:{$cutoff_time}:".date("r",$cutoff_time)."
"; if($current_time >= $cutoff_time) { return TRUE; } return FALSE; } /** * Returns a reason for which a show is not available, or empty is available */ function getNotAvailMsg($status,$showdate,$showtime) { global $Today, $TimeNow; //$showserial = str_replace('-','',$showdate).str_replace(':','',$showtime); //$tserial = str_replace('-','',$Today).str_replace(':','',$TimeNow); $tserial = strtotime("$Today $TimeNow"); $showserial = strtotime("$showdate $showtime"); switch($status){ case 0: if( $tserial > $showserial ){ return "Past"; } //if( {$Today} {$TimeNow}") > strtotime($showdate . ' ' . $showtime)){ return "$Today $showdate Past"; } //if(strtotime("{$Today} {$TimeNow}") > strtotime($showdate . ' ' . $showtime)){ return "$Today $showdate Past"; } if(showIsCutoff($showdate,$showtime)){ return 'Cut-off'; } break; case 1: return "Sold Out"; break; case 2: return "On Hold"; break; case 3: return "Cancelled"; break; case 4: return "Not Available"; break; } return ''; } /** * Add an item to the cart - and check for errors - * * @param string $FCode * @param int $SESSION_ID * @return array(StatusCode,RETURN_MESSAGE,IS_ERROR) */ function addToCart($FCode,$SESSION_ID) { global $TX_CONFIG,$Today,$TimeNow,$CartData; // check emergency stop if($TX_CONFIG['EMERGENCY_STOP']) { $RETURN_MESSAGE = "We're sorry, but the connection to our system is currently unavailable. Please try again in a few minutes. Thanks for your patience, and we apologize for the inconvenience. Please note that you may continue to browse the filmguide, and that if you already have tickets in your cart, you will be able to check out soon."; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } // check status first to limit database load $sql = "SELECT MIN(ScreeningDate) AS StartDate FROM FG_SCHEDULE"; $tres = mysql_query($sql); $sched_data = mysql_fetch_assoc($tres); $START_DATE = $sched_data['StartDate']; $START_YEAR = substr($START_DATE,0,4); $CheckDate = $START_YEAR . '-' . substr($FCode,5,2) . '-' . substr($FCode,7,2); $sql = "SELECT * FROM FG_SCHEDULE WHERE FG_SCHEDULE.ProgCode = '" . substr($FCode,0,5) . "' AND FG_SCHEDULE.ScreeningDate='{$CheckDate}' AND FG_SCHEDULE.Sequence='".substr($FCode,9,1) . "'"; $tres = mysql_query($sql); $sched_data = mysql_fetch_assoc($tres); $show_status = $sched_data['Status']; if($show_status == '1'){ $RETURN_MESSAGE = "We're sorry but this show is now SOLD OUT for advance tickets (tickets may be available at the door just before showtime). Please make another selection."; $IS_ERROR = 1; $StatusCode = "SOLDOUT"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } if($show_status == '2'){ $RETURN_MESSAGE = "We're sorry but this show has been placed ON HOLD and we cannot issue tickets for it (they may become available again however). Please make another selection."; $IS_ERROR = 1; $StatusCode = "ONHOLD"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } if($show_status == '3'){ $RETURN_MESSAGE = "We're sorry but this show has been CANCELLED. Please make another selection."; $IS_ERROR = 1; $StatusCode = "CANCELLED"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } if($show_status == '9'){ $RETURN_MESSAGE = $sched_data['StatusMessage']; $IS_ERROR = 1; $StatusCode = "INFO"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } // check max shows //todo user data thingy /* $sql = "SELECT * FROM TX_ORDERB WHERE SessionID = '{$SESSION_ID}';"; $tres = mysql_query($sql); $number_of_shows = mysql_num_rows($tres); */ //if($number_of_shows >= $TX_CONFIG['MaxOrderLines']) { if( is_array($CartData['Screenings']) && count($CartData['Screenings']) >= $TX_CONFIG['MaxOrderLines'] ) { $RETURN_MESSAGE = "You have already have the maximum number of shows ({$TX_CONFIG['MaxOrderLines']}) in your cart. Please continue to the checkout to complete your order."; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } // check cart status $CART_STATUS = ''; //todo this will be done using the user data class /* $sql = "SELECT Status FROM TX_ORDERH WHERE SessionID = '{$SESSION_ID}'"; $tres = mysql_query($sql); if( mysql_num_rows($tres) ) { $orderh_data = mysql_fetch_assoc($tres); $CART_STATUS = $orderh_data['Status']; } */ //if( mysql_num_rows($tres) == 0 ){ if( !is_array($CartData['Screenings']) ) { $RETURN_MESSAGE = 'It appears that your order details are no longer on file. This probably means that you took too long to complete your order (#' . $OrderNumber . ') and it has been deleted. You can start again by clicking an ADD button and logging in to the system again.'; //setcookie($TX_CONFIG[$FestShortName],'DELETED',time() - 100000,'/',$TX_CONFIG['COOKIE_DOMAIN_NAME']); removeCookie(); $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } if( is_array($CartData['Screenings']) && isset($CartData['Screenings'][$_GET['FCode']]) ){ $RETURN_MESSAGE = 'That show ('. $_GET['FCode'] .') was already added to your Cart!'; $IS_ERROR = 1; $StatusCode = "ADDED"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } //todo delete this code, using serialized cart data this condition shouldn't occure /* if($CART_STATUS == 'COMPL' || $CART_STATUS == 'DONE'){ $RETURN_MESSAGE = 'It appears that your order has already been completed. You may need to click a CLEAR CART button to start a new order.'; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } */ // check cart contents //todo this will be done using the user data class /* $sql = "SELECT Screening FROM TX_ORDERB WHERE SessionID = '{$SESSION_ID}'"; $tres = mysql_query($sql); while( $tscrn = mysql_fetch_assoc($tres) ) { $CART_SCREENINGS[] = $tscrn['Screening']; } if(empty($CART_SCREENINGS)) { $CART_SCREENINGS = array(); } if(in_array($FCode,$CART_SCREENINGS)){ */ // get the full show info now $sql = "SELECT FG_SCHEDULE.Status, FG_SCHEDULE.ScreeningDate, FG_SCHEDULE.ScreeningTime, FG_SCHEDULE.Venue, FG_SCHEDULE.TicketType, FG_PROGRAMMES.ProgTitle, FG_VENUES.VenueName FROM FG_SCHEDULE, FG_PROGRAMMES, FG_VENUES WHERE FG_SCHEDULE.ProgCode = '" . substr($_GET['FCode'],0,5) . "' AND FG_SCHEDULE.ScreeningDate='{$CheckDate }' AND FG_SCHEDULE.Sequence='".substr($_GET['FCode'],9) . "' AND FG_PROGRAMMES.ProgCode=FG_SCHEDULE.ProgCode AND FG_VENUES.VenueCode=FG_SCHEDULE.Venue"; $tres = mysql_query($sql); $row_SHOWINFO = mysql_fetch_assoc($tres); $CurrentTimeStamp = $Today . $TimeNow; $ShowTimeStamp = substr($row_SHOWINFO['ScreeningDate'],0,4) . substr($row_SHOWINFO['ScreeningDate'],5,2) . substr($row_SHOWINFO['ScreeningDate'],8,2) . substr($row_SHOWINFO['ScreeningTime'],0,2) . substr($row_SHOWINFO['ScreeningTime'],3,2) . "00"; $ShowTime = strtotime($row_SHOWINFO['ScreeningDate'] . ' ' . $row_SHOWINFO['ScreeningTime'] . ':00'); if( mysql_num_rows($tres) == 0 ){ $RETURN_MESSAGE = "We're sorry but we can't find the show you requested (".substr($_GET['FCode'],0,5)." on ".$CheckDate."). Please make another selection."; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } if($CurrentTimeStamp >= $ShowTimeStamp){ $RETURN_MESSAGE = "You cannot select this show because it has already played! Please make another selection."; $IS_ERROR = 1; $StatusCode = "PAST"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } // add the show if(!$IS_ERROR){ $Line = count($CART_SCREENINGS) + 1; //todo this will be done in the user data class //$sql = "INSERT INTO TX_ORDERB (SessionID,Line,Screening,TixType,TixPrice,Quantity,Time,Status,QtyAuthd) VALUES ('{$SESSION_ID}','{$Line}','{$_GET['FCode']}','','0','0','','','0')"; //mysql_query($sql); global $CartData,$UserData; $CartData['Screenings'][$_GET['FCode']]['Line'] = $Line; $UserData->store_value("CartData",$CartData); $RETURN_MESSAGE = "" . $row_SHOWINFO['ProgTitle'] . "
on " .CnvtDate($row_SHOWINFO['ScreeningDate']).' '.CnvtTime($row_SHOWINFO['ScreeningTime']). "
at the " .$row_SHOWINFO['VenueName']. "
has been added to your cart.."; //$RETURN_MESSAGE = "" . $row_SHOWINFO['ProgTitle'] . "
on " . date("l, F jS, Y, g:i a",$ShowTime) . "
at the " .$row_SHOWINFO['VenueName']. "
has been added to your cart."; $IS_ERROR = 0; $StatusCode = "ADDED"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } } /** * CUSTOM IFFBOSTON ADD MERCH */ function addMerchToCart($FCode,$SESSION_ID) { global $TX_CONFIG,$Today,$TimeNow,$merchandise,$UserData, $CartData,$_GET; // check emergency stop if($TX_CONFIG['EMERGENCY_STOP']) { $RETURN_MESSAGE = "We're sorry, but the connection to our system is currently unavailable. Please try again in a few minutes. Thanks for yo ur patience, and we apologize for the inconvenience. Please note that you may continue to browse the filmguide, and that if you already have tickets in your cart, you will be able to check out soon."; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } // check max shows $number_of_shows = count($CartData['Screenings']); if($number_of_shows >= $TX_CONFIG['MaxOrderLines']) { $RETURN_MESSAGE = "You have already have the maximum number of shows/items ({$TX_CONFIG['MaxOrderLines']}) in your cart. Please continue to the checkout to complete your order."; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } // prices $Price = 0; $Name = ''; $MCode = substr($_GET['FCode'],1,5); $MPrefix = substr($MCode,0,3); // Chris - add this to the main line $sql = " SELECT MERCH_PRODUCTS.Name, MERCH_PRODUCTS.Description, MERCH_PRODUCTS.Price AS ProductPrice, MERCH_PRODUCTS.SalePrice AS ProductSalePrice, MERCH_PRODUCTS.OnSale AS ProductOnSale, MERCH_ITEMS.ItemPrice, MERCH_ITEMS.SalePrice, MERCH_ITEMS.OnSale, MERCH_ITEMS.SizeCode, MERCH_ITEMS.BaseSKU, MERCH_ITEMS.ExternalSKU, MERCH_ITEMS.StyleCode, MERCH_ITEMS.SizeCode, MERCH_ITEMS.ColorCode, MERCH_ITEMS.ItemPrice, MERCH_ITEMS.SalePrice, MERCH_ITEMS.OnSale, MERCH_ITEMS.ShipSizeCode, MERCH_ITEMS.SoldOut, MERCH_ITEMS.TixSYSCode, MERCH_ITEMS.Hide FROM MERCH_PRODUCTS, MERCH_ITEMS WHERE MERCH_ITEMS.ExternalSKU = '{$MCode}' AND MERCH_ITEMS.BaseSKU = MERCH_PRODUCTS.BaseSKU "; //print ""; $mres = mysql_query($sql); if( mysql_num_rows($mres) == 0 ) { $RETURN_MESSAGE = "Product has not been found"; $IS_ERROR = 1; $StatusCode = "ERROR"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } /* if($_GET['FCode'] == 'iHODSM'){ $Price = 120; $Name = 'All-Access VIP Pass'; } */ $mdata = mysql_fetch_assoc($mres); $sres = mysql_query("SELECT * FROM MERCH_SIZES WHERE SizeCode = '{$mdata['SizeCode']}'"); $sdata = mysql_fetch_assoc($sres); // check cart status $CartData['Screenings'][$_GET['FCode']]['Price'] = $mdata['Price']; // Chris, add this to the main line //price calc // we check to see if the item has and individual price and override the product price with it, if so. if($mdata['ItemPrice'] > 0 && $mdata['ItemPrice'] != $mdata['ProductPrice']){ $mdata['ProductPrice'] = $mdata['ItemPrice']; } if(strtolower($mdata['OnSale']) == 'y' || $mdata['OnSale'] == 1){ $mdata['ProductOnSale'] = 'Y'; $mdata['ProductSalePrice'] = $mdata['SalePrice']; } // mow we set the product price $MerchItemPrice = $mdata['ProductPrice']; // if the product is on sale, we use the prodct line sale price if(strtolower($mdata['ProductOnSale']) == 'y' || $mdata['ProductOnSale'] == 1){ $MerchItemPrice = $mdata['ProductSalePrice']; } $CartData['Screenings'][$_GET['FCode']]['Price'] = $MerchItemPrice; $CartData['Screenings'][$_GET['FCode']]['Name'] = $mdata['Name']; $CartData['Screenings'][$_GET['FCode']]['Size'] = $sdata['Size']; $UserData->store_value("CartData",$CartData); $RETURN_MESSAGE = "
{$mdata['Name']} - {$sdata['Size']}.
Has been added to your cart.
"; $IS_ERROR = 0; $StatusCode = "ADDED"; return(array("StatusCode" => $StatusCode,"RETURN_MESSAGE" => $RETURN_MESSAGE,"IS_ERROR" => $IS_ERROR)); } /** * Reads cookie and returns value or false if cookie is not set, or if it == "DELETED" * - optional var $name will be appended to the application default of FestShortName * * @param string $name * @return value | false */ function readCookie($name="") { global $TX_CONFIG; if(!isset($_COOKIE[ $TX_CONFIG['FestShortName'].$name ])) { return false; } if($_COOKIE[ $TX_CONFIG['FestShortName'].$name ] == "DELETED") { return false; } return $_COOKIE[ $TX_CONFIG['FestShortName'].$name ]; } /** * Writes a value into cookie * - optional second var, $name, will be appended to the application default of FestShortName * - optional third var will specify the expiry, which will default to 0, for end of session * * @param string $value * @param string $name * @param unknown_type $expiry */ function writeCookie($value,$name="",$expiry=0) { global $TX_CONFIG; //print $TX_CONFIG['FestShortName']; setcookie($TX_CONFIG['FestShortName'].$name,$value,$expiry,"/",$TX_CONFIG['COOKIE_DOMAIN_NAME']); } /** * Removes a cookie spcified by optional argument $name, which will be appended to application default of FestShortName * * @param string $name */ function removeCookie($name="") { global $TX_CONFIG; setcookie($TX_CONFIG['FestShortName'].$name,"DELETED",time()-86400,"/",$TX_CONFIG['COOKIE_DOMAIN_NAME']); } function hash_replace($hash_data, $template) { if( count($hash_data) == 0 ) return($template); foreach( $hash_data as $pattern => $data ) { $template = str_replace("{{".$pattern."}}",$data,$template); } return($template); } function f2s($filename) { $fhandle = fopen($filename,'r'); $returnstring = fread($fhandle,filesize($filename)); fclose($fhandle); //$returnstring = conv_brackets($returnstring); return($returnstring); } ?> 3600 ) { //niceErrorSend($parseme[0]); mail("jestersi@gmail.com","bala",$parseme[0]); touch($pgfd); } } return($parseme[0]); } } function niceErrorSend($string) { global $TX_CONFIG; if(!empty($TX_CONFIG['SMS_TIMEOS_TO'])) { foreach($TX_CONFIG['SMS_TIMEOS_TO'] as $sms_recipient) { mail($sms_recipient,"{$TX_CONFIG['FESTSHORTNAME']}",$string); } } } function writeLog($logfile,$message='.'){ global $_COOKIE; if($logfile){ $log_message = date("[d-M-Y H:i:s]") . " " . $message . "\n"; if (is_writable($logfile)) { if (!$handle = fopen($logfile, 'a')) { header("Location: {$TX_CONFIG['ABS_PATH']}error.php?ErrorCode=CONFIGLOG&EXT=A"); exit(0); } if (fwrite($handle, $log_message) === FALSE) { header("Location: {$TX_CONFIG['ABS_PATH']}error.php?ErrorCode=CONFIGLOG&EXT=W"); exit(0); } fclose($handle); } else { header("Location: {$TX_CONFIG['ABS_PATH']}error.php?ErrorCode=CONFIGLOG&EXT=N"); exit(0); } } } ?> 5) ){ $GRID_COMPAT=1; }; if( ($BROWSER_NAME == "MSIE") && ($BROWSER_VERSION > 4) ){ $GRID_COMPAT=1; }; if( ($BROWSER_NAME == "Opera") && ($BROWSER_VERSION > 5) ){ $GRID_COMPAT=1; }; if( ereg("Firebird",$ClientAgent) && ereg("Firebird",$ClientAgent)){ $FIREBIRD=1; }; if( ereg("Firebird",$ClientAgent) && ereg("Firebird",$ClientAgent)){ $GRID_COMPAT=1; }; if( ereg("Firefox",$ClientAgent) && ereg("Firefox",$ClientAgent)){ $GRID_COMPAT=1; }; ////////// // predeclare all variabels 'casue the server debug options will drive me nuts $Country = ''; $DirBio = ''; $DirectorIMDB = ''; $DirID = ''; $DirTerm = ''; $DirectorName = ''; $Color = ''; $ProgCode = ''; $EventNote = ''; $EventNumber = ''; $EventTitle = ''; $ProgTitle = ''; $EventSortTitle = ''; $ProgSortTitle = ''; $ForeignTitle = ''; $IMDBFilm = ''; $Language = ''; $PSource = ''; $ProgRunTime = ''; $RunTime = ''; $EventSection = ''; $ProgSection = ''; $EventType = ''; $ProgType = ''; $Website = ''; $EventYear = ''; $FS_Type = ''; //is this a real var or a typo?? $PS_Address1 = ''; $PS_Address2 = ''; $PS_City = ''; $PS_Company = ''; $PS_Contact = ''; $PS_Country = ''; $PS_EMail = ''; $PS_Fax = ''; $PS_Phone = ''; $PS_State = ''; $PS_WebSite = ''; $PS_Zip = ''; $AllocType = ''; $ColourCode = ''; $ScreeningDate = ''; $SectionName = ''; $Sequence = ''; $Status = ''; $TicketType = ''; $ScreeningTime = ''; $ScreeningDate = ''; $Venue = ''; $TicketPrice = ''; $DispVenName = ''; $VenueCode = ''; $VenueName = ''; $where_clause = ''; if($HTTP_COOKIE_VARS[$FESTSHORTNAME] == 'DELETED'){ unset($HTTP_COOKIE_VARS[$FESTSHORTNAME]); } $MemCookie = $FESTSHORTNAME . "MEM"; $PkgCookie = $FESTSHORTNAME . "PKG"; $PkgUserIDCookie = $FESTSHORTNAME. 'PKGMEMBERID'; if($HTTP_COOKIE_VARS[$MemCookie] == 'DELETED') { unset($HTTP_COOKIE_VARS[$MemCookie]); } if($HTTP_COOKIE_VARS[$PkgCookie] == 'DELETED') { unset($HTTP_COOKIE_VARS[$PkgCookie]); } // netscape 7 bugfix - KIM 20021021 ?>