Skip to content

Commit

Permalink
Comment Signatures now checks for postmode. Also uses common signatur…
Browse files Browse the repository at this point in the history
…e divider

For #1119

Some minor optimizations as well.
  • Loading branch information
eSilverStrike committed Apr 1, 2022
1 parent 351ba07 commit d188ff6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion public_html/layout/denim/comment/comment.thtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<!-- BEGIN comment_signature -->
<div class="comment-sig">
---<br{xhtml}>
{signature_divider_html}
{user_signature}
</div>
<!-- END comment_signature -->
Expand Down
2 changes: 1 addition & 1 deletion public_html/layout/denim_three/comment/comment.thtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<!-- BEGIN comment_signature -->
<div class="">
---<br{xhtml}>
{signature_divider_html}
{user_signature}
</div>
<!-- END comment_signature -->
Expand Down
2 changes: 1 addition & 1 deletion public_html/layout/modern_curve/comment/comment.thtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<!-- BEGIN comment_signature -->
<div class="comment-sig">
---<br{xhtml}>
{signature_divider_html}
{user_signature}
</div>
<!-- END comment_signature -->
Expand Down
2 changes: 0 additions & 2 deletions public_html/profiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ function contactemail($uid, $cc, $author, $authorEmail, $subject, $message)
$subject = GLText::stripTags($subject);
$subject = substr($subject, 0, strcspn($subject, "\r\n"));



// Create HTML and plaintext version of email
$t = COM_newTemplate(CTL_core_templatePath($_CONF['path_layout'] . 'emails/'));
$t->set_file(array('email_html' => 'contact-html.thtml'));
Expand Down
34 changes: 14 additions & 20 deletions system/lib-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function CMT_commentBar($sid, $title, $type, $order, $mode, $commentCode = 0)
function CMT_getComment(&$comments, $mode, $type, $order, $delete_option = false, $preview = false, $commentCode = 0,
$commentPage = 1)
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG03, $LANG_ADMIN, $MESSAGE, $_IMAGE_TYPE;
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG03, $LANG31, $LANG_ADMIN, $MESSAGE, $_IMAGE_TYPE;

$indent = 0; // begin with 0 indent
$retval = ''; // initialize return value
Expand Down Expand Up @@ -627,15 +627,14 @@ function CMT_getComment(&$comments, $mode, $type, $order, $delete_option = false

// Check for User Signature and add first
// Get signature of comment owner
if ($A['uid'] > 1) {
$sig = DB_getItem($_TABLES['users'], 'sig', "uid = {$A['uid']}");
if (!empty($sig)) {
$template->set_var('user_signature', COM_nl2br($sig));
$template->parse('comment_signature', 'comment_signature');
} else {
$template->set_var('user_signature', '');
$template->set_var('comment_signature', '');
}
if ($A['uid'] > 1 && !empty($A['sig'])) {
$template->set_var('signature_divider_html', $LANG31['sig_divider_html']);

// Converts to HTML, fixes links, and executes autotags
$sig_html = GLText::getDisplayText(stripslashes($A['sig']), $A['postmode'], GLTEXT_LATEST_VERSION);

$template->set_var('user_signature', $sig_html);
$template->parse('comment_signature', 'comment_signature');
} else {
$template->set_var('user_signature', '');
$template->set_var('comment_signature', '');
Expand Down Expand Up @@ -766,15 +765,15 @@ function CMT_userComments($sid, $title, $type = 'article', $order = '', $mode =
if ($cid) {
$count = 1;

$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, "
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, u.sig, u.postmode, "
. "UNIX_TIMESTAMP(c.date) AS nice_date "
. "FROM {$_TABLES['comments']} AS c, {$_TABLES['users']} AS u "
. "WHERE c.uid = u.uid AND c.cid = $pid AND type='{$type}'";
} else {
$count = DB_count($_TABLES['comments'],
array('sid', 'type'), array($sid, $type));

$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, "
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, u.sig, u.postmode, "
. "UNIX_TIMESTAMP(c.date) AS nice_date "
. "FROM {$_TABLES['comments']} AS c, {$_TABLES['users']} AS u "
. "WHERE c.uid = u.uid AND c.sid = '$sid' AND type='{$type}' "
Expand Down Expand Up @@ -802,7 +801,7 @@ function CMT_userComments($sid, $title, $type = 'article', $order = '', $mode =
$result = DB_query($q2);
list($count) = DB_fetchArray($result);

$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, c2.indent AS pindent, "
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, u.sig, u.postmode, c2.indent AS pindent, "
. "UNIX_TIMESTAMP(c.date) AS nice_date "
. "FROM {$_TABLES['comments']} AS c, {$_TABLES['comments']} AS c2, "
. "{$_TABLES['users']} AS u "
Expand All @@ -815,7 +814,7 @@ function CMT_userComments($sid, $title, $type = 'article', $order = '', $mode =
$count = DB_count($_TABLES['comments'],
array('sid', 'type'), array($sid, $type));

$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, 0 AS pindent, "
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, u.sig, u.postmode, 0 AS pindent, "
. "UNIX_TIMESTAMP(c.date) AS nice_date "
. "FROM {$_TABLES['comments']} AS c, {$_TABLES['users']} AS u "
. "WHERE c.sid = '$sid' AND c.uid = u.uid AND type='{$type}' "
Expand All @@ -829,7 +828,7 @@ function CMT_userComments($sid, $title, $type = 'article', $order = '', $mode =
$result = DB_query($q2);
list($count) = DB_fetchArray($result);

$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, c2.indent + 1 AS pindent, "
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, u.sig, u.postmode, c2.indent + 1 AS pindent, "
. "UNIX_TIMESTAMP(c.date) AS nice_date "
. "FROM {$_TABLES['comments']} AS c, {$_TABLES['comments']} AS c2, "
. "{$_TABLES['users']} AS u "
Expand Down Expand Up @@ -1027,11 +1026,6 @@ function CMT_commentForm($title, $comment, $sid, $pid, $type, $mode, $postMode,
}
}

$sig = '';
if ($uid > 1) {
$sig = DB_getItem($_TABLES['users'], 'sig', "uid = '$uid'");
}

// Note:
// $comment / $newComment is what goes into the preview / is
// actually stored in the database -> strip HTML
Expand Down

0 comments on commit d188ff6

Please sign in to comment.