bug fix, username is lost when edit the page

This commit is contained in:
Diego Najar 2018-08-28 19:32:15 +02:00
parent 2c5151c3ab
commit 78726b7c3a
1 changed files with 6 additions and 7 deletions

View File

@ -147,8 +147,11 @@ class Pages extends dbJSON {
public function edit($args, $climode=false)
{
$row = array();
// Old key
// This variable is not belong to the database so is not defined in $row
$key = $args['key'];
$row = array();
// Check values on args or set default values
foreach ($this->dbFields as $field=>$value) {
if ($field=='tags') {
@ -161,8 +164,8 @@ class Pages extends dbJSON {
// Sanitize if will be stored on database
$finalValue = Sanitize::html($args[$field]);
} else {
// Default value for the field if not defined
$finalValue = $value;
// Default value from the current
$finalValue = $this->db[$key][$field];
}
settype($finalValue, gettype($value));
$row[$field] = $finalValue;
@ -179,10 +182,6 @@ class Pages extends dbJSON {
$parent = $args['parent'];
}
// Old key
// This variable is not belong to the database so is not defined in $row
$key = $args['key'];
// Slug from the title or the content
// This variable is not belong to the database so is not defined in $row
if (empty($args['slug'])) {