summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--search.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/search.php b/search.php
index 0aeb0b9..2c9ddb7 100644
--- a/search.php
+++ b/search.php
@@ -10,7 +10,7 @@ try {
if (!$config = parse_ini_file("config.ini")) {
throw new Exception('Could not parse ini file');
}
-
+
// hash the password
if (isset($config['password'])) {
$hash = hash("sha256", $config['password']);
@@ -22,7 +22,7 @@ try {
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$output = json_decode(curl_exec($curl));
curl_close($curl);
-
+
$search = read_stdin();
if (empty($search)) {
@@ -65,18 +65,18 @@ try {
throw new Exception("Page `" . $page . "` is not valid");
}
-
+
// remove the pagination from the search args
$pos = array_search("#" . $page, $args);
if ($pos) {
$args[$pos] = null;
}
-
+
// Really slow search
$results = [];
foreach ($output as $upload) {
$match = false;
- foreach ($args as $arg) {
+ foreach ($args as $arg) {
if (!is_null($arg) && stripos($upload->filename, $arg) === false) {
$match = false;
break;
@@ -121,7 +121,7 @@ try {
}
function read_stdin()
-{
+{
$fr=fopen("php://stdin","r"); // open our file pointer to read from stdin
$input = fgets($fr,128); // read a maximum of 128 characters
$input = rtrim($input); // trim any trailing spaces.