diff --git a/php/cl_contactform_input.php b/php/cl_contactform_input.php index dcce82a..87a7724 100644 --- a/php/cl_contactform_input.php +++ b/php/cl_contactform_input.php @@ -1,38 +1,39 @@ ?>setWidth(30); +$oCfgTable->setCell(0, 0, mi18n("Zieladresse (alias@mydomain.com):")); +$oCfgTable->setCell(0, 1, $oField->render()); + +$oField = new cHTMLTextbox("CMS_VAR[1]", "CMS_VALUE[1]"); +$oField->setWidth(30); +$oCfgTable->setCell(1, 0, mi18n("Betreff:")); +$oCfgTable->setCell(1, 1, $oField->render()); + +$oField = new cHTMLTextbox("CMS_VAR[2]", "CMS_VALUE[2]"); +$oField->setWidth(30); +$oCfgTable->setCell(2, 0, mi18n("Antwortadresse (alias@mydomain.com):")); +$oCfgTable->setCell(2, 1, $oField->render()); + +$oField = new cHTMLTextbox("CMS_VAR[3]", "CMS_VALUE[3]"); +$oField->setWidth(30); +$oCfgTable->setCell(3, 0, mi18n("Emailname (z.B. Vorname Name):")); +$oCfgTable->setCell(3, 1, $oField->render()); + +$oField = new cHTMLTextbox("CMS_VAR[4]", "CMS_VALUE[4]"); +$oField->setWidth(8); +$oCfgTable->setCell(4, 0, mi18n("Hintergrundfarbe bei Fehlern (z.B. red):")); +$oCfgTable->setCell(4, 1, $oField->render()); +/* +$oField = new cHTMLCheckbox("CMS_VAR[5]", "true"); +$bHasJQuery = ("CMS_VALUE[5]" == 'true')?true:false; +$oField->setChecked($bHasJQuery); +$oField->setLabelText(' '); +$oCfgTable->setCell(5, 0, mi18n("jQuery Script vorhanden:")); +$oCfgTable->setCell(5, 1, $oField->render()); +*/ +$oCfgTable->render(true); - echo " - - - - - - - - - - - - - - - - - - - - - -
" . mi18n("Zieladresse (alias@mydomain.com):") . "
" . mi18n("Betreff:") . "
" . mi18n("Antwortadresse (alias@mydomain.com):") . "
" . mi18n("Emailname (z.B. Vorname Name):") . "
" . mi18n("Hintergrundfarbe bei Fehlern (z.B. red):") . "
- "; ?> '', + 'from' => array( + 'name' => '', + 'email' => '' + ), + 'message' => '', + 'subject' => '' + ); private $unraveled = array(); - private $form; + private $form = array( + 'form' => '', + 'answer' => '', + 'colorError' => '' + ); private $formField = array(); - public function __construct() { - $this->email = array( - 'adresses' => '', - 'from' => array( - 'name' => '', - 'email' => '' - ), - 'message' => '', - 'subject' => '' - ); - - $this->form = array( - 'form' => '', - 'answer' => '', - 'colorError' => '' - ); + public function __construct() + { } private function sendEmail() { @@ -158,6 +161,8 @@ class w3form { } public function formField($attribute, $sent) { + $style = ''; + $value = ''; $parameter = "name=\"{$attribute['name']}\""; if ($sent && !$this->formFieldCorrect($attribute)) $style = "style=\"background-color:{$this->form['colorError']};\""; @@ -184,6 +189,33 @@ class w3form { } switch ($attribute['type']) { + case 'captcha': + if ($sent) { + $captcha = @$_POST['ct_captcha']; + $capId = @$_POST['captcha_id']; + $securimage = new Securimage(); + + if ($securimage->check($captcha) == false) { + echo ''; + } + } + // show captcha HTML using Securimage::getCaptchaHtml() + $options = array(); + $options['input_name'] = 'ct_captcha'; // change name of input element for form post input_text + $options['input_text'] = mi18n("Zeichen eingeben"); + $options['input_required'] = false; + + if (!empty($_SESSION['ctform']['captcha_error'])) { + // error html to show in captcha output + $options['error_html'] = $_SESSION['ctform']['captcha_error']; + } + + echo "
\n"; + echo Securimage::getCaptchaHtml($options); + echo "\n
\n"; + break; case 'text': echo ""; break; @@ -230,7 +262,7 @@ class w3form { if ($_POST["{$formId[0]}"]["{$formId[1]}"] == $attribute['value']) { echo ""; } else { - echo ""; + echo ""; } } else { if (!empty($attribute['selected']) && $attribute['selected'] == 'true') { @@ -261,13 +293,11 @@ class w3form { private function formComplete() { $form = $this->form['form']; $fields = $this->formInterpretation($form); - foreach ($fields as $field) { if (!$this->formFieldCorrect($field)) { return false; } } - return true; } @@ -319,7 +349,7 @@ class w3form { } break; case 'text': - if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[(\d)? ?\w]*$/")))) { + if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[,;:\. ÄÖÜäöüß\-\+\*§$%&\/()=?!\"'\w\d]*$/")))) { return false; } break; @@ -350,19 +380,19 @@ class w3form { break; } } - - // grössenbereich bei integer und float prüfen - if (!empty($field['minvalue']) && $sPostFieldValue < $field['minvalue']) - return false; - if (!empty($field['maxvalue']) && $sPostFieldValue > $field['maxvalue']) - return false; - // längenbereich bei allen typen prüfen - if (!empty($field['minlength']) && strlen($sPostFieldValue) < $field['minlength']) - return false; - if (!empty($field['maxlength']) && strlen($sPostFieldValue) > $field['maxlength']) - return false; - + // grössenbereich bei integer und float prüfen + if (!empty($field['minvalue']) && $sPostFieldValue < $field['minvalue']) + return false; + if (!empty($field['maxvalue']) && $sPostFieldValue > $field['maxvalue']) + return false; + + // längenbereich bei allen typen prüfen + if (!empty($field['minlength']) && strlen($sPostFieldValue) < $field['minlength']) + return false; + if (!empty($field['maxlength']) && strlen($sPostFieldValue) > $field['maxlength']) + return false; + return true; } @@ -370,8 +400,16 @@ class w3form { if (!isset($_POST['sent'])) { $this->formOutput(); } elseif ($this->formComplete()) { - $this->success(); - //$this->formOutput(true); + // check captcha + $captcha = @$_POST['ct_captcha']; + $capId = @$_POST['captcha_id']; + $securimage = new Securimage(); + if ($securimage->check($captcha, $capId, true) == false) { + echo '
' . mi18n("Ihr Captcha Code war nicht korrekt. Bitte versuchen Sie es erneut.") . '
'; + $this->formOutput(true); + } else { + $this->success(); + } } else { $this->formOutput(true); }