mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-04-11 18:49:21 -04:00
Merge pull request #1518 from ixten/master
Fix available templates configuration and adding custom themes
This commit is contained in:
commit
dd6537b277
@ -47,6 +47,16 @@ sizelimit = 10485760
|
||||
; a session cookie to store the choice until the browser is closed.
|
||||
templateselection = false
|
||||
|
||||
; List of available for selection templates when "templateselection" option is enabled
|
||||
availabletemplates[] = "bootstrap"
|
||||
availabletemplates[] = "bootstrap-page"
|
||||
availabletemplates[] = "bootstrap-dark"
|
||||
availabletemplates[] = "bootstrap-dark-page"
|
||||
availabletemplates[] = "bootstrap-compact"
|
||||
availabletemplates[] = "bootstrap-compact-page"
|
||||
availabletemplates[] = "bootstrap5"
|
||||
availabletemplates[] = "page"
|
||||
|
||||
; set the template your installs defaults to, defaults to "bootstrap" (tpl/bootstrap.php), also
|
||||
; available are "page" (tpl/page.php), the classic ZeroBin style and several
|
||||
; bootstrap variants: "bootstrap-dark", "bootstrap-compact", "bootstrap-page",
|
||||
@ -151,17 +161,6 @@ plaintext = "Plain Text"
|
||||
syntaxhighlighting = "Source Code"
|
||||
markdown = "Markdown"
|
||||
|
||||
[available_templates]
|
||||
; List of available for selection templates when "templateselection" option is enabled
|
||||
bootstrap
|
||||
bootstrap-page
|
||||
bootstrap-dark
|
||||
bootstrap-dark-page
|
||||
bootstrap-compact
|
||||
bootstrap-compact-page
|
||||
bootstrap5
|
||||
page
|
||||
|
||||
[traffic]
|
||||
; time limit between calls from the same IP address in seconds
|
||||
; Set this to 0 to disable rate limiting.
|
||||
|
@ -47,6 +47,16 @@ class Configuration
|
||||
'sizelimit' => 10485760,
|
||||
'templateselection' => false,
|
||||
'template' => 'bootstrap',
|
||||
'availabletemplates' => array(
|
||||
'bootstrap5',
|
||||
'bootstrap',
|
||||
'bootstrap-page',
|
||||
'bootstrap-dark',
|
||||
'bootstrap-dark-page',
|
||||
'bootstrap-compact',
|
||||
'bootstrap-compact-page',
|
||||
'page',
|
||||
),
|
||||
'info' => 'More information on the <a href=\'https://privatebin.info/\'>project page</a>.',
|
||||
'notice' => '',
|
||||
'languageselection' => false,
|
||||
@ -78,16 +88,6 @@ class Configuration
|
||||
'syntaxhighlighting' => 'Source Code',
|
||||
'markdown' => 'Markdown',
|
||||
),
|
||||
'available_templates' => array(
|
||||
'bootstrap5',
|
||||
'bootstrap',
|
||||
'bootstrap-page',
|
||||
'bootstrap-dark',
|
||||
'bootstrap-dark-page',
|
||||
'bootstrap-compact',
|
||||
'bootstrap-compact-page',
|
||||
'page',
|
||||
),
|
||||
'traffic' => array(
|
||||
'limit' => 10,
|
||||
'header' => '',
|
||||
|
@ -210,7 +210,7 @@ class Controller
|
||||
{
|
||||
$this->_conf = new Configuration;
|
||||
|
||||
$templates = $this->_conf->getSection('available_templates');
|
||||
$templates = $this->_conf->getKey('availabletemplates');
|
||||
$template = $this->_conf->getKey('template');
|
||||
TemplateSwitcher::setAvailableTemplates($templates);
|
||||
TemplateSwitcher::setTemplateFallback($template);
|
||||
|
@ -13,7 +13,7 @@ class TemplateSwitcherTest extends TestCase
|
||||
$existingTemplateFallback = 'bootstrap-dark';
|
||||
$wrongTemplateFallback = 'bootstrap-wrong';
|
||||
|
||||
TemplateSwitcher::setAvailableTemplates($conf->getSection('available_templates'));
|
||||
TemplateSwitcher::setAvailableTemplates($conf->getKey('availabletemplates'));
|
||||
TemplateSwitcher::setTemplateFallback($existingTemplateFallback);
|
||||
$this->assertEquals($existingTemplateFallback, TemplateSwitcher::getTemplate(), 'Correct template fallback');
|
||||
|
||||
@ -24,7 +24,7 @@ class TemplateSwitcherTest extends TestCase
|
||||
public function testSetAvailableTemplates()
|
||||
{
|
||||
$conf = new Configuration;
|
||||
$availableTemplates = $conf->getSection('available_templates');
|
||||
$availableTemplates = $conf->getKey('availabletemplates');
|
||||
|
||||
TemplateSwitcher::setAvailableTemplates($availableTemplates);
|
||||
$this->assertEquals($availableTemplates, TemplateSwitcher::getAvailableTemplates(), 'Set available templates');
|
||||
@ -57,7 +57,7 @@ class TemplateSwitcherTest extends TestCase
|
||||
$existingTemplate = 'bootstrap';
|
||||
$nonExistentTemplate = 'bootstrap-wrong';
|
||||
|
||||
TemplateSwitcher::setAvailableTemplates($conf->getSection('available_templates'));
|
||||
TemplateSwitcher::setAvailableTemplates($conf->getKey('availabletemplates'));
|
||||
|
||||
$this->assertTrue(TemplateSwitcher::isTemplateAvailable($existingTemplate), 'Existing template');
|
||||
$this->assertFalse(TemplateSwitcher::isTemplateAvailable($nonExistentTemplate), 'Non-existent template');
|
||||
|
Loading…
x
Reference in New Issue
Block a user