Updates
This commit is contained in:
parent
98a1084ec4
commit
ba63dd524d
|
@ -264,7 +264,8 @@ function install($adminPassword, $email)
|
||||||
'uriPost'=>'/post/',
|
'uriPost'=>'/post/',
|
||||||
'uriPage'=>'/',
|
'uriPage'=>'/',
|
||||||
'uriTag'=>'/tag/',
|
'uriTag'=>'/tag/',
|
||||||
'url'=>'http://'.DOMAIN.HTML_PATH_ROOT
|
'url'=>'http://'.DOMAIN.HTML_PATH_ROOT,
|
||||||
|
'cliMode'=>true
|
||||||
);
|
);
|
||||||
|
|
||||||
file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
|
|
|
@ -141,6 +141,11 @@ function build_all_pages()
|
||||||
// Main
|
// Main
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// Search for changes on pages by the user.
|
||||||
|
if( $Site->cliMode() ) {
|
||||||
|
$dbPages->regenerateCli();
|
||||||
|
}
|
||||||
|
|
||||||
// Filter by page, then build it
|
// Filter by page, then build it
|
||||||
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
|
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,6 +117,11 @@ function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeU
|
||||||
// Main
|
// Main
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// Search for changes on posts by the user.
|
||||||
|
if( $Site->cliMode() ) {
|
||||||
|
$dbPosts->regenerateCli();
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the scheduler.
|
// Execute the scheduler.
|
||||||
if( $dbPosts->scheduler() ) {
|
if( $dbPosts->scheduler() ) {
|
||||||
// Reindex dbTags.
|
// Reindex dbTags.
|
||||||
|
|
|
@ -393,12 +393,24 @@ class dbPosts extends dbJSON
|
||||||
foreach($fields as $f=>$v)
|
foreach($fields as $f=>$v)
|
||||||
{
|
{
|
||||||
if($Post->getField($f)) {
|
if($Post->getField($f)) {
|
||||||
// DEBUG: Validar/Sanitizar valores, ej: validar formato fecha
|
|
||||||
$this->db[$key][$f] = $Post->getField($f);
|
$valueFromFile = $Post->getField($f);
|
||||||
|
|
||||||
|
// Validate values from file.
|
||||||
|
if($f=='tags') {
|
||||||
|
$valueFromFile = array_map('trim', explode(',', $valueFromFile));
|
||||||
|
$valueFromFile = implode(',', $valueFromFile);
|
||||||
|
}
|
||||||
|
elseif($f=='date') {
|
||||||
|
if(!Valid::date($valueFromFile,DB_DATE_FORMAT)) {
|
||||||
|
$valueFromFile = Date::current(DB_DATE_FORMAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG: Update tags
|
// Sanitize the values from file.
|
||||||
|
$this->db[$key][$f] = Sanitize::html($valueFromFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove old posts from db
|
// Remove old posts from db
|
||||||
|
@ -406,6 +418,9 @@ class dbPosts extends dbJSON
|
||||||
unset($this->db[$key]);
|
unset($this->db[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort posts before save.
|
||||||
|
$this->sortByDate();
|
||||||
|
|
||||||
// Save the database.
|
// Save the database.
|
||||||
if( $this->save() === false ) {
|
if( $this->save() === false ) {
|
||||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||||
|
|
|
@ -17,7 +17,8 @@ class dbSite extends dbJSON
|
||||||
'uriPage'=> array('inFile'=>false, 'value'=>'/'),
|
'uriPage'=> array('inFile'=>false, 'value'=>'/'),
|
||||||
'uriPost'=> array('inFile'=>false, 'value'=>'/post/'),
|
'uriPost'=> array('inFile'=>false, 'value'=>'/post/'),
|
||||||
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
|
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
|
||||||
'url'=> array('inFile'=>false, 'value'=>'')
|
'url'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
'cliMode'=> array('inFile'=>false, 'value'=>true)
|
||||||
);
|
);
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
|
@ -135,6 +136,12 @@ class dbSite extends dbJSON
|
||||||
return $this->db['url'];
|
return $this->db['url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns TRUE if the cli mode is enabled, otherwise FALSE.
|
||||||
|
public function cliMode()
|
||||||
|
{
|
||||||
|
return $this->db['cliMode'];
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the relative home link
|
// Returns the relative home link
|
||||||
public function homeLink()
|
public function homeLink()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@ class Valid {
|
||||||
public static function date($date, $format='Y-m-d H:i:s')
|
public static function date($date, $format='Y-m-d H:i:s')
|
||||||
{
|
{
|
||||||
$tmp = DateTime::createFromFormat($format, $date);
|
$tmp = DateTime::createFromFormat($format, $date);
|
||||||
|
|
||||||
return $tmp && $tmp->format($format)==$date;
|
return $tmp && $tmp->format($format)==$date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class pluginPages extends Plugin {
|
||||||
|
|
||||||
$html = '<div class="plugin plugin-pages">';
|
$html = '<div class="plugin plugin-pages">';
|
||||||
|
|
||||||
// If the label is not empty, print it.
|
// Print the label if it not empty.
|
||||||
$label = $this->getDbField('label');
|
$label = $this->getDbField('label');
|
||||||
if( !empty($label) ) {
|
if( !empty($label) ) {
|
||||||
$html .= '<h2>'.$label.'</h2>';
|
$html .= '<h2>'.$label.'</h2>';
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"plugin-data":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "SimpleMDE",
|
"name": "SimpleMDE",
|
||||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor.",
|
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick.",
|
||||||
"author": "Bludit",
|
"author": "Bludit",
|
||||||
"email": "",
|
"email": "",
|
||||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||||
|
@ -11,5 +11,4 @@
|
||||||
},
|
},
|
||||||
"toolbar": "Toolbar",
|
"toolbar": "Toolbar",
|
||||||
"tab-size": "Tab size"
|
"tab-size": "Tab size"
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
"plugin-data":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "SimpleMDE",
|
"name": "SimpleMDE",
|
||||||
"description": "Simple, facil y hermoso editor Markdown.",
|
"description": "Simple, facil y hermoso editor Markdown desarrollado por @WesCossick.",
|
||||||
"author": "Bludit",
|
"author": "Bludit",
|
||||||
"email": "",
|
"email": "",
|
||||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||||
|
@ -11,5 +11,4 @@
|
||||||
},
|
},
|
||||||
"toolbar": "Barra de herramientas",
|
"toolbar": "Barra de herramientas",
|
||||||
"tab-size": "Tamaño de la tabulación"
|
"tab-size": "Tamaño de la tabulación"
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue