summaryrefslogtreecommitdiffstats
path: root/www/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/index.php')
-rw-r--r--www/index.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/www/index.php b/www/index.php
index 1fd25a2..e37fe7f 100644
--- a/www/index.php
+++ b/www/index.php
@@ -16,7 +16,7 @@
<h3>rezultati</h3>
<pre>
<?php
-$q = "find .. -name '*.torrent' | xargs grep -lie " . escapeshellarg($_REQUEST["i"]);
+$q = "find .. -maxdepth 2 -name '*.torrent' | xargs grep -lie " . escapeshellarg($_REQUEST["i"]);
echo htmlspecialchars($q);
?>
</pre>
@@ -26,7 +26,11 @@ foreach (explode(PHP_EOL, shell_exec($q)) as $f) {
if (trim($f) == "")
continue;
$t = TorrentFile::load($f);
- echo "<li> <a href=info.php?h=" . $t->getInfoHash() . ">" . htmlspecialchars($t->getName()) . "</a></li>";
+ $m = [];
+ preg_match("|/([a-fA-F0-9]*).torrent|", $f, $m);
+ if (count($m) < 2)
+ var_dump([$f, $m]);
+ echo "<li> <a href=info.php?h=" . $m[1] . ">" . htmlspecialchars($t->getName()) . "</a></li>";
}
?>
</ul>