improved form comments

This commit is contained in:
Jesús 2020-04-26 12:19:50 -05:00
parent f8a757b7f9
commit 5e2b848760
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766
4 changed files with 67 additions and 48 deletions

View File

@ -2,7 +2,7 @@
* bulma css framework (github.com/jgthms | bulma.io) * bulma css framework (github.com/jgthms | bulma.io)
* Author: jeremy thomas * Author: jeremy thomas
* Author: jesus e. * Author: jesus e.
* Version: 1.0.5 * Version: 1.0.5a
* Licensed under MIT (https://github.com/jgthms/bulma/blob/master/LICENSE) * Licensed under MIT (https://github.com/jgthms/bulma/blob/master/LICENSE)
*/ */
/* basic formatting changes (mostly to cater for darker colours) */ /* basic formatting changes (mostly to cater for darker colours) */
@ -529,6 +529,10 @@ h2 > a:hover {
box-shadow: 0 1px 3px rgba(10, 10, 10, 0.1); box-shadow: 0 1px 3px rgba(10, 10, 10, 0.1);
} }
.warning-sp {
display: none;
}
.comments-content { .comments-content {
background-color: #161c1c; background-color: #161c1c;
padding-bottom: 10px; padding-bottom: 10px;

View File

@ -45,7 +45,7 @@
<!-- stylesheets --> <!-- stylesheets -->
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/bulma.css?v=0.7.4"/> <link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/bulma.css?v=0.7.4"/>
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/hover.css"/> <link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/hover.css"/>
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/style.css?v=1.0.5"/> <link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/style.css?v=1.0.5a"/>
<!-- favicon --> <!-- favicon -->
<link rel="icon" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/cl-favicon-16x16.png" sizes="16x16"/> <link rel="icon" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/cl-favicon-16x16.png" sizes="16x16"/>
<link rel="icon" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/cl-favicon-32x32.png" sizes="32x32"/> <link rel="icon" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/cl-favicon-32x32.png" sizes="32x32"/>

View File

@ -65,6 +65,13 @@
</div> </div>
</div> </div>
<div class="warning-sp">
<div class="field-label is-normal">
<label for="empty">{{ _('Deja esto vacío:') }}</label>
</div>
<input id="empty" type="text" name="url" />
</div>
<div class="field is-horizontal"> <div class="field is-horizontal">
<div class="field-label is-normal"> <div class="field-label is-normal">
<label class="has-text-white" for="comment">{{ _('Comentario') }}</label> <label class="has-text-white" for="comment">{{ _('Comentario') }}</label>

View File

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