"General", "settings" => [ [ "description" => "Allow NSFW content", "parameter" => "nsfw", "options" => [ [ "value" => "yes", "text" => "Yes" ], [ "value" => "maybe", "text" => "Maybe" ], [ "value" => "no", "text" => "No" ] ] ], [ "description" => "Theme", "parameter" => "theme", "options" => [ [ "value" => "dark", "text" => "Gruvbox dark" ], [ "value" => "cream", "text" => "Gruvbox cream" ] ] ], [ "description" => "Prevent clicking background elements when image viewer is open", "parameter" => "bg_noclick", "options" => [ [ "value" => "no", "text" => "No" ], [ "value" => "yes", "text" => "Yes" ] ] ] ] ], [ "name" => "Scrapers to use", "settings" => [ [ "description" => "Web", "parameter" => "scraper_web", "options" => [ [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "brave", "text" => "Brave" ], /*[ "value" => "google", "text" => "Google" ],*/ [ "value" => "mojeek", "text" => "Mojeek" ], [ "value" => "marginalia", "text" => "Marginalia" ], [ "value" => "wiby", "text" => "wiby" ] ] ], [ "description" => "Images", "parameter" => "scraper_images", "options" => [ [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "yandex", "text" => "Yandex" ], [ "value" => "brave", "text" => "Brave" ], [ "value" => "google", "text" => "Google" ] ] ], [ "description" => "Videos", "parameter" => "scraper_videos", "options" => [ [ "value" => "yt", "text" => "YouTube" ], [ "value" => "fb", "text" => "Facebook videos" ], [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "brave", "text" => "Brave" ]/*, [ "value" => "google", "text" => "Google" ]*/ ] ], [ "description" => "News", "parameter" => "scraper_news", "options" => [ [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "brave", "text" => "Brave" ],/* [ "value" => "google", "text" => "Google" ],*/ [ "value" => "mojeek", "text" => "Mojeek" ] ] ] ] ] ]; /* Set cookies */ if($_POST){ $loop = &$_POST; }else{ // refresh cookie dates $loop = &$_COOKIE; } foreach($loop as $key => $value){ foreach($settings as $title){ foreach($title["settings"] as $list){ if( $list["parameter"] == $key && $list["options"][0]["value"] == $value ){ unset($_COOKIE[$key]); setcookie( $key, "", [ "expires" => -1, // removes cookie "samesite" => "Strict" ] ); continue 3; } } } if(!is_string($value)){ continue; } $key = trim($key); $value = trim($value); $_COOKIE[$key] = $value; setcookie( $key, $value, [ "expires" => strtotime("+400 days"), // maximal cookie ttl in chrome "samesite" => "Strict" ] ); } include "lib/frontend.php"; $frontend = new frontend(); echo '' . '' . '' . '' . 'Settings' . '' . '' . '' . '' . '' . '' . '' . 'getthemeclass() . '>'; $left = '

Settings

' . '
' . 'By clicking
Update settings!
, a plaintext
key=value
cookie will be stored on your browser. When selecting a default setting, the parameter is removed from your cookies.'; $c = count($_COOKIE); if($c !== 0){ $left .= '

Your current cookie looks like this:' . '
'; $code = ""; $ca = 0; foreach($_COOKIE as $key => $value){ $code .= $key . "=" . $value; $ca++; if($ca !== $c){ $code .= "; "; } } $left .= $frontend->highlightcode($code); $left .= '
'; }else{ $left .= '

You currently don\'t have any cookies set.'; } $left .= '
'; foreach($settings as $title){ $left .= '

' . $title["name"] . '

'; foreach($title["settings"] as $setting){ $left .= '
' . '
' . $setting["description"] . '
' . '
'; } } $left .= '
' . '
' . '' . '< Return to main page' . '
' . '
'; echo $frontend->load( "search.html", [ "class" => "", "right-left" => "", "right-right" => "", "left" => $left ] );