diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-05-22 19:59:52 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-06-12 15:12:00 +0200 |
commit | 4d5a7ec39f9d036ab6f68e3ca9f9919cc967109c (patch) | |
tree | 8fb4770444917ded8f8ad3bb388fd55d7a6c709b /include/menu.php | |
parent | 13c074f8b8f8340efc7c5912c615b6cfa693409d (diff) | |
download | volse-hubzilla-4d5a7ec39f9d036ab6f68e3ca9f9919cc967109c.tar.gz volse-hubzilla-4d5a7ec39f9d036ab6f68e3ca9f9919cc967109c.tar.bz2 volse-hubzilla-4d5a7ec39f9d036ab6f68e3ca9f9919cc967109c.zip |
includes/menu: Fix timestamp handling in menu_create.
Referencing undefined array keys are not allowed anymore, so we need to
check whether they exist first.
Diffstat (limited to 'include/menu.php')
-rw-r--r-- | include/menu.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/menu.php b/include/menu.php index 1f65f987d..2fcf88bca 100644 --- a/include/menu.php +++ b/include/menu.php @@ -166,7 +166,8 @@ function menu_create($arr) { if($r) return false; - $t = datetime_convert(); + $time_created = datetime_convert('UTC', 'UTC', empty($arr['menu_created']) ? 'now' : $arr['menu_created']); + $time_edited = empty($arr['menu_edited']) ? $time_created : datetime_convert('UTC', 'UTC', $arr['menu_edited']); $r = q("insert into menu ( menu_name, menu_desc, menu_flags, menu_channel_id, menu_created, menu_edited ) values( '%s', '%s', %d, %d, '%s', '%s' )", @@ -174,8 +175,8 @@ function menu_create($arr) { dbesc($menu_desc), intval($menu_flags), intval($menu_channel_id), - dbesc(datetime_convert('UTC','UTC',(($arr['menu_created']) ? $arr['menu_created'] : $t))), - dbesc(datetime_convert('UTC','UTC',(($arr['menu_edited']) ? $arr['menu_edited'] : $t))) + dbesc($time_created), + dbesc($time_edited) ); if(! $r) return false; |