PPPRINT;
foreach( $pmenuitem AS $x => $menuitem)
{
$pmenu .= "$menuitem ";
}
$pmenu .= <<
PPPRINT;
}
if ( $amenuitem )
{
$amenu = <<
PPPRINT;
foreach( $amenuitem AS $x => $menuitem)
{
$amenu .= "$menuitem ";
}
$amenu .= <<
PPPRINT;
}
// find similiar posts
if ( empty($keywords) )
{
$keywords = $title;
}
$keylinks = null;
$keys = explode( " ", $keywords );
$keys = array_unique($keys);
$ignorew = array( "the", "a", "but", "are", "and" );
foreach( $keys as $si )
{
$si = trim(ereg_replace("[^a-z0-9]", "", strtolower($si)));
if ( $si && !in_array($si, $ignorew) )
{
$keylinks .= "$si ";
}
}
if ( $Globals['allowpost'] )
{
$cc = $ckcolor = 0;
$posts = null;
$comq = " ";
$query = "SELECT c.id,c.username,c.userid,c.date,c.comment,c.approved,c.ipaddress,r.rating
FROM {$Globals['pp_db_prefix']}comments c
LEFT JOIN {$Globals['pp_db_prefix']}ratings r ON (r.photo=c.photo AND r.userid=c.userid)
WHERE c.photo=$photo ORDER BY c.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 = 1;
$comnum = 0;
$commentrow = array();
while ( $comrow = mysql_fetch_assoc($rows) )
{
if ( (!$Globals['dispempty'] && trim($comrow['comment']) == "") || (!$Globals['moderatecoms'] && $comrow['approved'] == 0) )
{
$comnum++;
}
else
{
$cc++;
$comnum++;
if ($cc >= $cstartnumb)
{
if ($cc < ($cstartnumb+$perpage))
{
$profilelink = get_profilelink( $comrow['userid'], $comrow['username'] );
$commentrow[$itemnum]['imgtime'] = formatpptime( $comrow['date'] );
$commentrow[$itemnum]['imgdate'] = formatppdate( $comrow['date'] );
$commentrow[$itemnum]['commentnum'] = $comnum;
$commentrow[$itemnum]['userid'] = $comrow['userid'];
$commentrow[$itemnum]['id'] = $comrow['id'];
$commentrow[$itemnum]['username'] = $Globals['pp_lang']['unreg'];
$commentrow[$itemnum]['location'] = $commentrow[$itemnum]['title'] = $commentrow[$itemnum]['posts'] = null;
$commentrow[$itemnum]['regdate'] = $commentrow[$itemnum]['ugallery'] = $commentrow[$itemnum]['isonline'] = null;
$commentrow[$itemnum]['homepage'] = $commentrow[$itemnum]['signature'] = null;
$commentrow[$itemnum]['canedit'] = false;
// call get_profiledata to get all the links possible
list( $cuname, $cuhomep, $cuposts, $cutitle, $cureg, $culoc, $cuavatar, $usig ) = get_profiledata( $comrow['userid'] );
if ( $cureg )
{
$commentrow[$itemnum]['regdate'] = "
{$Globals['pp_lang']['registered']}: " . formatppdate($cureg, "month yyyy");
}
if ( $cuposts )
{
$commentrow[$itemnum]['posts'] = " {$Globals['pp_lang']['posts']}: ". number_format($cuposts);
}
if ( $culoc )
{
$commentrow[$itemnum]['location'] = " {$Globals['pp_lang']['location']}: $culoc";
}
if ( $cutitle )
{
$commentrow[$itemnum]['title'] = " $cutitle";
}
if ( ($User['adminedit'] == 1 || $User['moderator'] == 1) && $comrow['ipaddress'] )
{
$commentrow[$itemnum]['title'] .= " $comrow[ipaddress]";
}
$commentrow[$itemnum]['ugallery'] = $ugallery;
$commentrow[$itemnum]['isonline'] = $isonline;
$commentrow[$itemnum]['homepage'] = $cuhomep;
if ( $comrow['userid'] > 0 )
{
$commentrow[$itemnum]['username'] = " $comrow['userid'], 'username' => $cuname) ) ."\">$cuname";
if( $cuavatar && $Globals['showavatar'] )
{
$commentrow[$itemnum]['avatar'] = $cuavatar;
}
}
$comrow['comment'] = un_htmlspecialchars($comrow['comment']);
if ( VB3_ENHANCEDINT == "on" )
{
$comrow['comment'] = convert_markups($comrow['comment']);
}
else
{
$comrow['comment'] = convert_returns(convert_markups($comrow['comment']));
}
$commentrow[$itemnum]['comment'] = $comrow['comment'];
if ( $usig && $Globals['showsigs'] )
{
$usigline = convert_markups($usig);
$usigline = un_htmlspecialchars($usigline);
$commentrow[$itemnum]['signature'] = "$usigline";
}
if ( ($User['userid'] == $comrow['userid'] && $ueditposts == 1) || $ismod )
{
if ( $Globals['comtimeout'] > 0 && !$ismod )
{
$julian = time();
$timediff = $julian - $comrow['date'];
if ( $timediff < $Globals['comtimeout'] )
{
$commentrow[$itemnum]['canedit'] = true;
}
}
else
{
$commentrow[$itemnum]['canedit'] = true;
}
}
if ( ($comrow['rating'] > 0 && $ratingtype != 1) && $Globals['allowrate'] )
{
$commentrow[$itemnum]['rating'] = get_ratingicons( $comrow[rating] );
}
else
{
$commentrow[$itemnum]['rating'] = null;
}
$itemnum++;
}
}
}
}
ppmysql_free_result( $rows );
if ( ($Globals['allowpost'] && $User['comments'] == 1) && $CatPerms['ugpost'][$dbcat] == 0 )
{
if ( $ratingtype != 1 )
{
$ratecode .= get_rate_code(0);
}
if ( VB40 == "on" && VB3_ENHANCEDINT == "on" )
{
$messagearea = str_replace( "{ppcode}", $ecomments, $messagearea );
include( "$Globals[tmpldir]/quickcom40.tmpl" );
}
elseif ( SIMPLE_VERSION > 366 && VB40 == "off" && VB3_ENHANCEDINT == "on" )
{
include( "$Globals[tmpldir]/quickcom367.tmpl" );
}
else
{
include( "$Globals[tmpldir]/quickcom.tmpl" );
}
}
}
$ppcomments = null;
if ( $comcount >= 1 )
{
include( "$Globals[tmpldir]/showcomments.tmpl" );
}
// begin pages/nav system ##
$comnav = null;
if ( $compages > 1 )
{
//$comnav = "";
$comnav .= "$ppopen{$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";
}
$conurl = construct_newppurl( "showphoto.php", array('photo' => $photo, 'cpage' => $p, 'title' => $title, 'cat' => $cat) );
$comnav .= "$thispage";
}
if ( $p > $theend )
{
break;
}
if ( $cpage == $p )
{
$comnav .= "$p";
}
}
$comnav .= " | $ppclose";
}
// 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'] )
{
if ( $Globals['statspal'] )
{
get_statscache();
}
if ( $Globals['topposterspal'] )
{
get_posterscache();
}
if ( $Globals['ratingspal'] )
{
get_ratingcache();
}
}
$metadesc = $desc;
$metadesc = strip_tags(htmlspecialchars($metadesc));
$metakey = $keywords;
if ( !empty($title) )
{
printheader( $dbcat, $title, "", 1, $bigimage );
}
else
{
printheader( $dbcat, $bigimage, "", 1, $bigimage );
}
topmenu();
$Globals['menunav'] = null;
childsub($dbcat, $cattype);
$childnav = "{$Globals['pp_lang']['home']} $childnav";
$Globals['menunav'] = "aI(\"text={$Globals['pp_lang']['home']};url={$Globals['maindir']}/;showmenu=submenu0\");\n{$Globals['menunav']}";
// Make the display codes (just in case)
if ( is_multimedia($bigimage) )
{
$showbbcode = "[media]{$imgurl}[/media]";
}
else
{
$showbbcode = "[img]{$imgurl}[/img]";
}
$showhtmlcode = "<img src="$imgurl" />";
$phulink = construct_newppurl( "showgallery.php", array('ppuser' => $iuserid, 'username' => $photouser ) );
$views = number_format($views);
$useurl = construct_newppurl( "showphoto.php", array( 'photo' => $photo, 'title' => $title, 'cat' => $storecat ) );
if ( is_multimedia($bigimage) == 1 )
{
$showbbthumb = "[url=$useurl][img]{$mmthumb}[/img][/url]";
}
else
{
$showbbthumb = "[url=$useurl][img]{$Globals['datadir']}/{$storecat}/thumbs/{$bigimage}[/img][/url]";
}
$showbbmed = "[url=$useurl][img]{$Globals['datadir']}/{$storecat}/medium/{$bigimage}[/img][/url]";
$showbbfull = "[url=$useurl][img]{$Globals['datadir']}/{$storecat}/{$bigimage}[/img][/url]";
$showdirectcode = $imgurl;
$showimcode = $useurl;
//$fburl = "http://" . urlencode( $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
$fburl = urlencode( "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] );
// Start printing the page..
include( "$Globals[tmpldir]/menubar.tmpl" );
if ( $Globals['sidebar'] == "left" && $Globals['sidebar_global'] )
{
include( "$Globals[tmpldir]/sidebar_leftopen.tmpl" );
}
if ( $Globals['sidebar'] == "right" && $Globals['sidebar_global'] )
{
include( "$Globals[tmpldir]/sidebar_rightopen.tmpl" );
}
if ( VB3_ENHANCEDINT == "on" )
{
$stylepath = ( $stylevar[imgdir_button][0] == "/" || $stylevar[imgdir_button][0] == "h" ? "" : "{$Globals['vbulletin']}/" );
}
include( "$Globals[tmpldir]/showphoto.tmpl" );
if ( $Globals['sidebar'] == "left" && $Globals['sidebar_global'] )
{
include( "$Globals[tmpldir]/sidebar_leftclose.tmpl" );
}
if ( $Globals['sidebar'] == "right" && $Globals['sidebar_global'] )
{
include( "$Globals[tmpldir]/sidebar_rightclose.tmpl" );
}
printfooter();
?>
| |