remove some magic

This commit is contained in:
Jean-Christian Paul Denis 2023-04-07 23:58:34 +02:00
parent c9abe4063d
commit acbabf5b18
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -43,17 +43,17 @@ class Utils
$i = 0; $i = 0;
while ($rs->fetch()) { while ($rs->fetch()) {
$user = dcCore::app()->con->select( $user = dcCore::app()->con->select(
'SELECT * FROM ' . dcCore::app()->prefix . dcAuth::USER_TABLE_NAME . " WHERE user_id='" . $rs->user_id . "' " 'SELECT * FROM ' . dcCore::app()->prefix . dcAuth::USER_TABLE_NAME . " WHERE user_id='" . $rs->f('user_id') . "' "
); );
if ($user->isEmpty()) { if ($user->isEmpty()) {
continue; continue;
} }
$author = dcUtils::getUserCN( $author = dcUtils::getUserCN(
$user->user_id, $user->f('user_id'),
$user->user_name, $user->f('user_name'),
$user->user_firstname, $user->f('user_firstname'),
$user->user_displayname $user->f('user_displayname')
); );
if (empty($author)) { if (empty($author)) {
continue; continue;
@ -62,18 +62,18 @@ class Utils
$i++; $i++;
if (dcCore::app()->blog->settings->get('authormode')->get('authormode_active')) { if (dcCore::app()->blog->settings->get('authormode')->get('authormode_active')) {
$res[$i]['author_link'] = '<a href="' . $res[$i]['author_link'] = '<a href="' .
dcCore::app()->blog->url . dcCore::app()->url->getBase('author') . '/' . $user->user_id . '" ' . dcCore::app()->blog->url . dcCore::app()->url->getBase('author') . '/' . $user->f('user_id') . '" ' .
'title="' . __('Author posts') . '">' . $author . '</a>'; 'title="' . __('Author posts') . '">' . $author . '</a>';
} elseif ($user->user_url) { } elseif ($user->f('user_url')) {
$res[$i]['author_link'] = '<a href="' . $user->user_url . '" title="' . $res[$i]['author_link'] = '<a href="' . $user->f('user_url') . '" title="' .
__('Author link') . '">' . $author . '</a>'; __('Author link') . '">' . $author . '</a>';
} }
$res[$i]['author'] = $author; $res[$i]['author'] = $author;
if ($rs->count == 0) { if ((int) $rs->f('count') == 0) {
$res[$i]['count'] = __('no entries'); $res[$i]['count'] = __('no entries');
} else { } else {
$res[$i]['count'] = sprintf(__('one entry', '%s entries', (int) $rs->count), $rs->count); $res[$i]['count'] = sprintf(__('one entry', '%s entries', (int) $rs->f('count')), $rs->f('count'));
} }
} }
@ -112,26 +112,26 @@ class Utils
while ($rs->fetch()) { while ($rs->fetch()) {
$user = dcCore::app()->con->select( $user = dcCore::app()->con->select(
'SELECT * FROM ' . dcCore::app()->prefix . dcBlog::COMMENT_TABLE_NAME . ' ' . 'SELECT * FROM ' . dcCore::app()->prefix . dcBlog::COMMENT_TABLE_NAME . ' ' .
"WHERE comment_email='" . $rs->comment_email . "' " . "WHERE comment_email='" . $rs->f('comment_email') . "' " .
'ORDER BY comment_dt DESC' 'ORDER BY comment_dt DESC'
); );
if (!$user->comment_author) { if (!$user->f('comment_author')) {
continue; continue;
} }
$i++; $i++;
if ($user->comment_site) { if ($user->f('comment_site')) {
$res[$i]['author_link'] = '<a href="' . $user->comment_site . '" title="' . $res[$i]['author_link'] = '<a href="' . $user->f('comment_site') . '" title="' .
__('Author link') . '">' . $user->comment_author . '</a>'; __('Author link') . '">' . $user->f('comment_author') . '</a>';
} }
$res[$i]['author'] = $user->comment_author; $res[$i]['author'] = $user->f('comment_author');
if ($rs->count == 0) { if ((int) $rs->f('count') == 0) {
$res[$i]['count'] = __('no comments'); $res[$i]['count'] = __('no comments');
} else { } else {
$res[$i]['count'] = sprintf(__('one comment', '%s comments', (int) $rs->count), $rs->count); $res[$i]['count'] = sprintf(__('one comment', '%s comments', (int) $rs->f('count')), $rs->f('count'));
} }
} }