From 78726b7c3ac7932777520d5506d4e459961f36c7 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 28 Aug 2018 19:32:15 +0200 Subject: [PATCH] bug fix, username is lost when edit the page --- bl-kernel/pages.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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'])) {