Compare commits
6 Commits
f38cd8bc55
...
44d7e6f8a4
Author | SHA1 | Date |
---|---|---|
Dendy | 44d7e6f8a4 | |
Dendy | 4fd150c79d | |
Dendy | b9d0790834 | |
Dendy | 88f618b007 | |
Dendy | e6c41fa25a | |
Dendy | d3c559a23a |
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
session_start();
|
||||
include("../config.php");
|
||||
|
||||
if(!$_IS_ADMIN){
|
||||
die("Not authorized.");
|
||||
}
|
||||
|
||||
|
||||
$deleted_tags = "";
|
||||
$message = "No unused tags found.";
|
||||
|
||||
$output = "";
|
||||
$return = 0;
|
||||
exec($tmsu . "tags", $output, $return);
|
||||
|
||||
foreach($output as $tag){
|
||||
$count = "";
|
||||
$return = 0;
|
||||
|
||||
exec($tmsu . "files -c '" . addcslashes($tag, '(..)') . "' 2>&1", $count, $return);
|
||||
|
||||
if($return !== 0){
|
||||
$message = 'Could not execute deletion command: "' . $count[0] . '"';
|
||||
break;
|
||||
}
|
||||
|
||||
if(intval($count[0]) == 0){
|
||||
$output = "";
|
||||
exec($tmsu . "delete " . $tag, $output);
|
||||
|
||||
$deleted_tags .= $tag . " ";
|
||||
}
|
||||
}
|
||||
|
||||
if($deleted_tags !== "") $message = "Deleted unused tags: (" . $deleted_tags . ")";
|
||||
|
||||
array_push($_SESSION["msg"], $message);
|
||||
|
||||
if(isset($_GET["_back"])){
|
||||
header("Location: " . $_GET["_back"]);
|
||||
}
|
||||
else{
|
||||
//header("Location: " . $BASE_PATH . "/?msg[0]=" , $message);
|
||||
header("Location: " . $BASE_PATH . "/");}
|
|
@ -27,7 +27,7 @@ if(isset($_GET["t"]) and is_array($_GET["t"])){
|
|||
//echo($_GET["t"][$pic] . "\n<br/>");
|
||||
$new_tags = $_GET["t"][$pic];
|
||||
if($_GET["chk"][$pic] == "on" or !isset($_GET["chk"])){
|
||||
$new_tags .= $_GET["mass"];
|
||||
$new_tags .= " " . $_GET["mass"];
|
||||
}
|
||||
|
||||
$output = "";
|
||||
|
@ -78,7 +78,11 @@ if(isset($_GET["t"]) and is_array($_GET["t"])){
|
|||
<?php
|
||||
include("include/header.php");
|
||||
|
||||
echo "<h2>Woah</h2>";
|
||||
echo("<h2>Utilities</h2>");
|
||||
|
||||
echo("<a href='actions/delete-unused.php?_back=" . $BASE_PATH . $_SERVER['PHP_SELF'] . "'>Delete unused tags</a>");
|
||||
|
||||
echo("<h2>Tag files</h2>");
|
||||
|
||||
echo("<div class='paths'>");
|
||||
echo("<a href='" . $BASE_PATH . "/admin.php?l=" . dirname($dir) . "'><-</a><br/>\n");
|
||||
|
|
10
config.php
10
config.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$tmsu = "tmsu -D drw/.tmsu/db ";
|
||||
$tmsu = "tmsu -D /strg/drw/.tmsu/db ";
|
||||
|
||||
$BASE_ROUTE = "";
|
||||
|
||||
|
@ -22,4 +22,12 @@ if(!isset($_SESSION["login"])){
|
|||
$exclude_query = $exclude_query . $alone_exclude_query;
|
||||
$alone_exclude_query = "'" . $alone_exclude_query . "'";
|
||||
}
|
||||
|
||||
$_IS_LOGGED = $_SESSION["login"] === "true";
|
||||
$_IS_ADMIN = $_SESSION["username"] === "admin";
|
||||
|
||||
if(!is_array($_SESSION["msg"])){
|
||||
$_SESSION["msg"] = array();
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
#header{
|
||||
text-align: center;
|
||||
}
|
||||
.alert{
|
||||
margin: 20px;
|
||||
padding: 5px;
|
||||
color: orange;
|
||||
border: solid orange 1px;
|
||||
margin: auto;
|
||||
width: 60vw;
|
||||
}
|
||||
</style>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<div id="header">
|
||||
|
@ -41,4 +49,13 @@
|
|||
<input type="text" name="t" value="<?php if($_GET["t"]) echo $_GET["t"]; ?>">
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION["msg"]) and is_array($_SESSION["msg"])){
|
||||
foreach($_SESSION["msg"] as $message){
|
||||
echo("<div class='alert'>" . $message . "</div>");
|
||||
$_SESSION["msg"] = array();
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
2
tag.php
2
tag.php
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<?php $thumb_size = 150; ?>
|
||||
<title>Pòsweg\'s image gallery</title>
|
||||
<title>Dendy\'s image gallery</title>
|
||||
<style>
|
||||
.title{
|
||||
text-align: left;
|
||||
|
|
20
view.php
20
view.php
|
@ -1,17 +1,19 @@
|
|||
<?php session_start() ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Pòsweg's image gallery</title>
|
||||
<title>Dendy\'s image gallery</title>
|
||||
<style>
|
||||
#img{
|
||||
height: 70vh;
|
||||
max-height: 70vh;
|
||||
float: right;
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include("config.php");
|
||||
include("include/header.php");
|
||||
include("config.php");
|
||||
|
||||
exec($tmsu . "tags -1 \"" . $_GET["i"] . $excluded_query . "\"", $output);
|
||||
|
||||
|
@ -21,18 +23,24 @@
|
|||
// }
|
||||
// }
|
||||
|
||||
echo "<h1>Tag list</h1>";
|
||||
|
||||
echo "<img id=\"img\" src=\"/" . $_GET["i"] . "\">";
|
||||
|
||||
//Tag list
|
||||
$num_tags = sizeof($output);
|
||||
|
||||
echo "Tags(" . $num_tags . "):<br/>";
|
||||
echo "<h2>Tag list (" . $num_tags . ")</h2>";
|
||||
|
||||
//echo "Tags(" . $num_tags . "):<br/>";
|
||||
unset($output[0]);
|
||||
foreach($output as $tag){
|
||||
echo("<a href='http://" . $_SERVER['HTTP_HOST'] . "/tag.php?t=" . $tag . "'>" . $tag ."</a><br/>");
|
||||
}
|
||||
|
||||
if($_IS_ADMIN){
|
||||
echo("<h2>Admin</h2>");
|
||||
|
||||
echo("<a href='" . $BASE_PATH . "/admin.php?l=" . dirname($_GET["i"]) . "'>View folder</a>");
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue