UUID for posts and pages

This commit is contained in:
Diego 2017-04-26 21:26:17 +02:00
parent ba43495ca4
commit a28a02164c
3 changed files with 15 additions and 2 deletions

View File

@ -142,6 +142,11 @@ class Content {
return $this->getField('category'); return $this->getField('category');
} }
public function uuid()
{
return $this->getField('uuid');
}
// Returns the field key // Returns the field key
public function key() public function key()
{ {

View File

@ -15,7 +15,8 @@ class dbPages extends dbJSON
'dateModified'=> array('inFile'=>false, 'value'=>''), 'dateModified'=> array('inFile'=>false, 'value'=>''),
'position'=> array('inFile'=>false, 'value'=>0), 'position'=> array('inFile'=>false, 'value'=>0),
'coverImage'=> array('inFile'=>false, 'value'=>''), 'coverImage'=> array('inFile'=>false, 'value'=>''),
'category'=> array('inFile'=>false, 'value'=>'') 'category'=> array('inFile'=>false, 'value'=>''),
'uuid'=> array('inFile'=>false, 'value'=>'')
); );
function __construct() function __construct()
@ -30,6 +31,9 @@ class dbPages extends dbJSON
$key = $this->generateKey($args['slug'], $args['parent']); $key = $this->generateKey($args['slug'], $args['parent']);
// Generate UUID
$args['uuid'] = md5(time().DOMAIN);
// The user is always the one loggued. // The user is always the one loggued.
$args['username'] = Session::get('username'); $args['username'] = Session::get('username');
if( Text::isEmpty($args['username']) ) { if( Text::isEmpty($args['username']) ) {

View File

@ -14,7 +14,8 @@ class dbPosts extends dbJSON
'dateModified'=> array('inFile'=>false, 'value'=>''), 'dateModified'=> array('inFile'=>false, 'value'=>''),
'coverImage'=> array('inFile'=>false, 'value'=>''), 'coverImage'=> array('inFile'=>false, 'value'=>''),
'md5file'=> array('inFile'=>false, 'value'=>''), 'md5file'=> array('inFile'=>false, 'value'=>''),
'category'=> array('inFile'=>false, 'value'=>'') 'category'=> array('inFile'=>false, 'value'=>''),
'uuid'=> array('inFile'=>false, 'value'=>'')
); );
function __construct() function __construct()
@ -114,6 +115,9 @@ class dbPosts extends dbJSON
// Generate the database key / index // Generate the database key / index
$key = $this->generateKey($args['slug']); $key = $this->generateKey($args['slug']);
// Generate UUID
$args['uuid'] = md5(time().DOMAIN);
// The user is always who is loggued // The user is always who is loggued
$args['username'] = Session::get('username'); $args['username'] = Session::get('username');
if( Text::isEmpty($args['username']) ) { if( Text::isEmpty($args['username']) ) {