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

124 lines
3.7 KiB
PHP

<?php
require_once( 'lib/config.php' );
require_once( 'lib/users.php' );
require_once( 'lib/db.php' );
header("Content-type: text/html; charset=UTF-8");
$user = new User();
$user->login();
$user->loadEmail();
if( !$user->admin ) {
echo "You need to be logged in as an admin user!";
exit();
}
$Spammer = DB::query("SELECT * from pl_users WHERE spamblocked=1");
$Abuses = DB::query("SELECT * FROM `pl_abuse`WHERE `read` =:1",0);
$newComments = DB::query(
'SELECT
c.id, c.content, u.name, u.avatar,
UNIX_TIMESTAMP(c.created) AS created,
i.keyword FROM '.TABLE_COMMENTS.' c
LEFT JOIN '.TABLE_USERS.' u
ON u.id = c.userId
LEFT JOIN '.TABLE_IMAGES.' i
ON i.id = c.imageId
ORDER BY c.created DESC LIMIT 100'
);
include( 'templates/header.tpl.php' );
?>
<br />
<table align="center" class="duckytable" width="800px" cellspacing="0" cellpadding="0">
<caption>Spammer / Abuse:</caption>
<tr>
<td style="width:50%;">
<?php
if((count($Spammer)) > 0){
echo '<h2 style="margin:5px;" >Newest Spammer:</h2>';
foreach( $Spammer as $u ) {?>
<div class="userInfo" style="margin:5px;">
<img class="avatar" width="40" height="40" src="<?php echo Config::$absolutePath.$u['avatar']; ?>"/>
<div class="name">
<strong>
<a href="<?php echo Config::$absolutePath.'user/'.$u['name']; ?>"><?php echo $u['name']; ?></a>
</strong>
</div>
<div class="info">
ID: <strong><?php echo $u['id']; ?></strong> /
Images: <strong><?php echo $u['images']; ?></strong>
<?php if( !empty($u['website'])) { ?>/
Website: <strong><a href="<?php echo htmlspecialchars($u['website']); ?>" target="_blank">
<?php echo htmlspecialchars($u['website']); ?>
</a></strong>
<?php } ?>
<?php if ((int)$u["time"] > 0 ){ echo "/ Bis:".date('Y-m-d H:i:s', $u["time"]); echo("<br>Grund: ".$u["spam_reason"]);} if ($user->id == 11 || $user->id == 1 ){ ?> / <a href="/manage/free/<?php echo $u["id"] ?>">Unblock</a><?php } ?>
</div>
<div style="clear:both;"></div>
</div>
<?php } }else{echo '<h2 style="margin:5px;" >No Spammer atm</h2>'; }?></td>
<td style="width:50%;">
<?php
if((count($Abuses)) > 0){
echo '<h2 style="margin:5px;" >Newest Abuses:</h2>';
foreach( $Abuses as $a ) {
$Image = DB::getRow("SELECT *,UNIX_TIMESTAMP(logged) AS loggedTS FROM pl_images WHERE id=:1",$a["imageid"]);
if ($Image != NULL && $a["imageid"] != 0){
?>
<div class="userInfo" style="margin:5px;">
<img style="float:left; margin:2px;" width="64" height="64" src="<?php echo Config::$absolutePath."data/thumbs/".date("Y/m",$Image["loggedTS"])."/128x128/".$Image["thumb"]; ?>"/>
<div class="info">
Reason: <strong><?php echo htmlspecialchars($a['reason']); ?></strong> /
Email: <strong><?php echo htmlspecialchars($a['email']); ?></strong>
<?php if ($a["user"] != 0){
$username = DB::getRow("SELECT * FROM pl_users WHERE id=:1",$a["user"]);
echo('<br>User:<strong>'.$username["name"].'</strong>');
}
echo('<br><a href="/manage/del/'.$a["id"].'">Delete Abuse</a>'); ?>
</div>
<div class="info">
<strong><a href="<?php echo Config::$absolutePath."all/view/".$Image['keyword']; ?>"> >> Zum Thread</a> </strong>
</div>
<div style="clear:both;"></div>
</div>
<?php
}elseif ($a["imageid"] == "0") {
echo('<div class="userInfo" style="padding:5px;">');
echo('<a href="'.$a["imagelink"].'">'.$a["imagelink"].'</a><br>');
echo('Reason: <strong>'.$a['reason'].'</strong> /
Email: <strong>'.$a['email'].'</strong>');
echo('</div>');
echo('<div class="userInfo" style="padding:5px;">');
echo('<a href="/manage/del/'.$a["id"].'">Löschen</a>');
echo('</div>');
}
}
}else{echo '<h2 style="margin:5px;">No Abuses</h2>';}?>
</td>
</tr>
</table>
<?php
include( 'templates/footer.tpl.php' );
?>