mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 12:23:48 +01:00
Banners commit
This commit is contained in:
parent
64b6385921
commit
09ef0bc944
31
banners.php
Normal file
31
banners.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
include 'inc/functions.php';
|
||||
|
||||
header("Pragma-directive: no-cache");
|
||||
header("Cache-directive: no-cache");
|
||||
header("Cache-control: no-cache");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
if (!isset($_GET['board'])) {
|
||||
header("Location: static/8chan banner.png");
|
||||
die();
|
||||
}
|
||||
$b = $_GET['board'];
|
||||
if (!preg_match('/^[a-z0-9]{1,10}$/', $b))
|
||||
header("Location: static/8chan banner.png");
|
||||
|
||||
$dir = 'static/banners/'.$b;
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$banners = array_diff(scandir($dir), array('..', '.'));
|
||||
$r = array_rand($banners);
|
||||
} else {
|
||||
$banners = array();
|
||||
}
|
||||
|
||||
if (!empty($banners)) {
|
||||
header("Location: $dir/{$banners[$r]}");
|
||||
} else {
|
||||
header("Location: static/8chan banner.png");
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
<body>
|
||||
{{ boardlist.top }}
|
||||
{% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr />{% endif %}
|
||||
{% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %}
|
||||
{% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}?board={{ board.uri }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %}
|
||||
<header>
|
||||
<h1>{{ board.url }} - {{ board.title|e }}</h1>
|
||||
<div class="subtitle">
|
||||
|
Loading…
x
Reference in New Issue
Block a user