session_start();
require_once '/home/mcinnis/public_html/antique-auctions/auctionsConfig.inc.php';
require_once '/home/mcinnis/public_html/include/uifunctions.php';
require_once '/home/mcinnis/public_html/include/config.inc.php';
dbConnect();
//assign get var to local var - code written with register globals
$auctionid = $_GET['auctionid'];
if(!is_numeric($auctionid))
{
print "You have reached this page in error - no auction selected";
exit;
}
//get auction details
$selectSQL = "SELECT auctions.auctionid, auctions.title, auctions.description, auctions.sale_description, DATE_FORMAT(auctions.date, '%W %M %e, %Y') as display_date, lots.lotid FROM auctions LEFT JOIN lots ON auctions.auctionid = lots.auctionid WHERE auctions.auctionid = '$auctionid' LIMIT 1";
$selectresult = mysql_query($selectSQL); geterrors($selectresult);
$auctionrow = mysql_fetch_array($selectresult);
//get related links for this auction
$selectAuctionLinksSQL = "SELECT auctionlinks.* FROM auctionlinks WHERE auctionlinks.auctionid = '$auctionid'";
$linkresult = mysql_query($selectAuctionLinksSQL); geterrors($linkresult);
//put addtional dates into a string
while($linkrow = mysql_fetch_array($linkresult)){
//does at least one link already exist?
if($additionalLinks){
//add linke break to links
$additionalLinks .= "
";
}//if additional links
//is the text generic, 'Related Link'?
if($linkrow['linktext'] == 'Related Link'){
//url without http
$url_without_prefix = str_replace('http://', '', strtolower($linkrow['url']));
//we have generic link text, so show something specific about the file
$display_filename = ': ' . substr($url_without_prefix, strpos($url_without_prefix, '/'), 35);
}//if linktext generic
else{
$display_filename = '';
}//else
//add this link to cumulative var
$additionalLinks .= "
" . $linkrow['linktext'] . "$display_filename";
//does link description exist?
if($linkrow['linkdesc']){
//add link text to additional links
$additionalLinks .= " - " . $linkrow['linkdesc'] . "";
}//if linkdesc
}//while link row
//get any extra dates for this auction
$selectAuctionDatesSQL = "SELECT DATE_FORMAT(auctiondates.date, '%W %M %e') as full_date FROM auctiondates WHERE auctiondates.auctionid = '$auctionid'";
$dateresult = mysql_query($selectAuctionDatesSQL); geterrors($dateresult);
//put addtional dates into a string
while($daterow = mysql_fetch_array($dateresult))
$additionalDates .= $daterow['full_date'] . " and
";
//if related link exists, create a row
if($additionalLinks){
$html_related_link_row .= "
|
$additionalLinks
|
";
}//if additional links
else{
$html_related_link_row .= "";
}//else
//set width of auction pic
$auction_pic_width = SLIDER_PHOTO_WIDTH_PIXELS;
//max photos for slideshow
$max_photos_slideshow = 8;
//do lots exist? if so, we link to catalog
if($auctionrow[lotid]){
//set html for auction catalog link
$html_auction_catalog_link = "View Auction Catalog";
$html_catalog_link_row = "| $html_auction_catalog_link |
";
$html_auction_catalog_top = " | $html_auction_catalog_link";
}//if lotid
//get any auction pics from db
$selectAuctionPicSQL = "SELECT auctionpics.filename, auctionpics.sequence, auctionpics.width, auctionpics.height, auctionpics.auctionpicid FROM auctionpics WHERE auctionpics.auctionid = '" . $auctionrow['auctionid'] . "' ORDER BY auctionpics.sequence ASC, auctionpics.auctionpicid ASC";
$auctionpicresult = mysql_query($selectAuctionPicSQL); geterrors($auctionpicresult);
//set url for all photos
$url_all_photos = AUCTIONS_URL . "/auctionPhotos.php?auctionid=" . $auctionrow[auctionid];
//loop through auction pic results and add to html row
while($auctionpicrow = mysql_fetch_array($auctionpicresult))
{
if($auctionpicrow['filename'] AND $auction_pic_count < $max_photos_slideshow)
{
$array_image_size = getimagesize('http://www.mcinnisauctions.com' . IMG_DIR_URL . "/" . $auctionpicrow['filename']);
//is this a tall image or a wide image?
//is width greater than height?
if($array_image_size[0] > $array_image_size[1]){
//image is wide. must cap the width of this image
$query_string_param = 'w=';
}//if width greater than height
else{
//image is tall, must cap height
$query_string_param = 'h=';
}//else its a tall image
//is this height greater than previous?
if(!isset($auction_pic_min_height) OR $array_image_size[1] > $auction_pic_min_height){
//set new min
$auction_pic_min_height = $array_image_size[1];
}//if auction pic
//add this auction pic to array
//$array_auction_pic_filenames[] = THUMB_PATH . "phpThumb.php?src=" . IMG_DIR_URL . "/" . $auctionpicrow['filename'] . "&$query_string_param$auction_pic_width";
$array_auction_pic_filenames[] = THUMB_PATH . '/' . $auction_pic_width . '/' . $auctionpicrow['filename'];
//add to html slider photos
$html_slider_images .= "
";
}//if auctionpicrow[filename]
//maintain count of auction pics
$auction_pic_count++;
}//while
//do general auction pic rows exist?
if($auction_pic_count > 1){
//create a row to link to all other photos
$html_link_to_all_photos = "$auction_pic_count Total Photos - View All Photos";
}//if generalauctionpicrows
//do ANY pics exist?
if($auction_pic_count)
{
$html_auction_pic_row = "
|
" . $html_slider_images . "
|
|
$html_link_to_all_photos
$html_auction_catalog_top
|
";
}//if auction pic count
//does sale description exist?
if($auctionrow[sale_description]){
$html_sale_description_row = "
|
$auctionrow[sale_description]
|
";
}//if auction sale description
?>
printTitle($auctionrow['title']);
navScript();
styleCSS();
?>