1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19:
20: class XcaptchaImageForm extends Xoops\Form\ThemeForm
21: {
22: 23: 24:
25: public function __construct($object = null)
26: {
27: $this->object = $object;
28: $this->config = $object->config;
29:
30: $xoops = Xoops::getInstance();
31:
32: parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
33:
34: $this->addElement(new Xoops\Form\Text(_XCAPTCHA_NUM_CHARS, 'num_chars', 2, 2, $this->config['num_chars']), true);
35:
36: $this->addElement(new Xoops\Form\RadioYesNo(_XCAPTCHA_CASESENSITIVE, 'casesensitive', $this->config['casesensitive']));
37:
38: $fontmin_form = new Xoops\Form\Select(_XCAPTCHA_FONTSIZE_MIN, 'fontsize_min', $this->config['fontsize_min']);
39: for ($i = 10; $i <= 30; ++$i) {
40: $fontmin_form->addOption($i, $i);
41: }
42: $this->addElement($fontmin_form, false);
43:
44: $fontmax_form = new Xoops\Form\Select(_XCAPTCHA_FONTSIZE_MAX, 'fontsize_max', $this->config['fontsize_max']);
45: for ($i = 10; $i <= 30; ++$i) {
46: $fontmax_form->addOption($i, $i);
47: }
48: $this->addElement($fontmax_form, false);
49:
50: $backtype_form = new Xoops\Form\Select(_XCAPTCHA_BACKGROUND_TYPE, 'background_type', $this->config['background_type'], $size = 7);
51: $backtype_form->addOption(0, _XCAPTCHA_BACKGROUND_BAR);
52: $backtype_form->addOption(1, _XCAPTCHA_BACKGROUND_CIRCLE);
53: $backtype_form->addOption(2, _XCAPTCHA_BACKGROUND_LINE);
54: $backtype_form->addOption(3, _XCAPTCHA_BACKGROUND_RECTANGLE);
55: $backtype_form->addOption(4, _XCAPTCHA_BACKGROUND_ELLIPSE);
56: $backtype_form->addOption(5, _XCAPTCHA_BACKGROUND_POLYGONE);
57: $backtype_form->addOption(100, _XCAPTCHA_BACKGROUND_IMAGE);
58: $this->addElement($backtype_form, false);
59:
60: $backnum_form = new Xoops\Form\Select(_XCAPTCHA_BACKGROUND_NUM, 'background_num', $this->config['background_num']);
61: for ($i = 10; $i <= 100; $i = $i+10) {
62: $backnum_form->addOption($i, $i);
63: }
64: $this->addElement($backnum_form, false);
65:
66: $polygon_point = new Xoops\Form\Select(_XCAPTCHA_POLYGON_POINT, 'polygon_point', $this->config['polygon_point']);
67: for ($i = 3; $i <= 20; ++$i) {
68: $polygon_point->addOption($i, $i);
69: }
70: $this->addElement($polygon_point, false);
71:
72: $value = implode('|', $this->config['skip_characters']);
73: $this->addElement(new Xoops\Form\TextArea(_XCAPTCHA_SKIP_CHARACTERS, 'skip_characters', $value, 5, 50), true);
74:
75: $this->addElement(new Xoops\Form\Hidden('type', 'image'));
76:
77: $buttonTray = new Xoops\Form\ElementTray('', '');
78: $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
79: $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
80: $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'));
81: $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
82: $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'");
83: $buttonTray->addElement($buttonCancelSend);
84:
85: $this->addElement($buttonTray);
86: }
87: }
88: