Style admin panel up and fix path navigator bounds
This commit is contained in:
parent
a2b08e1000
commit
e50cbe895a
94
admin.php
94
admin.php
|
@ -1,10 +1,56 @@
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
||||||
|
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pòsweg's image gallery</title>
|
<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>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
@ -13,37 +59,41 @@ if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
||||||
|
|
||||||
echo "<h2>Woah</h2>";
|
echo "<h2>Woah</h2>";
|
||||||
|
|
||||||
$images = array();
|
echo("<div class='paths'>");
|
||||||
|
echo("<a href='" . $BASE_PATH . "/admin.php?l=" . dirname($dir) . "'><-</a><br/>\n");
|
||||||
$dir = "drw";
|
foreach($paths as $entry){
|
||||||
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 != "..") {
|
|
||||||
echo("<a href='" . $BASE_PATH . "/admin.php?l=$dir/$entry'>$entry</a><br/>\n");
|
echo("<a href='" . $BASE_PATH . "/admin.php?l=$dir/$entry'>$entry</a><br/>\n");
|
||||||
}
|
}
|
||||||
else if($x == "jpg" || $x == "jpeg" || $x == "png"){
|
echo("</div>");
|
||||||
array_push($images, $entry);
|
|
||||||
|
//var_dump($_GET["t"]);
|
||||||
|
if(defined($_GET["t"]) && is_array($_GET["t"])){
|
||||||
|
foreach($_GET["t"] as $file){
|
||||||
|
var_dump($file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* 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){
|
foreach($images as $img){
|
||||||
$output = "";
|
$output = "";
|
||||||
exec($tmsu . "tags -1 '$dir/$img'", $output);
|
exec($tmsu . "tags -1 '$dir/$img'", $output);
|
||||||
$num_tags = sizeof($output);
|
$num_tags = sizeof($output);
|
||||||
echo("<div style='float:left';>");
|
echo("<div class='pic-container'>\n");
|
||||||
echo("<img width='100px' src='" . $BASE_PATH . "/$dir/$img'/>");
|
echo("<img class='thumb' src='" . $BASE_PATH . "/$dir/$img'/>\n");
|
||||||
echo("<form action='admin.php'>");
|
|
||||||
echo("<input type='text' name='tags[" . $img . "]' value='");
|
|
||||||
for($i = 1; $i < $num_tags; $i++) echo $output[$i] . " ";
|
|
||||||
echo("'/>");
|
|
||||||
|
|
||||||
echo("<input type='hidden' name='l' value='" . $_GET["l"] . "'/>");
|
echo("<textarea placeholder='No tags.' class='tagbox' form='tag-submit' name='t[" . $img . "]'>");
|
||||||
echo("</form>");
|
for($i = 1; $i < $num_tags; $i++) echo $output[$i] . " ";
|
||||||
echo("</div>");
|
echo("</textarea>\n");
|
||||||
|
|
||||||
|
echo("</div>\n");
|
||||||
|
}
|
||||||
|
echo("<br/><input type='submit'/>");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<h1>Pòsweg's Suckless Booru</h1>
|
<h1>Pòsweg\'s Suckless Booru</h1>
|
||||||
<form method="GET" action="tag.php">
|
<form method="GET" action="tag.php">
|
||||||
<input type="text" name="t" value="<?php if($_GET["t"]) echo $_GET["t"]; ?>">
|
<input type="text" name="t" value="<?php if($_GET["t"]) echo $_GET["t"]; ?>">
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
|
|
6
tag.php
6
tag.php
|
@ -1,8 +1,8 @@
|
||||||
<?php session_start() ?>
|
<?php session_start(); ?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php $thumb_size = 150; ?>
|
<?php $thumb_size = 150; ?>
|
||||||
<title>Pòsweg's image gallery</title>
|
<title>Pòsweg\'s image gallery</title>
|
||||||
<style>
|
<style>
|
||||||
.title{
|
.title{
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
float: right;
|
float: right;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
Flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
Loading…
Reference in New Issue