Add support for actually updating tags in admin panel
This commit is contained in:
parent
e50cbe895a
commit
f38cd8bc55
49
admin.php
49
admin.php
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
include("config.php");
|
||||
session_start();
|
||||
if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
||||
|
||||
|
@ -21,11 +22,25 @@ if ($handle = opendir($dir)) {
|
|||
closedir($handle);
|
||||
}
|
||||
|
||||
if(isset($_GET["t"]) and is_array($_GET["t"])){
|
||||
foreach($images as $pic){
|
||||
//echo($_GET["t"][$pic] . "\n<br/>");
|
||||
$new_tags = $_GET["t"][$pic];
|
||||
if($_GET["chk"][$pic] == "on" or !isset($_GET["chk"])){
|
||||
$new_tags .= $_GET["mass"];
|
||||
}
|
||||
|
||||
$output = "";
|
||||
exec($tmsu . "untag -a $dir/$pic", $output);
|
||||
exec($tmsu . "tag --tags=\"" . $new_tags . "\" $dir/$pic", $output);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Pòsweg\'s image gallery</title>
|
||||
<title>Dendy\'s image gallery</title>
|
||||
<style>
|
||||
.paths{
|
||||
margin-bottom: 15px;
|
||||
|
@ -36,13 +51,20 @@ if ($handle = opendir($dir)) {
|
|||
.thumb{
|
||||
max-height: 100px;
|
||||
max-width: 100px;
|
||||
//height: 100px;
|
||||
//width: 100px;
|
||||
}
|
||||
.tagbox{
|
||||
position: relative;
|
||||
textarea{
|
||||
background-color: black;
|
||||
border: none;
|
||||
}
|
||||
.mass-box{
|
||||
margin-top: 10px;
|
||||
margin-bottom: 5px;
|
||||
border: solid white 1px;
|
||||
width: 100%;
|
||||
}
|
||||
.tag-box{
|
||||
height: 100px;
|
||||
width: calc(100% - 100px - 15px);
|
||||
width: calc(100% - 100px - 15px - 30px);
|
||||
background-color: black;
|
||||
border: none;
|
||||
}
|
||||
|
@ -55,7 +77,6 @@ if ($handle = opendir($dir)) {
|
|||
<body>
|
||||
<?php
|
||||
include("include/header.php");
|
||||
include("config.php");
|
||||
|
||||
echo "<h2>Woah</h2>";
|
||||
|
||||
|
@ -66,13 +87,6 @@ if ($handle = opendir($dir)) {
|
|||
}
|
||||
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){
|
||||
|
@ -80,6 +94,8 @@ if ($handle = opendir($dir)) {
|
|||
echo("<input type='hidden' name='l' value='" . $_GET["l"] . "'/>\n");
|
||||
echo("<input type='submit'/>");
|
||||
echo("</form>");
|
||||
|
||||
echo("<textarea class='mass-box' form='tag-submit' name='mass' placeholder='Tags to assign to all the selected images or all if none are selected.'></textarea>");
|
||||
foreach($images as $img){
|
||||
$output = "";
|
||||
exec($tmsu . "tags -1 '$dir/$img'", $output);
|
||||
|
@ -87,13 +103,14 @@ if ($handle = opendir($dir)) {
|
|||
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 . "]'>");
|
||||
echo("<textarea placeholder='No tags.' class='tag-box' form='tag-submit' name='t[" . $img . "]'>");
|
||||
for($i = 1; $i < $num_tags; $i++) echo $output[$i] . " ";
|
||||
echo("</textarea>\n");
|
||||
echo("<input form='tag-submit' name='chk[" . $img . "]' type='checkbox'/>");
|
||||
|
||||
echo("</div>\n");
|
||||
}
|
||||
echo("<br/><input type='submit'/>");
|
||||
echo("<br/><input form='tag-submit' type='submit'/>");
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
?>
|
||||
<h1>Pòsweg\'s Suckless Booru</h1>
|
||||
<h1>Dendy\'s Suckless Booru</h1>
|
||||
<form method="GET" action="tag.php">
|
||||
<input type="text" name="t" value="<?php if($_GET["t"]) echo $_GET["t"]; ?>">
|
||||
<input type="submit">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php session_start() ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Pòsweg's image gallery</title>
|
||||
<title>Dendy\'s image gallery</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
@ -30,7 +30,7 @@
|
|||
//Tag list
|
||||
foreach($output as $tag){
|
||||
$count = "";
|
||||
exec($tmsu . "files -c " . $tag . $exclude_query, $count);
|
||||
exec($tmsu . "files -c '" . addcslashes($tag . $exclude_query, '(..)') . "'", $count);
|
||||
echo("<a href='http://" . $_SERVER['HTTP_HOST'] . "/tag.php?t=" . $tag . "'>(" . $count[0] .") " . $tag ."</a>, ");
|
||||
}
|
||||
?>
|
||||
|
|
2
tag.php
2
tag.php
|
@ -74,7 +74,7 @@
|
|||
if(!$_GET["t"] || $_GET["t"] == "*")
|
||||
exec($tmsu . "files " . $alone_exclude_query, $output);
|
||||
// regular query
|
||||
else exec($tmsu . "files '" . $_GET["t"] . $exclude_query . "'", $output);
|
||||
else exec($tmsu . "files '" . addcslashes($_GET["t"] . $exclude_query, '(..)') . "'", $output);
|
||||
|
||||
/* Purge things that aren't images */
|
||||
|
||||
|
|
Loading…
Reference in New Issue