From 82dcbb1e9ed564374ffe9d6dec1b1f1e4ca57a0d Mon Sep 17 00:00:00 2001 From: pdontthink Date: Fri, 19 Mar 2010 08:29:44 +0000 Subject: [PATCH] Don't push out onsubmit handler unless necessary git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13929 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/compose.php b/src/compose.php index 5a30de5f..25beaec8 100644 --- a/src/compose.php +++ b/src/compose.php @@ -1173,21 +1173,24 @@ function showInputForm ($session, $values=false) { // Onsubmit text is enclosed inside of double quotes, so plugins // need to quote accordingly. if (checkForJavascript()) { - $onsubmit_text = ' onsubmit="'; if (empty($compose_onsubmit)) $compose_onsubmit = array(); else if (!is_array($compose_onsubmit)) $compose_onsubmit = array($compose_onsubmit); + $onsubmit_text = ''; foreach ($compose_onsubmit as $text) { $text = trim($text); - if (substr($text, -1) != ';' && substr($text, -1) != '}') - $text .= '; '; - $onsubmit_text .= $text; + if (!empty($text)) { + if (substr($text, -1) != ';' && substr($text, -1) != '}') + $text .= '; '; + $onsubmit_text .= $text; + } } + if (!empty($onsubmit_text)) //FIXME: DON'T ECHO HTML FROM CORE! - echo $onsubmit_text . ' return true;"'; + echo ' onsubmit="' . $onsubmit_text . ' return true;"'; } -- 2.25.1