2014-03-22 04:15:45 +08:00
|
|
|
<?php
|
2015-03-14 04:30:48 +08:00
|
|
|
require_once 'class/Session.php';
|
|
|
|
require_once 'class/Downloader.php';
|
|
|
|
require_once 'class/FileHandler.php';
|
|
|
|
|
2015-03-09 06:56:51 +08:00
|
|
|
$session = Session::getInstance();
|
2015-03-13 04:47:23 +08:00
|
|
|
$file = new FileHandler;
|
2014-03-22 04:15:45 +08:00
|
|
|
|
2015-03-09 06:56:51 +08:00
|
|
|
if(!$session->is_logged_in())
|
|
|
|
{
|
|
|
|
header("Location: login.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
if($session->is_logged_in() && isset($_GET["delete"]))
|
|
|
|
{
|
2016-01-21 05:08:07 +08:00
|
|
|
$file->delete($_GET["delete"]);
|
2016-01-21 00:49:11 +08:00
|
|
|
header("Location: list.php");
|
2015-03-09 06:56:51 +08:00
|
|
|
}
|
2017-09-29 16:42:38 +08:00
|
|
|
|
2016-11-26 18:06:23 +08:00
|
|
|
$files = $file->listFiles();
|
|
|
|
$parts = $file->listParts();
|
2015-03-09 06:56:51 +08:00
|
|
|
|
|
|
|
require 'views/header.php';
|
2014-03-22 04:15:45 +08:00
|
|
|
?>
|
2015-03-09 06:56:51 +08:00
|
|
|
<div class="container">
|
|
|
|
<?php
|
2015-03-13 04:47:23 +08:00
|
|
|
if(!empty($files))
|
2015-03-09 06:56:51 +08:00
|
|
|
{
|
|
|
|
?>
|
2016-01-21 00:36:34 +08:00
|
|
|
<h2>List of available files:</h2>
|
2015-03-09 06:56:51 +08:00
|
|
|
<table class="table table-striped table-hover ">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2016-06-21 16:07:41 +08:00
|
|
|
<th>Title</th>
|
|
|
|
<th>Size</th>
|
2016-11-28 22:55:53 +08:00
|
|
|
<th><span class="pull-right">Delete link</span></th>
|
2015-03-09 06:56:51 +08:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
2015-03-13 04:47:23 +08:00
|
|
|
foreach($files as $f)
|
2015-03-09 06:56:51 +08:00
|
|
|
{
|
|
|
|
echo "<tr>";
|
2016-08-23 16:47:44 +08:00
|
|
|
if ($file->get_relative_downloads_folder())
|
|
|
|
{
|
|
|
|
echo "<td><a href=\"".rawurlencode($file->get_relative_downloads_folder()).'/'.rawurlencode($f["name"])."\" download>".$f["name"]."</a></td>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<td>".$f["name"]."</td>";
|
|
|
|
}
|
2015-03-13 04:47:23 +08:00
|
|
|
echo "<td>".$f["size"]."</td>";
|
2016-11-28 22:55:53 +08:00
|
|
|
echo "<td><a href=\"./list.php?delete=".sha1($f["name"])."\" class=\"btn btn-danger btn-sm pull-right\">Delete</a></td>";
|
2015-03-09 06:56:51 +08:00
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-21 00:36:34 +08:00
|
|
|
echo "<br><div class=\"alert alert-warning\" role=\"alert\">No files!</div>";
|
2015-03-09 06:56:51 +08:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<br/>
|
2016-11-26 18:06:23 +08:00
|
|
|
<?php
|
|
|
|
if(!empty($parts))
|
|
|
|
{
|
|
|
|
?>
|
2016-11-26 18:09:45 +08:00
|
|
|
<h2>List of part files:</h2>
|
2016-11-26 18:06:23 +08:00
|
|
|
<table class="table table-striped table-hover ">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Title</th>
|
|
|
|
<th>Size</th>
|
2016-11-28 22:55:53 +08:00
|
|
|
<th><span class="pull-right">Delete link</span></th>
|
2016-11-26 18:06:23 +08:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
foreach($parts as $f)
|
|
|
|
{
|
|
|
|
echo "<tr>";
|
|
|
|
if ($file->get_relative_downloads_folder())
|
|
|
|
{
|
|
|
|
echo "<td><a href=\"".rawurlencode($file->get_relative_downloads_folder()).'/'.rawurlencode($f["name"])."\" download>".$f["name"]."</a></td>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<td>".$f["name"]."</td>";
|
|
|
|
}
|
|
|
|
echo "<td>".$f["size"]."</td>";
|
2016-11-28 22:55:53 +08:00
|
|
|
echo "<td><a href=\"./list.php?delete=".sha1($f["name"])."\" class=\"btn btn-danger btn-sm pull-right\">Delete</a></td>";
|
2016-11-26 18:06:23 +08:00
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<br/>
|
2015-03-09 06:56:51 +08:00
|
|
|
</div><!-- End container -->
|
2014-03-21 09:01:44 +08:00
|
|
|
<?php
|
2015-03-09 06:56:51 +08:00
|
|
|
require 'views/footer.php';
|
2016-11-28 22:55:53 +08:00
|
|
|
?>
|