1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Agora_Form_Message extends Horde_Form {
13:
14: function validate(&$vars, $canAutoFill = false)
15: {
16: global $conf;
17:
18: if (!parent::validate($vars, $canAutoFill)) {
19: if (!$GLOBALS['registry']->getAuth() && !empty($conf['forums']['captcha'])) {
20: $vars->remove('captcha');
21: $this->removeVariable($varname = 'captcha');
22: $this->insertVariableBefore('newcomment', _("Spam protection"), 'captcha', 'figlet', true, null, null, array(Agora::getCAPTCHA(true), $conf['forums']['figlet_font']));
23: }
24: return false;
25: }
26:
27: return true;
28: }
29:
30: function &getRenderer($params = array())
31: {
32: $renderer = new Horde_Form_Renderer_MessageForm($params);
33: return $renderer;
34: }
35:
36: }
37:
38: 39: 40: 41: 42:
43: class Horde_Form_Renderer_MessageForm extends Horde_Form_Renderer {
44:
45: function _renderVarInputEnd(&$form, &$var, &$vars)
46: {
47: if ($var->hasDescription()) {
48:
49: echo ' ' . $var->getDescription();
50: }
51: }
52:
53: function close($focus = false)
54: {
55: echo '</form>' . "\n";
56:
57: if (Horde_Util::getGet('reply_focus')) {
58: echo '<script type="text/javascript">document.getElementById("message_body").focus()</script>';
59: }
60: }
61:
62: }
63: