pub / serci

Search the web with !keywords
git clone https://https://src.jayvii.de/pub/serci.git
Home | Log | Files | Exports | Refs | README | RSS

commit 3a44d4c3b5ccfe331209fe79ed77026f48ef3114
parent 4d4f49b44b9c9e7f88cc6b6f94d052b70ac40613
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Wed, 16 Oct 2024 20:29:31 +0200

fix: refresh cookie only if it was set previously; performance improvement

Diffstat:
Mindex.php | 18+++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/index.php b/index.php @@ -20,17 +20,13 @@ $query = null; } - /* Handle Default Search Engine cookie or GET parameter */ - if ( - !is_null($_COOKIE["default_search"]) || - !is_null($_GET["default_search"]) - ) { - /* Use search engine stored in cookie or GET argument */ - if (!is_null($_GET["default_search"])) { - $default_search = $_GET["default_search"]; - } else { - $default_search = $_COOKIE["default_search"]; - } + /* Handle Default Search Engine via cookie or GET argument + * Fallback is always defined in config/configs.php + */ + if (!is_null($_GET["default_search"])) { + $default_search = $_GET["default_search"]; + } elseif (!is_null($_COOKIE["default_search"])) { + $default_search = $_COOKIE["default_search"]; /* refresh cookie */ setcookie( "default_search",