require_once JPATH_BASE . DS . 'modules' . DS . 'mod_simpleform2' . DS . 'kcaptcha' . DS . 'kcaptcha.php';
     $captcha = null;
     foreach ($form->elements as $elem) {
         if ($elem->type == 'captcha') {
             $captcha = $elem;
             break;
         }
     }
     if (is_null($captcha)) {
         sfEcho('!' . JText::_('Form has no captcha'));
     }
     $width = (int) $captcha->width > 0 ? (int) $captcha->width : 200;
     $height = (int) $captcha->height > 0 ? (int) $captcha->height : 60;
     $color = $captcha->color != '' ? $captcha->color : null;
     $background = $captcha->background != '' ? $captcha->background : null;
     $captchaObj = new simpleCAPTCHA($width, $height, $color, $background);
     $session =& JFactory::getSession();
     $session->set('easyform2.captcha', $captchaObj->getKeyString());
     die;
     break;
 case 'sendForm':
     $moduleID = (int) JRequest::getInt('moduleID', 0);
     if ($moduleID == 0) {
         sfEcho('!' . JText::_('Form not found'));
     }
     $module =& JTable::getInstance('module');
     $module->load($moduleID);
     if (!$module->id || $module->id != $moduleID) {
         sfEcho('!' . JText::_('Form not found'));
     }
     $params = new JParameter($module->params);
Exemple #2
0
     @ob_end_clean();
     $captcha = null;
     foreach ($form->elements as $elem) {
         if ($elem->type == 'captcha') {
             $captcha = $elem;
             break;
         }
     }
     if (is_null($captcha)) {
         sfEcho('!' . JText::_('Form has no captcha'));
     }
     $width = (int) $captcha->width > 0 ? (int) $captcha->width : 200;
     $height = (int) $captcha->height > 0 ? (int) $captcha->height : 60;
     $color = $captcha->color != '' ? $captcha->color : null;
     $background = $captcha->background != '' ? $captcha->background : null;
     $captchaObj = new simpleCAPTCHA($width, $height, $color, $background);
     $session =& JFactory::getSession();
     $session->set('simpleform2_' . $form->get('moduleID') . '.captcha', $captchaObj->getKeyString());
     die;
     break;
 case 'sendForm':
     $form->set('defaultError', JText::_('Enter value for'));
     $post = (array) JRequest::get('post');
     $result = $form->processRequest($post);
     if ($result !== false) {
         $ok = $form->sendEmail($result, $params);
         if ($ok) {
             sfEcho('=' . $params->get('okText', JText::_('Form succeed')));
         } else {
             sfEcho('!' . $form->getError());
         }