Categories++
This commit is contained in:
parent
457c981208
commit
f383a83c02
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,4 +2,4 @@
|
||||
bl-content/databases
|
||||
bl-content/pages
|
||||
bl-content/posts
|
||||
bl-content/uploads
|
||||
bl-content/uploads
|
@ -0,0 +1,11 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"videos": {
|
||||
"name": "Videos",
|
||||
"list": []
|
||||
},
|
||||
"music": {
|
||||
"name": "Music",
|
||||
"list": []
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"error": {
|
||||
"description": "Page not found",
|
||||
"username": "admin",
|
||||
"tags": [],
|
||||
"status": "published",
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dateModified": "",
|
||||
"allowComments": false,
|
||||
"position": 0,
|
||||
"coverImage": "",
|
||||
"md5file": "",
|
||||
"category": "",
|
||||
"uuid": "451ad70b20cacffaa5d1c63300cf33cc"
|
||||
},
|
||||
"about": {
|
||||
"description": "About your site or yourself",
|
||||
"username": "admin",
|
||||
"tags": [],
|
||||
"status": "published",
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dateModified": "",
|
||||
"allowComments": false,
|
||||
"position": 2,
|
||||
"coverImage": "",
|
||||
"md5file": "",
|
||||
"category": "",
|
||||
"uuid": "f2ebea0584b190ce4897efddb5cd104d"
|
||||
},
|
||||
"welcome": {
|
||||
"description": "Welcome to Bludit",
|
||||
"username": "admin",
|
||||
"tags": {
|
||||
"bludit": "Bludit",
|
||||
"cms": "CMS",
|
||||
"flat-files": "Flat files"
|
||||
},
|
||||
"status": "published",
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dateModified": "",
|
||||
"allowComments": false,
|
||||
"position": 1,
|
||||
"coverImage": "",
|
||||
"md5file": "",
|
||||
"category": "",
|
||||
"uuid": "eccd7bbd25a3239083ea695452043323"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"label": "About",
|
||||
"text": "This is a brief description of yourself or your site, to change this text go to the admin panel, settings, plugins, and configure the plugin about."
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"homeLink": true,
|
||||
"label": "Pages"
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"tabSize": 4,
|
||||
"toolbar": ""bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide""
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"label": "Tags"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"key1": "35a2cebb69e06e130572b109a46a0f8220af6260",
|
||||
"minutesBlocked": 5,
|
||||
"numberFailuresAllowed": 10,
|
||||
"blackList": []
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"title": "BLUDIT",
|
||||
"slogan": "CMS",
|
||||
"description": "",
|
||||
"footer": "Copyright \u00a9 2017",
|
||||
"language": "en_US",
|
||||
"locale": "en_US",
|
||||
"timezone": "Europe\/Warsaw",
|
||||
"theme": "log",
|
||||
"adminTheme": "default",
|
||||
"homepage": "",
|
||||
"postsperpage": "6",
|
||||
"uriPage": "\/",
|
||||
"uriTag": "\/tag\/",
|
||||
"uriCategory": "\/category\/",
|
||||
"url": "http:\/\/localbluditv2.com\/",
|
||||
"emailFrom": "no-reply@localbluditv2.com",
|
||||
"twitter": "",
|
||||
"facebook": "",
|
||||
"googlePlus": "",
|
||||
"instagram": "",
|
||||
"github": ""
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
[
|
||||
{
|
||||
"date": "2017-05-19 00:29:41",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e205505940",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:28:55",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e2026aa5c9",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:26:48",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e1fa822ec9",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:23:49",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e1ef48ed7d",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-18 23:58:14",
|
||||
"idExecution": "591e18f6df384",
|
||||
"method": "POST",
|
||||
"notes": "",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-18 23:56:52",
|
||||
"idExecution": "591e18a4b8d25",
|
||||
"method": "POST",
|
||||
"notes": "",
|
||||
"dictionaryKey": "",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dictionaryKey": "welcome-to-bludit",
|
||||
"username": "admin",
|
||||
"idExecution": "591e14d70fe0d",
|
||||
"method": "POST"
|
||||
}
|
||||
]
|
@ -0,0 +1,21 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"bludit": {
|
||||
"name": "Bludit",
|
||||
"list": [
|
||||
"welcome"
|
||||
]
|
||||
},
|
||||
"cms": {
|
||||
"name": "CMS",
|
||||
"list": [
|
||||
"welcome"
|
||||
]
|
||||
},
|
||||
"flat-files": {
|
||||
"name": "Flat files",
|
||||
"list": [
|
||||
"welcome"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"admin": {
|
||||
"firstName": "Administrator",
|
||||
"lastName": "",
|
||||
"role": "admin",
|
||||
"password": "5c3ac502b428342a56fa2abc9b7c006dd38d009a",
|
||||
"salt": "mnpqWziLAR",
|
||||
"email": "",
|
||||
"registered": "2017-05-18 23:40:39",
|
||||
"tokenEmail": "",
|
||||
"tokenEmailTTL": "2009-03-15 14:00",
|
||||
"twitter": "",
|
||||
"facebook": "",
|
||||
"googlePlus": "",
|
||||
"instagram": ""
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
Title: About
|
||||
Content: The about page is an important and powerful tool for potential clients and partners. For those who wonder who is behind the website, your About page is the first source of information. Change this page's content on the admin panel, manage, pages and click on the about page.
|
@ -0,0 +1,2 @@
|
||||
Title: Error
|
||||
Content: The page has not been found.
|
@ -0,0 +1,2 @@
|
||||
Title: Error
|
||||
Content: The page has not been found.
|
@ -0,0 +1,11 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"videos": {
|
||||
"name": "Videos",
|
||||
"list": []
|
||||
},
|
||||
"music": {
|
||||
"name": "Music",
|
||||
"list": []
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"error": {
|
||||
"description": "Page not found",
|
||||
"username": "admin",
|
||||
"tags": [],
|
||||
"status": "published",
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dateModified": "",
|
||||
"allowComments": false,
|
||||
"position": 0,
|
||||
"coverImage": "",
|
||||
"md5file": "",
|
||||
"category": "",
|
||||
"uuid": "451ad70b20cacffaa5d1c63300cf33cc"
|
||||
},
|
||||
"about": {
|
||||
"description": "About your site or yourself",
|
||||
"username": "admin",
|
||||
"tags": [],
|
||||
"status": "published",
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dateModified": "",
|
||||
"allowComments": false,
|
||||
"position": 2,
|
||||
"coverImage": "",
|
||||
"md5file": "",
|
||||
"category": "",
|
||||
"uuid": "f2ebea0584b190ce4897efddb5cd104d"
|
||||
},
|
||||
"welcome": {
|
||||
"description": "Welcome to Bludit",
|
||||
"username": "admin",
|
||||
"tags": {
|
||||
"bludit": "Bludit",
|
||||
"cms": "CMS",
|
||||
"flat-files": "Flat files"
|
||||
},
|
||||
"status": "published",
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dateModified": "",
|
||||
"allowComments": false,
|
||||
"position": 1,
|
||||
"coverImage": "",
|
||||
"md5file": "",
|
||||
"category": "",
|
||||
"uuid": "eccd7bbd25a3239083ea695452043323"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"label": "About",
|
||||
"text": "This is a brief description of yourself or your site, to change this text go to the admin panel, settings, plugins, and configure the plugin about."
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"homeLink": true,
|
||||
"label": "Pages"
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"tabSize": 4,
|
||||
"toolbar": ""bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide""
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0,
|
||||
"label": "Tags"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"position": 0
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"key1": "35a2cebb69e06e130572b109a46a0f8220af6260",
|
||||
"minutesBlocked": 5,
|
||||
"numberFailuresAllowed": 10,
|
||||
"blackList": []
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"title": "BLUDIT",
|
||||
"slogan": "CMS",
|
||||
"description": "",
|
||||
"footer": "Copyright \u00a9 2017",
|
||||
"language": "en_US",
|
||||
"locale": "en_US",
|
||||
"timezone": "Europe\/Warsaw",
|
||||
"theme": "log",
|
||||
"adminTheme": "default",
|
||||
"homepage": "",
|
||||
"postsperpage": "6",
|
||||
"uriPage": "\/",
|
||||
"uriTag": "\/tag\/",
|
||||
"uriCategory": "\/category\/",
|
||||
"url": "http:\/\/localbluditv2.com\/",
|
||||
"emailFrom": "no-reply@localbluditv2.com",
|
||||
"twitter": "",
|
||||
"facebook": "",
|
||||
"googlePlus": "",
|
||||
"instagram": "",
|
||||
"github": ""
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
[
|
||||
{
|
||||
"date": "2017-05-19 00:40:14",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e22ce08934",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:29:41",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e205505940",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:28:55",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e2026aa5c9",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:26:48",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e1fa822ec9",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-19 00:23:49",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"notes": "",
|
||||
"idExecution": "591e1ef48ed7d",
|
||||
"method": "POST",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-18 23:58:14",
|
||||
"idExecution": "591e18f6df384",
|
||||
"method": "POST",
|
||||
"notes": "",
|
||||
"dictionaryKey": "changes-on-settings",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-18 23:56:52",
|
||||
"idExecution": "591e18a4b8d25",
|
||||
"method": "POST",
|
||||
"notes": "",
|
||||
"dictionaryKey": "",
|
||||
"username": "admin"
|
||||
},
|
||||
{
|
||||
"date": "2017-05-18 23:40:39",
|
||||
"dictionaryKey": "welcome-to-bludit",
|
||||
"username": "admin",
|
||||
"idExecution": "591e14d70fe0d",
|
||||
"method": "POST"
|
||||
}
|
||||
]
|
@ -0,0 +1,21 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"bludit": {
|
||||
"name": "Bludit",
|
||||
"list": [
|
||||
"welcome"
|
||||
]
|
||||
},
|
||||
"cms": {
|
||||
"name": "CMS",
|
||||
"list": [
|
||||
"welcome"
|
||||
]
|
||||
},
|
||||
"flat-files": {
|
||||
"name": "Flat files",
|
||||
"list": [
|
||||
"welcome"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
{
|
||||
"admin": {
|
||||
"firstName": "Administrator",
|
||||
"lastName": "",
|
||||
"role": "admin",
|
||||
"password": "5c3ac502b428342a56fa2abc9b7c006dd38d009a",
|
||||
"salt": "mnpqWziLAR",
|
||||
"email": "",
|
||||
"registered": "2017-05-18 23:40:39",
|
||||
"tokenEmail": "",
|
||||
"tokenEmailTTL": "2009-03-15 14:00",
|
||||
"twitter": "",
|
||||
"facebook": "",
|
||||
"googlePlus": "",
|
||||
"instagram": ""
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
Title: About
|
||||
Content: The about page is an important and powerful tool for potential clients and partners. For those who wonder who is behind the website, your About page is the first source of information. Change this page's content on the admin panel, manage, pages and click on the about page.
|
@ -0,0 +1,2 @@
|
||||
Title: Error
|
||||
Content: The page has not been found.
|
@ -0,0 +1,2 @@
|
||||
Title: Error
|
||||
Content: The page has not been found.
|
@ -12,6 +12,7 @@ function addPage($args)
|
||||
{
|
||||
global $dbPages;
|
||||
global $Language;
|
||||
global $Syslog;
|
||||
|
||||
// Add the page, if the $key is FALSE the creation of the post failure.
|
||||
$key = $dbPages->add($args);
|
||||
@ -26,6 +27,12 @@ function addPage($args)
|
||||
// Call the plugins after page created
|
||||
Theme::plugins('afterPageCreate');
|
||||
|
||||
// Add to syslog
|
||||
$Syslog->add(array(
|
||||
'dictionaryKey'=>'new-page-created',
|
||||
'notes'=>$args['title']
|
||||
));
|
||||
|
||||
// Create an alert
|
||||
Alert::set( $Language->g('Page added successfully') );
|
||||
|
||||
|
@ -17,6 +17,7 @@ function setSettings($args)
|
||||
{
|
||||
global $Site;
|
||||
global $Language;
|
||||
global $Syslog;
|
||||
|
||||
// Add slash at the begin and end.
|
||||
// This fields are in the settings->advanced mode
|
||||
@ -33,7 +34,17 @@ function setSettings($args)
|
||||
}
|
||||
|
||||
if( $Site->set($args) ) {
|
||||
Alert::set($Language->g('the-changes-have-been-saved'));
|
||||
// Add to syslog
|
||||
$Syslog->add(array(
|
||||
'dictionaryKey'=>'changes-on-settings',
|
||||
'notes'=>''
|
||||
));
|
||||
|
||||
// Create an alert
|
||||
Alert::set( $Language->g('The changes have been saved') );
|
||||
|
||||
// Redirect
|
||||
Redirect::page('settings-general');
|
||||
}
|
||||
else {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
|
||||
@ -53,7 +64,6 @@ function setSettings($args)
|
||||
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
||||
{
|
||||
setSettings($_POST);
|
||||
Redirect::page($layout['controller']);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -30,21 +30,13 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
|
||||
|
||||
HTML::legend(array('value'=>$L->g('Website or Blog')));
|
||||
|
||||
HTML::formInputRadio(array(
|
||||
HTML::formSelect(array(
|
||||
'name'=>'orderBy',
|
||||
'type'=>'radio',
|
||||
'label'=>$L->g('Website'),
|
||||
'value'=>'position',
|
||||
'class'=>'',
|
||||
'tip'=>'Select this option if you want to order your pages by position.'
|
||||
));
|
||||
|
||||
HTML::formInputRadio(array(
|
||||
'name'=>'orderBy',
|
||||
'type'=>'radio',
|
||||
'label'=>$L->g('Blog'),
|
||||
'value'=>'date',
|
||||
'class'=>''
|
||||
'label'=>$L->g('Order Pages By'),
|
||||
'options'=>array('date'=>'Date','position'=>'Position'),
|
||||
'selected'=>$Site->orderBy(),
|
||||
'class'=>'uk-width-1-3 uk-form-medium',
|
||||
'tip'=>$L->g('Order the pages by date to create a Blog or order the pages by position to create a Website')
|
||||
));
|
||||
|
||||
HTML::legend(array('value'=>$L->g('Email account settings')));
|
||||
|
@ -54,7 +54,7 @@ define('DB_PAGES', PATH_DATABASES.'pages.php');
|
||||
define('DB_SITE', PATH_DATABASES.'site.php');
|
||||
define('DB_CATEGORIES', PATH_DATABASES.'categories.php');
|
||||
define('DB_TAGS', PATH_DATABASES.'tags.php');
|
||||
define('DB_NOTIFICATIONS', PATH_DATABASES.'notifications.php');
|
||||
define('DB_SYSLOG', PATH_DATABASES.'syslog.php');
|
||||
|
||||
// ADMIN URI FILTER
|
||||
define('ADMIN_URI_FILTER', '/admin/');
|
||||
@ -155,6 +155,7 @@ include(PATH_KERNEL.'dbtags.class.php');
|
||||
include(PATH_KERNEL.'dblanguage.class.php');
|
||||
include(PATH_KERNEL.'dbsite.class.php');
|
||||
include(PATH_KERNEL.'dbcategories.class.php');
|
||||
include(PATH_KERNEL.'dbsyslog.class.php');
|
||||
include(PATH_KERNEL.'page.class.php');
|
||||
include(PATH_KERNEL.'user.class.php');
|
||||
include(PATH_KERNEL.'url.class.php');
|
||||
@ -196,6 +197,7 @@ $Site = new dbSite();
|
||||
$Url = new Url();
|
||||
$Parsedown = new ParsedownExtra();
|
||||
$Security = new Security();
|
||||
$Syslog = new dbSyslog();
|
||||
|
||||
// --- Relative paths ---
|
||||
// This paths are relative for the user / web browsing.
|
||||
@ -275,8 +277,9 @@ $L = $Language;
|
||||
// --- CONSTANTS with dependency ---
|
||||
define('ORDER_BY', $Site->orderBy());
|
||||
|
||||
$ADMIN_CONTROLLER = ''; // modified on bl-kernel/
|
||||
$ADMIN_CONTROLLER = '';
|
||||
$ADMIN_VIEW = '';
|
||||
$ID_EXECUTION = uniqid(); // string 13 characters long
|
||||
|
||||
// DEBUG: Print constants
|
||||
// $arr = array_filter(get_defined_constants(), 'is_string');
|
||||
|
@ -33,6 +33,11 @@ class dbLanguage extends dbJSON
|
||||
unset($this->db['language-data']);
|
||||
}
|
||||
|
||||
public function exists($key)
|
||||
{
|
||||
return isset( $this->db[$key] );
|
||||
}
|
||||
|
||||
public function getCurrentLocale()
|
||||
{
|
||||
return $this->currentLocale;
|
||||
|
@ -1,211 +0,0 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbNotifications extends dbJSON
|
||||
{
|
||||
public $dbFields = array(
|
||||
'dictionaryKey'=> array('inFile'=>false, 'value'=>''),
|
||||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'username'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct(DB_NOTIFICATIONS);
|
||||
}
|
||||
|
||||
public function getUser($username)
|
||||
{
|
||||
$User = new User();
|
||||
|
||||
if($this->userExists($username))
|
||||
{
|
||||
$User->setField('username', $username);
|
||||
|
||||
foreach($this->db[$username] as $key=>$value) {
|
||||
$User->setField($key, $value);
|
||||
}
|
||||
|
||||
return $User;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
// Return an array with the username databases, filtered by username.
|
||||
public function getDb($username)
|
||||
{
|
||||
if($this->userExists($username))
|
||||
{
|
||||
$user = $this->db[$username];
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return the username associated to an email, if the email does not exists return FALSE.
|
||||
public function getByEmail($email)
|
||||
{
|
||||
foreach($this->db as $username=>$values) {
|
||||
if($values['email']==$email) {
|
||||
return $username;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return TRUE if the user exists, FALSE otherwise.
|
||||
public function userExists($username)
|
||||
{
|
||||
return isset($this->db[$username]);
|
||||
}
|
||||
|
||||
public function generateTokenEmail($username)
|
||||
{
|
||||
// Random hash
|
||||
$token = sha1(Text::randomText(SALT_LENGTH).time());
|
||||
$this->db[$username]['tokenEmail'] = $token;
|
||||
|
||||
// Token time to live, defined by TOKEN_EMAIL_TTL
|
||||
$this->db[$username]['tokenEmailTTL'] = Date::currentOffset(DB_DATE_FORMAT, TOKEN_EMAIL_TTL);
|
||||
|
||||
// Save the database
|
||||
if( $this->save() === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
public function setPassword($username, $password)
|
||||
{
|
||||
$salt = Text::randomText(SALT_LENGTH);
|
||||
$hash = sha1($password.$salt);
|
||||
|
||||
$args['username'] = $username;
|
||||
$args['salt'] = $salt;
|
||||
$args['password'] = $hash;
|
||||
|
||||
return $this->set($args);
|
||||
}
|
||||
|
||||
// Disable the user
|
||||
public function disableUser($username)
|
||||
{
|
||||
$args['username'] = $username;
|
||||
$args['password'] = '!';
|
||||
|
||||
return $this->set($args);
|
||||
}
|
||||
|
||||
public function set($args)
|
||||
{
|
||||
$dataForDb = array();
|
||||
|
||||
$user = $this->getDb($args['username']);
|
||||
|
||||
if($user===false)
|
||||
{
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the username '.$args['username']);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify arguments with the database fields.
|
||||
foreach($args as $field=>$value)
|
||||
{
|
||||
if( isset($this->dbFields[$field]) )
|
||||
{
|
||||
// Sanitize.
|
||||
$tmpValue = Sanitize::html($value);
|
||||
|
||||
// Set type.
|
||||
settype($tmpValue, gettype($this->dbFields[$field]['value']));
|
||||
|
||||
$user[$field] = $tmpValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Save the database
|
||||
$this->db[$args['username']] = $user;
|
||||
if( $this->save() === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($username)
|
||||
{
|
||||
unset($this->db[$username]);
|
||||
|
||||
if( $this->save() === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function add($args)
|
||||
{
|
||||
$dataForDb = array();
|
||||
|
||||
// Verify arguments with the database fields.
|
||||
foreach($this->dbFields as $field=>$options)
|
||||
{
|
||||
// If the user send the field.
|
||||
if( isset($args[$field]) )
|
||||
{
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
}
|
||||
}
|
||||
// Uses a default value for the field.
|
||||
else
|
||||
{
|
||||
$tmpValue = $options['value'];
|
||||
}
|
||||
|
||||
// Set type
|
||||
settype($tmpValue, gettype($options['value']));
|
||||
|
||||
// Save on database
|
||||
$dataForDb[$field] = $tmpValue;
|
||||
}
|
||||
|
||||
// Check if the user alredy exists.
|
||||
if( $this->userExists($dataForDb['username']) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Current date.
|
||||
$dataForDb['registered'] = Date::current(DB_DATE_FORMAT);
|
||||
|
||||
// Password
|
||||
$dataForDb['salt'] = Text::randomText(SALT_LENGTH);
|
||||
$dataForDb['password'] = sha1($dataForDb['password'].$dataForDb['salt']);
|
||||
|
||||
// Save the database
|
||||
$this->db[$dataForDb['username']] = $dataForDb;
|
||||
if( $this->save() === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
44
bl-kernel/dbsyslog.class.php
Normal file
44
bl-kernel/dbsyslog.class.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbSyslog extends dbJSON
|
||||
{
|
||||
public $dbFields = array(
|
||||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'dictionaryKey'=> array('inFile'=>false, 'value'=>''),
|
||||
'notes'=> array('inFile'=>false, 'value'=>''),
|
||||
'username'=> array('inFile'=>false, 'value'=>''),
|
||||
'idExecution'=> array('inFile'=>false, 'value'=>''),
|
||||
'method'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct(DB_SYSLOG);
|
||||
}
|
||||
|
||||
public function add($args)
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$data = array();
|
||||
$data['date'] = Date::current(DB_DATE_FORMAT);
|
||||
$data['dictionaryKey'] = $args['dictionaryKey'];
|
||||
$data['notes'] = Sanitize::html($args['notes']);
|
||||
$data['idExecution'] = $GLOBALS['ID_EXECUTION'];
|
||||
$data['method'] = $_SERVER['REQUEST_METHOD'];
|
||||
|
||||
// Username
|
||||
$data['username'] = Session::get('username');
|
||||
if( Text::isEmpty($data['username']) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Insert at beggining of the database
|
||||
array_unshift($this->db, $data);
|
||||
|
||||
// Save
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "За мен",
|
||||
"description": "Кратко описание за вашия сайт или за себе си."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Über",
|
||||
"description": "Kurzer Text über die Website oder zu dir."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Über",
|
||||
"description": "Kurzer Text über die Website oder zu dir."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "About",
|
||||
"description": "Little description about your site or yourself."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Acerca de",
|
||||
"description": "Breve descripción de ti mismo o sobre tu sitio."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "About",
|
||||
"description": "サイトやあなた自身についての概要を表示します。"
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Over mij",
|
||||
"description": "Een korte beschrijving over je site of jezelf."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "О блоге",
|
||||
"description": "Небольшое описание о вашем сайте или о себя."
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Hakkında",
|
||||
"description": "Senin veya siten hakkında kısa bilgiler"
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Про блог",
|
||||
"description": "Невеликий опис вашого сайту або про Вас."
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "1.5.2",
|
||||
"releaseDate": "2016-05-28",
|
||||
"license": "MIT",
|
||||
"compatible": "1.5.2",
|
||||
"notes": ""
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
class pluginTimeMachine extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function beforeAdminLoad()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$notifyText = '';
|
||||
if($_SERVER['REQUEST_METHOD']=='POST') {
|
||||
if($GLOBALS['ADMIN_CONTROLLER']=='new-page') {
|
||||
$notifyText = $L->g('New page created');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
install.php
15
install.php
@ -401,6 +401,19 @@ function install($adminPassword, $email, $timezone)
|
||||
|
||||
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File syslog.php
|
||||
$data = array(
|
||||
array(
|
||||
'date'=>$currentDate,
|
||||
'dictionaryKey'=>'welcome-to-bludit',
|
||||
'username'=>'admin',
|
||||
'idExecution'=>uniqid(),
|
||||
'method'=>'POST'
|
||||
));
|
||||
|
||||
file_put_contents(PATH_DATABASES.'syslog.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
|
||||
// File security.php
|
||||
$randomKey = getRandomString();
|
||||
$randomKey = sha1($randomKey);
|
||||
@ -507,7 +520,7 @@ Content:
|
||||
- '.$Language->get('Read the documentation for more information').'
|
||||
- '.$Language->get('Share with your friends and enjoy');
|
||||
|
||||
file_put_contents(PATH_POSTS.$welcomePageKey.DS.FILENAME, $data, LOCK_EX);
|
||||
file_put_contents(PATH_PAGES.'welcome'.DS.FILENAME, $data, LOCK_EX);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user