Browse Source

Commit local change to instance-config.php (no functional changes)

pull/40/head
towards-a-new-leftypol 3 years ago
parent
commit
192c0cec6e
  1. 47
      b.php
  2. 8
      inc/instance-config.php

47
b.php

@ -1,47 +0,0 @@
<?php
// This script assumes there is at least one normal (non-priority)
// banner!
// Get the files in a directory, returns null if the directory does
// not exist.
function getFilesInDirectory($dir) {
if (! is_dir($dir)) {
return null;
}
return array_diff(scandir($dir), array('.', '..'));
}
// Serve a random banner and exit.
function serveRandomBanner($dir, $files) {
$name = $files[array_rand($files)];
// snags the extension
$ext = pathinfo($name, PATHINFO_EXTENSION);
// 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: image/" . $ext);
header("Content-Disposition: inline; filename=" . $name);
// readfile displays the image, passthru seems to spits stream.
readfile($dir.$name);
exit;
}
// Get all the banners
$bannerDir = "banners/";
$priorityDir = "banners_priority/";
$banners = getFilesInDirectory($bannerDir);
$priority = getFilesInDirectory($priorityDir);
// If there are priority banners, serve 1/3rd of the time.
if($priority !== null && count($priority) !== 0 && rand(0,2) === 0) {
serveRandomBanner($priorityDir, $priority);
}
serveRandomBanner($bannerDir, $banners);
?>

8
inc/instance-config.php

@ -112,6 +112,10 @@ $config['delete_time'] = 5;
// Changes made via web editor by "krates" @ Tue, 22 Dec 2020 17:20:14 -0800:
$config['reply_hard_limit'] = 1000;
//Changes by Barbara_Pitt
$config['stylesheets']['Dark'] = 'dark.css';
$config['stylesheets']['Dark Red'] = 'dark_red.css';
$config['always_noko'] = true;
/*
* ====================
@ -144,7 +148,3 @@ $config['embedding'][0] = array(
'/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
$config['youtube_js_html']);
$config['additional_javascript'][] = 'js/youtube.js';
$config['stylesheets']['Dark'] = 'dark.css';
$config['stylesheets']['Dark Red'] = 'dark_red.css';
$config['always_noko'] = true;

Loading…
Cancel
Save