0 ) { list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $mon = $mon + 1; $lasttimeon = mktime($hour,$min,$sec,$mon,$mday,$year); $laston = "REPLACE INTO laston VALUES($cat,$userid,$lasttimeon)"; $resultb = ppmysql_query($laston, $link); } $perpage1x = $Globals['thumbcols']; $perpage3x = ($perpage1x * 3); $perpage4x = ($perpage1x * 4); $perpage5x = ($perpage1x * 5); $perpage6x = ($perpage1x * 6); if ( isset($perpage) ) { if ($perpage > $perpage6x) $perpage = $perpage6x; } else $perpage = $perpage3x; if ( isset($page) ) { $startnumb = ($page*$perpage)-$perpage+1; } else { $page=1; $startnumb=1; } if ( isset($cat) ) { if ( $thumb != 0 ) { $thecat = $cat; // do they have permission to be here? if ( $thecat > 3000 ) { $catthumbs = "yes"; $query = "SELECT id,albumname,parent,isprivate,password FROM useralbums WHERE id=$thecat"; $resultb = ppmysql_query($query,$link); if ( $resultb ) { list( $thecatid, $thecatname, $parent, $isprivate, $password ) = mysql_fetch_row($resultb); ppmysql_free_result( $resultb ); if ( ($isprivate == "yes" && $userid != $parent) && $adminedit != 1 ) { if ( empty($papass) ) $papass = ""; if ( $password != $papass ) { diewell( $Globals['pp_lang']['noperm'] ); exit; } } } } // do the sort box // $query = "SELECT * FROM sort"; if ($thecat == "500") { if ( empty($ppuser) && empty($si) ) { $query = "SELECT * FROM sortmemb"; } } $resultc = ppmysql_query($query,$link); if ( empty($sort) ) $sortparam = 1; else $sortparam = $sort; $sortoptions = ""; $sortdefault=""; $catrows=""; while ( list($sortid, $sortname, $sortc) = mysql_fetch_row($resultc) ) { if ($sortparam != $sortid) { $sortoptions .= ""; } else { $sortdefault = ""; $sortcode = "$sortc"; } if ($sortdefault == "") { $sortdefault = ""; } } ppmysql_free_result( $resultc ); $sort = ""; // end sort box // $albums=""; $personal=0; $subcats=""; $albumrow=""; $searchterms = $si; $incat = $cat; if ($ppuser != "") { if ( $cat == 500 ) { list( $tcat, $tmail ) = get_username($ppuser); $thecatname = "$tcat's Gallery"; $titlereplace = "$tcat's {$Globals['pp_lang']['gallery']}"; } elseif ( $cat > 3000 ) { list( $tcat, $tmail ) = get_username($ppuser); $thecatname = "$tcat's Personal Album"; $titlereplace = "$tcat's {$Globals['pp_lang']['album']}"; } } else { if ( $cat == "999" ) { list( $tcat, $tmail ) = get_username($userid); $thecatname = "$tcat's {$Globals['pp_lang']['favorites']}"; } elseif ( $cat == "998" ) { $thecatname = $Globals['pp_lang']['callimages']; } elseif ( $cat == "997" ) { $thecatname = $Globals['pp_lang']['clastday']; } elseif ( $cat == "996" ) { $thecatname = $Globals['pp_lang']['clast7']; } elseif ( $cat == "995" ) { $thecatname = $Globals['pp_lang']['clast14']; } elseif ( $cat == "991" ) { $thecatname = $Globals['pp_lang']['searchres']; } else { $query = "SELECT id,catname FROM categories WHERE id='$cat'"; $ctitleq = ppmysql_query($query, $link); if ( $ctitleq ) { list( $catid, $thecatname ) = mysql_fetch_row($ctitleq); ppmysql_free_result( $ctitleq ); } } } printheader( $thecat, $thecatname ); childsub($incat); $childnav = "{$Globals['pp_lang']['home']} $childnav"; topmenu(); $searchbox = "
{$Globals['pp_lang']['recent']}: {$Globals['pp_lang']['lastday']}  {$Globals['pp_lang']['last7']}  {$Globals['pp_lang']['last14']}  {$Globals['pp_lang']['allimages']}
"; if ($cat == "500") { if ($si == "") { if ( $ppuser == "" ) { $thumb = 2; } else { $query = "SELECT id,albumname,description,isprivate FROM useralbums WHERE parent=$ppuser"; $arows = ppmysql_query($query,$link); if ( $arows > 0 ) { while ( list( $subid, $subalbumname, $subalbumdesc, $isprivate ) = mysql_fetch_row($arows) ) { if ( empty($subalbumdesc) ) $subalbumdesc = " "; if ( $isprivate == "no" || ($isprivate == "yes" && ($userid == $ppuser || $adminedit == 1)) ) { $albumrow .= "$subalbumname $subalbumdesc \n"; } } if ( $arows ) ppmysql_free_result( $arows ); if ( $albumrow != "" ) { $albums .= "
$childnav $searchbox
$albumrow
{$Globals['pp_lang']['albums']} {$Globals['pp_lang']['desc']}

"; } $personal=1; } } } } else { if ( empty($si) ) { catrow( $cat ); if ( !empty($catrows) ) { $subcats = "
$childnav $searchbox
"; $subcats .= $catrows; $subcats .= "
{$Globals['pp_lang']['category']} {$Globals['pp_lang']['photos']}"; if ( $Globals['allowpost'] == "yes" ) { $subcats .= "{$Globals['pp_lang']['comments']} {$Globals['pp_lang']['lastcomment']}"; } $subcats .= "{$Globals['pp_lang']['lastphoto']}

"; } } } if ( !empty($incat) ) { if ( $incat == "500" ) $cols = 6; else $cols = $Globals['thumbcols']; } else { $cols = $Globals['thumbcols']; } $output .= "
$menu2 $menu 
"; if ( ($incat < 990 || $incat > 2999) && empty($si) ) { if ( $Globals['memformat'] == "no" && ($incat == "500" && $ppuser != "") ) { if ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "no" ) { display_gallery("latest", $ppuser); } else { $output .= "
"; } if ( $si == "" ) { list( $tname, $tmail ) = get_username($ppuser); $output .= "
{$Globals['pp_lang']['tosee']} $tname's {$Globals['pp_lang']['littlephotos']}

"; } } elseif ( $Globals['memformat'] == "no" && ($Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "no") ) { display_gallery("latest", "", $incat); } } if ( !empty($albums) ) { $output .= "$albums"; $galleryhead = ""; } elseif ( !empty($subcats) ) { $output .= "$subcats"; $galleryhead = ""; $count = 1; } } list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($ulast); $mon++; $year=1900+$year; $profilelink = get_profilelink( $theuserid ); if ( $Globals['memblist'] == "no" ) { $uout .= ""; } else { $uout .= "\n"; } } else { // usually means a person with no approved images, so we dont display them $cc--; } } } } ppmysql_free_result( $queryz ); if ( $Globals['memblist'] == "no" ) { $squares = $Globals['thumbcols']-$count; for ($v=1; $v <= $squares; $v++) { $uout .= ""; } $output .= "$uout
"; } else { $output .= ""; $galleryhead = "
"; } $output .= "
$childnav $searchbox
$galleryhead"; if ($incat != "" && $thumb != 1) { if ($incat != "500" ) { $space = catrow($incat); } if ( isset($space) ) { $catrows .= "


"; // If we're not in the member gallery cat, then print thumbs.. // Otherwise, print a list of users. $phrase=""; if ( $thumb != 2 ) { if ($si != "") { $sterms = trim($si); $searchterms = explode(" ", $sterms); $scount=0; $totalterms = count($searchterms); $totalterms++; foreach ($searchterms as $key) { $scount++; if ($scount > 1) { $phrase .= " AND "; } $key = addslashes( $key ); $phrase .= "(title LIKE \"% $key%\" OR description LIKE \"% $key%\" OR keywords LIKE \"% $key%\" OR bigimage LIKE \"% $key%\" OR user LIKE \"% $key%\")"; $phrase .= " OR (title LIKE \"$key%\" OR description LIKE \"$key%\" OR keywords LIKE \"$key%\" OR bigimage LIKE \"$key%\" OR user LIKE \"%$key%\")"; } } if ( $personal == 1 ) { $exclude_cat .= " AND cat < 3000"; } elseif ( $cat > 3000 ) { $exclude_cat .= " AND cat=$cat"; } if ( $cat == 999 ) { // My Favorites if ( empty($si) ) { $query = "SELECT f.userid,p.id,p.user,p.userid,p.cat,p.date,p.title,p.description,p.keywords, p.bigimage,p.width,p.height,p.filesize,p.views,p.medwidth,p.medheight,p.medsize,p.approved,p.rating,p.allowprint FROM favorites f, photos p WHERE f.userid=$userid AND f.photo=p.id $sortcode"; } else { $query = "SELECT f.userid,p.id,p.user,p.userid,p.cat,p.date,p.title,p.description,p.keywords, p.bigimage,p.width,p.height,p.filesize,p.views,p.medwidth,p.medheight,p.medsize,p.approved,p.rating,p.allowprint FROM favorites f, photos p WHERE ($phrase) AND f.userid=$userid AND f.photo=p.id $sortcode"; } $queryv = ppmysql_query($query, $link); } elseif ( $cat == 998 ) { // All Images if ( empty($si) ) { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE bigimage!='' $exclude_cat $sortcode"; $queryv = ppmysql_query($query, $link); } else { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE ($phrase) AND bigimage!='' $exclude_cat $sortcode"; $queryv = ppmysql_query($query, $link); } } elseif ( $cat > 994 && $cat < 998 ) { // Last 1 days if ( $cat == 995 ) $days = 14; elseif ( $cat == 996 ) $days = 7; else $days = 1; list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $mon = $mon + 1; $hour = $hour - ($days * 24); $searchdate = mktime($hour,$min,$sec,$mon,$mday,$year); $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE bigimage!='' AND date > $searchdate $exclude_cat $sortcode"; $queryv = ppmysql_query($query, $link); } elseif ($si == "") { if ($ppuser == "") { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE bigimage!='' AND cat=$thecat $exclude_cat $sortcode"; } else { if ( $Globals['memformat'] == "yes" ) { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE bigimage!='' AND userid=$ppuser $exclude_cat $sortcode"; } else { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE bigimage!='' AND userid=$ppuser AND cat=$thecat $exclude_cat $sortcode"; } } $queryv = ppmysql_query($query,$link); } else { if ($stype == "") { $stype=1; } if ($stype == "1") { if ($thecat != 500) { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE ($phrase) AND cat=$thecat $exclude_cat $sortcode"; $queryv = ppmysql_query($query,$link); } else { if ($phrase != "") { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE $phrase $exclude_cat $sortcode"; $queryv = ppmysql_query($query,$link); } else { if ($exclude_cat) { $exclude_cat = str_replace("AND", "WHERE", $exclude_cat); } $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos $exclude_cat $sortcode"; $queryv = ppmysql_query($query,$link); } } } else { if ($thecat != 500) { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE user LIKE '$sterms' AND cat=$thecat $exclude_cat $sortcode"; $queryv = ppmysql_query($query,$link); } else { $query = "SELECT id,user,userid,cat,date,title,description,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,allowprint FROM photos WHERE user LIKE '$sterms' $exclude_cat $sortcode"; $queryv = ppmysql_query($query,$link); } } } $rowcnt = mysql_num_rows($queryv); if ($rowcnt == "0") { if ( $catthumbs == "yes" ) { if ($ugview{$thecat} != 1 ) { $noresults = "
{$Globals['pp_lang']['nophotos']}

"; } else { $noresults = "
{$Globals['pp_lang']['nopermcat']}

"; } } else { $noresults = "
{$Globals['pp_lang']['nocatimg']}

"; } } else { $noresults=""; } pagesystem($rowcnt); $count=0; $cntresults=0; $numcols = $Globals['thumbcols']+1; $pwidth = intval(100/($numcols-1)); while ( $row = mysql_fetch_row($queryv) ) { if ( $cat == 999 ) list( $favid, $id, $tuser, $tuserid, $pcat, $date, $title, $desc, $keywords, $bigimage, $width, $height, $filesize, $views, $medwidth, $medheight, $medsize, $approved, $imgrating, $allowprint ) = $row; else list( $id, $tuser, $tuserid, $pcat, $date, $title, $desc, $keywords, $bigimage, $width, $height, $filesize, $views, $medwidth, $medheight, $medsize, $approved, $imgrating, $allowprint ) = $row; $is_private = "no"; if ( $pcat != $thecat ) $is_private = is_image_private( $pcat ); if ( $is_private == "no" ) { if ( $width == 0 && $height == 0 ) $sizecode = "n/a"; else $sizecode = "$width x $height"; $cntresults++; $filesize = $filesize/1024; $filesize = sprintf("%1.1f", $filesize); $filesize = $filesize."k"; if ($cntresults >= $startnumb) { if ($cntresults < ($startnumb+$perpage)) { // Print out the thumbnail photo along with the title, username, etc // PERL->PHP (had to +1 for some reason) $querya = "SELECT username FROM comments WHERE photo=$id ORDER BY date DESC"; $queryz = ppmysql_query($querya,$link); list( $lastposter ) = mysql_fetch_row($queryz); $comcount = mysql_num_rows($queryz); ppmysql_free_result($queryz); $count++; if ($count == $numcols) { $output .= ""; $count = 1; } $theext = get_ext($bigimage); $filename = $bigimage; $filename = str_replace( $theext, "", $filename); $ppdate = formatppdate( $date ); if ($medsize > 0) { $medsize = $medsize/1024; $medsize = sprintf("%1.1f", $medsize); $medsize = $medsize."k"; $ilink = "{$Globals['datadir']}/$pcat/$tuserid$filename-med$theext"; $biglink = "{$Globals['datadir']}/$pcat/$tuserid$filename$theext"; $fsizedisp = "$medsize, $filesize"; } else { $ilink = "{$Globals['datadir']}/$pcat/$tuserid$filename$theext"; $fsizedisp = "$filesize"; } // Find out if a photo has comments if ($comcount != "0") { $comline = "$comcount comments"; } else { $comline = "{$Globals['pp_lang']['nocomments']}"; } // get the rating if ($imgrating && $Globals['allowrate'] == "yes" ) { for ( $x = 1; $x <= $imgrating; $x++ ) { if ( $x == 1 ) $rating = "\"$imgrating"; else $rating .= "\"$imgrating"; } } else { $rating = $Globals['pp_lang']['none']; } $thumbrc = get_imagethumb( $bigimage, $pcat, $tuserid, $approved ); $profilelink = get_profilelink( $tuserid ); $output .= ""; } } } } if ( $queryv ) ppmysql_free_result( $queryv ); $squares = $Globals['thumbcols']-$count; for ($v=1; $v <= $squares; $v++) { $output .= ""; } if ( $posternav != "" ) $posternav = "$posternav

"; if ( $noresults != "" ) $noresults = "

$noresults"; $output .= "

"; } $output .= $catrows; } $output .= "<"; $output .= "!--7575-->"; $output .= "
{$Globals['pp_lang']['perpage']} {$Globals['pp_lang']['sortby']} $sort
$thumbrc
"; if ( $Globals['allowrate'] == "yes" ) { $output .= ""; } $output .= ""; if ( $Globals['allowpost'] == "yes" ) { $output .=""; } $output .= "
$title"; if ( ($allowprint == "yes" || $tuserid == $userid) && $Globals['enablecal'] == "yes" ) { $output .= " \"{$Globals['pp_lang']['canprint']}\""; } $output .= "
{$Globals['pp_lang']['user']}: $tuser
{$Globals['pp_lang']['views']}: $views
{$Globals['pp_lang']['rating']}: $rating
{$Globals['pp_lang']['date']}: $ppdate
{$Globals['pp_lang']['filesize']}: $fsizedisp
{$Globals['pp_lang']['dimensions']}: $sizecode
{$Globals['pp_lang']['comments']}: $comline
"; if ( $cat == 999 ) { $output .= "
"; $output .= "
{$Globals['pp_lang']['delfav']}"; if ( ($allowprint == "yes" || $tuserid == $userid) && $Globals['enablecal'] == "yes" ) { $output .= "{$Globals['pp_lang']['printable']}"; } else { $output .= " "; } $output .= "
"; } $output .= "
 
$posternav$noresults"; if ( ($incat < 990 || $incat > 2999) && empty($si) ) { if ( $Globals['memformat'] == "no" ) { if ( $incat == "500" && ($Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "yes") ) { display_gallery("latest", $ppuser); } elseif ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "yes" ) { display_gallery("latest", "", $incat); } if ( $Globals['dispopular'] == "yes" && $incat == "500" && $ppuser != "" ) { display_gallery("most_views", $ppuser); } elseif ( $Globals['dispopular'] == "yes" ) { display_gallery("most_views", "", $incat); } if ( $Globals['disrandom'] == "yes" && $incat == "500" && $ppuser != "" ) { display_gallery("random", $ppuser); } elseif ( $Globals['disrandom'] == "yes" ) { display_gallery("random", "", $incat); } } } print "$output{$Globals['cright']}"; printfooter(); exit; } else { $query = "SELECT user,userid,SUM(views) AS tviews,COUNT(*) AS pcount,MAX(lastpost) AS maxlast,MAX(date) AS maxdate,date,SUM(filesize) AS tfilesize,id FROM photos GROUP BY user $sortcode"; $queryz = ppmysql_query($query,$link); $rowcnt = mysql_num_rows($queryz); pagesystem($rowcnt); if ($rowcnt == "0") { $noresults = "
{$Globals['pp_lang']['nophotos']}

"; } else { $noresults=""; } $uout=""; $cc=0; $count=0; $cntresults=0; $numcols = $Globals['thumbcols']+1; //$numcols = 7; $pwidth = intval(100/($numcols-1)); while ( list($theuser, $theuserid, $views, $uphotos, $ulast, $maxdate, $date, $tfilesize, $pid) = mysql_fetch_row($queryz)) { $cc++; if ($cc >= $startnumb) { if ($cc < ($startnumb+$perpage)) { $query = "select comments.id from comments,photos where photos.id=comments.photo AND photos.userid=$theuserid"; $comcountdb = ppmysql_query($query,$link); $comcount = mysql_num_rows($comcountdb); //$lastphotime = $ulast+$soffset; $cclock = formatpptime( $ulast ); $ppdate = formatppdate( $ulast ); $lpprint = "$ppdate $cclock"; $mthumb = ""; if ($Globals['membthumb'] == "yes") { $query = "SELECT bigimage,id,cat FROM photos WHERE userid=$theuserid AND approved=1 $exclude_cat ORDER BY date DESC"; // 15615 $resulta = ppmysql_query($query,$link); while( list( $bigimage, $phoid, $pcat ) = mysql_fetch_row($resulta) ) { $is_private = is_image_private( $pcat ); if ( $is_private == "no" ) break; } ppmysql_free_result( $resulta ); if ( $is_private == "yes" ) { $bigimage=""; $mthumb = "\"\""; } if ( !empty($bigimage) ) { $imgthumb = get_imagethumb( $bigimage, $pcat, $theuserid, 1 ); $mthumb = "$imgthumb"; } } if ( !empty($mthumb) || (empty($mthumb) && $Globals['membthumb'] == "no") ) { $tfilesize = $tfilesize/1024; $filesize=sprintf("%1.1f", $tfilesize); $filesize = $filesize."k"; if ( $Globals['memblist'] == "no" ) { $count++; if ($count == $numcols) { $uout .= "
"; if ( $Globals['allowpost'] == "yes" ) { $uout .= ""; } $uout .= "
$mthumb
{$Globals['pp_lang']['user']}: $theuser
{$Globals['pp_lang']['photos']}: $uphotos
{$Globals['pp_lang']['space']}: $filesize
{$Globals['pp_lang']['views']}: $views
Comments: $comcount
$theuser $uphotos $views $comcount $filesize $mthumb$lpprint
 
"; } else { $output .= " {$Globals['pp_lang']['user']} Photos {$Globals['pp_lang']['views']} {$Globals['pp_lang']['comments']} {$Globals['pp_lang']['space']} {$Globals['pp_lang']['lastphoto']} $uout"; } print "$output$posternav$noresults
{$Globals['cright']}"; printfooter(); exit; } } } ?>