diff --git a/bl-kernel/pages.class.php b/bl-kernel/pages.class.php index dea1de76..f35b86f3 100644 --- a/bl-kernel/pages.class.php +++ b/bl-kernel/pages.class.php @@ -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'])) {