aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--comments.php22
-rw-r--r--include/functions_comment.inc.php17
-rw-r--r--template/yoga/comment_list.tpl6
3 files changed, 9 insertions, 36 deletions
diff --git a/comments.php b/comments.php
index 3570a6e53..d1609fdea 100644
--- a/comments.php
+++ b/comments.php
@@ -87,7 +87,7 @@ if (isset($_GET['items_number']))
{
$page['items_number'] = $_GET['items_number'];
}
-if ( !is_numeric($page['items_number']) and $page['items_number']!='all' )
+if ( !is_numeric($page['items_number']) and $page['items_number']!='all' )
{
$page['items_number'] = 10;
}
@@ -271,8 +271,6 @@ SELECT COUNT(DISTINCT(com.id))
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
INNER JOIN '.COMMENTS_TABLE.' AS com
ON ic.image_id = com.image_id
- LEFT JOIN '.USERS_TABLE.' As u
- ON u.'.$conf['user_fields']['id'].' = com.author_id
WHERE '.implode('
AND ', $page['where_clauses']).'
;';
@@ -304,15 +302,12 @@ SELECT com.id AS comment_id
, ic.category_id
, com.author
, com.author_id
- , '.$conf['user_fields']['username'].' AS username
, com.date
, com.content
, com.validated
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
INNER JOIN '.COMMENTS_TABLE.' AS com
ON ic.image_id = com.image_id
- LEFT JOIN '.USERS_TABLE.' AS u
- ON u.'.$conf['user_fields']['id'].' = com.author_id
WHERE '.implode('
AND ', $page['where_clauses']).'
GROUP BY comment_id
@@ -378,25 +373,12 @@ SELECT id, name, permalink, uppercats
)
);
- if (!empty($comment['author']))
- {
- $author = $comment['author'];
- if ($author == 'guest')
- {
- $author = l10n('guest');
- }
- }
- else
- {
- $author = $comment['username'];
- }
-
$tpl_comment =
array(
'U_PICTURE' => $url,
'TN_SRC' => $thumbnail_src,
'ALT' => $name,
- 'AUTHOR' => trigger_event('render_comment_author', $author),
+ 'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
'DATE'=>format_date($comment['date'], true),
'CONTENT'=>trigger_event('render_comment_content',$comment['content']),
);
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php
index 9ebe2e317..e7fbec7b7 100644
--- a/include/functions_comment.inc.php
+++ b/include/functions_comment.inc.php
@@ -110,7 +110,7 @@ SELECT COUNT(*) AS user_exists
}
else
{
- $comm['author'] = '';
+ $comm['author'] = addslashes($user['username']);
$comm['author_id'] = $user['id'];
}
@@ -171,24 +171,15 @@ INSERT INTO '.COMMENTS_TABLE.'
$comm['id'] = mysql_insert_id();
if (($comment_action=='validate' and $conf['email_admin_on_comment']) or
- ($comment_action!='validate'
- and $conf['email_admin_on_comment_validation']))
+ ($comment_action!='validate' and $conf['email_admin_on_comment_validation']))
{
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
$del_url = get_absolute_root_url().'comments.php?delete='.$comm['id'];
- if (empty($comm['author']))
- {
- $author_name = $user['username'];
- }
- else
- {
- $author_name = stripslashes($comm['author']);
- }
$keyargs_content = array
(
- get_l10n_args('Author: %s', $author_name),
+ get_l10n_args('Author: %s', stripslashes($comm['author']) ),
get_l10n_args('Comment: %s', stripslashes($comm['content']) ),
get_l10n_args('', ''),
get_l10n_args('Delete: %s', $del_url)
@@ -205,7 +196,7 @@ INSERT INTO '.COMMENTS_TABLE.'
pwg_mail_notification_admins
(
- get_l10n_args('Comment by %s', $author_name),
+ get_l10n_args('Comment by %s', stripslashes($comm['author']) ),
$keyargs_content
);
}
diff --git a/template/yoga/comment_list.tpl b/template/yoga/comment_list.tpl
index 5586c0f2a..fbb8ad7b0 100644
--- a/template/yoga/comment_list.tpl
+++ b/template/yoga/comment_list.tpl
@@ -10,7 +10,7 @@
</a>
</div>
{/if}
- <div class="description" style="height:{if ($comment.IN_EDIT==1)}200{/if}px">
+ <div class="description" style="height:{if isset($comment.IN_EDIT)}200{/if}px">
{if isset($comment.U_DELETE) or isset($comment.U_VALIDATE) or isset($comment.U_EDIT) }
<ul class="actions" style="float:right">
{if isset($comment.U_DELETE)}
@@ -20,7 +20,7 @@
</a>
</li>
{/if}
- {if isset($comment.U_EDIT) and ($comment.IN_EDIT!=1)}
+ {if isset($comment.U_EDIT) and !isset($comment.IN_EDIT)}
<li>
<a class="editComment" href="{$comment.U_EDIT}#edit_comment" title="{'edit this comment'|@translate}">
<img src="{$ROOT_URL}{$themeconf.icon_dir}/edit.png" class="button" alt="[edit]">
@@ -37,7 +37,7 @@
</ul>
{/if}
<span class="author">{$comment.AUTHOR}</span> - <span class="date">{$comment.DATE}</span>
- {if ($comment.IN_EDIT==1)}
+ {if isset($comment.IN_EDIT)}
<a name="edit_comment"></a>
<form method="post" action="{$comment.U_EDIT}" class="filter" id="editComment">
<fieldset>