From 2ffea8f2f2886a64535d5fd81745a8e5944a24c9 Mon Sep 17 00:00:00 2001 From: Adrian Lang <lang@cosmocode.de> Date: Mon, 22 Mar 2010 16:42:58 +0100 Subject: [PATCH] Do not trigger HTML_FORM_SELECTION in some cases When the page is not editable or the section info is out of date, a custom editor should not be used. --- inc/html.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/inc/html.php b/inc/html.php index 23eadebc4..86cda46f0 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1121,6 +1121,8 @@ function html_updateprofile(){ * Preprocess edit form data * * @author Andreas Gohr <andi@splitbrain.org> + * + * @triggers HTML_EDITFORM_OUTPUT */ function html_edit(){ global $ID; @@ -1167,10 +1169,16 @@ function html_edit(){ $form->addHidden('suffix', $SUF); $form->addHidden('changecheck', $check); - $data = compact('wr', 'form'); - $data['media_manager'] = true; - $data['intro_locale'] = $include; - trigger_event('HTML_EDIT_FORMSELECTION', $data, 'html_edit_form', true); + $data = array('form' => $form, + 'wr' => $wr, + 'media_manager' => true, + 'intro_locale' => $include); + if ($wr && $RANGE !== '') { + // Only emit event if page is writable and section edit data is valid. + trigger_event('HTML_EDIT_FORMSELECTION', $data, 'html_edit_form', true); + } else { + html_edit_form($data); + } if (isset($data['intro_locale'])) { echo p_locale_xhtml($data['intro_locale']); } @@ -1225,8 +1233,6 @@ function html_edit(){ * Display the default edit form * * Is the default action for HTML_EDIT_FORMSELECTION. - * - * @triggers HTML_EDITFORM_OUTPUT */ function html_edit_form($param) { global $TEXT; -- GitLab