+ // Plugins that use compose_form hook can add an array entry
+ // to the globally scoped $compose_onsubmit; we add them up
+ // here and format the form tag's full onsubmit handler.
+ // Each plugin should use "return false" if they need to
+ // stop form submission but otherwise should NOT use "return
+ // true" to give other plugins the chance to do what they need
+ // to do; SquirrelMail itself will add the final "return true".
+ // 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);
+
+ foreach ($compose_onsubmit as $text) {
+ $text = trim($text);
+ if (substr($text, -1) != ';' && substr($text, -1) != '}')
+ $text .= '; ';
+ $onsubmit_text .= $text;
+ }
+
+ echo $onsubmit_text . ' return true;"';
+ }
+
+