aboutsummaryrefslogtreecommitdiffstats
path: root/style/header.php
blob: faf729208183311081d373029515d150fc132d32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
  $config = require(__DIR__.'/../config.php');

  $_GET["SFW"]     ? $SFW = "checked"     : $SFW = NULL;
  $_GET["Sketchy"] ? $Sketchy = "checked" : $Sketchy = NULL;
  $_GET["NSFW"]    ? $NSFW = "checked"    : $NSFW = NULL;
  $_GET["General"] ? $General = "checked" : $General = NULL;
  $_GET["Anime"]   ? $Anime = "checked"   : $Anime = NULL;
  $_GET["People"]  ? $People = "checked"  : $People = NULL;
  if (!$_GET["SFW"] && !$_GET["Sketchy"] && !$_GET["NSFW"])
    $SFW = "checked";
  if (!$_GET["General"] && !$_GET["Anime"] && !$_GET["People"]) {
    $General = "checked";
    $Anime = "checked";
    $People = "checked";
  }

  if ($_GET["q"]) {
    printf("<head>\n<title>WallHeaven - %s</title>\n", $_GET["q"]);
    printf("<meta name='description' content='Pictures of %s'>\n", $_GET["q"]);
  } else {
    printf("<head>\n<title>WallHeaven - Viewing A Wallpaper</title>\n", $_GET["w"]);
    printf("<meta name='description' content='Wallpaper id:%s'>\n", $_GET["w"]);
  }
?>
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <link rel="stylesheet" href="/style/style.css">
  <meta charset="utf-8">
  </head>
  <a href="/" id="header"><h3>Wall<span id="heaven">Heaven</span></h3></a>
  <div id="searchbox">
  <form action="/query.php" method="GET">
<?php
  printf("<input type='text' placeholder='Search...' name='q' value='%s'>", $_GET["q"]);
  printf("<input type='submit' value='Go'>");
  printf("<div id='options'>\n");
  printf(" <input type='checkbox' name='SFW' id='SFW' %s>\n", $SFW);
  printf(" <label for='SFW'>SFW</label>\n");
  printf(" <input type='checkbox' name='Sketchy' id='Sketchy' %s>\n", $Sketchy);
  printf(" <label for='Sketchy'>Sketchy</label>\n");
  if ($config["frontends"]["wallhaven"]["apikey"]) { /* only display NSFW button with apikey */
    printf(" <input type='checkbox' name='NSFW' id='NSFW' %s>\n", $NSFW);
    printf(" <label for='NSFW'>NSFW</label>\n");
  }
  printf(" <input type='checkbox' name='General' id='General' %s>\n", $General);
  printf(" <label for='General'>General</label>\n");
  printf(" <input type='checkbox' name='Anime' id='Anime' %s>\n", $Anime);
  printf(" <label for='Anime'>Anime</label>\n");
  printf(" <input type='checkbox' name='People' id='People' %s>\n", $People);
  printf(" <label for='People'>People</label>\n");
  printf("</div>\n");
  printf("</form>\n<br>\n</div>\n")
?>