mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-10-06 02:39:59 +02:00
Fix available templates configuration and adding custom themes
This commit is contained in:
parent
ebb9e231aa
commit
9221629d8d
4 changed files with 24 additions and 25 deletions
|
@ -47,6 +47,16 @@ sizelimit = 10485760
|
||||||
; a session cookie to store the choice until the browser is closed.
|
; a session cookie to store the choice until the browser is closed.
|
||||||
templateselection = false
|
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
|
; 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
|
; available are "page" (tpl/page.php), the classic ZeroBin style and several
|
||||||
; bootstrap variants: "bootstrap-dark", "bootstrap-compact", "bootstrap-page",
|
; bootstrap variants: "bootstrap-dark", "bootstrap-compact", "bootstrap-page",
|
||||||
|
@ -151,17 +161,6 @@ plaintext = "Plain Text"
|
||||||
syntaxhighlighting = "Source Code"
|
syntaxhighlighting = "Source Code"
|
||||||
markdown = "Markdown"
|
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]
|
[traffic]
|
||||||
; time limit between calls from the same IP address in seconds
|
; time limit between calls from the same IP address in seconds
|
||||||
; Set this to 0 to disable rate limiting.
|
; Set this to 0 to disable rate limiting.
|
||||||
|
|
|
@ -47,6 +47,16 @@ class Configuration
|
||||||
'sizelimit' => 10485760,
|
'sizelimit' => 10485760,
|
||||||
'templateselection' => false,
|
'templateselection' => false,
|
||||||
'template' => 'bootstrap',
|
'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>.',
|
'info' => 'More information on the <a href=\'https://privatebin.info/\'>project page</a>.',
|
||||||
'notice' => '',
|
'notice' => '',
|
||||||
'languageselection' => false,
|
'languageselection' => false,
|
||||||
|
@ -78,16 +88,6 @@ class Configuration
|
||||||
'syntaxhighlighting' => 'Source Code',
|
'syntaxhighlighting' => 'Source Code',
|
||||||
'markdown' => 'Markdown',
|
'markdown' => 'Markdown',
|
||||||
),
|
),
|
||||||
'available_templates' => array(
|
|
||||||
'bootstrap5',
|
|
||||||
'bootstrap',
|
|
||||||
'bootstrap-page',
|
|
||||||
'bootstrap-dark',
|
|
||||||
'bootstrap-dark-page',
|
|
||||||
'bootstrap-compact',
|
|
||||||
'bootstrap-compact-page',
|
|
||||||
'page',
|
|
||||||
),
|
|
||||||
'traffic' => array(
|
'traffic' => array(
|
||||||
'limit' => 10,
|
'limit' => 10,
|
||||||
'header' => '',
|
'header' => '',
|
||||||
|
|
|
@ -210,7 +210,7 @@ class Controller
|
||||||
{
|
{
|
||||||
$this->_conf = new Configuration;
|
$this->_conf = new Configuration;
|
||||||
|
|
||||||
$templates = $this->_conf->getSection('available_templates');
|
$templates = $this->_conf->getKey('availabletemplates');
|
||||||
$template = $this->_conf->getKey('template');
|
$template = $this->_conf->getKey('template');
|
||||||
TemplateSwitcher::setAvailableTemplates($templates);
|
TemplateSwitcher::setAvailableTemplates($templates);
|
||||||
TemplateSwitcher::setTemplateFallback($template);
|
TemplateSwitcher::setTemplateFallback($template);
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TemplateSwitcherTest extends TestCase
|
||||||
$existingTemplateFallback = 'bootstrap-dark';
|
$existingTemplateFallback = 'bootstrap-dark';
|
||||||
$wrongTemplateFallback = 'bootstrap-wrong';
|
$wrongTemplateFallback = 'bootstrap-wrong';
|
||||||
|
|
||||||
TemplateSwitcher::setAvailableTemplates($conf->getSection('available_templates'));
|
TemplateSwitcher::setAvailableTemplates($conf->getKey('availabletemplates'));
|
||||||
TemplateSwitcher::setTemplateFallback($existingTemplateFallback);
|
TemplateSwitcher::setTemplateFallback($existingTemplateFallback);
|
||||||
$this->assertEquals($existingTemplateFallback, TemplateSwitcher::getTemplate(), 'Correct template fallback');
|
$this->assertEquals($existingTemplateFallback, TemplateSwitcher::getTemplate(), 'Correct template fallback');
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class TemplateSwitcherTest extends TestCase
|
||||||
public function testSetAvailableTemplates()
|
public function testSetAvailableTemplates()
|
||||||
{
|
{
|
||||||
$conf = new Configuration;
|
$conf = new Configuration;
|
||||||
$availableTemplates = $conf->getSection('available_templates');
|
$availableTemplates = $conf->getKey('availabletemplates');
|
||||||
|
|
||||||
TemplateSwitcher::setAvailableTemplates($availableTemplates);
|
TemplateSwitcher::setAvailableTemplates($availableTemplates);
|
||||||
$this->assertEquals($availableTemplates, TemplateSwitcher::getAvailableTemplates(), 'Set available templates');
|
$this->assertEquals($availableTemplates, TemplateSwitcher::getAvailableTemplates(), 'Set available templates');
|
||||||
|
@ -57,7 +57,7 @@ class TemplateSwitcherTest extends TestCase
|
||||||
$existingTemplate = 'bootstrap';
|
$existingTemplate = 'bootstrap';
|
||||||
$nonExistentTemplate = 'bootstrap-wrong';
|
$nonExistentTemplate = 'bootstrap-wrong';
|
||||||
|
|
||||||
TemplateSwitcher::setAvailableTemplates($conf->getSection('available_templates'));
|
TemplateSwitcher::setAvailableTemplates($conf->getKey('availabletemplates'));
|
||||||
|
|
||||||
$this->assertTrue(TemplateSwitcher::isTemplateAvailable($existingTemplate), 'Existing template');
|
$this->assertTrue(TemplateSwitcher::isTemplateAvailable($existingTemplate), 'Existing template');
|
||||||
$this->assertFalse(TemplateSwitcher::isTemplateAvailable($nonExistentTemplate), 'Non-existent template');
|
$this->assertFalse(TemplateSwitcher::isTemplateAvailable($nonExistentTemplate), 'Non-existent template');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue