inital commit
This commit is contained in:
55
view.php
Normal file
55
view.php
Normal file
@ -0,0 +1,55 @@
|
||||
<head>
|
||||
<title>WallHeaven</title>
|
||||
<meta name="description" content="Wallpaper proxy">
|
||||
</head>
|
||||
<?php
|
||||
include('scrapers/wallhaven.php');
|
||||
include('style/header.php');
|
||||
include('misc/tools.php');
|
||||
$config = require('config.php');
|
||||
|
||||
if ((!$_POST['purity'] && !$_POST['wall']) && $_GET['w']) {
|
||||
$_POST['purity'] = $_GET['p'];
|
||||
$wall = getwallpaper("https://wallhaven.cc/api/v1/w/".$_GET['w']);
|
||||
$_POST['wall'] = $wall["path"];
|
||||
}
|
||||
/* get wallpaper id and get info from api */
|
||||
preg_match("/(?!.*-)([A-Za-z0-9]+)/", $_POST['wall'], $matches);
|
||||
if ($_POST['purity'] === "nsfw")
|
||||
$apikey = $config["frontends"]["wallhaven"]["apikey"];
|
||||
else
|
||||
$apikey = "";
|
||||
$res = getwallpaper("https://wallhaven.cc/api/v1/w/$matches[0]?apikey=$apikey");
|
||||
?>
|
||||
<div id='wallmaster'>
|
||||
<div id='wallpaperinfo'>
|
||||
<div id='uploader'>
|
||||
<?php
|
||||
printf("<img src='/proxy.php?i=%s' width=64 height=64>\n<br>\n", $res["uploader"]["avatar"]["medium"]);
|
||||
printf("<a href='/query.php?q=@%s'><span title='%s'>%s</span></a>\n<br>\n", $res["uploader"]["username"], $res["uploader"]["group"], $res["uploader"]["username"]);
|
||||
printf("<span title='%s'>%s old</span>\n", $res["created_at"], timesince(strtotime($res["created_at"])));
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
printf("<hr><details id='tags' open><summary>Tags<a id='similar' href='/query.php?q=like:%s'>Similar Wallpapers</a></summary>\n", $matches[0]);
|
||||
foreach ($res["tags"] as $tags)
|
||||
printf("<span title='%s' id='%s'><a href='/query.php?q=id:%s'>%s</a></span>\n", $tags["alias"], $tags["purity"], $tags["id"], $tags["name"]);
|
||||
?>
|
||||
</details>
|
||||
<hr><details id='properties' open><summary>Properties</summary>
|
||||
<?php
|
||||
printf("<p>Category <span id='category'>%s</span></p>\n", ucfirst($res["category"]));
|
||||
printf("<p>Purity <span id='%s'>%s</span></p>\n", $res["purity"], toupperpurity($res["purity"]));
|
||||
printf("<p>Resolution <span id='resolution'>%s</span></p>\n", $res["resolution"]);
|
||||
printf("<p>File Size <span id='size'>%s</span></p>\n", humanfilesize($res["file_size"]));
|
||||
printf("<p>Share <span><a id='share' href='/view.php?w=%s&p=%s'>%s</a></span></p>\n", $matches[0], $_POST['purity'], $matches[0]);
|
||||
?>
|
||||
</details>
|
||||
<hr>
|
||||
</div>
|
||||
<div id='bwallpaperview'>
|
||||
<?php
|
||||
printf("<img src='/proxy.php?i=%s' alt='loading image...'>\n", $_POST['wall']);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user