Updates
This commit is contained in:
parent
98a1084ec4
commit
ba63dd524d
@ -264,7 +264,8 @@ function install($adminPassword, $email)
|
||||
'uriPost'=>'/post/',
|
||||
'uriPage'=>'/',
|
||||
'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);
|
||||
|
@ -141,6 +141,11 @@ function build_all_pages()
|
||||
// Main
|
||||
// ============================================================================
|
||||
|
||||
// Search for changes on pages by the user.
|
||||
if( $Site->cliMode() ) {
|
||||
$dbPages->regenerateCli();
|
||||
}
|
||||
|
||||
// Filter by page, then build it
|
||||
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
|
||||
{
|
||||
|
@ -117,6 +117,11 @@ function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeU
|
||||
// Main
|
||||
// ============================================================================
|
||||
|
||||
// Search for changes on posts by the user.
|
||||
if( $Site->cliMode() ) {
|
||||
$dbPosts->regenerateCli();
|
||||
}
|
||||
|
||||
// Execute the scheduler.
|
||||
if( $dbPosts->scheduler() ) {
|
||||
// Reindex dbTags.
|
||||
|
@ -393,12 +393,24 @@ class dbPosts extends dbJSON
|
||||
foreach($fields as $f=>$v)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize the values from file.
|
||||
$this->db[$key][$f] = Sanitize::html($valueFromFile);
|
||||
}
|
||||
}
|
||||
|
||||
// DEBUG: Update tags
|
||||
}
|
||||
|
||||
// Remove old posts from db
|
||||
@ -406,6 +418,9 @@ class dbPosts extends dbJSON
|
||||
unset($this->db[$key]);
|
||||
}
|
||||
|
||||
// Sort posts before save.
|
||||
$this->sortByDate();
|
||||
|
||||
// Save the database.
|
||||
if( $this->save() === false ) {
|
||||
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'=>'/'),
|
||||
'uriPost'=> array('inFile'=>false, 'value'=>'/post/'),
|
||||
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
|
||||
'url'=> array('inFile'=>false, 'value'=>'')
|
||||
'url'=> array('inFile'=>false, 'value'=>''),
|
||||
'cliMode'=> array('inFile'=>false, 'value'=>true)
|
||||
);
|
||||
|
||||
function __construct()
|
||||
@ -135,6 +136,12 @@ class dbSite extends dbJSON
|
||||
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
|
||||
public function homeLink()
|
||||
{
|
||||
|
@ -28,7 +28,8 @@ class Valid {
|
||||
public static function date($date, $format='Y-m-d H:i:s')
|
||||
{
|
||||
$tmp = DateTime::createFromFormat($format, $date);
|
||||
return $tmp && $tmp->format($format) == $date;
|
||||
|
||||
return $tmp && $tmp->format($format)==$date;
|
||||
}
|
||||
|
||||
}
|
@ -33,10 +33,10 @@ class pluginPages extends Plugin {
|
||||
global $pagesParents;
|
||||
global $Site, $Url;
|
||||
$home = $Url->whereAmI()==='home';
|
||||
|
||||
|
||||
$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');
|
||||
if( !empty($label) ) {
|
||||
$html .= '<h2>'.$label.'</h2>';
|
||||
|
@ -2,7 +2,7 @@
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor.",
|
||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick.",
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
@ -11,5 +11,4 @@
|
||||
},
|
||||
"toolbar": "Toolbar",
|
||||
"tab-size": "Tab size"
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"description": "Simple, facil y hermoso editor Markdown.",
|
||||
"description": "Simple, facil y hermoso editor Markdown desarrollado por @WesCossick.",
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
@ -11,5 +11,4 @@
|
||||
},
|
||||
"toolbar": "Barra de herramientas",
|
||||
"tab-size": "Tamaño de la tabulación"
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user