diff --git a/bl-kernel/admin/views/settings-advanced.php b/bl-kernel/admin/views/settings-advanced.php
index febae635..3a4bcc70 100644
--- a/bl-kernel/admin/views/settings-advanced.php
+++ b/bl-kernel/admin/views/settings-advanced.php
@@ -39,42 +39,6 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
'tip'=>$L->g('Order the content by date to create a Blog or order the content by position to create a Website')
));
- HTML::legend(array('value'=>$L->g('Special content')));
-
- $options = array();
- foreach($dbPages->db as $key=>$fields) {
- $page = buildPage($key);
- $options[$key] = $page->title();
- }
- HTML::formSelect(array(
- 'name'=>'pageError',
- 'label'=>$L->g('404 Page Not Found'),
- 'options'=>$options,
- 'selected'=>$Site->pageError(),
- 'class'=>'uk-width-1-3 uk-form-medium',
- 'tip'=>$L->g('This page is showed only when the page does not exist anymore')
- ));
-
- HTML::formSelect(array(
- 'name'=>'pageAbout',
- 'label'=>$L->g('About page'),
- 'options'=>$options,
- 'addEmptySpace'=>true,
- 'selected'=>$Site->pageAbout(),
- 'class'=>'uk-width-1-3 uk-form-medium',
- 'tip'=>$L->g('This page is to define a history about you or the content of your site')
- ));
-
- HTML::formSelect(array(
- 'name'=>'pageContact',
- 'label'=>$L->g('Contact page'),
- 'options'=>$options,
- 'addEmptySpace'=>true,
- 'selected'=>$Site->pageContact(),
- 'class'=>'uk-width-1-3 uk-form-medium',
- 'tip'=>$L->g('Page for contact information')
- ));
-
HTML::legend(array('value'=>$L->g('Email account settings')));
HTML::formInputText(array(
diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/dbpages.class.php
index a014025b..7ebdc266 100644
--- a/bl-kernel/dbpages.class.php
+++ b/bl-kernel/dbpages.class.php
@@ -239,6 +239,23 @@ class dbPages extends dbJSON
return true;
}
+ // Change a value of a page
+ public function setField($key, $field, $value)
+ {
+ if( $this->exists($key) ) {
+ settype($value, gettype($this->dbFields[$field]['value']));
+ $this->db[$key][$field] = $value;
+ return $this->save();
+ }
+
+ return false;
+ }
+
+ public function setStatus($key, $value)
+ {
+ return $this->setField($key, 'status', $value);
+ }
+
// Returns a database with published pages
public function getPublishedDB()
{
@@ -386,16 +403,7 @@ class dbPages extends dbJSON
// ----- OLD
- // Set a field of the database
- public function setField($key, $field, $value)
- {
- if( $this->exists($key) ) {
- settype($value, gettype($this->dbFields[$key]['value']));
- $this->db[$key][$field] = $value;
- }
- return false;
- }
diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php
index 4751502a..e93d1b51 100644
--- a/bl-kernel/dbsite.class.php
+++ b/bl-kernel/dbsite.class.php
@@ -27,10 +27,7 @@ class dbSite extends dbJSON
'googlePlus'=> array('inFile'=>false, 'value'=>''),
'instagram'=> array('inFile'=>false, 'value'=>''),
'github'=> array('inFile'=>false, 'value'=>''),
- 'orderBy'=> array('inFile'=>false, 'value'=>'date'), // date or position
- 'pageError'=> array('inFile'=>false, 'value'=>'error'),
- 'pageAbout'=> array('inFile'=>false, 'value'=>'about'),
- 'pageContact'=> array('inFile'=>false, 'value'=>'contact')
+ 'orderBy'=> array('inFile'=>false, 'value'=>'date') // date or position
);
function __construct()
diff --git a/bl-plugins/fixedPages/languages/en_US.json b/bl-plugins/fixedPages/languages/en_US.json
new file mode 100644
index 00000000..422ab2b7
--- /dev/null
+++ b/bl-plugins/fixedPages/languages/en_US.json
@@ -0,0 +1,7 @@
+{
+ "plugin-data":
+ {
+ "name": "Fixed Pages",
+ "description": "Show a list of links."
+ }
+}
diff --git a/bl-plugins/specialpages/metadata.json b/bl-plugins/fixedPages/metadata.json
similarity index 100%
rename from bl-plugins/specialpages/metadata.json
rename to bl-plugins/fixedPages/metadata.json
diff --git a/bl-plugins/fixedPages/plugin.php b/bl-plugins/fixedPages/plugin.php
new file mode 100644
index 00000000..d3f56589
--- /dev/null
+++ b/bl-plugins/fixedPages/plugin.php
@@ -0,0 +1,174 @@
+'About'
+ ));
+
+ // Fields and default values for the database of this plugin
+ $this->dbFields = array(
+ 'label'=>'Fixed Pages',
+ 'jsondb'=>$jsondb
+ );
+
+ // Disable default Save and Cancel button
+ $this->formButtons = false;
+ }
+
+ // Method called when a POST request is sent
+ public function post()
+ {
+ global $dbPages;
+
+ // Get current jsondb value from database
+ // All data stored in the database is html encoded
+ $jsondb = $this->db['jsondb'];
+ $jsondb = Sanitize::htmlDecode($jsondb);
+
+ // Convert JSON to Array
+ $pagesFixed = json_decode($jsondb, true);
+
+ // Check if the user click on the button delete or add
+ if( isset($_POST['delete']) ) {
+ // Values from $_POST
+ $pageKey = $_POST['delete'];
+
+ // Change the status of the page from fixed to published
+ $dbPages->setStatus($pageKey, 'published');
+
+ // Delete the link from the array
+ unset($pagesFixed[$pageKey]);
+ }
+ elseif( isset($_POST['add']) ) {
+ // Values from $_POST
+ $pageTitle = $_POST['newPageTitle'];
+ $pageKey = $_POST['newPageKey'];
+
+ // Change the status of the page from fixed to published
+ $dbPages->setStatus($pageKey, 'fixed');
+
+ // Add the link
+ $pagesFixed[$pageKey] = $pageTitle;
+ }
+
+ // Encode html to store the values on the database
+ $this->db['label'] = Sanitize::html($_POST['label']);
+ $this->db['jsondb'] = Sanitize::html(json_encode($pagesFixed));
+
+ // Save the database
+ return $this->save();
+ }
+
+ // Method called on plugin settings on the admin area
+ public function form()
+ {
+ global $Language;
+ global $dbPages;
+
+ $options = array();
+ foreach($dbPages->db as $key=>$fields) {
+ $page = buildPage($key);
+ if($page->published()) {
+ $options[$key] = $page->title();
+ }
+ }
+
+ $html = '
';
+ $html .= '';
+ $html .= '';
+ $html .= ''.$Language->get('Title of the plugin for the sidebar').'';
+ $html .= '
';
+
+ $html .= '';
+ }
+
+ return $html;
+ }
+
+ // Method called on the sidebar of the website
+ public function siteSidebar()
+ {
+ global $Language;
+
+ // HTML for sidebar
+ $html = '
';
+ $html .= '
'.$this->getValue('label').'
';
+ $html .= '
';
+ $html .= '
';
+
+ // Get the JSON DB, getValue() with the option unsanitized HTML code
+ $jsondb = $this->getValue('jsondb', false);
+ $pagesFixed = json_decode($jsondb);
+
+ // By default the database of categories are alphanumeric sorted
+ foreach($pagesFixed as $key=>$title) {
+ $html .= '
';
-
- return $html;
- }
-
- // Method called on the sidebar of the website
- public function siteSidebar()
- {
- global $Language;
-
- // HTML for sidebar
- $html = '
';
- $html .= '
'.$this->getValue('label').'
';
- $html .= '
';
- $html .= '
';
-
- // Show Home page link
- if( $this->getValue('homeLink') ) {
- $html .= '