本文整理汇总了PHP中qa_get_logged_in_points函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_get_logged_in_points函数的具体用法?PHP qa_get_logged_in_points怎么用?PHP qa_get_logged_in_points使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_get_logged_in_points函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qa_permit_check
function qa_permit_check($opt)
{
if (qa_opt($opt) == QA_PERMIT_POINTS) {
return qa_get_logged_in_points() >= qa_opt($opt . '_points');
}
return !qa_permit_value_error(qa_opt($opt), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags());
}
示例2: forbid_new_tag
function forbid_new_tag()
{
$q_edit = $this->template == 'ask' || isset($this->content['form_q_edit']);
$tag_prevent = qa_opt('tag_synonyms_prevent');
if ($q_edit && $tag_prevent) {
return qa_get_logged_in_points() < (int) qa_opt('tag_synonyms_rep') && qa_get_logged_in_level() < QA_USER_LEVEL_EXPERT;
}
return false;
}
示例3: logged_in
function logged_in()
{
qa_html_theme_base::logged_in();
if (qa_is_logged_in()) {
$userpoints = qa_get_logged_in_points();
$pointshtml = $userpoints == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html(number_format($userpoints)));
$this->output('<SPAN CLASS="qa-logged-in-points">', '(' . $pointshtml . ')', '</SPAN>');
}
}
示例4: logged_in
function logged_in()
{
if (qa_is_logged_in()) {
// output user avatar to login bar
$this->output('<div class="qa-logged-in-avatar">', QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true), '</div>');
}
qa_html_theme_base::logged_in();
if (qa_is_logged_in()) {
// adds points count after logged in username
$userpoints = qa_get_logged_in_points();
$pointshtml = $userpoints == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html(number_format($userpoints)));
$this->output('<span class="qa-logged-in-points">', '(' . $pointshtml . ')', '</span>');
}
}
示例5: set_duodaa_user
function set_duodaa_user()
{
$user = array();
$user['username'] = qa_get_logged_in_handle();
if (!$user['username']) {
//header("Content-type: text/html; charset=utf-8");
//unset($user['username']);
$user['nologin'] = 1;
$user['nologinzh'] = '没有登录';
//echo json_encode($user);
} else {
$user['nologin'] = 0;
$user['points'] = qa_get_logged_in_points();
}
return $user;
}
示例6: process_request
function process_request($request)
{
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
$appid = qa_opt('fb_app_id');
$secret = qa_opt('fb_app_secret');
$fb = new Facebook\Facebook(['app_id' => $appid, 'app_secret' => $secret, 'default_graph_version' => 'v2.4']);
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Facebook Sharing Page';
$helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
} catch (Facebook\Exceptions\FacebookSDKException $e) {
echo $e->getMessage();
exit;
}
if (isset($accessToken)) {
$_SESSION['fb_access_token'] = (string) $accessToken;
$res = $fb->post('/me/feed', array('link' => 'http://nathorr.com/qeta/user/' . qa_get_logged_in_handle() . '/', 'name' => qa_opt('fb_shared_message_title'), 'picture' => qa_opt('fb_shared_message_picture'), 'description' => qa_opt('fb_shared_message_description'), 'message' => 'I have scored ' . qa_get_logged_in_points() . ' points and achieved some nice badges in Nathorr Q&A, check it out!'), $accessToken);
$post = $res->getGraphObject();
$qa_content['custom'] = '<a href="http://nathorr.com/qeta/user/' . qa_get_logged_in_handle() . '">Successfully shared, return by clicking here.</a>';
return $qa_content;
} else {
if ($helper->getError()) {
var_dump($helper->getError());
echo '<br><br>';
var_dump($helper->getErrorCode());
echo '<br><br>';
var_dump($helper->getErrorReason());
echo '<br><br>';
var_dump($helper->getErrorDescription());
echo '<br><br>';
echo '<a href="http://nathorr.com/qeta/user/' . qa_get_logged_in_handle() . '/">Something went wrong, return by clicking here.</a>';
exit;
}
}
http_response_code(400);
exit;
}
示例7: qa_user_moderation_reason
function qa_user_moderation_reason($userlevel = null)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
$reason = false;
if (!isset($userlevel)) {
$userlevel = qa_get_logged_in_level();
}
if ($userlevel < QA_USER_LEVEL_EXPERT && qa_user_permit_error('permit_moderate')) {
$userid = qa_get_logged_in_userid();
if (isset($userid)) {
if (qa_opt('moderate_users') && qa_opt('moderate_unapproved') && $userlevel < QA_USER_LEVEL_APPROVED) {
$reason = 'approve';
} elseif (qa_opt('confirm_user_emails') && qa_opt('moderate_unconfirmed') && !(qa_get_logged_in_flags() & QA_USER_FLAGS_EMAIL_CONFIRMED)) {
$reason = 'confirm';
} elseif (qa_opt('moderate_by_points') && qa_get_logged_in_points() < qa_opt('moderate_points_limit')) {
$reason = 'points';
}
} elseif (qa_opt('moderate_anon_post')) {
$reason = 'login';
}
}
return $reason;
}
示例8: logged_in
/**
* Adding point count for logged in user
*
* @since Snow 1.4
*/
public function logged_in()
{
parent::logged_in();
if (qa_is_logged_in()) {
$userpoints = qa_get_logged_in_points();
$pointshtml = $userpoints == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_html(number_format($userpoints));
$this->output('<div class="qam-logged-in-points">' . $pointshtml . '</div>');
}
}
示例9: voting_inner_html
function voting_inner_html($post)
{
if (qw_hook_exist(__FUNCTION__)) {
$args = func_get_args();
array_unshift($args, $this);
return qw_event_hook(__FUNCTION__, $args, NULL);
}
$up_tags = preg_replace('/onclick="([^"]+)"/', '', str_replace('name', 'data-id', @$post['vote_up_tags']));
$down_tags = preg_replace('/onclick="([^"]+)"/', '', str_replace('name', 'data-id', @$post['vote_down_tags']));
if (qa_is_logged_in()) {
$user_point = qa_get_logged_in_points();
if ($post['raw']['type'] == 'Q') {
if (qa_opt('permit_vote_q') == '106') {
$need = qa_opt('permit_vote_q_points') - $user_point;
$up_tags = str_replace(qa_lang_html('main/vote_disabled_level'), 'You need ' . $need . ' more points to vote', $up_tags);
}
if (qa_opt('permit_vote_q') == '106' && qa_opt('permit_vote_down') == '106') {
$max = max(qa_opt('permit_vote_down_points'), qa_opt('permit_vote_q_points'));
$need = $max - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_q') == '106') {
$need = qa_opt('permit_vote_q_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_down') == '106') {
$need = qa_opt('permit_vote_down_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
}
}
if ($post['raw']['type'] == 'A') {
if (qa_opt('permit_vote_a') == '106') {
$need = qa_opt('permit_vote_a_points') - $user_point;
$up_tags = str_replace(qa_lang_html('main/vote_disabled_level'), 'You need ' . $need . ' more points to vote', $up_tags);
}
if (qa_opt('permit_vote_a') == '106' && qa_opt('permit_vote_down') == '106') {
$max = max(qa_opt('permit_vote_down_points'), qa_opt('permit_vote_a_points'));
$need = $max - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_a') == '106') {
$need = qa_opt('permit_vote_a_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_down') == '106') {
$need = qa_opt('permit_vote_down_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
}
}
}
$state = @$post['vote_state'];
$code = qa_get_form_security_code('vote');
$vote_text = $post['raw']['netvotes'] > 1 || $post['raw']['netvotes'] < -1 ? _ra_lang('votes') : _ra_lang('vote');
$this->output('<p class="count">' . $post['raw']['netvotes'] . '<span>' . $vote_text . '</span></p>');
if (isset($post['vote_up_tags'])) {
$this->output('<a ' . @$up_tags . ' href="#" data-code="' . $code . '" class="icon-chevron-up enabled vote-up ' . $state . '"></a>');
}
if (isset($post['vote_down_tags'])) {
$this->output('<a ' . @$down_tags . ' href="#" data-code="' . $code . '" class="icon-chevron-down enabled vote-down ' . $state . '"></a>');
}
}
示例10: voting_inner_html
function voting_inner_html($post)
{
$up_tags = preg_replace('/onclick="([^"]+)"/', '', str_replace('name', 'data-id', @$post['vote_up_tags']));
$down_tags = preg_replace('/onclick="([^"]+)"/', '', str_replace('name', 'data-id', @$post['vote_down_tags']));
if (qa_is_logged_in()) {
$user_point = qa_get_logged_in_points();
if ($post['raw']['type'] == 'Q') {
if (qa_opt('permit_vote_q') == '106') {
$need = qa_opt('permit_vote_q_points') - $user_point;
$up_tags = str_replace(qa_lang_html('main/vote_disabled_level'), 'You need ' . $need . ' more points to vote', $up_tags);
}
if (qa_opt('permit_vote_q') == '106' && qa_opt('permit_vote_down') == '106') {
$max = max(qa_opt('permit_vote_down_points'), qa_opt('permit_vote_q_points'));
$need = $max - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_q') == '106') {
$need = qa_opt('permit_vote_q_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_down') == '106') {
$need = qa_opt('permit_vote_down_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
}
}
if ($post['raw']['type'] == 'A') {
if (qa_opt('permit_vote_a') == '106') {
$need = qa_opt('permit_vote_a_points') - $user_point;
$up_tags = str_replace(qa_lang_html('main/vote_disabled_level'), 'You need ' . $need . ' more points to vote', $up_tags);
}
if (qa_opt('permit_vote_a') == '106' && qa_opt('permit_vote_down') == '106') {
$max = max(qa_opt('permit_vote_down_points'), qa_opt('permit_vote_a_points'));
$need = $max - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_a') == '106') {
$need = qa_opt('permit_vote_a_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
} elseif (qa_opt('permit_vote_down') == '106') {
$need = qa_opt('permit_vote_down_points') - $user_point;
$down_tags = preg_replace('/title="([^"]+)"/', 'title="You need ' . $need . ' more points to vote" ', $down_tags);
}
}
}
$state = @$post['vote_state'];
$code = qa_get_form_security_code('vote');
$vote_text = $post['raw']['netvotes'] > 1 || $post['raw']['netvotes'] < -1 ? qa_lang('cleanstrap/votes') : qa_lang('cleanstrap/vote');
if (isset($post['vote_up_tags'])) {
$this->output('<a ' . @$up_tags . ' href="#" data-code="' . $code . '" class=" icon-thumbs-up2 enabled vote-up ' . $state . '"></a>');
}
$this->output('<span class="count">' . $post['raw']['netvotes'] . '</span>');
if (isset($post['vote_down_tags'])) {
$this->output('<a ' . @$down_tags . ' href="#" data-code="' . $code . '" class=" icon-thumbs-down2 enabled vote-down ' . $state . '"></a>');
}
}
示例11: qa_lang_html
<?php
echo qa_lang_html('misc/nav_user_pms');
?>
</a>
</li>
<?php
}
?>
<li>
<a href="<?php
echo qa_path_html('user/' . qa_get_logged_in_handle());
?>
">
<span class="fa fa-money"></span>
<?php
echo qa_get_logged_in_points() . ' ' . qa_lang_html('admin/points_title');
?>
</a>
</li>
<?php
foreach ($this->content['navigation']['user'] as $key => $user_nav) {
?>
<?php
if ($key !== 'logout') {
?>
<li>
<a href="<?php
echo @$user_nav['url'];
?>
">
<?php
示例12: user_points
/**
* Get logged in user's points
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return string|null LoggedIn user's total points, null for guest
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private function user_points()
{
if (qa_is_logged_in()) {
$userpoints = qa_get_logged_in_points();
$pointshtml = $userpoints == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_html(number_format($userpoints));
$points = '<DIV CLASS="qam-logged-in-points">' . $pointshtml . '</DIV>';
return $points;
}
return null;
}
示例13: qa_post_html_fields
//.........这里部分代码省略.........
$fields['downvotes_view'] = $downvotes == 1 ? qa_lang_html_sub_split('main/1_disliked', $downvoteshtml, '1') : qa_lang_html_sub_split('main/x_disliked', $downvoteshtml);
$fields['netvotes_view'] = abs($netvotes) == 1 ? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1') : qa_lang_html_sub_split('main/x_votes', $netvoteshtml);
// Voting buttons
$fields['vote_tags'] = 'ID="voting_' . qa_html($postid) . '"';
$onclick = 'onClick="return qa_vote_click(this);"';
if ($fields['hidden']) {
$fields['vote_state'] = 'disabled';
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html($isanswer ? 'main/vote_disabled_hidden_a' : 'main/vote_disabled_hidden_q') . '"';
$fields['vote_down_tags'] = $fields['vote_up_tags'];
} elseif ($isbyuser) {
$fields['vote_state'] = 'disabled';
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html($isanswer ? 'main/vote_disabled_my_a' : 'main/vote_disabled_my_q') . '"';
$fields['vote_down_tags'] = $fields['vote_up_tags'];
} elseif (strpos($voteview, '-disabled-')) {
$fields['vote_state'] = @$post['uservote'] > 0 ? 'voted_up_disabled' : (@$post['uservote'] < 0 ? 'voted_down_disabled' : 'disabled');
if (strpos($voteview, '-disabled-page')) {
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_q_page_only') . '"';
} else {
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_level') . '"';
}
$fields['vote_down_tags'] = $fields['vote_up_tags'];
} elseif (@$post['uservote'] > 0) {
$fields['vote_state'] = 'voted_up';
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/voted_up_popup') . '" NAME="' . qa_html('vote_' . $postid . '_0_' . $elementid) . '" ' . $onclick;
$fields['vote_down_tags'] = ' ';
} elseif (@$post['uservote'] < 0) {
$fields['vote_state'] = 'voted_down';
$fields['vote_up_tags'] = ' ';
$fields['vote_down_tags'] = 'TITLE="' . qa_lang_html('main/voted_down_popup') . '" NAME="' . qa_html('vote_' . $postid . '_0_' . $elementid) . '" ' . $onclick;
} else {
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/vote_up_popup') . '" NAME="' . qa_html('vote_' . $postid . '_1_' . $elementid) . '" ' . $onclick;
// calculation new points for the case the user clicks on down or upvote button
if ($isquestion) {
$newpointsafterdownvote = qa_get_logged_in_points() + (@$post['uservote'] > 0 ? -1 * qa_opt('points_vote_up_q') : qa_opt('points_vote_down_q'));
$newpointsafterupvote = qa_get_logged_in_points() + (@$post['uservote'] < 0 ? -1 * qa_opt('points_vote_down_q') : qa_opt('points_vote_up_q'));
} else {
$newpointsafterdownvote = qa_get_logged_in_points() + (@$post['uservote'] > 0 ? -1 * qa_opt('points_vote_up_a') : qa_opt('points_vote_down_a'));
$newpointsafterupvote = qa_get_logged_in_points() + (@$post['uservote'] < 0 ? -1 * qa_opt('points_vote_down_a') : qa_opt('points_vote_up_a'));
}
if ($newpointsafterdownvote < 0) {
// If after downvote user will have less than 0 points, then hide downvoting button
if ($newpointsafterupvote < 0) {
// If after upvote user will have less than 0 points, then hide upvoting button
$fields['vote_state'] = 'disabled';
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_level') . '"';
$fields['vote_down_tags'] = $fields['vote_up_tags'];
} else {
// only hide downvoting button
$fields['vote_state'] = 'up_only';
$fields['vote_down_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_level') . '"';
}
} else {
if ($newpointsafterupvote < 0) {
// only hide upvoting button
if (strpos($voteview, '-uponly-level')) {
$fields['vote_state'] = 'disabled';
$fields['vote_down_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_down') . '"';
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_level') . '"';
} else {
// vote_state 'down_only' does not exist. Therfore use disabled state.
$fields['vote_state'] = 'disabled';
$fields['vote_down_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_down') . '"';
$fields['vote_up_tags'] = 'TITLE="' . qa_lang_html('main/vote_disabled_level') . '"';
}
} else {
// after click on either up or downvote button, points will be >0
示例14: qa_permit_error
function qa_permit_error($permitoption, $userid, $userlevel, $userflags, $userpoints = null)
{
$permit = isset($permitoption) ? qa_opt($permitoption) : QA_PERMIT_ALL;
if ($permit == QA_PERMIT_POINTS || $permit == QA_PERMIT_POINTS_CONFIRMED) {
// deal with points threshold by converting as appropriate
$permit = QA_PERMIT_EXPERTS;
// by default, only special users pass this, but...
if (isset($userid)) {
if (!isset($userpoints) && $userid == qa_get_logged_in_userid()) {
$userpoints = qa_get_logged_in_points();
}
// allow late retrieval of points (to avoid unnecessary DB query when using external users)
if ($userpoints >= qa_opt($permitoption . '_points')) {
$permit = $permit == QA_PERMIT_POINTS_CONFIRMED ? QA_PERMIT_CONFIRMED : QA_PERMIT_USERS;
}
// convert if user has enough points
}
}
if ($permit >= QA_PERMIT_ALL) {
$error = false;
} elseif ($permit >= QA_PERMIT_USERS) {
$error = isset($userid) ? false : 'login';
} elseif ($permit >= QA_PERMIT_CONFIRMED) {
if (!isset($userid)) {
$error = 'login';
} elseif (QA_FINAL_EXTERNAL_USERS || $userlevel >= QA_USER_LEVEL_EXPERT || $userflags & QA_USER_FLAGS_EMAIL_CONFIRMED || !qa_opt('confirm_user_emails')) {
$error = false;
} else {
$error = 'confirm';
}
} elseif ($permit >= QA_PERMIT_EXPERTS) {
$error = isset($userid) && $userlevel >= QA_USER_LEVEL_EXPERT ? false : 'level';
} elseif ($permit >= QA_PERMIT_EDITORS) {
$error = isset($userid) && $userlevel >= QA_USER_LEVEL_EDITOR ? false : 'level';
} elseif ($permit >= QA_PERMIT_MODERATORS) {
$error = isset($userid) && $userlevel >= QA_USER_LEVEL_MODERATOR ? false : 'level';
} elseif ($permit >= QA_PERMIT_ADMINS) {
$error = isset($userid) && $userlevel >= QA_USER_LEVEL_ADMIN ? false : 'level';
} else {
$error = isset($userid) && $userlevel >= QA_USER_LEVEL_SUPER ? false : 'level';
}
if (isset($userid) && $userflags & QA_USER_FLAGS_USER_BLOCKED && $error != 'level') {
$error = 'userblock';
}
return $error;
}
示例15: qa_path_html
<li id="user-nag">
<a class="profile" href="<?php
echo qa_path_html('user/' . qa_get_logged_in_handle());
?>
">
<img src="<?php
echo ra_get_avatar(qa_get_logged_in_handle(), 20, false);
?>
" />
<span><?php
echo ra_name(qa_get_logged_in_handle());
?>
</span>
<span class="points"><?php
echo qa_get_logged_in_points();
?>
</span>
</a>
</li>
<li class="dropdown" id="menuLogin">
<a class="dropdown-toggle user-tools" data-toggle="dropdown" href="#">
<i class="icon-cog"></i>
</a>
<div class="dropdown-menu">
<ul class="user-nav">
<li><a class="icon-profile" href="<?php
echo qa_path_html('user/' . qa_get_logged_in_handle());
?>
"><?php