forked from GithubBackups/tinyib
Make CSS styles configurable (#222)
Make CSS styles configurable Co-authored-by: Tortle <tortle.1099@gmail.com> Reviewed-on: https://code.rocketnine.space/tslocum/tinyib/pulls/222 Co-Authored-By: Tortle <tortle@noreply.%(DOMAIN)s> Co-Committed-By: Tortle <tortle@noreply.%(DOMAIN)s>
This commit is contained in:
parent
dd3b994a3c
commit
32ae4efbcf
@ -149,6 +149,13 @@ if (!defined('TINYIB_DBPATH')) {
|
|||||||
define('TINYIB_DBPATH', '.tinyib.db');
|
define('TINYIB_DBPATH', '.tinyib.db');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!defined('TINYIB_DEFAULTSTYLE')) {
|
||||||
|
define('TINYIB_DEFAULTSTYLE', 'futaba');
|
||||||
|
}
|
||||||
|
if (!isset($tinyib_stylesheets)) {
|
||||||
|
$tinyib_stylesheets = array('futaba' => 'Futaba',
|
||||||
|
'burichan' => 'Burichan');
|
||||||
|
}
|
||||||
if (!isset($tinyib_hidefieldsop)) {
|
if (!isset($tinyib_hidefieldsop)) {
|
||||||
$tinyib_hidefieldsop = array();
|
$tinyib_hidefieldsop = array();
|
||||||
}
|
}
|
||||||
|
50
inc/html.php
50
inc/html.php
@ -20,6 +20,8 @@ function pageHeader() {
|
|||||||
$js_captcha .= '<script src="https://www.google.com/recaptcha/api.js" async defer></script>';
|
$js_captcha .= '<script src="https://www.google.com/recaptcha/api.js" async defer></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$stylesheets = pageStylesheets();
|
||||||
|
|
||||||
return <<<EOF
|
return <<<EOF
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -33,9 +35,7 @@ function pageHeader() {
|
|||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
<link rel="shortcut icon" href="favicon.ico">
|
||||||
<link rel="stylesheet" type="text/css" href="css/global.css">
|
$stylesheets
|
||||||
<link rel="stylesheet" type="text/css" href="css/futaba.css" title="Futaba" id="mainStylesheet">
|
|
||||||
<link rel="alternate stylesheet" type="text/css" href="css/burichan.css" title="Burichan">
|
|
||||||
<script src="js/jquery.js"></script>
|
<script src="js/jquery.js"></script>
|
||||||
<script src="js/tinyib.js"></script>
|
<script src="js/tinyib.js"></script>
|
||||||
$js_captcha
|
$js_captcha
|
||||||
@ -43,6 +43,31 @@ function pageHeader() {
|
|||||||
EOF;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pageStylesheets() {
|
||||||
|
global $tinyib_stylesheets;
|
||||||
|
|
||||||
|
// Global stylesheet
|
||||||
|
$return = '<link rel="stylesheet" type="text/css" href="css/global.css">';
|
||||||
|
|
||||||
|
// Default stylesheet
|
||||||
|
$default_style_value = htmlentities(TINYIB_DEFAULTSTYLE, ENT_QUOTES);
|
||||||
|
$default_style_name = htmlentities($tinyib_stylesheets[TINYIB_DEFAULTSTYLE]);
|
||||||
|
$return .= '<link rel="stylesheet" type="text/css" href="css/' . 'test' . '.css" title="' . $default_style_name . '" id="mainStylesheet">';
|
||||||
|
|
||||||
|
// Additional stylesheets
|
||||||
|
foreach($tinyib_stylesheets as $value => $display_name) {
|
||||||
|
if ($value === TINYIB_DEFAULTSTYLE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value_html = htmlentities($value, ENT_QUOTES);
|
||||||
|
$name_html = htmlentities($display_name, ENT_QUOTES);
|
||||||
|
$return .= '<link rel="alternate stylesheet" type="text/css" href="css/' . $value_html . '.css" title="' . $name_html . '">';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
function pageFooter() {
|
function pageFooter() {
|
||||||
// If the footer link is removed from the page, please link to TinyIB somewhere on the site.
|
// If the footer link is removed from the page, please link to TinyIB somewhere on the site.
|
||||||
// This is all I ask in return for the free software you are using.
|
// This is all I ask in return for the free software you are using.
|
||||||
@ -559,6 +584,8 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0, $lastpostid = 0) {
|
function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0, $lastpostid = 0) {
|
||||||
|
global $tinyib_stylesheets;
|
||||||
|
|
||||||
$cataloglink = TINYIB_CATALOG ? ('[<a href="catalog.html" style="text-decoration: underline;">' . __('Catalog') . '</a>]') : '';
|
$cataloglink = TINYIB_CATALOG ? ('[<a href="catalog.html" style="text-decoration: underline;">' . __('Catalog') . '</a>]') : '';
|
||||||
$managelink = (TINYIB_MANAGEKEY == '') ? ('[<a href="' . basename($_SERVER['PHP_SELF']) . '?manage"" style="text-decoration: underline;">' . __('Manage') . '</a>]') : '';
|
$managelink = (TINYIB_MANAGEKEY == '') ? ('[<a href="' . basename($_SERVER['PHP_SELF']) . '?manage"" style="text-decoration: underline;">' . __('Manage') . '</a>]') : '';
|
||||||
|
|
||||||
@ -625,12 +652,27 @@ EOF;
|
|||||||
$txt_password = __('Password');
|
$txt_password = __('Password');
|
||||||
$txt_delete = __('Delete');
|
$txt_delete = __('Delete');
|
||||||
$txt_delete_post = __('Delete Post');
|
$txt_delete_post = __('Delete Post');
|
||||||
|
|
||||||
|
$style_select = '';
|
||||||
|
|
||||||
|
if (count($tinyib_stylesheets) > 1) {
|
||||||
|
$options = '<option value="">' . $txt_style . '</option>';
|
||||||
|
|
||||||
|
foreach($tinyib_stylesheets as $value => $display_name) {
|
||||||
|
$value_html = htmlentities($value, ENT_QUOTES);
|
||||||
|
$name_html = htmlentities($display_name);
|
||||||
|
$options .= '<option value="' . $value . '">'. $display_name . '</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$style_select = '<select id="switchStylesheet">'. $options . '</select>';
|
||||||
|
}
|
||||||
|
|
||||||
$body = <<<EOF
|
$body = <<<EOF
|
||||||
<body>
|
<body>
|
||||||
<div class="adminbar">
|
<div class="adminbar">
|
||||||
$cataloglink
|
$cataloglink
|
||||||
$managelink
|
$managelink
|
||||||
<select id="switchStylesheet"><option value="">$txt_style</option><option value="futaba">Futaba</option><option value="burichan">Burichan</option></select>
|
$style_select
|
||||||
</div>
|
</div>
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
EOF;
|
EOF;
|
||||||
|
@ -89,6 +89,13 @@ $tinyib_embeds = array('SoundCloud' => 'https://soundcloud.com/oembed?format=jso
|
|||||||
'Vimeo' => 'https://vimeo.com/api/oembed.json?url=TINYIBEMBED',
|
'Vimeo' => 'https://vimeo.com/api/oembed.json?url=TINYIBEMBED',
|
||||||
'YouTube' => 'https://www.youtube.com/oembed?url=TINYIBEMBED&format=json');
|
'YouTube' => 'https://www.youtube.com/oembed?url=TINYIBEMBED&format=json');
|
||||||
|
|
||||||
|
|
||||||
|
// Stylesheets (located in css)
|
||||||
|
// Format: File name excluding extension => Title
|
||||||
|
define('TINYIB_DEFAULTSTYLE', 'futaba');
|
||||||
|
$tinyib_stylesheets = array('futaba' => 'Futaba',
|
||||||
|
'burichan' => 'Burichan');
|
||||||
|
|
||||||
// File control
|
// File control
|
||||||
define('TINYIB_MAXKB', 2048); // Maximum file size in kilobytes [0 to disable]
|
define('TINYIB_MAXKB', 2048); // Maximum file size in kilobytes [0 to disable]
|
||||||
define('TINYIB_MAXKBDESC', '2 MB'); // Human-readable representation of the maximum file size
|
define('TINYIB_MAXKBDESC', '2 MB'); // Human-readable representation of the maximum file size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user