Browse Source

Fix things that broke on previous commission

When escaping characters it no longer breaks excluded
tags and searching for nothing giving everything
master
Dendy 1 year ago
parent
commit
77d7df6a01
Signed by: dendy GPG Key ID: 0168B35FFD7F608F
  1. 10
      config.php
  2. 4
      index.php
  3. 5
      tag.php

10
config.php

@ -4,6 +4,10 @@ $tmsu = "tmsu -D /strg/drw/.tmsu/db ";
$BASE_ROUTE = "";
function escape_cmd($command){
return "'" . addcslashes(addcslashes($command, '(..)'),'-') . "'";
}
/* Exclude */
$exclude = "";
@ -20,7 +24,7 @@ if(!isset($_SESSION["login"])){
$alone_exclude_query = $alone_exclude_query . " and not " . $ex_tag;
}
$exclude_query = $exclude_query . $alone_exclude_query;
$alone_exclude_query = "'" . $alone_exclude_query . "'";
$alone_exclude_query = escape_cmd($alone_exclude_query);
}
$_IS_LOGGED = $_SESSION["login"] === "true";
@ -30,8 +34,4 @@ if(!is_array($_SESSION["msg"])){
$_SESSION["msg"] = array();
}
function escape_cmd($command){
return "'" . addcslashes(addcslashes($command, '(..)'),'-') . "'";
}
?>

4
index.php

@ -27,10 +27,10 @@
// Echo total tag count
echo "<p>There is a total of " . $tag_num . " tags</p>";
//Tag list
//tag list
foreach($output as $tag){
$count = "";
exec($tmsu . "files -c " . escape_cmd($tag), $count);
exec($tmsu . "files -c " . escape_cmd($tag) . $exclude_query, $count);
if($count[0] !== "0"){
echo("<a href='http://" . $_SERVER['HTTP_HOST'] . "/tag.php?t=" . $tag . "'>(" . $count[0] .") " . $tag ."</a>, ");

5
tag.php

@ -71,8 +71,9 @@
/* Queries */
// Handle * and void to show everything
if(!$_GET["t"] || $_GET["t"] == "*")
exec($tmsu . "files " . escape_cmd($alone_exclude_query), $output);
if(!$_GET["t"] || $_GET["t"] == "*"){
exec($tmsu . "files " . $alone_exclude_query, $output);
}
// regular query
else exec($tmsu . "files " . escape_cmd($_GET["t"] . $exclude_query), $output);

Loading…
Cancel
Save