INT, 'cat' => INT)); typecast($_COOKIE, array('cpcollapse' => STRING)); authenticate(); if ( isset($Globals['ppboards']) && $User['adminedit'] != 1 ) { if ( $Globals['ppboards'] == "closed" ) { print $Globals['closedmsg']; exit; } } topmenu(); $tablehead = $Globals['pp_lang']['tablehead']; if ( isset($cat) ) { if ($CatPerms['ugview'][$cat] == 1 ) { diewell( $Globals['pp_lang']['noview'] ); } $query = "SELECT id,catname FROM {$Globals['pp_db_prefix']}categories WHERE id=$cat"; $resultb = ppmysql_query($query,$link); list( $catid, $cattitle ) = mysql_fetch_row($resultb); ppmysql_free_result( $resultb ); if ( $User['userid'] > 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 {$Globals['pp_db_prefix']}laston VALUES($cat,{$User['userid']},$lasttimeon)"; $resultb = ppmysql_query($laston, $link); } $tablehead = "$cattitle"; 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"; } printheader( $cat, $tablehead ); $count = 0; $catdepth = 0; $cptotal = 0; $posttotal = 0; $totalviews = 0; $diskspace = 0; if ( !(isset($cat)) ) { catrow(0); } else { catrow($cat); } if ( $Globals['statspal'] == "yes" ) { $usertotal = get_totalusers(); $query = "SELECT SUM(views), count(*) FROM {$Globals['pp_db_prefix']}products WHERE approved=1"; $totalv = ppmysql_query($query,$link); list( $totalviews, $totalproducts ) = mysql_fetch_row($totalv); ppmysql_free_result($totalv); $query = "SELECT count(*) FROM {$Globals['pp_db_prefix']}comments"; $totalv = ppmysql_query($query,$link); list( $posttotal ) = mysql_fetch_row($totalv); ppmysql_free_result($totalv); $query = "SELECT amt_sold,ads_sold FROM {$Globals['pp_db_prefix']}stats"; $totalv = ppmysql_query($query,$link); list( $amtsold, $soldads ) = mysql_fetch_row($totalv); ppmysql_free_result($totalv); $totalviews = number_format( $totalviews ); $totalproducts = number_format( $totalproducts ); $usertotal = number_format( $usertotal ); $posttotal = number_format( $posttotal ); $amtsold = number_format( $amtsold ); $soldads = number_format( $soldads ); } if ( $Globals['undercat'] == "yes" ) { // Lets get the Recent Comments $query = "SELECT c.username,c.userid,c.cat,c.product,c.comment,p.bigimage,p.cat,p.userid FROM {$Globals['pp_db_prefix']}comments c LEFT JOIN {$Globals['pp_db_prefix']}products p ON p.id=c.product WHERE c.comment != '' AND p.status=0 ORDER BY c.date DESC"; $queryz = ppmysql_query($query,$link); $cmtfound = 1; while ( list($lcuname[$cmtfound], $lcid[$cmtfound], $lccat[$cmtfound], $lcphoto[$cmtfound], $comcomment, $thumbimg, $thumbcat, $thumbuid) = mysql_fetch_row($queryz)) { if ($CatPerms['ugview'][$thumbcat]==0){ $find[] = '#\[.*/?\]#siU'; $replace[] = ''; $comcomment = preg_replace($find, $replace, $comcomment); $lccom[$cmtfound] = ( strlen($comcomment) > 100 ? substr($comcomment,0,100)."..." : $comcomment ); $filenoext = get_filename( $thumbimg ); $theext = get_ext( $thumbimg ); $image_file_path = "{$Globals['datafull']}/{$thumbcat}/$thumbuid{$filenoext}-thumb$theext"; list( $thumbw, $thumbh ) = @getimagesize( $image_file_path ); $thumblink[$cmtfound] = get_imagethumb( $thumbimg, $thumbcat, $thumbuid, 1, 0, 1, $thumbw, $thumbh ); $lclink[$cmtfound] = "{$Globals['maindir']}/showproduct.php?product={$lcphoto[$cmtfound]}&cat={$lccat[$cmtfound]}"; if ( $cmtfound == $Globals['numcompal'] ) break; $cmtfound++; } } } if ( $Globals['ratingspal'] == "yes" ) { // Lets get the Most Popular Ads $query = "SELECT cat,id,title,views FROM {$Globals['pp_db_prefix']}products WHERE approved=1 ORDER BY views DESC LIMIT {$Globals['mostpoppal']}"; $queryz = ppmysql_query($query,$link); $tpfound = 1; while ( list($tpcat[$tpfound], $tpphoto[$tpfound], $toptitle, $topviews) = mysql_fetch_row($queryz)) { $tptitle[$tpfound] = ( strlen($toptitle) > 20 ? substr($toptitle,0,20)."..." : $toptitle ); $tpviews[$tpfound] = number_format($topviews); $tplink[$tpfound] = "{$Globals['maindir']}/showproduct.php?product={$tpphoto[$tpfound]}&cat={$tpcat[$tpfound]}"; $tpfound++; } } // Lets get Who is Online $whoonline = get_whoonline(); include( "{$Globals['TMPL_PATH']}/menubar.tmpl" ); if ( $Globals['sidebar'] == "left" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['TMPL_PATH']}/sidebar_leftopen.tmpl" ); } if ( $Globals['sidebar'] == "right" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['TMPL_PATH']}/sidebar_rightopen.tmpl" ); } if ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "no" ) { display_gallery("latest"); } include( "{$Globals['TMPL_PATH']}/indexhead.tmpl" ); include( "{$Globals['TMPL_PATH']}/categories.tmpl" ); if ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "yes") { display_gallery("latest"); } if ( $Globals['dispopular'] == "yes" ) { display_gallery("most_views"); } if ( $Globals['disrandom'] == "yes" ) { display_gallery("random"); } if ( $Globals['undercat'] == "yes" ) { if ($Globals['sidebar_index'] == "no" || $Globals['sidebar'] == "off" ) { include( "{$Globals['TMPL_PATH']}/undercat.tmpl" ); } else { include( "{$Globals['TMPL_PATH']}/undercat-sidebar.tmpl" ); } } elseif ( $Globals['statspal'] == "yes" ) { include( "{$Globals['TMPL_PATH']}/indexstats.tmpl" ); } if ( $Globals['sidebar'] == "left" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['TMPL_PATH']}/sidebar_leftclose.tmpl" ); } if ( $Globals['sidebar'] == "right" && $Globals['sidebar_index'] == "yes" ) { include( "{$Globals['TMPL_PATH']}/sidebar_rightclose.tmpl" ); } printfooter(); ?>