INT, 'perpage' => INT, 'cpage' => INT, 'size' => STRING, 'cat' => STRING, 'nocache' => INT, 'sortby' => STRING, 'sortdir' => STRING, 'limit' => STRING, 'way' => STRING,' sorttime' => INT, 'page' => INT, 'date' => INT, 'ppuser' => INT)); typecast($_COOKIE, array('catp' => STRING)); // Init some variables if ( empty($size) ) $size = "medium"; if ( isset($_GET['catp']) ) { @setcookie( "catp", $_GET['catp'], 0, "{$Globals['cookie_path']}", $Globals['domain_path'] ); $GLOBALS[catp] = $_GET['catp']; } elseif ( isset($_POST['catp']) ) { @setcookie( "catp", $_POST['catp'], 0, "{$Globals['cookie_path']}", $Globals['domain_path'] ); $GLOBALS[catp] = $_POST['catp']; } if ( isset($perpage) && is_numeric($perpage) ) { if ( $perpage != $ppperpage ) { @setcookie( "ppperpage", $perpage, time()+2592000 ); $page = 1; } } authenticate(); if ( $Globals['ppboards'] == "closed" && $User['adminedit'] != 1 ) { diewell( $Globals['closedmsg'] ); } if ( !$photo ) { diewell( $Globals['pp_lang']['nophoto'] ); } if ( ($User['username'] == "" || $User['username'] == $Globals['pp_lang']['unreg']) && $Globals['reqregister'] == "yes" ) { diewell( $Globals['pp_lang']['noregview'] ); } if ( $perpage < 1 ) { $perpage = $Globals['defaultposts']; } $rows = ppmysql_query("SELECT id,user,userid,cat,storecat,storeid,date,title,description,ismature,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,extra1,extra2,extra3,extra4,extra5,extra6,disporder,ipaddress,allowprint,allowrate,allowcoms,tags,exifinfo FROM {$Globals['pp_db_prefix']}photos WHERE id=$photo", $link); list( $id, $photouser, $iuserid, $dbcat, $storecat, $storeid, $pdate, $title, $desc, $ismature, $keywords, $bigimage, $width, $height, $photosize, $views, $medwidth, $medheight, $medsize, $approved, $imgrating, $extra1, $extra2, $extra3, $extra4, $extra5, $extra6, $issticky, $ipaddr, $allowprint, $allowrate, $allowcoms, $tags, $exifinfo ) = mysql_fetch_row($rows); ppmysql_free_result( $rows ); if ( $photo != $id || !$dbcat ) { diewell( $Globals['pp_lang']['nophoto'] ); } if ( $Globals['mature'] == "yes" && $ismature && !$User['mature'] ) { diewell( $Globals['pp_lang']['maturewarn'] ); } if ( !$cat && $limit ) { $cat = $limit; } $extra1 = convert_markups($extra1); $extra2 = convert_markups($extra2); $extra3 = convert_markups($extra3); $extra4 = convert_markups($extra4); $extra5 = convert_markups($extra5); $extra6 = convert_markups($extra6); list( $phuid, $phuhomep, $numposts, $phutitle, $phureg, $phuloc, $phuavatar, $phusig ) = get_profiledata( $iuserid ); $photouser = htmlspecialchars( $photouser ); if ( $phuavatar && $Globals['showavatar'] == "yes" ) { $photouser .= "
$phuavatar"; } if ( $phureg ) { $phureg = "

{$Globals['pp_lang']['registered']}: " . formatppdate($phureg, "month yyyy"); } if ( $numposts ) { $phuposts = "
{$Globals['pp_lang']['posts']}: ". number_format($numposts); } if ( $phuloc ) { $phuloc = "
{$Globals['pp_lang']['location']}: $phuloc"; } if ( $phutitle ) { $phutitle = "
$phutitle"; } if ( $storecat == 0 ) { $storecat = $dbcat; } if ( $allowrate == 0 && $Globals['allowrate'] == "yes" ) { // User doesn't want any ratings on their image $Globals['allowrate'] = "no"; } if ( $allowcoms == 0 && $Globals['allowpost'] == "yes" ) { // User doesn't want any comments on their image $Globals['allowpost'] = "no"; } elseif ( $allowcoms == 2 && $Globals['allowpost'] == "yes" ) { // Photo is "closed" for new topics $User['comments'] = 0; } $resulta = ppmysql_query("SELECT catname,cattype,theme,frames,sortorder,extra1,extra2,extra3,extra4,extra5,extra6,thumbnail,numextra,ratingtype,ugnopost,ugnovote FROM {$Globals['pp_db_prefix']}categories where id=$dbcat", $link); list( $thecatname, $cattype, $cattheme, $frames, $sortorder, $Globals['extra1name'], $Globals['extra2name'], $Globals['extra3name'], $Globals['extra4name'], $Globals['extra5name'], $Globals['extra6name'], $catthumb, $numextra, $ratingtype, $ugnopost, $ugnovote ) = mysql_fetch_row($resulta); ppmysql_free_result($resulta); // We need these here $CatPerms['ugpost'][$dbcat] = $CatPerms['ugvote'][$dbcat] = 1; foreach( $User['usergroups'] AS $usergroup ) { $allnopost = explode( ",", $ugnopost ); if ( !in_array( $usergroup, $allnopost ) ) { $CatPerms['ugpost'][$dbcat] = 0; } $allnovote = explode( ",", $ugnopost ); if ( !in_array( $usergroup, $allnovote ) ) { $CatPerms['ugvote'][$dbcat] = 0; } } if ( $cattheme && $Globals['forumstyle'] == "no" ) { $Globals['theme'] = $cattheme; if ( is_dir( "{$Globals['PP_PATH']}/stylesheets/{$Globals['theme']}" ) ) { $Globals['idir'] = "{$Globals['maindir']}/stylesheets/{$Globals['theme']}"; } } // Non standard frames if ( !empty($frames) ) { unset( $Globals['thumbstd'] ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/$frames.tmpl" ); } is_cat_protected( $dbcat, $catp, $cattype ); // 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']}photoextras p ON (p.extraid=e.id AND p.photo=$id) WHERE e.cat=$dbcat", $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] = $extrasel; } $numcustom++; } ppmysql_free_result( $catextras ); } if ( $User['userid'] > 0 && $Globals['displaynew'] == "yes" ) { $resultb = ppmysql_query("REPLACE INTO {$Globals['pp_db_prefix']}laston VALUES('$dbcat',{$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 ); } elseif ( isset($sortby) ) { // Timeframe $searchq = null; if ( $sorttime > 0 ) { $searchq = "AND date > ". time() - (($sorttime * 24) * 3600); } // Sortname? if ( !empty($sortby) ) { if ( $sortby == "s" ) { $sortvar = "filesize"; } elseif ( $sortby == "r" ) { $sortvar = "rating"; } elseif ( $sortby == "l" ) { $sortvar = "lastpost"; } elseif ( $sortby == "d" ) { $sortvar = "date"; } elseif ( $sortby == "v" ) { $sortvar = "views"; } else { $sortvar = "bigimage"; } $sortdir = ( $way == "asc" ? "ASC" : "DESC" ); $sortcode = "$searchq ORDER BY $sortvar $sortdir"; if ( $sortby == "r" ) { $sortcode = "$searchq AND rating > 0 $sortcode"; } } } else { if ( !empty($limit) ) { $sortcode = "ORDER BY date DESC"; } } if ( $cat == "fav" ) { $query = "SELECT p.id,p.bigimage,p.cat,p.userid,p.approved,p.storecat,p.height,p.width,p.ismature FROM {$Globals['pp_db_prefix']}favorites f, {$Globals['pp_db_prefix']}photos p WHERE f.userid={$User['userid']} AND f.photo=p.id $sortcode"; } elseif ( $cat == 500 ) { if ( $Globals['memformat'] == "yes" ) { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE userid='$iuserid' AND approved=1 $sortcode"; } else { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE cat=500 AND userid='$iuserid' AND approved=1 $sortcode"; } } elseif ( $cat == MOBILE_CAT || $dbcat == MOBILE_CAT ) { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE cat='".MOBILE_CAT."' AND userid='$iuserid' AND approved=1 $sortcode"; } elseif ( $cat == "recent" || $limit == "recent" ) { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND storecat=0 ORDER BY date DESC"; } elseif ( $cat == "views" || $limit == "views" ) { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND storecat=0 ORDER BY views DESC"; } elseif ( $cat == "all" || $limit == "all" ) { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos 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,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE date > $searchdate AND approved=1 $whichcat ORDER BY date DESC"; } elseif( !empty($date) ) { $thisdate = getdate($date); $thismonth = $thisdate["mon"]; $thisyear = $thisdate["year"]; $thisday = $thisdate["mday"]; $lowdate = mktime(0, 0, 0, $thismonth, $thisday, $thisyear); $highdate = mktime(0, 0, 0, $thismonth, $thisday+1, $thisyear); $whichcat = ( is_numeric($cat) ? "AND cat=$cat" : "" ); $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE date >= $lowdate AND date < $highdate AND approved=1 $whichcat ORDER BY date DESC"; } elseif ( $ppuser ) { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width FROM {$Globals['pp_db_prefix']}photos WHERE cat=$dbcat AND userid=$ppuser AND approved=1 $sortcode"; } else { $query = "SELECT id,bigimage,cat,userid,approved,storecat,height,width,ismature FROM {$Globals['pp_db_prefix']}photos WHERE cat=$dbcat AND approved=1 $sortcode"; } $rows = ppmysql_query($query, $link); $stripimgs = array(); while ( $thisrec = mysql_fetch_row($rows) ) { if ( $thisrec[8] == 1 && (!$User['userid'] || !$User['mature'] ) ) { continue; } if ( is_image_private($thisrec[2]) == "no" ) { if ( $thisrec[0] == $photo ) { 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 ( $nextrec[8] == 1 && (!$User['userid'] || !$User['mature']) ) { continue; } 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 = $slidecode = $nextajax = $prevajax = null; $init = 1; foreach( $stripimgs AS $ids => $strip ) { if ( $strip[0] > 0 ) { list($npid, $npbig, $npcat, $npuserid, $npapp, $npstore, $npheight, $npwidth) = $strip; if ( !$npstore ) { $npstore = $npcat; } $isme[$ids] = ( $npid == $photo ? true : false ); $pimgtag = get_imagethumb( $npbig, $npstore, $npuserid, $npapp ); $filmstrips[$ids] = get_thumbtmpl( $npid, $pimgtag, $npheight, $npwidth, $thumbtag ); if ( $ids == 0 && $npid ) { $prevajax = "\"{$Globals['pp_lang']['more']}\""; } elseif ( $ids == 2 && $npid ) { if ( $Globals['spider'] == "yes" ) { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php/photo/$npid" ); $prevlink = "\"{$Globals['pp_lang']['prev']}\""; } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$npid" ); $prevlink = "\"{$Globals['pp_lang']['prev']}\""; } } elseif ( $ids == 4 && $npid ) { if ( $Globals['spider'] == "yes" ) { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php/photo/$npid" ); $nextlink = "   \"{$Globals['pp_lang']['next']}\""; } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$npid" ); $nextlink = "   \"{$Globals['pp_lang']['next']}\""; } } elseif ( $ids == 6 && $npid ) { $nextajax = "\"{$Globals['pp_lang']['more']}\""; } } else { $filmstrips[$ids] = null; } } // Now flip 'em to put them into display order $filmstrip = null; // Let's get their preference if ( $Globals['filmstrip'] == "bottom" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/filmstrip-hor.tmpl" ); $filmstrip = "
$prevajax$filmstrip$nextajax
"; } elseif ( $Globals['filmstrip'] == "left" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/filmstrip-ver.tmpl" ); $filmstrip = "$prevajax$filmstrip$nextajax"; } elseif ( $Globals['filmstrip'] == "right" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/filmstrip-ver.tmpl" ); $filmstrip = "$prevajax$filmstrip$nextajax"; } else { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/filmstrip-hor.tmpl" ); $filmstrip = "
$prevajax$filmstrip$nextajax
"; } // End to get Next and Previous images for display unset($stripimgs); if ( $nextlink && $Globals['slideshow'] == "yes" ) { $slideurl = "{$Globals['maindir']}/slideshow.php?photo=$photo"; if ( !empty($limit) ) { $slideurl .= "&limit=$limit"; } if ( !empty($cat) ) { $slideurl .= "&cat=$cat"; } $slidecode = "   \"{$Globals['pp_lang']['slideshow']}\""; } if ( $Globals['showexif'] == "no" ) { // Force this to off if they turn off the option $exifinfo = 0; } // for childsub, we need to set these globals $ppuser = $iuserid; $uploadquery = "?cat=$dbcat"; if ( $width && $height ) { $sizecode = "$width x $height"; } else { $Globals['dispdims'] = "no"; } $count = 0; $theext = get_ext($bigimage); $filename = $bigimage; $filename = str_replace( $theext, "", $filename); $altlink = null; if ( $imgrating && $Globals['allowrate'] == "yes" ) { $rating = number_format( $imgrating, 2 ); $ratingicon = null; for ( $x = 0; $x < round($rating); $x++ ) { $ratingicon .= "\"*\""; } } else { $rating = $Globals['pp_lang']['none']; } $extracat = null; if ( $Globals['optcats'] == "yes" ) { // Additional categories? $result2 = ppmysql_query("SELECT p.id,c.catname FROM {$Globals['pp_db_prefix']}photos p LEFT JOIN {$Globals['pp_db_prefix']}categories c ON c.id=p.cat WHERE p.storeid=$id OR p.id=$storeid", $link); while ( list( $exid, $excat ) = mysql_fetch_row($result2) ) { if ( $exid != $photo ) { if ( $Globals['spider'] == "yes" ) { $otherlink = "$excat"; } else { $otherlink = "$excat"; } $extracat .= ( empty($extracat) ? "$otherlink" : ", $otherlink" ); } } ppmysql_free_result( $result2 ); } $rand = ( $nocache == 1 ? "?".rand(0,999) : null ); if ( $approved != 0 || $User['moderator'] == 1 || $User['adminedit'] == 1 ) { $filesize = sprintf("%1.1f", ($photosize/1024))."{$Globals['pp_lang']['kb']}"; $dispmed = 0; if ( $medsize > 0 ) { $medsize = sprintf("%1.1f", ($medsize/1024))."{$Globals['pp_lang']['kb']}"; if ( $Globals['bigpopup'] == "yes" ) { if ( $Globals['lightbox'] == "yes" && ($width < $Globals['lbwidth'] || $height < $Globals['lbheight']) ) { $useimglink = ""; } else { $useimglink = ""; } } else { if ( $Globals['spider'] == "yes" ) { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php/photo/$photo/size/big/cat/$cat", true ); } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$photo&size=big&cat=$cat", true ); } $useimglink = ""; } if ( $Globals['spider'] == "yes" ) { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php/photo/$id", true ); $filesize = "$medsize, {$useimglink}$filesize"; } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$id", true ); $filesize = "$medsize, {$useimglink}$filesize"; } if ( $size != "big" ) { $dispmed = 1; $altlink = "
{$Globals['pp_lang']['viewlarger']}
"; } else { $altlink = "
{$Globals['pp_lang']['viewsmaller']}
"; } } $videodisp = $imgurl = null; if ($Globals['bigsave'] == "yes") { if ( $dispmed == 1 ) { if ( $Globals['onthefly'] == "yes" ) { if ( $Globals['spider'] == "yes" ) { $imgdisp = "$useimglink\"\""; } else { $imgdisp = "$useimglink\"\""; } $imgurl = "{$Globals['datadir']}/$storecat/medium/$bigimage"; } else { if ( $Globals['spider'] == "yes" ) { if ( $Globals['zoom'] == "no" ) { $imgdisp = "$useimglink\"\""; } else { $imgdisp = "$useimglink\"\""; } } else { if ( $Globals['zoom'] == "no" ) { $imgdisp = "$useimglink\"\""; } else { $imgdisp = "$useimglink\"\""; } } $imgurl = "{$Globals['datadir']}/$storecat/medium/$bigimage"; } } else { if ( is_multimedia($bigimage) == 1 ) { $mmthumb = "{$Globals['datadir']}/$storecat/thumbs/$filename.jpg"; $dirthumb = "{$Globals['datafull']}/$storecat/thumbs/$filename.jpg"; $imgurl = "{$Globals['datadir']}/$storecat/$bigimage"; if ( !file_exists($dirthumb) ) { $mmthumb = "{$Globals['idir']}/video.gif"; } $imgdisp = "\"\""; $videodisp = "{$Globals['pp_lang']['video']}
"; if ( $Globals['embededmm'] == "yes" ) { if ( stristr($bigimage, ".mov") ) { $mmthumb = "{$Globals['idir']}/mm-qt.gif"; include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/embed-qt.tmpl" ); $videodisp = null; } elseif ( stristr($bigimage, ".wmv") || stristr($bigimage, ".mpg") || stristr($bigimage, ".mpeg") || stristr($bigimage, ".avi") ) { $mmthumb = "{$Globals['idir']}/mm-video.gif"; include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/embed-ms.tmpl" ); } elseif( stristr($bigimage, ".fla") || stristr($bigimage, ".swf") ) { $mmthumb = "{$Globals['idir']}/mm-fla.gif"; include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/embed-fla.tmpl" ); } elseif( stristr($bigimage, ".mp3") || stristr($bigimage, ".wav") || stristr($bigimage, ".mid") || stristr($bigimage, ".aiff") ) { $mmthumb = "{$Globals['idir']}/mm-audio.gif"; include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/embed-audio.tmpl" ); } elseif( stristr($bigimage, ".rm") ) { $mmthumb = "{$Globals['idir']}/mm-real.gif"; include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/embed-rm.tmpl" ); } } } else { if ( $Globals['onthefly'] == "yes" ) { if ( $Globals['zoom'] == "no" ) { $imgdisp = "\"\""; } else { $imgdisp = "\"\""; } $imgurl = "{$Globals['origdir']}/$storecat/$bigimage"; } else { $imgsrc = "{$Globals['origdir']}/$storecat/$bigimage$rand"; if ( $Globals['zoom'] == "no" ) { $imgdisp = "\"$filename\""; } else { $imgdisp = "\"$filename\""; } $imgurl = "{$Globals['origdir']}/$storecat/$bigimage"; } if ( $altlink ) { if ( $Globals['spider'] == "yes" ) { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php/photo/$photo", true ); } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$photo", true ); } $imgdisp = "$imgdisp"; } } } } else { $imgdisp = "\"\""; } } else { $imgdisp = "\"\""; } $userip = null; $ratedisplay = null; $rateperms = ( $cattype == "a" ? $CatPerms['ugvote'][500] : $CatPerms['ugvote'][$dbcat] ); if ( $Globals['allowrate'] == "yes" && $rateperms == 0 && $ratingtype != 1 ) { $alreadyrated = 0; if ( $User['userid'] > 0 ) { $resultb = ppmysql_query("SELECT rating FROM {$Globals['pp_db_prefix']}comments WHERE photo=$photo AND userid={$User['userid']} AND rating > 0 LIMIT 1", $link); while( list( $checkrating ) = mysql_fetch_row($resultb) ) { $alreadyrated = 1; $ratedisplay = "{$Globals['pp_lang']['rated']}$checkrating"; } ppmysql_free_result($resultb); } else { // Let's check their IP address for unregistered $ipaddress = findenv("REMOTE_ADDR"); $result = ppmysql_query("SELECT rating FROM {$Globals['pp_db_prefix']}comments WHERE photo=$photo AND ipaddress='$ipaddress' AND rating > 0 LIMIT 1", $link); $numfound = mysql_num_rows($result); if ( $numfound > 0 ) { $ratedisplay = "{$Globals['pp_lang']['unregrated']}"; $alreadyrated = 1; } } if ( $alreadyrated == 0 ) { if ( $User['userid'] != $iuserid ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/quickrate.tmpl" ); } } } $ppdate = formatppdate( $pdate ); if ( VB3_ENHANCEDINT == "on" ) { $desc = un_htmlspecialchars(convert_markups($desc)); } else { $desc = convert_returns(convert_markups($desc)); } $pmenu = null; if ( $User['userid'] > 0 ) { $resultf = ppmysql_query("SELECT id FROM {$Globals['pp_db_prefix']}favorites WHERE photo=$id AND userid={$User['userid']}", $link); $isfav = mysql_num_rows($resultf); if ( $isfav == 0 ) { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['addfav']}\""; } else { $buttonlink = $Globals['pp_lang']['addfav']; } $pmenu .= "$buttonlink"; } else { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['delfav']}\""; } else { $buttonlink = $Globals['pp_lang']['delfav']; } $pmenu .= "$buttonlink"; } } if ( ($Globals['allowpost'] == "yes" && $User['comments'] == 1) && $CatPerms['ugpost'][$dbcat] == 0 ) { $newid = 0; if ( $User['userid'] < 1 ) { if ( $Globals['usecaptcha'] == "yes" ) { // Let's generate a totally random string using md5 $md5 = md5(rand(0,999)); // We don't need a 32 character long string so we trim it down to 5 $pass = substr($md5, 10, 5); $r = ppmysql_query( "INSERT INTO {$Globals['pp_db_prefix']}captcha (id,code) VALUES (NULL,'$pass')", $link ); $newid = mysql_insert_id($link); if ( !$newid ) { diewell( $Globals['pp_lang']['caperror'] ); } } } if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['post']}\""; } else { $buttonlink = $Globals['pp_lang']['post']; } $pmenu .= ( $pmenu ? "   " : null ); $pmenu .= "$buttonlink"; } if ( $User['userid'] > 0 ) { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['reportphoto']}\""; } else { $buttonlink = $Globals['pp_lang']['reportphoto']; } $pmenu .= ( $pmenu ? "   " : null ); $pmenu .= "$buttonlink"; } if ( $Globals['enablecard'] == "yes" && ($Globals['cardreg'] == "no" || $User['userid'] > 0) ) { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['sendecard']}\""; } else { $buttonlink = $Globals['pp_lang']['sendecard']; } $pmenu .= ( $pmenu ? "   " : null ); $pmenu .= "$buttonlink"; } if ( $Globals['usenotify'] == "yes" && $User['userid'] > 0 ) { $results = ppmysql_query("SELECT id FROM {$Globals['pp_db_prefix']}notify WHERE userid={$User['userid']} AND photo=$photo LIMIT 1", $link); list( $notifyid ) = mysql_fetch_row($results); ppmysql_free_result($results); $pmenu .= ( $pmenu ? "   " : null ); if ( $notifyid ) { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['disable']}\""; } else { $buttonlink = $Globals['pp_lang']['disable']; } $pmenu .= "$buttonlink"; } else { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['enable']}\""; } else { $buttonlink = $Globals['pp_lang']['enable']; } $pmenu .= "$buttonlink"; } } $linef = false; if ( is_image($bigimage) ) { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['printview']}\""; } else { $buttonlink = $Globals['pp_lang']['printview']; } $pmenu .= ( $pmenu ? "   " : null ); $pmenu .= "$buttonlink"; } if ( $exifinfo ) { if ( $Globals['imgmenu'] == "yes" ) { $buttonlink = "\"{$Globals['pp_lang']['showexif']}\""; } else { $buttonlink = $Globals['pp_lang']['showexif']; } $pmenu .= ( $pmenu ? "   " : null ); $pmenu .= "$buttonlink"; } $userip = null; if ( $User['adminedit'] == 1 || $User['moderator'] == 1 || ($User['userid'] == $iuserid && $ueditpho == 1) ) { if ( !isset($ismod) ) { $ismod = ( $User['adminedit'] == 1 ? true : false ); if ( $User['moderator'] == 1 ) { $ismod = is_moderator($dbcat); } } if ( $ismod || ($User['userid'] == $iuserid && $ueditpho == 1) ) { if ( $Globals['imgmenu'] == "no" ) { $pmenu .= "
"; } $pmenu .= ( $pmenu ? "   " : null ); $pmenu .= "\"{$Globals['pp_lang']['editphoto']}\""; if ( $Globals['allowpost'] == "yes" && $CatPerms['ugpost'][$dbcat] == 0 ) { if ( $allowcoms == 1 ) { $pmenu .= "   \"{$Globals['pp_lang']['closecoms']}\""; } else { $pmenu .= "   \"{$Globals['pp_lang']['opencoms']}\""; } } } if ( $ismod || $User['adminedit'] == 1 ) { $userip = " $ipaddr"; } if ( $User['adminedit'] == 1 ) { if ( $approved == 0 ) { $pmenu .= "   \"{$Globals['pp_lang']['approve']}\""; } elseif ( $approved == 2 ) { $pmenu .= "   \"{$Globals['pp_lang']['unhide']}\""; } else { $pmenu .= "   \"{$Globals['pp_lang']['hide']}\""; } $pmenu .= "   \"{$Globals['pp_lang']['movedel']}\""; if ( $cattype == "a" ) { if ( $photo == $catthumb ) { $pmenu .= "   \"{$Globals['pp_lang']['removealbum']}\""; } else { $pmenu .= "   \"{$Globals['pp_lang']['makethumb']}\""; } } $pmenu .= ( $pmenu ? "   " : null ); if ( $issticky == 99999 ) { $pmenu .= "\"{$Globals['pp_lang']['stick']}\""; } else { $pmenu .= "\"{$Globals['pp_lang']['unstick']}\""; } if ( $cattype == "c" ) { $pmenu .= ( $pmenu ? "   " : null ); if ( $photo == $catthumb ) { $pmenu .= "\"{$Globals['pp_lang']['removeindex']}\""; } else { $pmenu .= "\"{$Globals['pp_lang']['makeindex']}\""; } } } } // find similiar posts if ( empty($keywords) ) { $keywords = $title; } $keylinks = null; $keys = explode( " ", $keywords ); $keys = array_unique($keys); foreach( $keys as $si ) { $si = un_htmlspecialchars($si); $ignorew = array( "the", "a", "but", "are", "and" ); if ( $si && !in_array($si, $ignorew) ) { $keylinks .= "$si "; } } if ( $Globals['allowpost'] == "yes" ) { $cc = $ckcolor = 0; $posts = null; $comq = "
"; if ( $Globals['dispempty'] == "yes" ) { $query = "SELECT id,username,userid,date,rating,comment,approved,ipaddress FROM {$Globals['pp_db_prefix']}comments WHERE photo=$photo ORDER BY date ASC"; } else { $query = "SELECT id,username,userid,date,rating,comment,approved,ipaddress FROM {$Globals['pp_db_prefix']}comments WHERE photo=$photo AND LENGTH(comment) > 0 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, $cuser, $cuserid, $cdate, $crating, $commenttextline, $approved, $comip ) = mysql_fetch_row($rows) ) { if ( ($crating > 0 && $ratingtype != 1) && $Globals['allowrate'] == "yes" ) { $ratingdisp[$itemnum] = "{$Globals['pp_lang']['rating']}: $crating "; } else { $ratingdisp[$itemnum] = null; } if ( ($Globals['dispempty'] == "no" && trim($commenttextline) == "") || ($Globals['moderatecoms'] == "no" && $approved == 0) ) { // Do not print anything under these condition; placeholder } else { $cc++; if ($cc >= $cstartnumb) { if ($cc < ($cstartnumb+$perpage)) { $profilelink = get_profilelink( $cuserid, $cuser ); $imgtime[$itemnum] = formatpptime( $cdate ); $imgdate[$itemnum] = formatppdate( $cdate ); $commentnum[$itemnum] = $id; $cowner[$itemnum] = $cuserid; $ucuser[$itemnum] = $Globals['pp_lang']['unreg']; $uclocation[$itemnum] = $uctitle[$itemnum] = $ucposts[$itemnum] = null; $uregdate[$itemnum] = $uugallery[$itemnum] = $uisonline[$itemnum] = $uhpage[$itemnum] = null; $ucedit[$itemnum] = false; // call get_profiledata to get all the links possible unset($postline); list( $cuname, $cuhomep, $cuposts, $cutitle, $cureg, $culoc, $cuavatar, $usig ) = get_profiledata( $cuserid ); if ( $cureg ) { $uregdate[$itemnum] = "

{$Globals['pp_lang']['registered']}: " . formatppdate($cureg, "month yyyy"); } if ( $cuposts ) { $ucposts[$itemnum] = "
{$Globals['pp_lang']['posts']}: ". number_format($cuposts); } if ( $culoc ) { $uclocation[$itemnum] = "
{$Globals['pp_lang']['location']}: $culoc"; } if ( $cutitle ) { $uctitle[$itemnum] = "
$cutitle"; } if ( ($User['adminedit'] == 1 || $User['moderator'] == 1) && $comip ) { $uctitle[$itemnum] .= "
$comip"; } $uugallery[$itemnum] = $ugallery; $uisonline[$itemnum] = $isonline; $uhpage[$itemnum] = $cuhomep; if ( $cuavatar && $Globals['showavatar'] == "yes" ) { $cuname .= "
$cuavatar"; } $ucuser[$itemnum] = $cuname; if ( $cuserid > 0 ) { $upostline[$itemnum] = $postline; } if ( $ckcolor == 1 ) { $fillcolor[$itemnum] = "{$Style['tdbackground']}"; $ckcolor = 0; } else { $fillcolor[$itemnum] = "{$Style['tddetails']}"; $ckcolor = 1; } $commenttextline = un_htmlspecialchars($commenttextline); //if ( VB3_ENHANCEDINT == "on" ) //{ // $commenttextline = convert_markups($commenttextline); //} //else //{ $commenttextline = convert_returns(convert_markups($commenttextline)); //} $commenttext[$itemnum] = $commenttextline; if ( $usig && $Globals['showsigs'] == "yes" ) { $usigline = convert_markups($usig); $commenttext[$itemnum] .= "

------------------------------
$usigline"; } if ( ($User['userid'] == $cowner[$itemnum] && $ueditposts == 1) || $ismod ) { if ( $Globals['comtimeout'] > 0 && !$ismod ) { $julian = time(); $timediff = $julian - $cdate; if ( $timediff < $Globals['comtimeout'] ) { $ucedit[$itemnum] = true; } } else { $ucedit[$itemnum] = true; } } $itemnum++; } } } } ppmysql_free_result( $rows ); if ( ($Globals['allowpost'] == "yes" && $User['comments'] == 1) && $CatPerms['ugpost'][$dbcat] == 0 ) { if ( $ratingtype != 1 ) { $ratecode .= get_rate_code(0); } if ( defined('SIMPLE_VERSION') && SIMPLE_VERSION > 366 && VB3_ENHANCEDINT == "on" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/quickcom367.tmpl" ); } else { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/quickcom.tmpl" ); } } } // begin pages/nav system ## $comnav = null; if ( $compages > 1 ) { $comnav .= "
  {$Globals['pp_lang']['page']}:  "; $thestart = null; 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']}/showphoto.php/photo/$photo/cpage/$p" ); } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$photo&cpage=$p" ); } $comnav .= "$thispage"; } if ( $p > $theend ) { break; } if ( $cpage == $p ) { $comnav .= "$p"; } } if ( $cpage < $compages ) { $nextpage = $cpage + 1; if ( $Globals['spider'] == "yes" ) { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php/photo/$photo/cpage/$nextpage" ); } else { $conurl = construct_ppurl( "{$Globals['maindir']}/showphoto.php?photo=$photo&cpage=$nextpage" ); } $more = "\"{$Globals['pp_lang']['more']}\""; } else { $more = " "; } $comnav .= "$more
"; } // end pages/nav ### if ( $Globals['ipcache'] != 0 ) { $ipaddress = findenv("REMOTE_ADDR"); $result = ppmysql_query("SELECT userid,date,photo FROM {$Globals['pp_db_prefix']}ipcache WHERE ipaddr='$ipaddress' AND type='view' AND photo=$photo LIMIT 1", $link); $numfound = mysql_num_rows($result); $mytime = time(); if ( $numfound > 0 ) { list( $tuserid, $lastdate, $photo ) = mysql_fetch_row($result); if ( $lastdate < $timeout ) { inc_photoviews( $photo ); if ( $User['userid'] > 0 && $Globals['vbversion'] == "photopost" ) { ppmysql_query("UPDATE {$Globals['pp_db_prefix']}users SET views=views+1 WHERE userid={$User['userid']}", $db_link); } $timeout = time() - ($Globals['ipcache'] * 3600); ppmysql_query("DELETE FROM {$Globals['pp_db_prefix']}ipcache WHERE date < $timeout", $link); ppmysql_query("INSERT INTO {$Globals['pp_db_prefix']}ipcache (userid,ipaddr,date,type,photo) VALUES ('$tuserid', '$ipaddress', '$mytime', 'view', $photo)", $link); } } else { ppmysql_query("INSERT INTO {$Globals['pp_db_prefix']}ipcache (userid,ipaddr,date,type,photo) VALUES ('$tuserid', '$ipaddress', '$mytime', 'view', $photo)", $link); inc_photoviews( $photo ); if ( $User['userid'] > 0 && $Globals['vbversion'] == "photopost" ) { ppmysql_query("UPDATE {$Globals['pp_db_prefix']}users SET views=views+1 WHERE userid={$User['userid']}",$db_link); } } } else { inc_photoviews( $photo ); if ( $User['userid'] > 0 && $Globals['vbversion'] == "photopost" ) { ppmysql_query("UPDATE {$Globals['pp_db_prefix']}users SET views=views+1 WHERE userid={$User['userid']}", $link); } } if ( $Globals['sidebar_global'] == "yes" ) { if ( $Globals['statspal'] == "yes" ) { get_statscache(); } if ( $Globals['topposterspal'] == "yes" ) { get_posterscache(); } if ( $Globals['ratingspal'] == "yes" ) { get_ratingcache(); } } if ( !empty($title) ) { printheader( $dbcat, " $title", 0, "yes", $bigimage ); } else { printheader( $dbcat, " $bigimage", 0, "yes", $bigimage ); } topmenu(); childsub($dbcat, $cattype); $childnav = "{$Globals['pp_lang']['home']} $childnav"; // Make the display codes (just in case) if ( is_multimedia($bigimage) ) { $showbbcode = "[media]{$imgurl}[/media]"; } else { $showbbcode = "[img]{$imgurl}[/img]"; } $showhtmlcode = "<img src="$imgurl" />"; $showdirectcode = "$imgurl"; if ( $Globals['spider'] == "yes" ) { $showbbthumb = "[url={$Globals['maindir']}/showphoto.php/photo/$photo][img]{$Globals['datadir']}/{$storecat}/thumbs/{$bigimage}[/img][/url]"; $showbbmed = "[url={$Globals['maindir']}/showphoto.php/photo/$photo][img]{$Globals['datadir']}/{$storecat}/medium/{$bigimage}[/img][/url]"; } else { $showbbthumb = "[url={$Globals['maindir']}/showphoto.php?photo=$photo][img]{$Globals['datadir']}/{$storecat}/thumbs/{$bigimage}[/img][/url]"; $showbbmed = "[url={$Globals['maindir']}/showphoto.php?photo=$photo][img]{$Globals['datadir']}/{$storecat}/medium/{$bigimage}[/img][/url]"; } $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"; } } // Start printing the page.. include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/menubar.tmpl" ); if ( $Globals['sidebar'] == "left" && $Globals['sidebar_global'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_leftopen.tmpl" ); } if ( $Globals['sidebar'] == "right" && $Globals['sidebar_global'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_rightopen.tmpl" ); } if ( VB3_ENHANCEDINT == "on" ) { $stylepath = ( $stylevar[imgdir_button][0] == "/" || $stylevar[imgdir_button][0] == "h" ? "" : "{$Globals['vbulletin']}/" ); } include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/showphoto.tmpl" ); if ( $Globals['sidebar'] == "left" && $Globals['sidebar_global'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_leftclose.tmpl" ); } if ( $Globals['sidebar'] == "right" && $Globals['sidebar_global'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_rightclose.tmpl" ); } printfooter(); ?>