private function validarFormulario($vo) { if (!Functions::isEmpty($vo->getId()) && !is_numeric($vo->getId())) { return 'N' . 'Valor para "ID" é inválido'; } else { if (Functions::isEmpty($vo->getNome())) { return 'N' . 'Informe o campo "Nome"'; } else { if (Functions::isEmpty($vo->getEmail())) { return 'N' . 'Informe o campo "E-mail"'; } else { if (!Functions::isEmail($vo->getEmail())) { return 'N' . 'Valor para "E-mail" é inválido'; } else { if (Functions::isEmpty($vo->getPerfil()->getId())) { return 'N' . 'Informe o campo "Perfil"'; } else { if (!Functions::isInteger($vo->getPerfil()->getId())) { return 'N' . 'Valor para "Perfil" é inválido'; } else { if (!Functions::isEmpty($vo->getSituacao()) && !is_numeric($vo->getSituacao())) { return 'N' . 'Valor para "Situação" é inválido'; } else { return 'S' . 'Operação realizada com sucesso'; } } } } } } } }
function init($servlet, $request = array()) { if (isset($_POST["action"]) && strcmp("send", strtolower($_POST["action"])) == 0) { //$privatekey = "6LfMk_YSAAAAAMIox5-yFggxrvwUmNH-gsiqROQO"; //$resp_captcha = recaptcha_check_answer ($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]); //if(!$resp_captcha->is_valid)$error[]="Le code CAPTCHA ne correspond pas au code affiché sur l'image"; $input = "name"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Nom doit être remplir"; } $input = "email"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Email doit être remplir"; } elseif (isset($_POST[$input]) && !Functions::isEmail($_POST[$input])) { $error[] = "Format email non valide"; } $input = "subject"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Sujet doit être remplir"; } $input = "message"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Message doit être remplir"; } if (!isset($error)) { $contact = Models::getMessageObject(); // if($contact->add($_POST["name"],$_POST["email"],$_POST["subject"],$_POST["message"])){ if (true) { $hdrs = array('to' => $_POST["email"], 'from' => $_POST["email"], 'subject' => 'Arenalub contact : ' . $_POST["subject"]); $values = array("%%NAME%%" => $_POST["name"], "%%SUBJECT%%" => $_POST["subject"], "%%EMAIL%%" => $_POST["email"], "%%MESSAGE%%" => $_POST["message"], "%%DATE%%" => date("d/m/Y à H:i"), "%%FOOTER%%" => Functions::getPublicFile("../servlet/files/mail.footer.html")); $servlet->html->setCommonArray($values); $mail = Functions::getMailObject($hdrs); $message = $servlet->html->getFilteredText(Functions::getPublicFile("../servlet/files/mail.html")); $mail->setMessage($_POST["message"]); if (!$mail->send()) { $error = "Message ajouté avec succée que le mail n'est pas envoyé"; } else { $error = "no"; } //unset($_POST); } else { $error = "Erreur Technique : votre message ne peut pas être soumettre, veuillez réessayer plus tard :("; } } } return isset($error) ? $error : false; }
function init($request = array()) { if (isset($_POST["action"]) && strcmp("send", strtolower($_POST["action"])) == 0) { //$privatekey = "6LfMk_YSAAAAAMIox5-yFggxrvwUmNH-gsiqROQO"; //$resp_captcha = recaptcha_check_answer ($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]); //if(!$resp_captcha->is_valid)$error[]="Le code CAPTCHA ne correspond pas au code affiché sur l'image"; $input = "name"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Nom doit être remplir"; } $input = "email"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Email doit être remplir"; } elseif (isset($_POST[$input]) && !Functions::isEmail($_POST[$input])) { $error[] = "Format email non valide"; } $input = "subject"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Sujet doit être remplir"; } $input = "message"; if (!isset($_POST[$input]) || isset($_POST[$input]) && empty($_POST[$input])) { $error[] = "(*) Message doit être remplir"; } if (!isset($error)) { $contact = Models::getMessageObject(); if ($contact->add($_POST["name"], $_POST["email"], $_POST["subject"], $_POST["message"])) { $error = "no"; unset($_POST); } else { $error = "Erreur Technique : votre message ne peut pas être soumettre, veuillez réessayer plus tard :("; } } } return isset($error) ? $error : false; }
private function validarFormulario($connection, $email, $senha) { if (Functions::isEmpty($email)) { return 'N' . 'Informe o campo "E-mail"'; } else { if (!Functions::isEmpty($email) && !Functions::isEmail($email)) { return 'N' . 'Valor para "E-mail" é inválido'; } else { if (Functions::isEmpty($senha)) { return 'N' . 'Informe o campo "Senha"'; } else { $vo = $this->efetuarLogin($connection, $email, $senha); if (Functions::isEmpty($vo->getId())) { return 'N' . 'Credenciais de acesso inválidas'; } else { return 'S' . 'Operação realizada com sucesso'; } } } } }