Compare commits

...

3 Commits

Author SHA1 Message Date
Trevor Slocum fca5562fd2 Update translations 2021-06-02 17:18:21 -07:00
Trevor Slocum 2f900306cb Minor tweaks to TINYIB_DEFAULTSTYLE 2021-06-02 17:17:06 -07:00
Tortle 32ae4efbcf 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>
2021-06-02 17:07:31 -07:00
5 changed files with 1171 additions and 4 deletions

View File

@ -39,6 +39,7 @@ See [DEMOS.md](https://code.rocketnine.space/tslocum/tinyib/src/branch/master/DE
- Italian
- Korean
- Norwegian
- Polish
- Portuguese
- Russian
- Spanish (Mexico)

View File

@ -149,6 +149,15 @@ if (!defined('TINYIB_DBPATH')) {
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)) {
$tinyib_hidefieldsop = array();
}

View File

@ -20,6 +20,8 @@ function pageHeader() {
$js_captcha .= '<script src="https://www.google.com/recaptcha/api.js" async defer></script>';
}
$stylesheets = pageStylesheets();
return <<<EOF
<!DOCTYPE html>
<html>
@ -33,9 +35,7 @@ function pageHeader() {
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>$title</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="css/global.css">
<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">
$stylesheets
<script src="js/jquery.js"></script>
<script src="js/tinyib.js"></script>
$js_captcha
@ -43,6 +43,27 @@ function pageHeader() {
EOF;
}
function pageStylesheets() {
global $tinyib_stylesheets;
// Global stylesheet
$return = '<link rel="stylesheet" type="text/css" href="css/global.css">';
// Default stylesheet
$return .= '<link rel="stylesheet" type="text/css" href="css/' . htmlentities(TINYIB_DEFAULTSTYLE, ENT_QUOTES) . '.css" title="' . htmlentities($tinyib_stylesheets[TINYIB_DEFAULTSTYLE], ENT_QUOTES) . '" id="mainStylesheet">';
// Additional stylesheets
foreach($tinyib_stylesheets as $filename => $title) {
if ($filename === TINYIB_DEFAULTSTYLE) {
continue;
}
$return .= '<link rel="alternate stylesheet" type="text/css" href="css/' . htmlentities($filename, ENT_QUOTES) . '.css" title="' . htmlentities($title, ENT_QUOTES) . '">';
}
return $return;
}
function pageFooter() {
// 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.
@ -559,6 +580,8 @@ EOF;
}
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>]') : '';
$managelink = (TINYIB_MANAGEKEY == '') ? ('[<a href="' . basename($_SERVER['PHP_SELF']) . '?manage"" style="text-decoration: underline;">' . __('Manage') . '</a>]') : '';
@ -625,12 +648,25 @@ EOF;
$txt_password = __('Password');
$txt_delete = __('Delete');
$txt_delete_post = __('Delete Post');
$select_style = '';
if (count($tinyib_stylesheets) > 1) {
$select_style = '<select id="switchStylesheet">';
$select_style .= '<option value="">' . $txt_style . '</option>';
foreach($tinyib_stylesheets as $filename => $title) {
$select_style .= '<option value="' . htmlentities($filename, ENT_QUOTES) . '">'. htmlentities($title) . '</option>';
}
$select_style .= '</select>';
}
$body = <<<EOF
<body>
<div class="adminbar">
$cataloglink
$managelink
<select id="switchStylesheet"><option value="">$txt_style</option><option value="futaba">Futaba</option><option value="burichan">Burichan</option></select>
$select_style
</div>
<div class="logo">
EOF;

1114
locale/pl/tinyib.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -48,11 +48,18 @@ define('TINYIB_EXPANDWIDTH', 85); // Expanded content size as a percentage o
define('TINYIB_TIMEZONE', 'UTC'); // See https://secure.php.net/manual/en/timezones.php - e.g. America/Los_Angeles
define('TINYIB_CATALOG', true); // Generate catalog page
define('TINYIB_JSON', true); // Generate JSON files
define('TINYIB_DEFAULTSTYLE', 'futaba'); // Default page style
define('TINYIB_DATEFMT', '%g/%m/%d(%a)%H:%M:%S'); // Date and time format (see php.net/strftime)
$tinyib_hidefieldsop = array(); // Fields to hide when creating a new thread - e.g. array('name', 'email', 'subject', 'message', 'file', 'embed', 'password')
$tinyib_hidefields = array(); // Fields to hide when replying
$tinyib_anonymous = array('Anonymous'); // Default name (or names)
$tinyib_capcodes = array(array('Admin', 'red'), array('Mod', 'purple')); // Administrator and moderator capcode label and color
// Stylesheets (located in css)
// Format: File name excluding extension => Title
$tinyib_stylesheets = array(
'futaba' => 'Futaba',
'burichan' => 'Burichan'
);
// Post control
define('TINYIB_DELAY', 30); // Delay (in seconds) between posts from the same IP address to help control flooding [0 to disable]