Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ DirectoryIndex index.php
<IfModule mod_rewrite.c>

RewriteEngine on


# rule needed for sysmessages
RewriteRule ^(.*/)?system/resources/js/sysmessages-set\.js$ $1system/resources/php/sysmessages.php [L]

# Uncomment the following to redirect all visitors to the https version
# RewriteCond %{HTTPS} off
# RewriteRUle (.*) https://www.example.com/$1 [R=301,L]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ e.g. `www.yoursite.com/login`

- Homepage: [HTMLy Homepage](https://www.htmly.com/)
- Documentation: [HTMLy Docs](https://docs.htmly.com/)
- Comment system: [HTMLy Comment System Docs](https://github.com/danpros/htmly/blob/master/system/includes/comments_readme.md)
- Themes: [HTMLy Themes](https://www.htmly.com/theme/)
- Demo: [HTMLy Demo](http://demo.htmly.com/)
- Repository: [Github](https://github.com/danpros/htmly/)
Expand Down
30 changes: 30 additions & 0 deletions lang/en_US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,33 @@ backtotop = "Back to top"
subpages = "Sub pages"
getstarted = "Get started"
onthispage = "On this page"
enable_jstime="Enable Javascript and timestamp anti-spam protection"
jstime_desc="Usually bots dont't use Javascript. Form also checks if submitted between 3 and 600 seconds (preventing bots fast submission)"
comment_email_admin_awaiting="New comment awaiting moderation"
comment_email_admin_new="New comment"
comment_email_subscription_subject = "Subscription confirmation to"
comment_email_new = "New comment on"
comment_email_from = "From"
comment_email_moderate = "Moderate comments"
comment_email_new_subscribed = "New reply on a subscribed thread"
comment_email_new_replied = "Someone replied to your comment on"
comment_email_view_comment = "View comment"
comment_subscribe_confirmation = "Subscription confirmation to"
comment_subscribe_thread = "Thread subscription at"
comment_subscribe_request = "We received a subscription request to a thread at"
comment_subscribe_never_requested = "If you never visited the site or requested to be notified on thread messages, please ignore this email."
comment_subscribe_click = "Click"
comment_subscribe_here = "HERE"
comment_subscribe_confirm_message = "to confirm your subscription and start receiving notification emails on replies on the thread."
comment_subscribe_unsubscribe_message = "You can unsubscribe all notifications from"
comment_subscribe_unsubscribe_anytime = "at any time using this link"
comment_unsubscribe = "unsubscribe"
sysmsg_subscribe_success = "Your will receive now new comment notifications on the subscribed threads."
sysmsg_subscribe_fail = "Something went wrong during subscription verification process."
sysmsg_unsubscribe_success = "You have successfully unsubscribed from notification emails."
sysmsg_unsubscribe_fail = "Something wrong during unsubscription process"


posts_not_found = "Posts not found!"
page_not_found = "Page not found!"

65 changes: 28 additions & 37 deletions system/admin/views/comments.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,18 @@

<?php elseif ($tab === 'settings'): ?>
<!-- Settings Form -->
<form method="POST" action="<?php echo site_url(); ?>admin/comments/settings">
<form method="POST">
<input type="hidden" name="csrf_token" value="<?php echo get_csrf(); ?>">

<!-- // removed by Emidio 20251105
<div class="alert alert-info">
<strong><?php echo i18n('Note'); ?>:</strong> <?php echo i18n('Enable_comments_in_main_config'); ?>
<br>
<code>config/config.ini</code> → <code>comment.system = "local"</code>
</div>
-->

<h4><?php echo i18n('General_Settings');?></h4>
<hr>

<div class="form-group row">
<label class="col-sm-3 col-form-label"><?php echo i18n('Comment_Moderation');?></label>
<div class="col-sm-9">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="comments.moderation" value="true"
<?php echo comments_config('comments.moderation') === 'true' ? 'checked' : ''; ?>>
<input type="checkbox" class="form-check-input" name="-config-comments.moderation" value="true"
<?php echo config('comments.moderation') === 'true' ? 'checked' : ''; ?>>
<label class="form-check-label"><?php echo i18n('Require_admin_approval');?></label>
</div>
<small class="form-text text-muted"><?php echo i18n('Comments_moderation_desc');?></small>
Expand All @@ -157,15 +149,15 @@
<label class="col-sm-3 col-form-label"><?php echo i18n('Anti_Spam_Protection');?></label>
<div class="col-sm-9">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="comments.honeypot" value="true"
<?php echo comments_config('comments.honeypot') === 'true' ? 'checked' : ''; ?>>
<input type="checkbox" class="form-check-input" name="-config-comments.honeypot" value="true"
<?php echo config('comments.honeypot') === 'true' ? 'checked' : ''; ?>>
<label class="form-check-label"><?php echo i18n('Enable_honeypot');?></label>
</div>
<small class="form-text text-muted"><?php echo i18n('Honeypot_desc');?></small>

<div class="form-check">
<input type="checkbox" class="form-check-input" name="comments.jstime" value="true"
<?php echo comments_config('comments.jstime') === 'true' ? 'checked' : ''; ?>>
<input type="checkbox" class="form-check-input" name="-config-comments.jstime" value="true"
<?php echo config('comments.jstime') === 'true' ? 'checked' : ''; ?>>
<label class="form-check-label"><?php echo i18n('Enable_jstime');?></label>
</div>
<small class="form-text text-muted"><?php echo i18n('Jstime_desc');?></small>
Expand All @@ -179,8 +171,8 @@
<label class="col-sm-3 col-form-label"><?php echo i18n('Enable_Notifications');?></label>
<div class="col-sm-9">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="comments.notify" value="true"
<?php echo comments_config('comments.notify') === 'true' ? 'checked' : ''; ?>>
<input type="checkbox" class="form-check-input" name="-config-comments.notify" value="true"
<?php echo config('comments.notify') === 'true' ? 'checked' : ''; ?>>
<label class="form-check-label"><?php echo i18n('Send_email_notifications');?></label>
</div>
</div>
Expand All @@ -189,8 +181,8 @@
<div class="form-group row">
<label for="admin-email" class="col-sm-3 col-form-label"><?php echo i18n('Admin_Email');?></label>
<div class="col-sm-9">
<input type="email" class="form-control" id="admin-email" name="comments.admin.email"
value="<?php echo _h(comments_config('comments.admin.email')); ?>"
<input type="email" class="form-control" id="admin-email" name="-config-comments.admin.email"
value="<?php echo _h(config('comments.admin.email')); ?>"
placeholder="admin@example.com">
<small class="form-text text-muted"><?php echo i18n('Admin_email_desc');?></small>
</div>
Expand All @@ -203,8 +195,8 @@
<label class="col-sm-3 col-form-label"><?php echo i18n('Enable_SMTP');?></label>
<div class="col-sm-9">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="comments.mail.enabled" value="true"
<?php echo comments_config('comments.mail.enabled') === 'true' ? 'checked' : ''; ?>>
<input type="checkbox" class="form-check-input" name="-config-comments.mail.enabled" value="true"
<?php echo config('comments.mail.enabled') === 'true' ? 'checked' : ''; ?>>
<label class="form-check-label"><?php echo i18n('Enable_SMTP_for_emails');?></label>
</div>
</div>
Expand All @@ -213,17 +205,17 @@
<div class="form-group row">
<label for="mail-host" class="col-sm-3 col-form-label"><?php echo i18n('SMTP_Host');?></label>
<div class="col-sm-9">
<input type="text" class="form-control" id="mail-host" name="comments.mail.host"
value="<?php echo _h(comments_config('comments.mail.host')); ?>"
<input type="text" class="form-control" id="mail-host" name="-config-comments.mail.host"
value="<?php echo _h(config('comments.mail.host')); ?>"
placeholder="smtp.gmail.com">
</div>
</div>

<div class="form-group row">
<label for="mail-port" class="col-sm-3 col-form-label"><?php echo i18n('SMTP_Port');?></label>
<div class="col-sm-9">
<input type="number" class="form-control" id="mail-port" name="comments.mail.port"
value="<?php echo _h(comments_config('comments.mail.port')); ?>"
<input type="number" class="form-control" id="mail-port" name="-config-comments.mail.port"
value="<?php echo _h(config('comments.mail.port')); ?>"
placeholder="587">
<small class="form-text text-muted">587 (TLS) or 465 (SSL)</small>
</div>
Expand All @@ -232,45 +224,45 @@
<div class="form-group row">
<label for="mail-encryption" class="col-sm-3 col-form-label"><?php echo i18n('Encryption');?></label>
<div class="col-sm-9">
<select class="form-control" id="mail-encryption" name="comments.mail.encryption">
<option value="tls" <?php echo comments_config('comments.mail.encryption') === 'tls' ? 'selected' : ''; ?>>TLS</option>
<option value="ssl" <?php echo comments_config('comments.mail.encryption') === 'ssl' ? 'selected' : ''; ?>>SSL</option>
<select class="form-control" id="mail-encryption" name="-config-comments.mail.encryption">
<option value="tls" <?php echo config('comments.mail.encryption') === 'tls' ? 'selected' : ''; ?>>TLS</option>
<option value="ssl" <?php echo config('comments.mail.encryption') === 'ssl' ? 'selected' : ''; ?>>SSL</option>
</select>
</div>
</div>

<div class="form-group row">
<label for="mail-username" class="col-sm-3 col-form-label"><?php echo i18n('SMTP_Username');?></label>
<div class="col-sm-9">
<input type="text" class="form-control" id="mail-username" name="comments.mail.username"
value="<?php echo _h(comments_config('comments.mail.username')); ?>"
<input type="text" class="form-control" id="mail-username" name="-config-comments.mail.username"
value="<?php echo _h(config('comments.mail.username')); ?>"
placeholder="your-email@gmail.com">
</div>
</div>

<div class="form-group row">
<label for="mail-password" class="col-sm-3 col-form-label"><?php echo i18n('SMTP_Password');?></label>
<div class="col-sm-9">
<input type="password" class="form-control" id="mail-password" name="comments.mail.password"
value="<?php echo _h(comments_config('comments.mail.password')); ?>"
<input type="password" class="form-control" id="mail-password" name="-config-comments.mail.password"
value="<?php echo _h(config('comments.mail.password')); ?>"
placeholder="<?php echo i18n('Enter_password');?>">
</div>
</div>

<div class="form-group row">
<label for="mail-from-email" class="col-sm-3 col-form-label"><?php echo i18n('From_Email');?></label>
<div class="col-sm-9">
<input type="email" class="form-control" id="mail-from-email" name="comments.mail.from.email"
value="<?php echo _h(comments_config('comments.mail.from.email')); ?>"
<input type="email" class="form-control" id="mail-from-email" name="-config-comments.mail.from.email"
value="<?php echo _h(config('comments.mail.from.email')); ?>"
placeholder="noreply@example.com">
</div>
</div>

<div class="form-group row">
<label for="mail-from-name" class="col-sm-3 col-form-label"><?php echo i18n('From_Name');?></label>
<div class="col-sm-9">
<input type="text" class="form-control" id="mail-from-name" name="comments.mail.from.name"
value="<?php echo _h(comments_config('comments.mail.from.name')); ?>"
<input type="text" class="form-control" id="mail-from-name" name="-config-comments.mail.from.name"
value="<?php echo _h(config('comments.mail.from.name')); ?>"
placeholder="<?php echo config('blog.title'); ?>">
</div>
</div>
Expand All @@ -291,7 +283,6 @@
<form method="POST" action="<?php echo site_url(); ?>admin/comments/update/<?php echo $editComment['file_encoded']; ?>/<?php echo $editComment['id']; ?>">
<input type="hidden" name="csrf_token" value="<?php echo get_csrf(); ?>">

<input type="hidden" name="url" value="<?php echo $editComment['url']; ?>">
<input type="hidden" name="file" value="<?php echo $editComment['file_encoded']; ?>">

<div class="form-group">
Expand Down
6 changes: 6 additions & 0 deletions system/admin/views/config-widget.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@
<input type="text" name="-config-social.youtube" class="form-control" id="social.youtube" value="<?php echo config('social.youtube');?>" placeholder="https://www.youtube.com/user/username">
</div>
</div>
<div class="form-group row">
<label for="social.whatsapp" class="col-sm-2 col-form-label">WhatsApp</label>
<div class="col-sm-10">
<input type="text" name="-config-social.whatsapp" class="form-control" id="social.whatsapp" value="<?php echo config('social.whatsapp');?>" placeholder="https://whatsapp.com/channel/id or https://wa.me/number">
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary"><?php echo i18n('Save_Config');?></button>
Expand Down
2 changes: 1 addition & 1 deletion system/admin/views/layout.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</ul>
</li>
<?php if ($role === 'editor' || $role === 'admin'):?>
<?php if (local()): ?>
<?php if (comments()): ?>
<li class="nav-item has-treeview menu-open">
<a href="#" class="nav-link">
<i class="nav-icon fa fa-comments"></i>
Expand Down
14 changes: 14 additions & 0 deletions system/configList.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
"social.tiktok",
"breadcrumb.home",
"comment.system",
"comments.moderation",
"comments.honeypot",
"comments.jstime",
"comments.notify",
"comments.admin.email",
"comments.mail.enabled",
"comments.mail.host",
"comments.mail.port",
"comments.mail.encryption",
"comments.mail.encryption",
"comments.mail.username",
"comments.mail.password",
"comments.mail.from.email",
"comments.mail.from.name",
"fb.appid",
"fb.num",
"fb.color",
Expand Down
22 changes: 6 additions & 16 deletions system/htmly.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
// Load theme settings
theme_settings();


// Handle comments subscribe/unsubscribe
handle_comments_subscription();


// The front page of the blog
get('/index', function () {

Expand Down Expand Up @@ -3243,23 +3248,8 @@
$config['comments.mail.password'] = $password;
}

// Debug: log to file (remove after debugging)
file_put_contents('content/comments-debug.log',
date('Y-m-d H:i:s') . "\n" .
"POST data: " . print_r($_POST, true) . "\n" .
"Config array: " . print_r($config, true) . "\n\n",
FILE_APPEND
);

$result = save_comments_config($config);

// Log result
file_put_contents('content/comments-debug.log',
"Save result: " . ($result ? "SUCCESS ($result bytes)" : "FAILED") . "\n" .
"File content after save:\n" . file_get_contents('config/comments.ini') . "\n\n",
FILE_APPEND
);

$redir = site_url() . 'admin/comments/settings';
header("location: $redir");
} else {
Expand Down Expand Up @@ -6072,7 +6062,7 @@

// Submit comment from public form
post('/comments/submit', function () {
if (!local()) {
if (!comments()) {
$redir = site_url();
header("location: $redir");
return;
Expand Down
Loading