INT, 'cat' => INT)); typecast($_COOKIE, array('ppcollapse' => STRING)); // Init variables if ( empty($page) ) $page = 1; authenticate(); if ( $Globals['ppboards'] == "closed" && $User['adminedit'] != 1 ) { diewell( $Globals['closedmsg'] ); } $tablehead = $Globals['pp_lang']['tablehead']; if ( $cat > 0 ) { if ($CatPerms['ugview'][$cat] == 1 ) { diewell( $Globals['pp_lang']['noview'] ); } if ( trim($CatPerms['catpass'][$cat]) && $User['adminedit'] != 1 ) { if ( !isset($catp) ) $catp = null; if ( $catp != $CatPerms['catpass'][$cat] ) { get_password( $cat ); exit; } } $ctitleq = ppmysql_query("SELECT id,theme,sortorder,frames,intro,introtitle,introcopy FROM {$Globals['pp_db_prefix']}categories WHERE id=$cat", $link); $catinfo = mysql_fetch_array($ctitleq); if ( !preg_match("/([\<])([^\>]{1,})*([\>])/i", $catinfo['introtitle']) ) { $catinfo['introtitle'] = preg_replace("/(\r\n|\r|\n)/i","
", $catinfo['introtitle']); } if ( !preg_match("/([\<])([^\>]{1,})*([\>])/i", $catinfo['introcopy']) ) { $catinfo['introcopy'] = preg_replace("/(\r\n|\r|\n)/i","
", $catinfo['introcopy']); } // Nonstandard theme if ( $catinfo['theme'] ) { $Globals['theme'] = $catinfo['theme']; if ( is_dir( "{$Globals['PP_PATH']}/stylesheets/{$Globals['theme']}" ) ) { $Globals['idir'] = "{$Globals['maindir']}/stylesheets/{$Globals['theme']}"; } } // Non standard frames if ( !empty($catinfo['frames']) ) { unset( $Globals['thumbstd'] ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/{$catinfo['frames']}.tmpl" ); } if ( $User['userid'] > 0 && $Globals['displaynew'] == "yes" ) { ppmysql_query("REPLACE INTO {$Globals['pp_db_prefix']}laston VALUES($cat,{$User['userid']},$lasttimeon)", $link); } $tablehead = $CatPerms['catname'][$cat]; childsub($cat); $childnav = "{$Globals['pp_lang']['home']} $childnav"; $searchcat = $cat; } else { if ( $User['username'] && $User['username'] != "Unregistered" ) { $childnav = "{$Globals['pp_lang']['welcomeuser']} {$User['username']}"; } else { $childnav = "{$Globals['pp_lang']['welcome']} {$Globals['galleryname']}!"; } $searchcat = "all"; } topmenu(); printheader( $cat, $tablehead ); // Let's go! $count = $catdepth = $cptotal = $posttotal = $totalviews = $diskspace = 0; $catrows = $nextbutton = $prevbutton = null; catrow($cat); if ( $posternav ) { if ( $page < $pages ) { $nextpage = $page + 1; if ( $Globals['spider'] == "yes" ) { $extrainfo = ( !empty($cat) ? "/cat/$cat" : "" ); $nextbutton = " »"; } else { $extrainfo = ( !empty($cat) ? "&cat=$cat" : "" ); $nextbutton = " »"; } } if ( $page > 1 ) { $prevpage = $page - 1; if ( $Globals['spider'] == "yes" ) { $extrainfo = ( !empty($cat) ? "/cat/$cat" : "" ); $prevbutton = "« "; } else { $extrainfo = ( !empty($cat) ? "&cat=$cat" : "" ); $prevbutton = "« "; } } $posternav = "$prevbutton$posternav$nextbutton"; } if ( !$updatecache ) { // We're reading from the cache $cache = unserialize( $cacheq['statscache'] ); } else { if ( $Globals['statspal'] == "yes" ) { get_statscache(); } if ( $Globals['topposterspal'] == "yes" ) { get_posterscache(); } if ( $Globals['ratingspal'] == "yes" ) { get_ratingcache(); } if ( $Globals['undercat'] == "yes" ) { // Lets get the Recent Comments $numcompal = ($Globals['numcompal'] + 5); $queryz = ppmysql_query("SELECT c.username,c.userid,c.cat,c.photo,c.comment,p.bigimage,p.cat,p.storecat,p.userid,p.width,p.height FROM {$Globals['pp_db_prefix']}comments c LEFT JOIN {$Globals['pp_db_prefix']}photos p ON p.id=c.photo WHERE comment != '' ORDER BY c.date DESC LIMIT $numcompal", $link); $numfound = 0; while ( list($cache['comments']['username'][$numfound], $cache['comments']['userid'][$numfound], $cache['comments']['cat'][$numfound], $cache['comments']['lcphoto'][$numfound], $comcomment, $thumbimg, $thumbcat, $storecat, $thumbuid, $thumbw, $thumbh ) = mysql_fetch_row($queryz)) { if ( $storecat != 0 ) { $thumbcat = $storecat; } // Clean up html conversions $comcomment = un_htmlspecialchars($comcomment); // Strip out BB codes $comcomment = preg_replace("#\[.*/?\]#siU", "", $comcomment); $cache['comments']['cat'][$numfound] = $thumbcat; $cache['comments']['comment'][$numfound] = ( strlen($comcomment) > 100 ? substr($comcomment,0,100)."..." : $comcomment ); $cache['comments']['thumblink'][$numfound] = get_imagethumb( $thumbimg, $thumbcat, $thumbuid, 1, 0, 1, $thumbw, $thumbh ); // Rotated? We need unrotated... if ( $Globals['rotatel'] > 0 || $Globals['rotatep'] > 0 ) { $cache['comments']['thumblink'][$numfound] = str_replace("/thumbs/", "/mini/", $cache['comments']['thumblink'][$numfound]); } if ( $Globals['spider'] == "yes" ) { $cache['comments']['link'][$numfound] = "{$Globals['maindir']}/showphoto.php/photo/{$cache['comments']['lcphoto'][$numfound]}/cat/{$cache['comments']['cat'][$numfound]}"; } else { $cache['comments']['link'][$numfound] = "{$Globals['maindir']}/showphoto.php?photo={$cache['comments']['lcphoto'][$numfound]}&cat={$cache['comments']['cat'][$numfound]}"; } if ( $numfound == $Globals['numcompal'] ) { break; } $numfound++; } } if ( $Globals['cachetimeout'] > 0 ) { // Let's update the cache $slashcache = addslashes(serialize($cache)); // Next update in settings.cachetimeout minutes $nextupdate = $lasttimeon + ($Globals['cachetimeout'] * 60); ppmysql_query("UPDATE {$Globals['pp_db_prefix']}cache SET timestamp=$nextupdate,statscache='$slashcache' WHERE id=1", $link); } } if ( $Globals['undercat'] == "yes" ) { // Process the Recent Comments array (if needed) $numfound = 0; $compal = array(); for ( $x = 0; $x < count($cache['comments']['comment']); $x++ ) { $thumbcat = $cache['comments']['cat'][$x]; if ( $CatPerms['ugview'][$thumbcat] == 0 ) { $compal['comment'][] = $cache['comments']['comment'][$x]; $compal['thumblink'][] = $cache['comments']['thumblink'][$x]; $compal['link'][] = $cache['comments']['link'][$x]; $compal['username'][] = $cache['comments']['username'][$x]; $compal['userid'][] = $cache['comments']['userid'][$x]; $numfound++; if ( $numfound == $Globals['numcompal'] ) { break; } } } } $whoonline = null; if ( $Globals['onlinepal'] == "yes" ) { // Lets get Who is Online $whoonline = get_whoonline(); } // // Generate the page // include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/menubar.tmpl" ); if ( $Globals['sidebar'] == "left" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_leftopen.tmpl" ); } if ( $Globals['sidebar'] == "right" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_rightopen.tmpl" ); } if ( $Globals['news'] == "yes" && $page == 1 ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/announce.tmpl" ); } if ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "no" && $page == 1 ) { display_gallery("latest"); } include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/indexhead.tmpl" ); if ( $catinfo['intro'] == "yes" && $page == 1 ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/catintro.tmpl" ); } $whichgallery = ( $Globals['pplayout'] == "no" ? "categall" : "categories" ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/$whichgallery.tmpl" ); if ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "yes" && $page == 1 ) { display_gallery("latest"); } if ( $Globals['dispopular'] == "yes" && $page == 1 ) { display_gallery("most_views"); } if ( $Globals['disrandom'] == "yes" && $page == 1 ) { display_gallery("random"); } if ( $Globals['undercat'] == "yes" ) { if ($Globals['sidebar_index'] == "no" || $Globals['sidebar'] == "off" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/undercat.tmpl" ); } else { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/undercat-sidebar.tmpl" ); } } elseif ( $Globals['statspal'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/indexstats.tmpl" ); } if ( $Globals['sidebar'] == "left" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_leftclose.tmpl" ); } if ( $Globals['sidebar'] == "right" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/sidebar_rightclose.tmpl" ); } printfooter(); ?>