2021-07-10 19:18:17 +01:00
|
|
|
<?php
|
2021-08-09 04:21:39 -04:00
|
|
|
define('IN_PONEPASTE', 1);
|
2023-05-13 20:05:10 -04:00
|
|
|
require_once(__DIR__ . '/common.php');
|
|
|
|
|
|
|
|
use PonePaste\Models\Paste;
|
2023-05-13 21:19:35 -04:00
|
|
|
use PonePaste\Models\User;
|
|
|
|
|
|
|
|
checkAdminAccess(User::ROLE_ADMIN);
|
2023-05-13 20:05:10 -04:00
|
|
|
|
|
|
|
list($per_page, $current_page) = pp_setup_pagination();
|
|
|
|
|
|
|
|
$total_pastes = Paste::count();
|
|
|
|
$pastes = Paste::with('user')
|
|
|
|
->orderBy('id', 'desc')
|
|
|
|
->limit($per_page)
|
|
|
|
->offset($current_page * $per_page)
|
|
|
|
->get();
|
2021-07-10 19:18:17 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2021-07-12 09:03:02 -04:00
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2021-07-10 19:18:17 +01:00
|
|
|
<title>Paste - Pastes</title>
|
2021-07-12 09:03:02 -04:00
|
|
|
<link rel="shortcut icon" href="favicon.ico">
|
|
|
|
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
|
|
|
<link href="css/datatables.min.css" rel="stylesheet" type="text/css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="top" class="clearfix">
|
|
|
|
<!-- Start App Logo -->
|
|
|
|
<div class="applogo">
|
|
|
|
<a href="../" class="logo">Paste</a>
|
|
|
|
</div>
|
|
|
|
<!-- End App Logo -->
|
|
|
|
|
|
|
|
<!-- Start Top Right -->
|
|
|
|
<ul class="top-right">
|
|
|
|
<li class="dropdown link">
|
|
|
|
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
2023-05-13 20:05:10 -04:00
|
|
|
class="caret"></span></a>
|
2021-07-12 09:03:02 -04:00
|
|
|
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
|
|
|
<li><a href="admin.php">Settings</a></li>
|
|
|
|
<li><a href="?logout">Logout</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<!-- End Top Right -->
|
|
|
|
</div>
|
|
|
|
<!-- END TOP -->
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
|
<!-- START CONTAINER -->
|
|
|
|
<div class="container-widget">
|
|
|
|
<!-- Start Menu -->
|
|
|
|
<?php include 'menu.php'; ?>
|
|
|
|
<!-- End Menu -->
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if (isset($_GET['delete'])) {
|
|
|
|
$delid = htmlentities(Trim($_GET['delete']));
|
|
|
|
$query = "DELETE FROM pastes WHERE id=$delid";
|
|
|
|
$result = mysqli_query($con, $query);
|
|
|
|
if (mysqli_errno($con)) {
|
|
|
|
$msg = '<div class="paste-alert alert6" style="text-align: center;">
|
2021-07-10 19:18:17 +01:00
|
|
|
' . mysqli_error($con) . '
|
|
|
|
</div>';
|
2021-07-12 09:03:02 -04:00
|
|
|
} else {
|
|
|
|
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
2021-07-10 19:18:17 +01:00
|
|
|
Paste deleted
|
|
|
|
</div>';
|
2021-07-12 09:03:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!-- Start Pastes -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="panel panel-widget">
|
2023-05-13 20:05:10 -04:00
|
|
|
<div class="panel-body">
|
2021-07-12 09:03:02 -04:00
|
|
|
<div class="panel-title">
|
2023-05-13 20:05:10 -04:00
|
|
|
Manage Pastes
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
|
2023-05-13 20:05:10 -04:00
|
|
|
<?php if (isset($msg)) echo $msg; ?>
|
|
|
|
|
|
|
|
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
|
|
|
|
id="pastesTable">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>ID</th>
|
|
|
|
<th>Title</th>
|
|
|
|
<th>Username</th>
|
|
|
|
<th>IP</th>
|
|
|
|
<th>Visibility</th>
|
|
|
|
<th>Delete</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php foreach ($pastes as $paste): ?>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<a href="<?= urlForPaste($paste) ?>">
|
|
|
|
<?= pp_html_escape($paste->id); ?>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td><?= pp_html_escape($paste->title); ?></td>
|
|
|
|
<td><?= pp_html_escape($paste->user->username); ?></td>
|
|
|
|
<td><?= pp_html_escape($paste->ip); ?></td>
|
|
|
|
<td><?= pp_html_escape($paste->visible); ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
2023-05-13 20:05:10 -04:00
|
|
|
<?= paginate($current_page, $per_page, $total_pastes); ?>
|
|
|
|
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
2023-05-13 20:05:10 -04:00
|
|
|
<!-- End Admin Settings -->
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
2023-05-13 20:05:10 -04:00
|
|
|
<!-- END CONTAINER -->
|
2021-07-12 09:03:02 -04:00
|
|
|
|
2023-05-13 20:05:10 -04:00
|
|
|
<!-- Start Footer -->
|
|
|
|
<div class="row footer">
|
|
|
|
</div>
|
|
|
|
<!-- End Footer -->
|
2021-07-12 09:03:02 -04:00
|
|
|
|
2023-05-13 20:05:10 -04:00
|
|
|
</div>
|
|
|
|
<!-- End content -->
|
2021-07-12 09:03:02 -04:00
|
|
|
|
|
|
|
</body>
|
2021-07-10 19:18:17 +01:00
|
|
|
</html>
|