2020-05-09 18:53:47 +00:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
2020-12-23 22:22:28 +00:00
|
|
|
|
|
|
|
$paths = array();
|
|
|
|
$images = array();
|
|
|
|
|
|
|
|
$dir = "drw";
|
|
|
|
if($_GET["l"] == ".") $_GET["l"] = null;
|
|
|
|
if(isset($_GET["l"])) $dir = $_GET["l"];
|
|
|
|
if ($handle = opendir($dir)) {
|
|
|
|
while (false !== ($entry = readdir($handle))) {
|
|
|
|
$x = pathinfo($entry,PATHINFO_EXTENSION);
|
|
|
|
if ($x == "" && $entry != "." && $entry != "..") {
|
|
|
|
array_push($paths, $entry);
|
|
|
|
}
|
|
|
|
else if($x == "jpg" || $x == "jpeg" || $x == "png"){
|
|
|
|
array_push($images, $entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir($handle);
|
|
|
|
}
|
|
|
|
|
2020-05-09 18:53:47 +00:00
|
|
|
?>
|
2020-12-23 22:22:28 +00:00
|
|
|
<!DOCTYPE html>
|
2020-05-09 18:53:47 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2020-12-23 22:22:28 +00:00
|
|
|
<title>Pòsweg\'s image gallery</title>
|
|
|
|
<style>
|
|
|
|
.paths{
|
|
|
|
margin-bottom: 15px;
|
|
|
|
}
|
|
|
|
input{
|
|
|
|
margin-bottom: 5px;
|
|
|
|
}
|
|
|
|
.thumb{
|
|
|
|
max-height: 100px;
|
|
|
|
max-width: 100px;
|
|
|
|
//height: 100px;
|
|
|
|
//width: 100px;
|
|
|
|
}
|
|
|
|
.tagbox{
|
|
|
|
position: relative;
|
|
|
|
height: 100px;
|
|
|
|
width: calc(100% - 100px - 15px);
|
|
|
|
background-color: black;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
.pic-container{
|
|
|
|
margin-top: 10px;
|
|
|
|
border: solid white 1px;
|
|
|
|
}
|
|
|
|
</style>
|
2020-05-09 18:53:47 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
|
|
include("include/header.php");
|
|
|
|
include("config.php");
|
|
|
|
|
|
|
|
echo "<h2>Woah</h2>";
|
|
|
|
|
2020-12-23 22:22:28 +00:00
|
|
|
echo("<div class='paths'>");
|
|
|
|
echo("<a href='" . $BASE_PATH . "/admin.php?l=" . dirname($dir) . "'><-</a><br/>\n");
|
|
|
|
foreach($paths as $entry){
|
|
|
|
echo("<a href='" . $BASE_PATH . "/admin.php?l=$dir/$entry'>$entry</a><br/>\n");
|
|
|
|
}
|
|
|
|
echo("</div>");
|
|
|
|
|
|
|
|
//var_dump($_GET["t"]);
|
|
|
|
if(defined($_GET["t"]) && is_array($_GET["t"])){
|
|
|
|
foreach($_GET["t"] as $file){
|
|
|
|
var_dump($file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Images */
|
|
|
|
|
|
|
|
if($images){
|
|
|
|
echo("<form action='admin.php' id='tag-submit'>\n");
|
|
|
|
echo("<input type='hidden' name='l' value='" . $_GET["l"] . "'/>\n");
|
|
|
|
echo("<input type='submit'/>");
|
|
|
|
echo("</form>");
|
|
|
|
foreach($images as $img){
|
|
|
|
$output = "";
|
|
|
|
exec($tmsu . "tags -1 '$dir/$img'", $output);
|
|
|
|
$num_tags = sizeof($output);
|
|
|
|
echo("<div class='pic-container'>\n");
|
|
|
|
echo("<img class='thumb' src='" . $BASE_PATH . "/$dir/$img'/>\n");
|
|
|
|
|
|
|
|
echo("<textarea placeholder='No tags.' class='tagbox' form='tag-submit' name='t[" . $img . "]'>");
|
|
|
|
for($i = 1; $i < $num_tags; $i++) echo $output[$i] . " ";
|
|
|
|
echo("</textarea>\n");
|
|
|
|
|
|
|
|
echo("</div>\n");
|
|
|
|
}
|
|
|
|
echo("<br/><input type='submit'/>");
|
|
|
|
}
|
2020-05-09 18:53:47 +00:00
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|