Files
5ducky/templates/browse.tpl.php
T
2022-10-06 22:04:13 +02:00

154 lines
6.3 KiB
PHP

<?php include( $templates.'header.tpl.php' );
/*if (!$user->id){
?>
<div class="warn" style="text-align:center">
Only registered users can see images! Register now.
</div>
<?php
include( $templates.'footer.tpl.php' );
exit();
}*/
if( $ib->user['id'] ) {
/* Abfrage nach Kommentaren / Likes des Users */
$idAbfrage = $ib->user['id'];
$comm = DB::getRow("SELECT COUNT(*) as count FROM pl_comments WHERE userid=:1 AND c_like = 0",$idAbfrage);
$favs = DB::getRow("SELECT COUNT(*) as count FROM pl_fav WHERE user=:1",$idAbfrage);
$users = DB::getRow("SELECT color as color,registered as reg FROM pl_users WHERE id=:1",$idAbfrage);
$days = floor((time() - strtotime(substr($users['reg'],0,10)))/86400);
?>
<div style="margin-left: 5px; width: 95%;">
<div style="font-size: 20px; margin-bottom: 5px; font-weight: bold;">
<a style="color:#<?php echo $users['color'] ?>" href="<?php echo Config::$absolutePath.'user/'.$ib->user['name']; ?>"><?php echo $ib->user['name']; ?></a> <?php
if ($idAbfrage > 1100) {echo "&#9770;";}
elseif ($idAbfrage < 500) {echo "&#991;&#991;";}
elseif ($idAbfrage > 939) {echo "&#10017;";}
else {echo "&#9773;";} ?> <?php if( !empty($ib->user['website'])) { ?>- <a href="<?php echo htmlspecialchars($ib->user['website']); ?>" target="_blank">www</a> -<?php } ?>
</div>
<div style="max-width: 35em; float: left;"><img alt="<?php echo $ib->user['name']; ?>" src="<?php echo Config::$absolutePath.$ib->user['avatar']; ?>"/></div>
<div id="userstats"><a href="<?php echo Config::$absolutePath.'inbox/'.$ib->user['name']; ?>"><img alt="mailme" src="/media/<?php if ($user->stylecolor == "white") {?>mailme_fb.png<?php } else{ ?>mailme.png<?php }?>" width="64px" height="64px"/></a></div>
<div id="userstats"><div><?php echo $ib->user['id']; ?></div>ID</div>
<div id="userstats"><div><?php echo $days; ?></div>Days past</div>
<div id="userstats"><div><?php echo $ib->user['images']; ?></div>Uploads</div>
<div id="userstats"><div><?php echo $comm["count"]; ?></div>Comments</div>
<div id="userstats"><div><?php echo $favs["count"]; ?></div>Favs</div>
</div>
<?php } ?>
<div style="clear:both;"></div>
<h1>
&raquo; Browsing
<?php if( !empty($ib->user) ) { ?>
User: <a href="<?php echo Config::$absolutePath.'user/'.$ib->user['name']; ?>"><?php echo $ib->user['name']; ?></a>
<?php } else if( !empty($ib->channel) ) { ?>
Channel: <a href="<?php echo Config::$absolutePath.'channel/'.$ib->channel['keyword']; ?>"><?php echo $ib->channel['name']; ?></a>,
<?php } else if( !empty($ib->searchColor) || !empty($ib->searchTerm) ) { ?>
Results for <?php echo htmlspecialchars($term); ?>,
<?php } else if(($ib->commentState)) { ?>
Comments ,
<?php } else if(($ib->FavState)) { ?>
favorites ,
<?php } else { ?>
All,
<?php } ?>
Page: <?php echo $ib->pages['current']; ?> of <?php echo $ib->pages['total']; ?>
<?php if(($ib->commentState)) { ?>
| <strong><a href="/comments/reset">&#187; reset unread</a></strong>
<?php $newcomments = DB::getRow("SELECT COUNT(*) as c FROM pl_unread as u,pl_images as i WHERE u.userid=:1 AND u.imageid = i.id",$user->id);
if( $newcomments["c"] > 0 ) { ?>
| <a href="/unread">&#187; newest comments (<?php echo $newcomments["c"]; ?>)</a> | <a href="/comments">&#187; Comments</a></strong>
<?php }} ?>
</h1>
<div id="images" style="height:<?php echo $gv->height * Config::$gridView['gridSize']; ?>px">
<?php if( isset($ib->pages['prev']) ) { ?>
<a href="<?php echo Config::$absolutePath.$ib->basePath.'page/'.$ib->pages['prev']; ?>" class="prev" title="Previous" id="prevBar">Previous</a>
<?php } else { ?>
<div class="noPrev" id="prevBar">Previous</div>
<?php } ?>
<?php if( isset($ib->pages['next']) ) { ?>
<a href="<?php echo Config::$absolutePath.$ib->basePath.'page/'.$ib->pages['next']; ?>" class="next" title="Next" id="nextBar">Next</a>
<?php } else { ?>
<div class="noNext" id="nextBar">Next</div>
<?php } ?>
<noscript>
<div class="noscr">Please enable Javascript.</div>
</noscript>
<div id="imageGrid" style="height:<?php echo $gv->height * Config::$gridView['gridSize'];?>px">
<?php
if( !empty($ib->searchColor) || !empty($ib->searchTerm) || ($ib->commentState) || ($ib->FavState) ) {
$imgBasePath = 'all/';
} else {
$imgBasePath = $ib->basePath;
}
foreach( $ib->thumbs as $thumb ) {
if( isset( $thumb['left'] ) ) {
$blockedrow = DB::getRow("SELECT id,users FROM pl_blocked WHERE id=:1",$user->id);
$commentalert = DB::getRow("SELECT COUNT(*) as count FROM pl_unread WHERE keyword=:1 AND userid=:2",$thumb['keyword'],$user->id);
$commentdiv = "";
$commentcolor ="";
$commentalertdiv ="";
if($commentalert["count"] > 0){
$commentdiv ='<div class="overlay"></div>';
$commentcolor = 'style="background-color:#96b2e4;"' ;
$commentalertdiv = '<div class="inboxalert" style="padding:3px;" >!</div>';
}else{
$commentdiv = "";
$commentalertdiv ="";
$commentcolor = '' ;
}
if (!empty($blockedrow)) {
$blockeduser = array_map('strtolower', unserialize($blockedrow['users']));
$lower = strtolower($thumb['userName']);
if (!in_array($lower,$blockeduser)){
echo '<div class="'.$thumb['class'].'" style="left:'.$thumb['left'].'px;top:'.$thumb['top'].'px;">'.$commentalertdiv.'<a '.$commentcolor.' class="thumb" href="'
.Config::$absolutePath.$imgBasePath.'view/'.$thumb['keyword'].'">'.$commentdiv.'<img src="'.$thumb['thumb'].'" title="'.$thumb['userName'].' - '.
date('d. M Y H:i',$thumb['loggedTS']).'" alt="'.$thumb['keyword'].'"/></a></div>'."\n";
}
}else{
if (!$user->id){
$bilder = scandir('images/rs', 1);
$random = rand(3,114);
$thumb['thumb'] = "http://www.4ducky.com/images/rs/" . $bilder[$random];
echo "<h5>" . $bilder[0] . "</h5>";
}
echo '<div class="'.$thumb['class'].'" style="left:'.$thumb['left'].'px;top:'.$thumb['top'].'px;">'.$commentalertdiv.'<a '.$commentcolor.' class="thumb" href="'
.Config::$absolutePath.$imgBasePath.'view/'.$thumb['keyword'].'">'.$commentdiv.'<img src="'.$thumb['thumb'].'" title="'.$thumb['userName'].' - '.
date('d. M Y H:i',$thumb['loggedTS']).'" alt="'.$thumb['keyword'].'"/></a></div>'."\n";
}
}
}
?>
</div>
</div>
<script type="text/javascript">
gridView('imageGrid');
//jQuery(function(){jQuery("#imageGrid").preloader();});
ieAdjustHeight(0);
</script>
<?php include( $templates.'footer.tpl.php' ); ?>