SimpleFileRepository/index.php

151 lines
4.7 KiB
PHP
Raw Normal View History

2021-01-04 20:22:48 +00:00
<html>
<head>
<?php
session_start();
2021-02-17 23:34:07 +00:00
//css, js, and other includes
include 'www/include.php';
include 'helpers/files.php';
2021-02-18 20:50:30 +00:00
//if debug is enabled
2021-02-17 23:34:07 +00:00
if($isDebug){
2021-01-04 20:22:48 +00:00
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
}
?>
<title><?php echo $site_name ?></title>
2021-02-08 19:51:46 +00:00
<link rel="icon" href="<?php echo $site_image ?>">
2021-01-04 20:22:48 +00:00
2021-03-08 20:18:28 +00:00
<script type="text/javascript">
<!-- add onclick function -->
function makeLink(){
var host = "<?php echo $_SERVER['HTTP_HOST'] ?>";
var folder = document.getElementById("folderName").value;
var password = document.getElementById("password").value;
var link = "/hiddenlisting.php?folder=" + folder +"&psk=" + password;
open(link);
};
</script>
2021-01-04 20:22:48 +00:00
</head>
2021-01-04 21:58:05 +00:00
<body style="background-color: black">
2021-01-04 20:22:48 +00:00
<?php
include 'www/header.php';
?>
2021-01-04 21:58:05 +00:00
<div class="card bg-dark text-white ml-4 mr-4">
2021-01-04 20:22:48 +00:00
<div class="card-header">
<h2>Folders</h2>
</div>
<div class="card-body">
2021-01-05 00:18:26 +00:00
<?php
if(!$isDir){
echo <<< errorblock
<h2><b>THERE ARE NO TRACKED DIRECTORIES,
OR THERE IS AN ERROR IN YOU CONFIGURATION.
PLEASE CHECK 'var/config'</b></h2>
errorblock;
exit();
}
?>
<p>Select a category to start browsing</p>
2021-01-04 21:58:05 +00:00
<table id="catTable" class="display table text-white">
2021-01-04 20:22:48 +00:00
<thead>
<tr>
<th>Name</th>
<th>Link</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<?php
foreach($dir_names as $i=>$currentdir){
echo '<tr>';
echo '<td>' . $currentdir . '</td>';
echo '<td><a href="listing.php?folder=' . $dir_names[$i] .'">View Listing</a></td>';
echo '<td>' . foldersize($dir_dirs[$i]) . '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
2021-01-05 01:34:14 +00:00
<?php
if($isTree){
echo <<< cardHead
2021-02-17 23:34:07 +00:00
<br />
2021-01-05 01:34:14 +00:00
<div class="card bg-dark text-white ml-4 mr-4">
<div class="card-header">
cardHead;
echo '<h2>' . $treeName . '</h2>';
echo <<< tableandcard
</div>
<div class="card-body">
<table id="treeTable" class="display table text-white">
<thead>
<tr>
<th>Link</th>
<th>Url</th>
</tr>
</thead>
<tbody>
tableandcard;
foreach($tree_names as $i=>$currentLink){
echo '<tr>';
echo '<td><a href="' . $tree_links[$i] . '">'
. $currentLink . '</a></td>';
echo '<td>' . $tree_links[$i] . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
echo '</div>';
}
?>
2021-02-17 23:34:07 +00:00
<?php
if($isHidden){
echo <<< cardtop
<br />
<div class="card bg-dark text-white ml-4 mr-4">
<div class="card-header">
<h2>Access Hidden Directories</h2>
</div>
<div class="card-body">
cardtop;
if($useJavascript){
2021-03-08 20:18:28 +00:00
echo <<< javascriptbox
<p>The server admin has enabled javascript. Type the name and password and click Goto Folder!</p>
<div class="form-group">
<span>Folder Name:&nbsp;</span><input type="text" id="folderName">
<span>Password :&nbsp;</span><input type="text" id="password">
<button onclick="makeLink();">Goto Folder</button>
</div>
javascriptbox;
2021-02-17 23:34:07 +00:00
} else {
2021-03-08 20:18:28 +00:00
echo '<p>The server admin has disabled javascript, therefore this is not dynamic. Please type the link in the URL and replace &lt;name&gt; with the directory name, and &lt;password&gt; with the password</p>';
2021-02-17 23:34:07 +00:00
echo '<p>The link to copy is:</p>';
2021-03-08 20:18:28 +00:00
echo $_SERVER['HTTP_HOST'] . "/hiddenlisting.php?folder=&lt;name&gt;&psk=&lt;password&gt;";
2021-02-17 23:34:07 +00:00
}
echo <<< cardbottom
</div>
</div>
cardbottom;
}
?>
<br />
2021-01-04 20:22:48 +00:00
</body>
2021-01-04 21:58:05 +00:00
2021-01-04 20:22:48 +00:00
</html>