Files
nexusphp/public/bitbucketlog.php

54 lines
2.6 KiB
PHP
Raw Normal View History

2021-06-15 10:35:13 +08:00
<?php
2021-01-13 19:32:26 +08:00
require "../include/bittorrent.php";
2021-06-15 10:35:13 +08:00
dbconn();
loggedinorreturn();
2020-12-26 01:42:23 +08:00
parked();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Sorry", "Access denied.");
$bucketpath = "$bitbucket";
if (get_user_class() >= UC_MODERATOR)
{
2021-01-07 17:35:00 +08:00
$delete = intval($_GET["delete"] ?? 0);
2020-12-26 01:42:23 +08:00
if (is_valid_id($delete)) {
2021-06-15 10:35:13 +08:00
$r = sql_query("SELECT name,owner FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($r) == 1) {
$a = mysql_fetch_assoc($r);
if (get_user_class() >= UC_MODERATOR || $a["owner"] == $CURUSER["id"]) {
sql_query("DELETE FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__);
2021-03-31 03:17:33 +08:00
if (!unlink("$bucketpath/{$a['name']}"))
stderr("Warning", "Unable to unlink file: <b>{$a['name']}</b>. You should contact an administrator about this error.",false);
2021-06-15 10:35:13 +08:00
} } } }
stdhead("BitBucket Log");
$res = sql_query("SELECT count(*) FROM bitbucket"); $row = mysql_fetch_array($res); $count = $row[0];
$perpage = 10;
2021-01-07 17:35:00 +08:00
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?out=" . ($_GET["out"] ?? '') . "&" );
2021-06-15 10:35:13 +08:00
print("<h1>BitBucket Log</h1>\n");
print("Total Images Stored: $count");
echo $pagertop;
$res = sql_query("SELECT * FROM bitbucket ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("<b>BitBucket Log is empty</b>\n");
else {
print("<table align='center' border='0' cellspacing='0' cellpadding='5'>\n");
2020-12-26 01:42:23 +08:00
while ($arr = mysql_fetch_assoc($res)) {
2021-06-15 10:35:13 +08:00
$date = substr($arr['added'], 0, strpos($arr['added'], " "));
$time = substr($arr['added'], strpos($arr['added'], " ") + 1);
2020-12-26 01:42:23 +08:00
$name = $arr["name"];
2021-06-15 10:35:13 +08:00
list($width, $height, $type, $attr) = getimagesize("" . get_protocol_prefix() . "$BASEURL/$bitbucket/$name");
2020-12-26 01:42:23 +08:00
$url = str_replace(" ", "%20", htmlspecialchars("$bitbucket/$name"));
print("<tr>");
2021-06-15 10:35:13 +08:00
print("<td><center><a href=$url><img src=\"".$url."\" border=0 onLoad='SetSize(this, 400)'></a></center>");
2021-01-07 17:35:00 +08:00
print("Uploaded by: " . get_username($arr['owner']). "<br />");
print("(#{$arr['id']}) Filename: $name ($width&nbsp;x&nbsp;$height)");
2021-06-15 10:35:13 +08:00
if (get_user_class() >= UC_MODERATOR)
2021-03-31 03:17:33 +08:00
print(" <b><a href=?delete={$arr['id']}>[Delete]</a></b><br />");
2021-06-15 10:35:13 +08:00
print("Added: $date $time");
print("</tr>");
}
print("</table>");
}
echo
$pagerbottom;
2020-12-26 01:42:23 +08:00
stdfoot();
?>