<?php
//////////////////////////// COPYRIGHT NOTICE //////////////////////////////
// This script is part of PhotoPost PHP, a software application by //
// All Enthusiast, Inc. Use of any kind of part or all of this //
// script or modification of this script requires a license from All //
// Enthusiast, Inc. Use or modification of this script without a license //
// constitutes Software Piracy and will result in legal action from All //
// Enthusiast, Inc. All rights reserved. //
// http://www.photopost.com legal@photopost.com //
// Contributing Developer: Michael Pierce (danasoft.com) //
// //
// PhotoPost Copyright 2003, All Enthusiast, Inc. //
////////////////////////////////////////////////////////////////////////////
require "pp-inc.php";
if ( is_numeric($argv[0]) ) {
header("Location: {$Globals['maindir']}/showphoto.php?photo={$argv[0]}");
exit;
}
require "languages/$pplang/index.php";
require "login-inc.php";
if ( file_exists("install.php") || file_exists("{$Globals['maindir']}/install.php") ) {
diewell( "For security reasons, please remove the install.php from the PhotoPost directory before proceeding." );
exit;
}
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 ($ugview{$cat} == 1 ) {
diewell( $Globals['pp_lang']['noview'] );
}
$query = "SELECT id,catname,password FROM {$Globals['pp_db_prefix']}categories WHERE id=$cat";
$resultb = ppmysql_query($query,$link);
list( $catid, $cattitle, $catpass ) = mysql_fetch_row($resultb);
ppmysql_free_result( $resultb );
if ( trim($catpass) != "" && $User['adminedit'] != 1 ) {
if ( !isset($password) ) $password = "";
if ( $password != $catpass ) {
get_password( $cat );
exit;
}
}
if ( $User['userid'] > 0 && $Globals['displaynew'] == "yes" ) {
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 = "<font class=\"small\"><a href=\"{$Globals['maindir']}/index.php\">{$Globals['pp_lang']['home']}</a> $childnav</font>";
$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 = 998;
}
printheader( $cat, $tablehead );
if ( $Globals['mostrecent'] == "yes" && $Globals['recentdefault'] == "no" ) {
display_gallery("latest");
}
$count = 0; $catdepth = 0;
$catrows = ""; $cptotal = 0; $posttotal = 0; $totalviews = 0; $diskspace = 0;
if ( !(isset($cat)) ) {
catrow(0);
}
else {
catrow($cat);
}
$usertotal = get_totalusers();
$query = "SELECT SUM(views), SUM(filesize) AS fsize FROM {$Globals['pp_db_prefix']}photos";
$totalv = ppmysql_query($query,$link);
list( $totalviews, $diskuse ) = mysql_fetch_row($totalv);
ppmysql_free_result($totalv);
$totalviews = number_format( $totalviews );
$totalphotos = number_format( $totalphotos );
$usertotal = number_format( $usertotal );
$posttotal = number_format( $posttotal );
$diskspace = $diskuse/1048576;
$diskspace = number_format( $diskspace, 1 );
$diskspace = "$diskspace MB";
// Lets get the Top 5 Posters
$query = "SELECT user,userid,COUNT(*) AS pcount FROM {$Globals['pp_db_prefix']}photos GROUP BY user ORDER BY pcount DESC";
$queryz = ppmysql_query($query,$link);
$rowcnt = mysql_num_rows($queryz);
$numfound = 0;
while ( list($theuser, $theuserid, $uphotos) = mysql_fetch_row($queryz)) {
$numfound++;
$topposters[$numfound] = $theuser;
$topid[$numfound] = $theuserid;
$topposts[$numfound] = $uphotos;
if ( $numfound == 5 ) break;
}
if ( $numfound > 0 ) {
$toplist = "
{$Globals['pp_lang']['toposter']}";
for ( $x=1; $x < ($numfound+1); $x++ ) {
$toplist .= "<a href=\"{$Globals['maindir']}/showgallery.php?ppuser={$topid[$x]}&cat=500\">{$topposters[$x]} <font class=\"small\">($topposts[$x])</font></a>";
}
}
// Lets get Who is Online
$oquery = "SELECT userid,date FROM {$Globals['pp_db_prefix']}iponline ORDER BY date DESC";
$oqueryz = ppmysql_query($oquery,$link);
$onumfound = 0; $anononline=0; $whoonline = "";
while ( list($ouser, $odate) = mysql_fetch_row($oqueryz)) {
$onumfound++;
if ( $ouser != "" && $ouser != "Unregistered" ) {
if ( $whoonline != "" ) $whoonline .= ", ";
$whoonline .= "$ouser";
}
else $anononline++;
}
if ( $onumfound > 0 ) {
$whogreet = "{$Globals['pp_lang']['whoonline']}: ";
if ( $whoonline != "" ) {
$whoonline = "$whoonline";
if ( $anononline > 0 ) {
if ( $anononline == 1 ) $whoonline .= " {$Globals['pp_lang']['and']} $anononline {$Globals['pp_lang']['unruser']}";
else $whoonline .= " {$Globals['pp_lang']['and']} $anononline {$Globals['pp_lang']['unrusers']}";
}
}
else {
if ( $anononline == 1 ) $whoonline .= "$anononline {$Globals['pp_lang']['unruser']}";
else $whoonline .= "$anononline {$Globals['pp_lang']['unrusers']}";
}
$whoonline = "{$whogreet}{$whoonline}.";
}
include( "templates/menubar.tmpl" );
include( "templates/index.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");
}
printfooter();
?> |