add theme to query parameter

This commit is contained in:
davidovski 2023-08-23 00:51:23 +01:00
parent 1b898c6614
commit 14cdccb83f
2 changed files with 3 additions and 2 deletions

View File

@ -8,5 +8,6 @@
<link rel="stylesheet" type="text/css" href="static/css/styles.css"/>
<link title="LibreY search" type="application/opensearchdescription+xml" href="opensearch.xml?method=POST" rel="search"/>
<link rel="stylesheet" type="text/css" href="<?php
echo "static/css/" . htmlspecialchars($_COOKIE["theme"] ?? "dark") . ".css";
$theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? "dark"));
echo "static/css/" . $theme . ".css";
?>"/>

View File

@ -37,7 +37,7 @@
$opts->page = (int) ($_REQUEST["p"] ?? 0);
$opts->do_fallback = (int) ($_REQUEST["nfb"] ?? 0) == 0;
$opts->theme = trim(htmlspecialchars($_COOKIE["theme"] ?? "dark"));
$opts->theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? "dark"));
$opts->safe_search = (int) ($_REQUEST["safe"] ?? 0) == 1 || isset($_COOKIE["safe_search"]);