本文整理汇总了PHP中cmsUser::isRateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::isRateUser方法的具体用法?PHP cmsUser::isRateUser怎么用?PHP cmsUser::isRateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::isRateUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPosts
public function getPosts()
{
$inUser = cmsUser::getInstance();
$sql = "SELECT p.id, p.thread_id, p.user_id, p.pubdate, p.editdate, p.edittimes, p.rating, p.attach_count, p.content_html, p.pinned,\r\n u.nickname, u.login, u.is_deleted, u.logdate, u.status,\r\n up.imageurl, up.signature_html, up.city, up.karma, g.access as group_access, g.is_admin {$this->inDB->select}\r\n FROM cms_forum_posts p\r\n {$this->inDB->join}\r\n LEFT JOIN cms_users u ON u.id = p.user_id\r\n LEFT JOIN cms_user_profiles up ON up.user_id = u.id\r\n LEFT JOIN cms_user_groups g ON u.group_id = g.id\r\n WHERE 1=1\r\n {$this->inDB->where}\r\n {$this->inDB->group_by}\r\n {$this->inDB->order_by} \n";
if ($this->inDB->limit) {
$sql .= "LIMIT {$this->inDB->limit}";
}
$result = $this->inDB->query($sql);
$this->inDB->resetConditions();
if (!$this->inDB->num_rows($result)) {
return array();
}
while ($post = $this->inDB->fetch_assoc($result)) {
$post['fpubdate'] = cmsCore::dateFormat($post['pubdate']);
$post['wday'] = cmsCore::dateToWday($post['pubdate']);
$post['peditdate'] = cmsCore::dateFormat($post['editdate'], true, true);
$post['post_count'] = $this->getUserPostsCount($post['user_id']);
$post['avatar_url'] = cmsUser::getUserAvatarUrl($post['user_id'], 'small', $post['imageurl'], $post['is_deleted']);
$post['flogdate'] = cmsUser::getOnlineStatus($post['user_id'], $post['logdate']);
$post['userrank'] = $this->getForumUserRank($post);
$post['user_awards'] = cmsUser::getAwardsList($post['user_id']);
$post['attached_files'] = $this->config['fa_on'] && $post['attach_count'] ? $this->getPostAttachments($post['id']) : array();
$end_min = $this->checkEditTime($post['pubdate']);
$post['is_author'] = $post['user_id'] == cmsUser::getInstance()->id;
$post['is_author_can_edit'] = (is_bool($end_min) ? $end_min : $end_min > 0) && $post['is_author'];
if ($inUser->id) {
$post['is_voted'] = $post['is_author'] ? true : cmsUser::isRateUser('forum_post', $inUser->id, $post['id']);
} else {
$post['is_voted'] = true;
}
$posts[] = $post;
}
$this->resetAbstractArray();
return cmsCore::callEvent('GET_FORUM_POSTS', $posts);
}
示例2: getComments
/**
* Получаем комментарии по заданным параметрам
* @return array
*/
public function getComments($only_published = true, $is_tree = false, $from_module = false)
{
$inUser = cmsUser::getInstance();
$comments = array();
global $_LANG;
$published = $only_published ? 'c.published = 1' : '1=1';
$sql = "SELECT c.*,\r\n\t\t\t\t\t IFNULL(u.nickname, 0) as nickname,\r\n\t\t\t\t\t IFNULL(u.login, 0) as login,\r\n\t\t\t\t\t IFNULL(u.is_deleted, 0) as is_deleted,\r\n\t\t\t\t\t IFNULL(p.imageurl, 0) as imageurl,\r\n\t\t\t\t\t IFNULL(p.gender, 0) as gender\r\n FROM cms_comments c\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = c.user_id\r\n\t\t\t\tLEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n WHERE {$published}\r\n\t\t\t\t\t{$this->inDB->where}\r\n\r\n {$this->inDB->group_by}\r\n\r\n {$this->inDB->order_by}\n";
if ($this->inDB->limit) {
$sql .= "LIMIT {$this->inDB->limit}";
}
$result = $this->inDB->query($sql);
$this->inDB->resetConditions();
if (!$this->inDB->num_rows($result)) {
return array();
}
while ($comment = $this->inDB->fetch_assoc($result)) {
$comment['level'] = 0;
$comment['is_editable'] = $this->isEditable($comment['pubdate']);
$comment['fpubdate'] = cmsCore::dateFormat($comment['pubdate'], true, true);
if ($comment['guestname']) {
$comment['author'] = $comment['guestname'];
$comment['is_profile'] = false;
$comment['ip'] = in_array($this->config['cmm_ip'], array(1, 2)) ? $comment['ip'] : '';
} else {
$comment['author']['nickname'] = $comment['nickname'];
$comment['author']['login'] = $comment['login'];
$comment['is_profile'] = true;
$comment['user_image'] = cmsUser::getUserAvatarUrl($comment['user_id'], 'small', $comment['imageurl'], $comment['is_deleted']);
$comment['ip'] = $this->config['cmm_ip'] == 2 && $comment['ip'] ? $comment['ip'] : '';
}
switch ($comment['gender']) {
case 'm':
$comment['gender'] = $_LANG['COMMENTS_MALE'];
break;
case 'f':
$comment['gender'] = $_LANG['COMMENTS_FEMALE'];
break;
default:
$comment['gender'] = $_LANG['COMMENTS_GENDER'];
}
$comment['show'] = !$this->config['min_karma'] || $comment['rating'] >= $this->config['min_karma_show'] || cmsUser::userIsAdmin($comment['user_id']);
$comment['is_my'] = $inUser->id == $comment['user_id'];
if ($inUser->id) {
$comment['is_voted'] = $comment['is_my'] ? true : cmsUser::isRateUser('comment', $inUser->id, $comment['id']);
} else {
$comment['is_voted'] = true;
}
$comments[] = $comment;
}
if ($is_tree) {
$comments = $this->buildTree(0, 0, $comments);
}
return $from_module ? cmsCore::callEvent('GET_COMMENTS_MODULE', $comments) : cmsCore::callEvent('GET_COMMENTS', $comments);
}