diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/vendor/form-comments/commentsubmit.php | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/content/vendor/form-comments/commentsubmit.php b/content/vendor/form-comments/commentsubmit.php index e10f72b..d2be0e0 100644 --- a/content/vendor/form-comments/commentsubmit.php +++ b/content/vendor/form-comments/commentsubmit.php @@ -16,54 +16,56 @@ function seourl($string) { return $string; } -// Check for empty fields -if(empty($_POST['name']) || - empty($_POST['comment']) || - empty($_POST['email']) || - !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) -) -{ - // Rediret to current post - header( "Location: {$return_url}"); -} else { +// if the url field is empty +if(isset($_POST['url']) && $_POST['url'] == '') { + // Check for empty fields + if(empty($_POST['name']) || + empty($_POST['comment']) || + empty($_POST['email']) || + !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) + ) + { + // Rediret to current post + header( "Location: {$return_url}"); + } else { - $DATE_FORMAT = "Y-m-d H:i:s"; - $publish = date($DATE_FORMAT); + $DATE_FORMAT = "Y-m-d H:i:s"; + $publish = date($DATE_FORMAT); - $name = strip_tags(utf8_decode(utf8_encode($_POST['name']))); - $link = strip_tags(htmlspecialchars($_POST['link'])); - $email_address = strip_tags(htmlspecialchars($_POST['email'])); - $comment = utf8_decode($_POST['comment']); + $name = strip_tags(utf8_decode(utf8_encode($_POST['name']))); + $link = strip_tags(htmlspecialchars($_POST['link'])); + $email_address = strip_tags(htmlspecialchars($_POST['email'])); + $comment = utf8_decode($_POST['comment']); - // article - $postID = str_replace('/','',$post_id); + // article + $postID = str_replace('/','',$post_id); - // web-site - if (!empty($link)) { - $web = "Web: {$link}"; - } else { - $web = NULL; - } + // web-site + if (!empty($link)) { + $web = "Web: {$link}"; + } else { + $web = NULL; + } - //slug - $nslug = seourl($name); - $fslug = date("Ymd-H:i:s"); - $slug = "$nslug-$fslug"; + //slug + $nslug = seourl($name); + $fslug = date("Ymd-H:i:s"); + $slug = "$nslug-$fslug"; - // Create the email and send the message - // Add your email address - $local_address = "heckyel@riseup.net"; - $recipients = array( - $local_address, - $email_address, - // more emails - ); - $to = implode(',', $recipients); - $email_subject = <<<EOT + // Create the email and send the message + // Add your email address + $local_address = "heckyel@riseup.net"; + $recipients = array( + $local_address, + $email_address, + // more emails + ); + $to = implode(',', $recipients); + $email_subject = <<<EOT [conocimientoslibres.tuxfamily.org] Mensaje de {$name} EOT; - $email_body = <<<EOT + $email_body = <<<EOT Nuevo comentario del formulario de conocimientoslibres.tuxfamily.org Aqui estan los detalles:\n post_id: {$postID} @@ -77,11 +79,17 @@ Slug: {$slug} Responde este mensaje para eliminar el comentario. EOT; - $headers = "From: noreply@conocimientoslibres.tuxfamily.org\n"; // Using something like noreply@yourdomain.com. - $headers .= "Reply-To: $local_address"; - mail($to,$email_subject,utf8_decode($email_body),$headers); + $headers = "From: noreply@conocimientoslibres.tuxfamily.org\n"; // Using something like noreply@yourdomain.com. + $headers .= "Reply-To: $local_address"; + mail($to,$email_subject,utf8_decode($email_body),$headers); - // Rediret to current post + // Rediret to current post + header("Refresh: 10; URL={$return_url}"); + printf('Hurra! %s su comentario se envió correctamente, +volviendo a la web en 10 segundos...', $name); + } +} else { + // woow! header("Refresh: 10; URL={$return_url}"); printf('Hurra! %s su comentario se envió correctamente, volviendo a la web en 10 segundos...', $name); |