"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" => [] ], [ "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" => "Autocomplete
Picking Auto changes the source dynamically depending of the page's scraper
Warning: If you edit this field, you will need to re-add the search engine so that the new autocomplete settings are applied!
", "parameter" => "scraper_ac", "options" => [ [ "value" => "disabled", "text" => "Disabled" ], [ "value" => "auto", "text" => "Auto" ], [ "value" => "brave", "text" => "Brave" ], [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "yandex", "text" => "Yandex" ], [ "value" => "google", "text" => "Google" ], [ "value" => "startpage", "text" => "Startpage" ], [ "value" => "kagi", "text" => "Kagi" ], [ "value" => "qwant", "text" => "Qwant" ], [ "value" => "ghostery", "text" => "Ghostery" ], [ "value" => "yep", "text" => "Yep" ], [ "value" => "marginalia", "text" => "Marginalia" ], [ "value" => "yt", "text" => "YouTube" ], [ "value" => "sc", "text" => "SoundCloud" ] ] ], [ "description" => "Web", "parameter" => "scraper_web", "options" => [ [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "brave", "text" => "Brave" ], [ "value" => "yandex", "text" => "Yandex" ], [ "value" => "google", "text" => "Google" ], [ "value" => "startpage", "text" => "Startpage" ], [ "value" => "qwant", "text" => "Qwant" ], [ "value" => "ghostery", "text" => "Ghostery" ], [ "value" => "yep", "text" => "Yep" ], [ "value" => "greppr", "text" => "Greppr" ], [ "value" => "crowdview", "text" => "Crowdview" ], [ "value" => "mwmbl", "text" => "Mwmbl" ], [ "value" => "mojeek", "text" => "Mojeek" ], [ "value" => "solofield", "text" => "Solofield" ], [ "value" => "marginalia", "text" => "Marginalia" ], [ "value" => "wiby", "text" => "wiby" ], [ "value" => "curlie", "text" => "Curlie" ] ] ], [ "description" => "Images", "parameter" => "scraper_images", "options" => [ [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "yandex", "text" => "Yandex" ], [ "value" => "brave", "text" => "Brave" ], [ "value" => "google", "text" => "Google" ], [ "value" => "startpage", "text" => "Startpage" ], [ "value" => "qwant", "text" => "Qwant" ], [ "value" => "yep", "text" => "Yep" ], [ "value" => "solofield", "text" => "Solofield" ], /*[ "value" => "pinterest", "text" => "Pinterest" ],*/ [ "value" => "imgur", "text" => "Imgur" ], [ "value" => "ftm", "text" => "FindThatMeme" ] ] ], [ "description" => "Videos", "parameter" => "scraper_videos", "options" => [ [ "value" => "yt", "text" => "YouTube" ], [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "brave", "text" => "Brave" ], [ "value" => "yandex", "text" => "Yandex" ], [ "value" => "google", "text" => "Google" ], [ "value" => "startpage", "text" => "Startpage" ], [ "value" => "qwant", "text" => "Qwant" ], [ "value" => "solofield", "text" => "Solofield" ] ] ], [ "description" => "News", "parameter" => "scraper_news", "options" => [ [ "value" => "ddg", "text" => "DuckDuckGo" ], [ "value" => "brave", "text" => "Brave" ], [ "value" => "google", "text" => "Google" ], [ "value" => "startpage", "text" => "Startpage" ], [ "value" => "qwant", "text" => "Qwant" ], [ "value" => "yep", "text" => "Yep" ], [ "value" => "mojeek", "text" => "Mojeek" ] ] ], [ "description" => "Music", "parameter" => "scraper_music", "options" => [ [ "value" => "sc", "text" => "SoundCloud" ]//, //[ // "value" => "spotify", // "text" => "Spotify" //] ] ] ] ] ]; /* Set theme collection */ $themes = glob("static/themes/*"); $settings[0]["settings"][1]["options"][] = [ "value" => "Dark", "text" => "Dark" ]; foreach($themes as $theme){ $theme = explode(".", basename($theme))[0]; $settings[0]["settings"][1]["options"][] = [ "value" => $theme, "text" => $theme ]; } /* Set cookies */ if($_POST){ $loop = &$_POST; }elseif(count($_GET) !== 0){ // redirect user to front page $loop = &$_GET; header("Location: /"); }else{ // refresh cookie dates $loop = &$_COOKIE; } foreach($loop as $key => $value){ if($key == "theme"){ if($value == config::DEFAULT_THEME){ unset($_COOKIE[$key]); setcookie( "theme", "", [ "expires" => -1, // removes cookie "samesite" => "Lax", "path" => "/" ] ); continue; } }else{ 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" => "Lax", "path" => "/" ] ); 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" => "Lax", "path" => "/" ] ); } include "lib/frontend.php"; $frontend = new frontend(); echo $frontend->load( "header_nofilters.html", [ "title" => "Settings", "class" => "" ] ); $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); $code = ""; if($c !== 0){ $left .= '

Your current cookie looks like this:' . '
'; $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 .= '
' . '
' . '' . '< Go back' . '
' . '
'; if(count($_GET) === 0){ $code = []; foreach($_COOKIE as $key => $value){ $code[] = rawurlencode($key) . "=" . rawurlencode($value); } $code = implode("&", $code); if($code != ""){ $code = "?" . $code; } echo $frontend->load( "search.html", [ "timetaken" => null, "class" => "", "right-left" => '

Preference link

Following this link will re-apply all cookies configured here and will redirect you to the front page. Useful if your browser clears out cookies after a browsing session.

' . 'Bookmark me!' . '
', "right-right" => "", "left" => $left ] ); }