From 1467d177c950617c290cec2193c690da7fa6a4e9 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 14 Apr 2021 00:32:04 +0200 Subject: Some nitpicking in editforms. Filter $_POST['edit'] into a boolean we can use to check wether we're editing or not. Then use this rather than other implicit assumptions to detect wether we're an edit form or a new concert form. --- includes/admin/views/giglog_admin_page.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'includes/admin') diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 5749bab..5f43331 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -137,8 +137,9 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { static function editforms() { $cid = filter_input(INPUT_POST, "cid"); + $editing = filter_input(INPUT_POST, "edit") == "EDIT"; - if(isset($_POST['edit']) && $_POST['edit']=="EDIT" && !empty($cid)) //A bit overdoing with the checks if concert ID is empty both here and in find_cid. But based on that, things are NULL or not. Better ideas? + if ($editing && !empty($cid)) //A bit overdoing with the checks if concert ID is empty both here and in find_cid. But based on that, things are NULL or not. Better ideas? $c = GiglogAdmin_Concert::find_cid($cid); else $c = new GiglogAdmin_Concert(); @@ -150,10 +151,15 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { .'
' .'
' .'
'; - if ($c->band()=='') //actions differ if we update or create a concert, hence two buttons needed - $content.='

'; - else - $content.='

'; + + // actions differ if we update or create a concert, hence two buttons needed + if ($editing) { + $content.='

'; + } + else { + $content.='

'; + } + $content.=''; $content.='

' -- cgit v1.2.3