INT, 'perpage' => INT, 'cpage' => INT, 'size' => STRING, 'cat' => STRING, 'nocache' => INT,
'sortby' => STRING, 'sortdir' => STRING, 'limit' => STRING, 'way' => STRING,' sorttime' => INT,
'page' => INT, 'ppuser' => INT));
typecast($_POST, array('myzipcode' => STRING));
typecast($_COOKIE, array('zipcode' => STRING));
if ( isset($myzipcode) )
{
@setcookie( "zipcode", $myzipcode, time()+2592000, $Globals['cookie_path'], $Globals['domain_path'] );
}
function deg_to_rad($deg)
{
$radians = 0.0;
$radians = $deg * M_PI/180.0;
return($radians);
}
if ( isset($perpage) && is_numeric($perpage) )
{
if ( $perpage != $ppperpage )
{
@setcookie( "cpperpage", $perpage, time()+2592000 );
$page = 1;
}
}
authenticate();
if ( $Globals['ppboards'] == "closed" && $User['adminedit'] != 1 )
{
diewell( $Globals['closedmsg'] );
}
if ( isset($friendemail) && !strstr($friendemail,"yourfriend") )
{
if ( valid_email($friendemail) )
{
$rname = $User['username'];
$from_email = "From: {$Globals['adminemail']}";
require_once("{$Globals['PP_PATH']}/languages/$pplang/emails.php");
$letter = $Globals['pp_lang']['emailsug'];
$subject = $Globals['pp_lang']['esugsub'];
mail( $friendemail, $subject, $letter, $from_email );
forward("showcat.php?cat=$cat", $Globals['pp_lang']['linksent']);
}
}
if ( !empty($product) )
{
if ( ($User['username'] == "" || $User['username'] == $Globals['pp_lang']['unreg']) && $Globals['reqregister'] == "yes" )
{
diewell( $Globals['pp_lang']['noreg'] );
}
if ($perpage == "-1" || $perpage == "")
{
$perpage = $Globals['defaultposts'];
}
if ( isset($cat) ) $holdcat = $cat;
else $holdcat = 0;
$query = "SELECT id,user,userid,cat,date,title,price,description,keywords,bigimage,bigimage2,bigimage3,bigimage4,bigimage5,bigimage6,views,approved,rating,extra1,extra2,extra3,extra4,extra5,extra6,disporder,status,isauction,highbidder,maxbid,numbids,enddate,zipcode,currency,buyit,reserve,quantity FROM {$Globals['pp_db_prefix']}products WHERE id='$product'";
$rows = ppmysql_query($query,$link);
list( $id, $user, $iuserid, $cat, $date, $ptitle, $askprice, $desc, $keywords, $bigimage, $bigimage2, $bigimage3, $bigimage4, $bigimage5, $bigimage6, $views, $approved, $rating, $extra1, $extra2, $extra3, $extra4, $extra5, $extra6, $issticky, $status, $isauction, $highbidder, $maxbid, $numbids, $enddate, $prodzipcode, $currency, $buyit, $reserve, $quantity) = mysql_fetch_row($rows);
ppmysql_free_result( $rows );
list( $aduid, $aduhomep, $aduposts, $adutitle, $adureg, $aduloc, $aduavatar, $adusig ) = get_profiledata( $iuserid );
$aduser = htmlspecialchars( $aduser );
if ( $aduavatar && $Globals['showavatar'] == "yes" )
{
$adpic .= "$aduavatar";
}
if ( $adureg )
{
$adureg = "{$Globals['pp_lang']['registered']}: " . formatppdate($adureg, "month yyyy");
}
if ( $aduposts > 0 )
{
$aduposts = "{$Globals['pp_lang']['posts']}: ". number_format($aduposts);
}
else
{
$aduposts = "{$Globals['pp_lang']['posts']}: 0";
}
if ( $aduloc )
{
$aduloc = "{$Globals['pp_lang']['location']}: $aduloc";
}
if ( empty($id) )
{
diewell( $Globals['pp_lang']['noproduct'] );
}
if ( $approved == 3 && $User['adminedit'] == 0 )
{
diewell( $Globals['pp_lang']['nopayment'] );
}
if ( $iuserid != $User['userid'] && ($approved == 0 && $User['adminedit'] == 0) )
{
diewell( $Globals['pp_lang']['notapproved'] );
}
if ( $holdcat == 0 ) $holdcat = $cat;
is_cat_protected( $cat );
if ( $User['userid'] > 0 && $Globals['displaynew'] == "yes" )
{
list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$mon = $mon + 1;
$year = $year + 1900;
$lasttimeon = mktime($hour,$min,$sec,$mon,$mday,$year);
$laston = "REPLACE INTO {$Globals['pp_db_prefix']}laston VALUES($cat,{$User['userid']},$lasttimeon)";
$resultb = ppmysql_query($laston, $link);
}
$query = "SELECT catname,template,extra1,extra2,extra3,extra4,extra5,extra6,thumbnail,numextra FROM {$Globals['pp_db_prefix']}categories where id='$cat'";
$resulta = ppmysql_query($query,$link);
list( $thecatname, $Globals['cattemp'], $Globals['extra1name'], $Globals['extra2name'], $Globals['extra3name'], $Globals['extra4name'], $Globals['extra5name'], $Globals['extra6name'], $catthumb, $numextra ) = mysql_fetch_row($resulta);
ppmysql_free_result($resulta);
$query = "SELECT paypal FROM {$Globals['pp_db_prefix']}users WHERE userid = '$iuserid'";
$resultb = ppmysql_query($query,$link);
list( $paypal ) = mysql_fetch_row($resultb);
ppmysql_free_result($resultb);
// Need to grab any custom fields for this category
$numcustom = 0;
if ( $numextra > 0 )
{
$catextras = ppmysql_query("SELECT e.id,e.fieldname,e.fieldtype,e.fieldoptions,p.selection FROM {$Globals['pp_db_prefix']}extrafields e
LEFT JOIN {$Globals['pp_db_prefix']}productextras p ON (p.extraid=e.id AND p.product=$id)
WHERE e.cat=$cat ORDER BY e.id", $link);
$customboxes = array();
$numcustom = 0;
while ( list( $exid, $exname, $extype, $exoptions, $extrasel ) = mysql_fetch_row($catextras) )
{
if ( $extype == "c" )
{
// Checkboxes are different, because we display each of the selections indexed by number
$exselection = null;
$exselects = explode( "||", $exoptions );
$exmysel = explode( ",", $extrasel );
$y = 0;
foreach( $exselects as $exextra )
{
$checked = null;
if ( $extrasel != null && in_array($y, $exmysel) )
{
// This is one they selected
$checked = "checked=\"checked\"";
}
$exselection .= " $exextra
";
$y++;
}
$customboxes['title'][$numcustom] = $exname;
$customboxes['value'][$numcustom] = $exselection;
}
else
{
// Everything else is only a one-item display
$customboxes['title'][$numcustom] = $exname;
$customboxes['value'][$numcustom] = convert_markups($extrasel);
}
$numcustom++;
}
ppmysql_free_result( $catextras );
}
if ( $User['userid'] > 0 && $Globals['displaynew'] == "yes" )
{
$resultb = ppmysql_query("REPLACE INTO {$Globals['pp_db_prefix']}laston VALUES('$cat',{$User['userid']},$lasttimeon)", $link);
}
//
// Next and Previous images for display
//
if ( !isset($sortby) && $sortorder > 0 && empty($limit) )
{
$resultc = ppmysql_query("SELECT * FROM {$Globals['pp_db_prefix']}sort WHERE sortid=$sortorder", $link);
list($sortid, $sortname, $sortcode) = mysql_fetch_row($resultc);
ppmysql_free_result( $resultc );
}
else
{
$sortcode = "ORDER BY date ASC";
}
if ( $cat == "fav" )
{
$query = "SELECT p.id,p.bigimage,p.cat,p.userid,p.approved FROM {$Globals['pp_db_prefix']}favorites f, {$Globals['pp_db_prefix']}products p
WHERE f.userid={$User['userid']} AND f.product=p.id $sortcode";
}
elseif ( $cat == "recent" || $limit == "recent" )
{
$query = "SELECT id,bigimage,cat,userid,approved FROM {$Globals['pp_db_prefix']}products WHERE approved=1 ORDER BY date DESC";
}
elseif ( $cat == "views" || $limit == "views" )
{
$query = "SELECT id,bigimage,cat,userid,approved FROM {$Globals['pp_db_prefix']}products WHERE approved=1 ORDER BY views DESC";
}
elseif ( $cat == "all" || $limit == "all" )
{
$query = "SELECT id,bigimage,cat,userid,approved FROM {$Globals['pp_db_prefix']}products WHERE approved=1 $sortcode";
}
elseif ( strstr($limit,"last") )
{
// Last xx days
if ( $limit == "last14" )
{
$days = 14;
}
elseif ( $limit == "last7" )
{
$days = 7;
}
else
{
$days = 1;
}
$searchdate = time() - (($days * 24) * 3600);
$whichcat = ( is_numeric($cat) ? "AND cat=$cat" : null );
$query = "SELECT id,bigimage,cat,userid,approved FROM {$Globals['pp_db_prefix']}products WHERE date > $searchdate AND approved=1 $whichcat ORDER BY date DESC";
}
elseif ( $ppuser )
{
$query = "SELECT id,bigimage,cat,userid,approved FROM {$Globals['pp_db_prefix']}products WHERE cat=$cat AND userid=$ppuser AND approved=1 $sortcode";
}
else
{
$query = "SELECT id,bigimage,cat,userid,approved FROM {$Globals['pp_db_prefix']}products WHERE cat=$cat AND approved=1 $sortcode";
}
$rows = ppmysql_query($query, $link);
$stripimgs = array();
while ( $thisrec = mysql_fetch_row($rows) )
{
if ( is_image_private($thisrec[2]) == "no" )
{
if ( $thisrec[0] == $product )
{
for( $x = count($stripimgs); $x < 3; $x++ )
{
array_unshift( $stripimgs, null );
}
$stripimgs[] = $thisrec;
// Grab two more (if there)
$exc = 0;
while ( $nextrec = mysql_fetch_row($rows) )
{
if ( is_image_private($nextrec[2]) == "no" )
{
$stripimgs[] = $nextrec;
$exc++;
if ( $exc == 3 )
{
break;
}
}
}
break;
}
else
{
$stripimgs[] = $thisrec;
if ( count($stripimgs) == 4 )
{
array_shift($stripimgs);
}
}
}
}
ppmysql_free_result($rows);
$filmstrips = array( null, null, null, null, null, null, null );
$nextlink = $prevlink = null;
foreach( $stripimgs AS $ids => $strip )
{
if ( $strip[0] > 0 )
{
list($npid, $npbig, $npcat, $npuserid, $npapp) = $strip;
$isme[$ids] = ( $npid == $product ? true : false );
$pimgtag = get_imagethumb( $npbig, $npcat, $npuserid, $npapp );
$checklink = "{$Globals['datafull']}$npcat/$npbig";
if ( file_exists($checklink) )
{
$image_stats = @getimagesize( $checklink );
$npwidth = $image_stats[0];
$npheight = $image_stats[1];
}
$filmstrips[$ids] = get_thumbtmpl( $npid, $pimgtag, $npheight, $npwidth, $thumbtag );
if ( $ids == 0 && $npid )
{
$prevajax = "";
}
elseif ( $ids == 2 && $npid )
{
if ( $Globals['spider'] == "yes" )
{
$conurl = construct_ppurl( "{$Globals['maindir']}/showproduct.php/product/$npid" );
$prevlink = "";
}
else
{
$conurl = construct_ppurl( "{$Globals['maindir']}/showproduct.php?product=$npid" );
$prevlink = "";
}
}
elseif ( $ids == 4 && $npid )
{
if ( $Globals['spider'] == "yes" )
{
$conurl = construct_ppurl( "{$Globals['maindir']}/showproduct.php/product/$npid" );
$nextlink = " ";
}
else
{
$conurl = construct_ppurl( "{$Globals['maindir']}/showproduct.php?product=$npid" );
$nextlink = " ";
}
}
elseif ( $ids == 6 && $npid )
{
$nextajax = "";
}
}
else
{
$filmstrips[$ids] = null;
}
}
// End to get Next and Previous images for display
unset($stripimgs);
$filmstrip = null;
// Let's get their preference
if ( $Globals['filmstrip'] == "bottom" )
{
include( "{$Globals['TMPL_PATH']}/filmstrip-hor.tmpl" );
$filmstrip = "
$prevajax | $filmstrip | $nextajax |
";
}
elseif ( $Globals['filmstrip'] == "left" )
{
include( "{$Globals['TMPL_PATH']}/filmstrip-ver.tmpl" );
$filmstrip = "$prevajax$filmstrip$nextajax";
}
elseif ( $Globals['filmstrip'] == "right" )
{
include( "{$Globals['TMPL_PATH']}/filmstrip-ver.tmpl" );
$filmstrip = "$prevajax$filmstrip$nextajax";
}
else
{
include( "{$Globals['TMPL_PATH']}/filmstrip-hor.tmpl" );
$filmstrip = "$prevajax | $filmstrip | $nextajax |
";
}
// End to get Next and Previous images for display
unset($stripimgs);
$ppuser = $iuserid;
$adusername = $user;
childsub($cat);
$childnav = "{$Globals['pp_lang']['home']} $childnav";
if ( !empty($ptitle) )
{
printheader( $cat, " $ptitle" );
}
else
{
printheader( $cat, " $bigimage" );
}
if ( $Globals['cattemp'] > 0 )
{
// We're using a different template here
require "{$Globals['PP_PATH']}/languages/$pplang/showproduct{$Globals['cattemp']}.php";
}
else {
$Globals['cattemp'] = "";
}
topmenu();
$count=0;
$theext = get_ext($bigimage);
$filename = $bigimage;
$imagefn = "{$Globals['datafull']}/$cat/$bigimage";
if ( $approved == 0 && $bigimage != "" )
{
$imgdisp = "";
}
else
{
if ( $bigimage == "" )
{
$imgdisp = "";
}
else
{
if ( file_exists($imagefn) )
{
if ( $Globals['onthefly'] == "yes" )
{
$imgdisp = "";
}
else
{
$imgdisp = "";
}
}
else
{
$imgdisp = "";
}
}
}
$pmenu = $admmenu = null;
$adminopts="";
if ( $Globals['quickopts'] == "yes" )
{
$ismod = false;
if ( $User['adminedit'] == 1 || $User['moderator'] == 1 || ($User['userid'] == $iuserid && $Globals['userdel'] == "yes") )
{
$selected = $cat;
if ( $User['adminedit'] == 1 || $User['moderator'] == 1 )
{
$userip = " $ipaddr";
$ismod = true;
if ( $User['moderator'] == 1 )
{
$ismod = is_moderator($cat);
}
}
catmoveopt(0, -1);
$adminopts = " |
{$Globals['pp_lang']['delete']}
|
|
";
}
}
if ( $adminopts != "" )
{
$admindisplay .= "
";
}
if ( VB3_COMMWYSIWYG == "on" ) $desc = un_htmlspecialchars(convert_markups($desc));
else $desc = convert_returns(convert_markups($desc));
if ( $Globals['allowhtml'] == "yes" ) $desc = un_htmlspecialchars($desc);
if ( VB3_COMMWYSIWYG == "on" ) $extra1 = un_htmlspecialchars(convert_markups($extra1));
else $extra1 = convert_returns(convert_markups($extra1));
if ( $Globals['allowhtml'] == "yes" ) $extra1 = un_htmlspecialchars($extra1);
if ( VB3_COMMWYSIWYG == "on" ) $extra2 = un_htmlspecialchars(convert_markups($extra2));
else $extra2 = convert_returns(convert_markups($extra2));
if ( $Globals['allowhtml'] == "yes" ) $extra2 = un_htmlspecialchars($extra2);
if ( VB3_COMMWYSIWYG == "on" ) $extra3 = un_htmlspecialchars(convert_markups($extra3));
else $extra3 = convert_returns(convert_markups($extra3));
if ( $Globals['allowhtml'] == "yes" ) $extra3 = un_htmlspecialchars($extra3);
if ( VB3_COMMWYSIWYG == "on" ) $extra4 = un_htmlspecialchars(convert_markups($extra4));
else $extra4 = convert_returns(convert_markups($extra4));
if ( $Globals['allowhtml'] == "yes" ) $extra4 = un_htmlspecialchars($extra4);
if ( VB3_COMMWYSIWYG == "on" ) $extra5 = un_htmlspecialchars(convert_markups($extra5));
else $extra5 = convert_returns(convert_markups($extra5));
if ( $Globals['allowhtml'] == "yes" ) $extra5 = un_htmlspecialchars($extra5);
if ( VB3_COMMWYSIWYG == "on" ) $extra6 = un_htmlspecialchars(convert_markups($extra6));
else $extra6 = convert_returns(convert_markups($extra6));
if ( $Globals['allowhtml'] == "yes" ) $extra6 = un_htmlspecialchars($extra6);
if ( $User['userid'] != "" )
{
$resultf = ppmysql_query("SELECT id FROM {$Globals['pp_db_prefix']}favorites WHERE product='$id' AND userid='{$User['userid']}'", $link);
$isfav = mysql_num_rows($resultf);
if ( $isfav == 0 )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['addfav']}";
}
}
else
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['removefav']}";
}
}
}
if ( $iuserid != 0 ) $postreview = "{$Globals['pp_lang']['post']}";
if ( ($Globals['allowpost'] == "yes" && $User['comments'] == 1) && $CatPerms['ugpost'][$cat] == 0 )
{
$pmenu .= ( $pmenu ? " " : null );
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['postcomment']}";
}
$postbutton = "$postreply ";
}
if ( $User['userid'] > 0 )
{
$pmenu .= ( $pmenu ? " " : null );
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['report']}";
}
if ( $buyit == "yes" && $status == 0 && $paypal != "" )
{
$pmenu .= ( $pmenu ? " " : null );
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['buynow']}";
}
}
}
if ($Globals['usenotify'] == "yes" && $User['userid'] > 0)
{
$results = ppmysql_query("SELECT id FROM {$Globals['pp_db_prefix']}notify WHERE userid={$User['userid']} AND product='$product' LIMIT 1", $link);
list( $notifyid ) = mysql_fetch_row($results);
$pmenu .= ( $pmenu ? " " : null );
if ( $notifyid )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['disable']}";
}
}
else
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['enable']}";
}
}
}
$postbutton = "";
if ( $ismod || $User['adminedit'] == 1 || ($User['userid'] == $iuserid ) )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "
";
}
else
{
$pmenu .= "
{$Globals['pp_lang']['editproduct']}";
}
if ( $isauction == 0 )
{
if ( $status == 0 )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= " {$Globals['pp_lang']['soldit']}";
}
}
else
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= " {$Globals['pp_lang']['relist']}";
}
}
}
if ( $isauction == 1 )
{
if ( $status == 0 )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= " {$Globals['pp_lang']['endauction']}";
}
}
else
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= " {$Globals['pp_lang']['relist']}";
}
}
}
}
if ( $User['adminedit'] == 1 || $ismod)
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= " {$Globals['pp_lang']['movedel']}";
}
$pmenu .= ( $pmenu ? " " : null );
if ( $issticky == 99999 )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['stick']}";
}
}
else
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= "";
}
else
{
$pmenu .= "{$Globals['pp_lang']['unstick']}";
}
}
$pmenu .= ( $pmenu ? " " : null );
if ( $product == $catthumb )
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= "{$Globals['pp_lang']['removeindex']}";
}
}
else
{
if ( $Globals['useicons'] == "yes" )
{
$pmenu .= " ";
}
else
{
$pmenu .= "{$Globals['pp_lang']['makeindex']}";
}
}
}
// find similiar posts
if ( empty($keywords) ) $keywords = $ptitle;
$keylinks = "";
$keys = explode( " ", $keywords );
$keys = array_unique($keys);
foreach($keys as $eachkey)
{
if ( !empty($eachkey) && $eachkey != "the" && $eachkey != "a" && $eachkey != "but" && $eachkey != "are" && $eachkey != "and" )
{
if ( $Globals['spider'] == "yes" )
{
$keylinks .= "$eachkey ";
}
else
{
$keylinks .= "$eachkey ";
}
}
}
if ( !empty($bigimage) )
{
$file1thumb = "";
$largeimg = "{$Globals['datafull']}/$cat/large/$bigimage";
$largeurl = "{$Globals['maindir']}/showfull.php?product=$id&bigimage=$bigimage";
$image_stats = @getimagesize( $largeimg );
$width = $image_stats[0];
$height = $image_stats[1];
if ( file_exists($largeimg) ) $file1thumb .= "
{$Globals['pp_lang']['supersize']}";
}
else
$file1thumb = "";
if ( !empty($bigimage2) )
{
$file2thumb = "";
$largeimg = "{$Globals['datafull']}/$cat/large/$bigimage2";
$largeurl = "{$Globals['maindir']}/showfull.php?product=$id&bigimage=$bigimage2";
$image_stats = @getimagesize( $largeimg );
$width = $image_stats[0];
$height = $image_stats[1];
if ( file_exists($largeimg) ) $file2thumb .= "
{$Globals['pp_lang']['supersize']}";
}
else
{
$file2thumb = "";
}
if ( !empty($bigimage3) )
{
$file3thumb = "";
$largeimg = "{$Globals['datafull']}/$cat/large/$bigimage3";
$largeurl = "{$Globals['maindir']}/showfull.php?product=$id&bigimage=$bigimage3";
$image_stats = @getimagesize( $largeimg );
$width = $image_stats[0];
$height = $image_stats[1];
if ( file_exists($largeimg) ) $file3thumb .= "
{$Globals['pp_lang']['supersize']}";
}
else
{
$file3thumb = "";
}
if ( !empty($bigimage4) && $approved == 1 )
{
$file4thumb = "";
$largeimg = "{$Globals['datafull']}/$cat/large/$bigimage4";
$largeurl = "{$Globals['maindir']}/showfull.php?product=$id&bigimage=$bigimage4";
$image_stats = @getimagesize( $largeimg );
$width = $image_stats[0];
$height = $image_stats[1];
if ( file_exists($largeimg) ) $file4thumb .= "
{$Globals['pp_lang']['supersize']}";
}
else
{
$file4thumb = "";
}
if ( !empty($bigimage5) && $approved == 1 )
{
$file5thumb = "";
$largeimg = "{$Globals['datafull']}/$cat/large/$bigimage5";
$largeurl = "{$Globals['maindir']}/showfull.php?product=$id&bigimage=$bigimage5";
$image_stats = @getimagesize( $largeimg );
$width = $image_stats[0];
$height = $image_stats[1];
if ( file_exists($largeimg) ) $file5thumb .= "
{$Globals['pp_lang']['supersize']}";
}
else
{
$file5thumb = "";
}
if ( !empty($bigimage6) && $approved == 1 )
{
$file6thumb = "";
$largeimg = "{$Globals['datafull']}/$cat/large/$bigimage6";
$largeurl = "{$Globals['maindir']}/showfull.php?product=$id&bigimage=$bigimage6";
$image_stats = @getimagesize( $largeimg );
$width = $image_stats[0];
$height = $image_stats[1];
if ( file_exists($largeimg) ) $file6thumb .= "
{$Globals['pp_lang']['supersize']}";
}
else
{
$file6thumb = "";
}
// Comments Start
if ( $Globals['allowpost'] == "yes" )
{
$cc=0; $ckcolor=0; $posts=""; $comq = "
";
$query = "SELECT id,username,userid,date,comment,approved FROM {$Globals['pp_db_prefix']}comments WHERE product=$product AND approved=1 ORDER BY date ASC";
$rows = ppmysql_query($query,$link);
$comcount = mysql_num_rows($rows);
if ( $comcount == 0 )
{
$compages = 0;
}
else
{
if ($perpage > 0)
{
$compages=($comcount/$perpage);
}
else
{
$perpage = $Globals['defaultposts'];
$compages = ($comcount/$perpage);
}
}
if (intval($compages) < $compages)
{
$compages=intval($compages)+1;
}
else
{
$compages=intval($compages);
}
if ( isset($cpage) )
{
$cstartnumb=($cpage*$perpage)-$perpage+1;
}
else
{
$cpage=1;
$cstartnumb=1;
}
if ($Globals['vbversion'] == 'dcfplus')
{
// need some admin preferences from DCF+, but don't want to call for them inside
// the loop, since they incur a sql query.
$allow_disable_email = dcfp_auth_get_setup_param("allow_disable_email");
$allow_disable_inbox = dcfp_auth_get_setup_param("allow_disable_inbox");
$allow_disable_profile = dcfp_auth_get_setup_param("allow_disable_profile");
}
$itemnum = 0;
while ( list( $id, $user, $cuserid, $cdate, $clinetext, $capproved ) = mysql_fetch_row($rows) )
{
$reviewnum[$itemnum] = $id;
$ucuserid[$itemnum] = $cuserid;
if ( ($Globals['moderatecoms'] == "no" && $capproved == 0) )
{
// Do not print anything under these condition; placeholder
}
else
{
$cc++;
if ($cc >= $cstartnumb)
{
if ($cc < ($cstartnumb+$perpage))
{
$profilelink = get_profilelink( $cuserid, $cuser );
$cclock[$itemnum] = formatpptime( $cdate );
$ppdate[$itemnum] = formatppdate( $cdate );
$results = ppmysql_query("SELECT id FROM {$Globals['pp_db_prefix']}products WHERE userid='$cuserid' LIMIT 1", $link);
list( $phoid ) = mysql_fetch_row($results);
$ucuser[$itemnum] = $Globals['pp_lang']['unreg'];
$uclocation[$itemnum] = "";
$uctitle[$itemnum] = "";
$ucposts[$itemnum] = "";
$uregdate[$itemnum] = "";
$uugallery[$itemnum] = "";
$uisonline[$itemnum] = "";
$uhpage[$itemnum] = "";
$ucedit[$itemnum] = false;
$ismod = false;
if ( $User['adminedit'] == 1 || $User['moderator'] == 1 || ($User['userid'] == $ucuserid[$x] && $ueditposts == 1) )
{
$ismod = ( $User['adminedit'] == 1 ? true : false );
if ( $User['moderator'] == 1 )
{
$ismod = is_moderator($cat);
}
}
if ( $cuserid > 0 )
{
// call get_profiledata to get all the links possible
unset($postline);
list( $cuname, $cuhomep, $cuposts, $cutitle, $cureg, $culoc, $cuavatar, $usig ) = get_profiledata( $cuserid );
$cuname = un_htmlspecialchars(convert_markups($cuname));
$cutitle = un_htmlspecialchars(convert_markups($cutitle));
$uhpage[$itemnum] = $cuhomep;
$ucuser[$itemnum] = $cuname;
$upostline[$itemnum] = $postline;
if ($regdate != "") $uregdate[$itemnum] = "
{$Globals['pp_lang']['registered']}: " . formatppdate($regdate, "month yyyy");
if ($cposts != "") $ucposts[$itemnum] = "
{$Globals['pp_lang']['posts']}: $cposts";
if ($clocation != "") $uclocation[$itemnum] = "
{$Globals['pp_lang']['location']}: $clocation";
if ($ctitle != "") $uctitle[$itemnum] = "
$ctitle";
if ( !empty($cuavatar) && $Globals['showavatar'] == "yes" ) $uctitle[$itemnum] .= "
$cuavatar";
$uugallery[$itemnum] = $ugallery;
$uisonline[$itemnum] = $isonline;
$uhpage[$itemnum] = $hpage;
$ucuser[$itemnum] = $cuser;
$upostline[$itemnum] = $postline;
}
if ( ($User['adminedit'] == 1 || $User['moderator'] == 1) && !empty($comip) ) $uctitle[$itemnum] .= "
$comip";
if ($ckcolor == 1) {
$fillcolor[$itemnum] = "{$Style['alternatetable']}";
$ckcolor = 0;
}
else {
$fillcolor[$itemnum] = "{$Style['tddetails']}";
$ckcolor = 1;
}
$clinetext = un_htmlspecialchars($clinetext);
if ( VB3_COMMWYSIWYG == "on" ) $clinetext = convert_markups($clinetext);
else $clinetext = convert_returns(convert_markups($clinetext));
$commenttext[$itemnum] = $clinetext;
if ( !empty($usig) && $Globals['showsigs'] == "yes" ) {
$usigline = convert_markups($usig);
$commenttext[$itemnum] .= "
------------------------------
$usigline";
}
if ( ($User['userid'] == $cowner[$itemnum] && $ueditposts == 1) || $ismod )
{
$ucedit[$itemnum] = true;
}
$itemnum++;
}
}
}
}
ppmysql_free_result( $rows );
if ( ($Globals['allowpost'] == "yes" && $User['comments'] == 1) && $CatPerms['ugpost'][$cat] == 0 )
{
if ( $ratingtype != 1 )
{
$ratecode .= get_rate_code(0);
}
if ( defined('SIMPLE_VERSION') && SIMPLE_VERSION > 366 && VB3_ENHANCEDINT == "on" )
{
include( "{$Globals['TMPL_PATH']}/quickcom367.tmpl" );
}
else
{
include( "{$Globals['TMPL_PATH']}/quickcom.tmpl" );
}
}
}
// begin pages/nav system ##
$comnav="";
if ($compages > 1)
{
$comnav .= " |
{$Globals['pp_lang']['page']}: ";
$thestart="";
if ($cpage < 11)
{
$thestart=1;
}
if ($cpage > 10)
{
$thestart = ($cpage / 10);
$thestart = (int)$thestart;
$thestart = ($thestart * 10);
}
$theend=$thestart+9;
for ($p=$thestart;$p<=$compages;$p++)
{
if ($p != $thestart)
{
$comnav .= " · ";
}
if ($cpage != $p)
{
if ($p == ($theend+1))
{
$thispage="$p>";
}
else
{
$thispage="$p";
}
if ( $Globals['spider'] == "yes" )
{
$conurl = construct_ppurl( "{$Globals['maindir']}/showproduct.php/product/$product/cpage/$p" );
}
else
{
$conurl = construct_ppurl( "{$Globals['maindir']}/showproduct.php?product=$product&cpage=$p" );
}
$comnav .= "$thispage";
}
if ($p >$theend)
{
break;
}
if ($cpage == $p)
{
$comnav .= "$p";
}
}
if ($cpage < $compages)
{
$nextpage=$cpage+1;
$more = "
";
}
else
{
$more = " ";
}
$comnav .= " | $more |
";
}
// end pages/nav ###
$timelast = formatpptime( $date );
$datelast = formatppdate( $date );
$curcheck = ppmysql_query("SELECT symbol,type FROM {$Globals['pp_db_prefix']}currency WHERE code = '$currency'", $link);
list( $csymbol, $ctype ) = mysql_fetch_row($curcheck);
if ( $askprice > 0 )
{
if ( $ctype == 0 ) $askprice = ($askprice == 0 ? "{$Globals['pp_lang']['noneind']}" : "{$csymbol}".number_format($askprice,2) );
elseif ( $ctype == 1 ) $askprice = ($askprice == 0 ? "{$Globals['pp_lang']['noneind']}" : "{$csymbol}".number_format($askprice,2,',','') );
elseif ( $ctype == 2 ) $askprice = ($askprice == 0 ? "{$Globals['pp_lang']['noneind']}" : number_format($askprice,2)."{$csymbol}" );
}
else
{
$askprice = ($askprice == 0 ? "{$Globals['pp_lang']['noneind']}" : number_format($askprice)."{$csymbol}" );
}
if ( $reserve > 0 )
{
if ( $ctype == 0 ) $auctionbuy = ($reserve == 0 ? "{$Globals['pp_lang']['noneind']}" : "{$csymbol}".number_format($reserve,2) );
elseif ( $ctype == 1 ) $auctionbuy = ($reserve == 0 ? "{$Globals['pp_lang']['noneind']}" : "{$csymbol}".number_format($reserve,2,',','') );
elseif ( $ctype == 2 ) $auctionbuy = ($reserve == 0 ? "{$Globals['pp_lang']['noneind']}" : number_format($reserve,2)."{$csymbol}" );
}
else
{
$auctionbuy = ($reserve == 0 ? "{$Globals['pp_lang']['noneind']}" : number_format($reserve)."{$csymbol}" );
}
if ( $status > 0 )
{
$askprice = "{$Globals['pp_lang']['sold']} ($askprice)";
}
if ( $Globals['ipcache'] != 0 )
{
$ipaddress = findenv("REMOTE_ADDR");
$result = ppmysql_query("SELECT userid,date,product FROM {$Globals['pp_db_prefix']}ipcache WHERE ipaddr='$ipaddress' AND type='view' AND product='$product' LIMIT 1", $link);
$numfound = mysql_num_rows($result);
if ( $numfound > 0 )
{
list( $tuserid, $lastdate, $product ) = mysql_fetch_row($result);
list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$mon = $mon + 1;
$year = $year + 1900;
$mytime = mktime($hour,$min,$sec,$mon,$mday,$year);
$hour = $hour - $Globals['ipcache'];
$timeout = mktime($hour,$min,$sec,$mon,$mday,$year);
if ( $lastdate < $timeout ) {
$result = ppmysql_query("UPDATE {$Globals['pp_db_prefix']}products SET views=views+1 WHERE id=$product", $link);
if ( $User['userid'] > 0 && $Globals['vbversion'] == "sellerspost" ) {
$result = ppmysql_query("UPDATE {$Globals['pp_db_prefix']}users SET views=views+1 WHERE userid={$User['userid']}", $db_link);
}
$result = ppmysql_query("DELETE FROM {$Globals['pp_db_prefix']}ipcache WHERE date < $timeout", $link);
$result = ppmysql_query("INSERT INTO {$Globals['pp_db_prefix']}ipcache (userid,ipaddr,date,type,product) VALUES ('$tuserid', '$ipaddress', '$mytime', 'view', '$product')", $link);
}
}
else
{
list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$mon = $mon + 1;
$year = $year + 1900;
$mytime = mktime($hour,$min,$sec,$mon,$mday,$year);
$result = ppmysql_query("INSERT INTO {$Globals['pp_db_prefix']}ipcache (userid,ipaddr,date,type,product) VALUES ('$tuserid', '$ipaddress', '$mytime', 'view', '$product')", $link);
$result = ppmysql_query("UPDATE {$Globals['pp_db_prefix']}products SET views=views+1 WHERE id=$product", $link);
if ( $User['userid'] > 0 && $Globals['vbversion'] == "sellerspost" )
{
$result = ppmysql_query("UPDATE {$Globals['pp_db_prefix']}users SET views=views+1 WHERE userid={$User['userid']}", $db_link);
}
}
}
else
{
$query = "UPDATE {$Globals['pp_db_prefix']}products SET views=views+1 WHERE id=$product";
$result = ppmysql_query($query,$link);
if ( $User['userid'] > 0 && $Globals['vbversion'] == "sellerspost" ) {
$query = "UPDATE {$Globals['pp_db_prefix']}users SET views=views+1 WHERE userid={$User['userid']}";
$result = ppmysql_query($query,$link);
}
}
list( $numstars, $overall ) = get_user_rating( $iuserid );
$ratingicon = "";
if ( $numstars > 0 ) $ratingicon = " ";
// If an auction get some more info
$bidq = ""; $auctionend = ""; $hbnumbids = $Globals['pp_lang']['none']; $auctionclosed = 0;
if ( $isauction == 1 ) {
list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$mon = $mon + 1;
$year = $year + 1900;
$julian = mktime($hour,$min,$sec,$mon,$mday,$year);
if ( $enddate < $julian ) {
$auctionend = "{$Globals['pp_lang']['auctionclose']}";
$auctionclosed = 1;
}
else {
$auctionend = formatppdate( $enddate );
$auctionend .= " " . formatpptime( $enddate );
$timeleft = $enddate - $julian;
if ( $timeleft > 0 ) {
$auctionend .= "
" . time_left($timeleft);
}
}
// Find out who the high bidder is (if one)
if ( $highbidder > 0 ) {
$Globals['pp_lang']['askprice'] = $Globals['pp_lang']['highbidr'];
list( $hbuserid, $hbuser, $tmail ) = get_userinfo("",$highbidder);
list( $hbstars, $hboverall ) = get_user_rating($highbidder);
$hbicon = "";
if ( $hbstars > 0 ) $hbicon = " ";
$hbuserlink = "$hbuser$hbicon";
$hbnumbids = "$numbids ";
$hbnumbids .= ($numbids > 1 ? $Globals['pp_lang']['bids'] : $Globals['pp_lang']['bid'] ) . " · {$Globals['pp_lang']['bidhistory']}";
$askprice .= " · $hbuserlink";
}
else {
$Globals['pp_lang']['askprice'] = $Globals['pp_lang']['openprice'];
}
if ( $gologin == 0 && $status == 0 && $auctionclosed == 0 && $User['userid'] != $iuserid ) {
include( "{$Globals['TMPL_PATH']}/askbid.tmpl" );
}
}
// Distance from zip
if ( $Globals['zipcode'] == "yes" )
{
$pickcode = "";
if ( isset($myzipcode) ) $zipcode = $myzipcode;
if ( !isset($zipcode) )
{
$distcode = $pickcode;
$long1 = 0; $lat1 = 0;
}
else
{
$longlat = ppmysql_query("SELECT lon,lat FROM zipData WHERE zipcode = '$zipcode'", $link);
list( $long1, $lat1 ) = mysql_fetch_row($longlat);
if ( $long1 != 0 && $lat1 != 0 )
{
$lat1 = deg_to_rad($lat1);
$long1 = deg_to_rad($long1);
}
else
{
$distcode = $pickcode;
$long1 = 0; $lat1 = 0;
}
}
if ( $long1 != 0 && $lat1 != 0 )
{
$longlat = ppmysql_query("SELECT lon,lat FROM zipData WHERE zipcode = '$prodzipcode'", $link);
list( $long2, $lat2 ) = mysql_fetch_row($longlat);
if ( $long2 != 0 && $lat2 != 0 )
{
$lat2 = deg_to_rad($lat2);
$long2 = deg_to_rad($long2);
$delta_lat = $lat2 - $lat1;
$delta_lon = $long2 - $long1;
/* Find the Great Circle distance */
$temp = pow(sin($delta_lat/2.0),2) + cos($lat1) * cos($lat2) * pow(sin($delta_lon/2.0),2);
$EARTH_RADIUS = 3956;
$distance = $EARTH_RADIUS * 2 * atan2(sqrt($temp),sqrt(1-$temp));
$distcode = number_format($distance)." {$Globals['pp_lang']['miles']}";
}
else
{
$distcode = $Globals['pp_lang']['nozip'];
}
}
}
if ( $Globals['sidebar_global'] == "yes" )
{
if ( $Globals['statspal'] == "yes" )
{
get_statscache();
}
if ( $Globals['topposterspal'] == "yes" )
{
get_posterscache();
}
if ( $Globals['ratingspal'] == "yes" )
{
get_ratingcache();
}
}
$userlink="$adusername$ratingicon";
$filmstrip_top = $filmstrip_bottom = $filmstrip_left = $filmstrip_right = null;
$colspan1 = 5;
$colspan2 = 5;
if ( $Globals['nextbox'] == "yes" )
{
// Let's get their preference
if ( $Globals['filmstrip'] == "bottom" ) {
$filmstrip_bottom = "$filmstrip |
";
}
elseif ( $Globals['filmstrip'] == "left" )
{
$filmstrip_left = "$filmstrip | ";
$colspan1 = 2;
$colspan2 = 1;
}
elseif ( $Globals['filmstrip'] == "right" )
{
$filmstrip_right = "$filmstrip | ";
$colspan1 = 2;
$colspan2 = 1;
}
else
{
$filmstrip_top = "$filmstrip |
";
}
}
include( "{$Globals['TMPL_PATH']}/menubar.tmpl" );
if ( $Globals['sidebar'] == "left" && $Globals['sidebar_global'] == "yes" )
{
include( "{$Globals['TMPL_PATH']}/sidebar_leftopen.tmpl" );
}
if ( $Globals['sidebar'] == "right" && $Globals['sidebar_global'] == "yes" )
{
include( "{$Globals['TMPL_PATH']}/sidebar_rightopen.tmpl" );
}
include( "{$Globals['TMPL_PATH']}/showproduct{$Globals['cattemp']}.tmpl" );
if ( $Globals['sidebar'] == "left" && $Globals['sidebar_global'] == "yes" )
{
include( "{$Globals['TMPL_PATH']}/sidebar_leftclose.tmpl" );
}
if ( $Globals['sidebar'] == "right" && $Globals['sidebar_global'] == "yes" )
{
include( "{$Globals['TMPL_PATH']}/sidebar_rightclose.tmpl" );
}
printfooter();
} // end individual product display ###
?>