From 82b5ae8dcdf80c19a76b79c19dd6b50154113483 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:11:38 -0700 Subject: [PATCH 01/14] Fixed printftext having no return There is a difference. Before, on index: After: 56 --- locale/localization.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/localization.php b/locale/localization.php index 65bb17a8..417f7521 100644 --- a/locale/localization.php +++ b/locale/localization.php @@ -7,7 +7,7 @@ function printtext($key) { function printftext() { $argv = func_get_args(); $key = array_shift($argv); - vprintf(TEXTS[$key], $argv); + return vprintf(TEXTS[$key], $argv); } // default to language "en" From cc8fd01412cdd9758903c7fe18b8a855a738cedf Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:13:10 -0700 Subject: [PATCH 02/14] Fixed uninitalized usage of $opts (to $this->opts) set_cooldown($this->engine, ($opts->request_cooldown ?? "1") * 60, $this->opts->cooldowns); to set_cooldown($this->engine, ($this->opts->request_cooldown ?? "1") * 60, $this->opts->cooldowns); --- engines/text/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/text/text.php b/engines/text/text.php index e93d14a1..35cd7612 100644 --- a/engines/text/text.php +++ b/engines/text/text.php @@ -102,7 +102,7 @@ public function parse_results($response) { $results = $this->engine_request->get_results(); if (empty($results)) { - set_cooldown($this->engine, ($opts->request_cooldown ?? "1") * 60, $this->opts->cooldowns); + set_cooldown($this->engine, ($this->opts->request_cooldown ?? "1") * 60, $this->opts->cooldowns); } else { if ($this->special_request) { $special_result = $this->special_request->get_results(); From c18483ac73cc5f8922bc1bd4d8c3a962cb4796f3 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:15:14 -0700 Subject: [PATCH 03/14] Declare visibility of __construct --- misc/search_engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/search_engine.php b/misc/search_engine.php index 5becfbac..997a6e20 100644 --- a/misc/search_engine.php +++ b/misc/search_engine.php @@ -4,7 +4,7 @@ abstract class EngineRequest { protected $url, $query, $page, $opts, $mh, $ch; protected $DO_CACHING = true; - function __construct($opts, $mh) { + public function __construct($opts, $mh) { $this->query = $opts->query; $this->page = $opts->page; $this->mh = $mh; From 8c794a10e268da81797e7eb61a16d323865c451d Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:18:06 -0700 Subject: [PATCH 04/14] Unexpected shorthand "margin" after "margin-bottom" In CSS, when you use the shorthand property like margin, it will override any individual margin properties like margin-bottom. --- static/css/styles.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/static/css/styles.css b/static/css/styles.css index 559a8102..6ec5ae1e 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -94,7 +94,6 @@ a:hover, } .sub-search-container input { - margin-bottom: 20px; width: 580px; position: relative; left: 140px; @@ -587,4 +586,4 @@ hr.small-line { /* donate css end */ -} \ No newline at end of file +} From 1f76795425fc9ee6ee9400a7599b6f07ecd11af6 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:19:03 -0700 Subject: [PATCH 05/14] Update styles.css Unexpected duplicate "margin-top" --- static/css/styles.css | 1 - 1 file changed, 1 deletion(-) diff --git a/static/css/styles.css b/static/css/styles.css index 6ec5ae1e..9ea675a9 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -461,7 +461,6 @@ hr.small-line { padding: 10px; font-size: 28px; display: block; - margin-top: 0px; top: 0px; left: 0px; } From a35720b03a2a8e7c73c13feaf9f145240ea3ca73 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:19:26 -0700 Subject: [PATCH 06/14] Update styles.css Unexpected duplicate "word-wrap" --- static/css/styles.css | 1 - 1 file changed, 1 deletion(-) diff --git a/static/css/styles.css b/static/css/styles.css index 9ea675a9..80ad91b4 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -550,7 +550,6 @@ hr.small-line { word-wrap: break-word; align-items: center; justify-content: space-between; - word-wrap: break-word; height: auto; } From 2b62e16aee69bcff021c5a1482d9670dfee33cc9 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 16:50:06 -0700 Subject: [PATCH 07/14] Fixed warnings and fatal error --- engines/invidious/video.php | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/engines/invidious/video.php b/engines/invidious/video.php index ca80b9d7..762ba6ee 100644 --- a/engines/invidious/video.php +++ b/engines/invidious/video.php @@ -9,7 +9,7 @@ public function get_request_url() { public function parse_results($response) { $results = array(); - $json_response = json_decode($response, true); + $json_response = json_decode($response, true) ?? []; foreach ($json_response as $response) { if ($response["type"] == "video") { @@ -41,26 +41,27 @@ public function parse_results($response) { public static function print_results($results, $opts) { echo "
"; - foreach($results as $result) { - $title = $result["title"]; - $url = $result["url"]; - $url = check_for_privacy_frontend($url, $opts); - $base_url = get_base_url($url); - $uploader = $result["uploader"]; - $views = $result["views"]; - $date = $result["date"]; - $thumbnail = $result["thumbnail"]; + foreach ($results as $result) { + $title = $result["title"] ?? ''; + $url = $result["url"] ?? ''; + $url = check_for_privacy_frontend($url, $opts); + $base_url = get_base_url($url); + $uploader = $result["uploader"] ?? ''; + $views = $result["views"] ?? ''; + $date = $result["date"] ?? ''; + $thumbnail = $result["thumbnail"] ?? ''; + + echo ""; + } - echo ""; - } echo "
"; } From ee22d85b1760119b5e5af8813e8c8cc594c74f9d Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 17:20:15 -0700 Subject: [PATCH 08/14] Fixed a unnecessary use of parse_url on HTTP_HOST --- engines/librex/fallback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/librex/fallback.php b/engines/librex/fallback.php index 4aab449a..fb797085 100644 --- a/engines/librex/fallback.php +++ b/engines/librex/fallback.php @@ -53,7 +53,7 @@ function get_librex_results($opts) { if (!(filter_var($instance, FILTER_VALIDATE_URL))) continue; - if (parse_url($instance)["host"] == parse_url($_SERVER['HTTP_HOST'])["host"]) + if (parse_url($instance)["host"] == $_SERVER['HTTP_HOST']) continue; $librex_request = new LibreXFallback($instance, $opts, null); From fe2a723645f270b0b27b73c68297c07ed09491f5 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 17:25:39 -0700 Subject: [PATCH 09/14] Fix for "textContent" null --- engines/text/brave.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/text/brave.php b/engines/text/brave.php index bc46ce8e..dd7da0f4 100644 --- a/engines/text/brave.php +++ b/engines/text/brave.php @@ -47,7 +47,7 @@ public function parse_results($response) { continue; $title = $title->textContent; - $description = $xpath->evaluate(".//div[contains(@class, 'snippet-content')]//div[contains(@class, 'snippet-description')]", $result)[0]->textContent; + $description = ($xpath->evaluate(".//div[contains(@class, 'snippet-content')]//div[contains(@class, 'snippet-description')]", $result)[0] ?? null) ?->textContent ?? ''; array_push($results, array ( From c9433ee4b95e7cd837848b341fed2da716f34245 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 17:28:49 -0700 Subject: [PATCH 10/14] Fix for "textContent" null --- engines/text/mojeek.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/text/mojeek.php b/engines/text/mojeek.php index 886a748d..6400e50b 100644 --- a/engines/text/mojeek.php +++ b/engines/text/mojeek.php @@ -42,7 +42,7 @@ public function parse_results($response) { $title = $title->textContent; - $description = $xpath->evaluate(".//p[contains(@class, 's')]", $result)[0]->textContent; + $description = ($xpath->evaluate(".//p[contains(@class, 's')]", $result)[0] ?? null) ?->textContent ?? ''; array_push($results, array ( From 2d3c98c93fddcd640a4e8dfba2aa043ef97910c1 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 17:31:39 -0700 Subject: [PATCH 11/14] Fixed resources trying to load from root --- donate.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/donate.php b/donate.php index 1426dee4..a26fde9b 100644 --- a/donate.php +++ b/donate.php @@ -21,7 +21,7 @@ btc qr code xmr qr code (hnhx) xmr qr code (ahwx) kifi img buy-me-a-coffee img + From 47aab4361773a9661c31a96a2e277402aeecf566 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 17:35:09 -0700 Subject: [PATCH 12/14] oops --- donate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/donate.php b/donate.php index a26fde9b..290ed098 100644 --- a/donate.php +++ b/donate.php @@ -86,4 +86,4 @@ - + From 72585c4e45f3573db45d6e202198b04dd0aa4100 Mon Sep 17 00:00:00 2001 From: Delirious Date: Thu, 22 Feb 2024 18:17:37 -0700 Subject: [PATCH 13/14] Update tools.php --- misc/tools.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/misc/tools.php b/misc/tools.php index e69c6b53..847d8e8d 100644 --- a/misc/tools.php +++ b/misc/tools.php @@ -1,9 +1,16 @@ $trace) { + // Skip the first entry as it's the current function call + if ($index === 0) { + continue; + } + + // Build the log message for each stack frame + $logMessage .= "#{$index} "; + if (isset($trace['file'])) { + $logMessage .= "File: {$trace['file']} "; + } + if (isset($trace['line'])) { + $logMessage .= "Line: {$trace['line']} "; + } + if (isset($trace['function'])) { + $logMessage .= "Function: {$trace['function']} "; + } + $logMessage .= "\n"; + } + + // Log the stack trace to the error log + error_log($logMessage); + } + ?> From 054f6a1940bb0931fdc0a0e155e6d21eecb2d408 Mon Sep 17 00:00:00 2001 From: Delirious Date: Fri, 23 Feb 2024 11:57:00 -0700 Subject: [PATCH 14/14] Update fallback.php --- engines/librex/fallback.php | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/librex/fallback.php b/engines/librex/fallback.php index fb797085..7039d66e 100644 --- a/engines/librex/fallback.php +++ b/engines/librex/fallback.php @@ -62,7 +62,6 @@ function get_librex_results($opts) { if (!empty($results)) { $results["results_source"] = parse_url($instance)["host"]; - error_log($results["results_source"]); return $results; }