1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-12 01:50:48 +01:00

Add banners as default functionality & display them on mod login / dashboard when enabled (#513)

* Add banner support as a default, integrated option.
Used lainchan's original banner script, authored by barrucadu

* Display banners on moderator login and dashboard

* Remove memes & better directory structure
This commit is contained in:
deysu 2022-11-17 01:48:24 -05:00 committed by GitHub
parent f62acd5c1a
commit c8f88c14a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 6 deletions

19
b.php Normal file
View File

@ -0,0 +1,19 @@
<?php
$dir = "static/banners/";
$files = scandir($dir);
$images = array_diff($files, array('.', '..'));
$name = $images[array_rand($images)];
// open the file in a binary mode
$fp = fopen($dir . $name, 'rb');
// send the right headers
header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1
header('Pragma: no-cache'); // HTTP 1.0
header('Expires: 0'); // Proxies
header('Content-Type: ' . $fp['type']);
header('Content-Length: ' . $fp['bytes']);
// dump the picture and stop the script
fpassthru($fp);
exit;
?>

View File

@ -940,12 +940,13 @@
// Characters used to generate a random password (with Javascript).
$config['genpassword_chars'] = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+';
// Optional banner image at the top of every page.
// $config['url_banner'] = '/banner.php';
// Banner dimensions are also optional. As the banner loads after the rest of the page, everything may be
// shifted down a few pixels when it does. Making the banner a fixed size will prevent this.
// $config['banner_width'] = 300;
// $config['banner_height'] = 100;
// Banner settings.
// Banners are rotating, random images displayed to users at the top of thread pages and the catalog.
// You should upload your banners to static/banners.
$config['url_banner'] = '/b.php'; // Custom script may be used.
// Setting the banner dimensions stops the page shifting as it loads. If you have banners of various different sizes, unset these.
$config['banner_width'] = 300;
$config['banner_height'] = 100;
// Custom stylesheets available for the user to choose. See the "stylesheets/" folder for a list of
// available stylesheets (or create your own).

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,3 +1,4 @@
{% 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 %}
<fieldset>
<legend>{% trans 'Boards' %}</legend>

View File

@ -1,4 +1,5 @@
{% if error %}<h2 style="text-align:center">{{ error }}</h2>{% 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 %}
<form action="" method="post">
<table style="margin-top:25px;">
<tr>