本文整理汇总了PHP中qa_get_logged_in_handle函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_get_logged_in_handle函数的具体用法?PHP qa_get_logged_in_handle怎么用?PHP qa_get_logged_in_handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_get_logged_in_handle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hw_init_current_userlogin
/**
* init current user logined
*/
function hw_init_current_userlogin()
{
global $iflychat_userinfo;
//init user
if (qa_is_logged_in()) {
$handle = qa_get_logged_in_handle();
//user name
$userid = qa_get_logged_in_userid();
//user id
$user = qa_db_select_with_pending(qa_db_user_account_selectspec($handle, false));
//get user avatar src
$avatar_src = hw_get_user_avatar_src($user['flags'], $user['email'], $user['avatarblobid']);
if (empty($avatar_src)) {
$avatar_src = 'https://iflychat.com/sites/all/modules/drupalchat/themes/light/images/default_avatar.png';
}
//set detail current user to chat
$iflychat_userinfo = new iFlyChatUserDetails($handle, $userid);
$iflychat_userinfo->setIsAdmin(TRUE);
$iflychat_userinfo->setAvatarUrl($avatar_src);
$iflychat_userinfo->setProfileLink(qa_opt('site_url') . 'user/' . $handle);
$iflychat_userinfo->setRoomRoles(array());
$iflychat_userinfo->setRelationshipSet(FALSE);
//$iflychat_userinfo->setAllRoles(array('1'=>'admin'));
}
}
示例2: head_custom
function head_custom()
{
qa_html_theme_base::head_custom();
if (qa_opt('priv_active') && qa_opt('priv_check') && qa_get_logged_in_handle()) {
$userid = qa_get_logged_in_userid();
$notices = qa_db_read_one_value(qa_db_query_sub('SELECT meta_value FROM ^usermeta WHERE user_id=# AND meta_key=$ ', $userid, 'priv_notify'), true);
if ($notices) {
$all = explode('^', $notices);
if (!$all[1]) {
// no new
return;
}
$n = explode(',', $all[1]);
$this->notify = '<div class="notify-container">';
$text = count($n) > 1 ? str_replace('#', count($n), qa_opt('priv_notify_text_multi')) : str_replace('^privilege', qa_lang('profile/' . $n[0]), qa_opt('priv_notify_text'));
$text = str_replace('^profile', qa_path_html('user/' . qa_get_logged_in_handle(), array('tab' => 'privileges'), qa_opt('site_url')), $text);
$this->notify .= '<div class="priv-notify notify">' . $text . '<div class="notify-close" onclick="jQuery(this).parent().sildeUp(\'fast\')">x</div></div>';
$this->notify .= '</div>';
// remove notification flag
qa_db_query_sub('UPDATE ^usermeta SET meta_value=$ WHERE meta_key=$ AND user_id=#', ($all[0] ? $all[0] . ',' : '') . $all[1] . '^', 'priv_notify', $userid);
/*
$this->output("
<script>
jQuery('document').ready(function() { jQuery('.notify-container').delay(10000).fadeOut(); });
</script>");
*/
$this->output('
<style>', qa_opt('priv_css'), '</style>');
}
}
}
示例3: theme_switch_form
function theme_switch_form()
{
// displays signature form in user profile
global $qa_request;
$handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $qa_request);
$userid = $this->getuserfromhandle($handle);
if (!$userid) {
return;
}
if (qa_get_logged_in_handle() && qa_get_logged_in_handle() == $handle) {
if (qa_clicked('theme_switch_save')) {
qa_db_query_sub('INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES (#,$,$) ON DUPLICATE KEY UPDATE meta_value=$', $userid, 'custom_theme', qa_post_text('theme_choice'), qa_post_text('theme_choice'));
qa_redirect($this->request, array('ok' => qa_lang_html('admin/options_saved')));
} else {
if (qa_clicked('theme_switch_user_reset')) {
qa_db_query_sub('DELETE FROM ^usermeta WHERE user_id=# AND meta_key=$', $userid, 'custom_theme');
qa_redirect($this->request, array('ok' => qa_lang_html('admin/options_reset')));
}
}
require_once QA_INCLUDE_DIR . 'qa-app-admin.php';
$ok = qa_get('ok') ? qa_get('ok') : null;
$theme_choice = qa_db_read_one_value(qa_db_query_sub('SELECT meta_value FROM ^usermeta WHERE user_id=# AND meta_key=$', $userid, 'custom_theme'), true);
$themes = qa_admin_theme_options();
$fields['themes'] = array('label' => qa_opt('theme_switch_text'), 'tags' => 'NAME="theme_choice"', 'type' => 'select', 'options' => qa_admin_theme_options(), 'value' => @$themes[$theme_choice]);
$form = array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'tall', 'title' => '<a name="theme_text"></a>' . qa_opt('theme_switch_title'), 'tags' => 'action="' . qa_self_html() . '#theme_text" method="POST"', 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="theme_switch_user_reset"'), array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="theme_switch_save"')));
return $form;
}
}
示例4: dele_single_article
public function dele_single_article($articleid = 0)
{
$username = qa_get_logged_in_handle();
$article = $this->article_model->select_single_article($articleid);
$userlevel = $this->user_model->get_user_level($username);
if ($username == null) {
echo '发生了错误1';
exit;
}
//判断权限
$power = -1;
if ($userlevel != null) {
$power = $userlevel['level'];
}
if ($power < 0) {
echo '你没有权限发表文章';
exit;
}
if ($article != null) {
$newid = $this->article_model->update_article_by_array($articleid, array("status"), array(-1));
}
if ($newid == null) {
$newid = 0;
}
echo $newid;
}
示例5: index
public function index($id = null)
{
$username = qa_get_logged_in_handle();
if ($username == '') {
exit;
}
$user = $this->user_model->get_user_config($username);
if ($user == null) {
exit;
}
$userlevel = $this->user_model->get_user_level($username);
$data = $this->defaultpage_model->all_items();
$data = array_merge($data, array('blog_title' => $user['blogtitle'], 'blog_subtitle' => $user['blogsubtitle'], 'img_article_operation_btns1' => base_url($this->config->item('app_src') . 'views/theme/' . $this->config->item('theme') . '/img/article_operation_btns1.gif'), 'article_submit' => site_url('action/add_article/add_single_by_post'), 'save_posted_page' => site_url('action/save_article/save_single_by_post'), 'aritile_site_url' => site_url('article/index')));
if ($id == null) {
$data['ar_saveid'] = '0';
$data['ar_draft_title'] = '';
$data['ar_draft_content'] = '';
$data['ar_draft_tags'] = '';
} else {
$artl = $this->article_model->select_single_article($id);
if ($artl != null and ($artl['username'] == $username or $userlevel['level'] >= 4)) {
$data['ar_saveid'] = $id;
$data['ar_draft_title'] = htmlspecialchars($artl['caption'], ENT_QUOTES, 'UTF-8');
$data['ar_draft_content'] = htmlspecialchars($artl['content'], ENT_QUOTES, 'UTF-8');
$data['ar_draft_tags'] = htmlspecialchars($artl['tags'], ENT_QUOTES, 'UTF-8');
} else {
echo 'no permits!';
exit;
}
}
$this->parser->parse('theme/default/templete/header', $data);
$this->parser->parse('theme/default/templete/head', $data);
$this->parser->parse('theme/default/templete/createarticle', $data);
$this->parser->parse('theme/default/templete/foot', $data);
}
示例6: logged_in
function logged_in()
{
if (isset($this->content['loggedin']['data']) && qa_opt('buddypress_integration_enable') && qa_opt('buddypress_display_names')) {
$handle = qa_get_logged_in_handle();
$name = bp_core_get_user_displayname($handle);
$this->content['loggedin']['data'] = str_replace('>' . $handle . '<', ' title="@' . $handle . '">' . $name . '<', $this->content['loggedin']['data']);
}
qa_html_theme_base::logged_in();
}
示例7: qa_page_q_post_rules
function qa_page_q_post_rules($post, $parentpost = null, $siblingposts = null, $childposts = null)
{
$rules = qa_page_q_post_rules_base($post, $parentpost, $siblingposts, $childposts);
qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^postmeta (
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
post_id bigint(20) unsigned NOT NULL,
meta_key varchar(255) DEFAULT \'\',
meta_value longtext,
PRIMARY KEY (meta_id),
KEY post_id (post_id),
KEY meta_key (meta_key)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
$expert = qa_db_read_one_value(qa_db_query_sub("SELECT meta_value FROM ^postmeta WHERE meta_key='is_expert_question' AND post_id=#", $post['postid']), true);
if ($expert) {
if (!qa_permit_value_error(qa_opt('expert_question_roles'), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags())) {
$is_expert = true;
}
$users = qa_opt('expert_question_users');
$users = explode("\n", $users);
$handle = qa_get_logged_in_handle();
foreach ($users as $idx => $user) {
if ($user == $handle) {
$is_expert = true;
break;
}
if (strpos($user, '=')) {
$user = explode('=', $user);
if ($user[0] == $handle) {
$catnames = explode(',', $user[1]);
$cats = qa_db_read_all_values(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE title IN ($)', $catnames));
$is_expert = $cats;
}
}
}
if (isset($is_expert) && !$rules['viewable']) {
// experts that aren't allowed to change hidden questions
if (is_array($is_expert)) {
$in_cats = qa_db_read_one_value(qa_db_query_sub("SELECT COUNT(postid) FROM ^posts WHERE categoryid IN (#) AND postid=#", $is_expert, $post['postid']), true);
if ($in_cats) {
$rules['viewable'] = true;
}
} else {
$rules['viewable'] = true;
}
}
$rules['reshowable'] = false;
$rules['answerbutton'] = true;
$rules['commentbutton'] = true;
$rules['commentable'] = true;
}
return $rules;
}
示例8: qw_notification_btn
function qw_notification_btn()
{
//if (true){ // check options
$userid = qa_get_logged_in_userid();
if (isset($userid)) {
$handle = qa_get_logged_in_handle();
$this->output('
<div class="user-actions pull-right">
<div class="activity-bar">
<div class="button dropdown">
<a href="' . qa_path_html('user/' . $handle . '/activity') . '" class=" icon-bullhorn dropdown-toggle activitylist" data-toggle="dropdown" id="activitylist"></a>
<div class="dropdown-menu activity-dropdown-list pull-right" id="activity-dropdown-list">
<div class="bar">
<span>' . qa_lang_html('dude/notifications') . '</span>
<a class="mark-activity" href="#" data-id="' . qa_get_logged_in_userid() . '">' . qa_lang('dude/mark_all_as_read') . '</a>
</div>
<div class="append">
<div class="ajax-list"></div>
<span class="loading"></span>
<div class="no-activity icon-chart-bar">' . qa_lang('dude/no-activity') . '</div>
</div>
<a class="event-footer" href="' . qa_path_html('notifications', null, QW_BASE_URL) . '">' . qa_lang('dude/see_all') . '</a>
</div>
</div>
</div>
<div class="message-bar">
<div class="button dropdown">
<a href="' . qa_path_html('user/' . $handle . '/message') . '" class=" icon-envelope-alt dropdown-toggle messagelist" data-toggle="dropdown" id="messagelist"></a>
<div class="dropdown-menu message-dropdown-list pull-right" id="message-dropdown-list">
<div class="bar">
<span>' . qa_lang_html('dude/messages') . '</span>
<a class="mark-messages" href="#">' . qa_lang('dude/mark_all_as_read') . '</a>
</div>
<div class="append">
<div class="ajax-list"></div>
<span class="loading"></span>
<div class="no-activity icon-chart-bar">' . qa_lang('dude/no-activity') . '</div>
</div>
<a class="event-footer" href="' . qa_path_html('user/' . $handle . '/wall', null, QW_BASE_URL) . '">' . qa_lang('dude/see_all') . '</a>
</div>
</div>
</div>
</div>
');
}
//}
}
示例9: head_custom
function head_custom()
{
qa_html_theme_base::head_custom();
if (@$this->template == 'user' && qa_opt('signatures_enable')) {
$formats = qa_list_modules('editor');
$editorname = $formats[qa_opt('signatures_format')];
$handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $this->request);
if (qa_get_logged_in_handle() == $handle && (!$editorname || $editorname == 'Markdown Editor')) {
$this->output_raw('<script src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'textLimitCount.js" type="text/javascript"></script>');
$this->output_raw("\n<script>\n\tvar signature_max_length = " . (qa_opt('signatures_length') ? qa_opt('signatures_length') : 1000) . ";\n\tjQuery('document').ready(function(){\n\t\ttextLimiter(jQuery('textarea[name=\"signature_text\"]'),{\n\t\tmaxLength: signature_max_length,\n\t\telCount: 'elCount'\n\t });\n\t});\n</script>");
}
}
}
示例10: index
public function index($articleid = 1)
{
$atcl = $this->article_model->select_single_article($articleid);
if ($atcl == null) {
exit;
}
if ($atcl['status'] == 1) {
//如果不是文章作者,且不是管理员
if (qa_get_logged_in_handle() != $atcl['username'] or $this->user_model->get_user_level(qa_get_logged_in_handle()) < 4) {
echo 'no permints!';
exit;
}
}
if ($atcl['status'] < 0) {
//如果不是管理员
if ($this->user_model->get_user_level(qa_get_logged_in_handle()) < 4) {
echo 'no permints!';
exit;
}
}
$username = $atcl['username'];
$user = $this->user_model->get_user_config($username);
$articles_meta = $this->article_model->get_article_list_by_author($username);
$comments_meta = $this->comment_model->get_comments_by_to_user($username);
$messages_meta = $this->message_model->get_messages_by_to_user($username);
$articles = array();
$comments = array();
$messages = array();
foreach ($articles_meta as $key => $article) {
$articles[$key]['title'] = $article['caption'];
$articles[$key]['content'] = mb_substr($article['content'], 0, 200);
$articles[$key]['date'] = date('Y-m-d g:i', strtotime($article['createtime']));
}
foreach ($comments_meta as $key => $comment) {
$comments[$key]['comment'] = mb_substr($comment['content'], 0, 17) . '...';
}
foreach ($messages_meta as $key => $message) {
$messages_meta[$key]['comment'] = mb_substr($message['content'], 0, 17) . '...';
}
$data = $this->defaultpage_model->all_items();
$data = array_merge($data, array('blog_title' => $user['blogtitle'], 'blog_subtitle' => $user['blogsubtitle'], 'user_photo' => $this->user_model->get_qa_avartar_html($username), 'user_profile' => $this->config->item('qaroot_src') . '?qa=user/' . $username));
$atcl['createtime'] = date('Y-m-d g:i', strtotime($atcl['createtime']));
$data['articles'] = array($atcl);
//var_dump($data['articles']);
$data['comments'] = $comments;
$data['messages'] = $messages;
$this->parser->parse('theme/default/templete/header', $data);
$this->parser->parse('theme/default/templete/head', $data);
$this->parser->parse('theme/default/templete/article', $data);
$this->parser->parse('theme/default/templete/foot', $data);
}
示例11: doctype
function doctype()
{
parent::doctype();
if (QA_FINAL_EXTERNAL_USERS) {
return;
}
// check if logged in
$handle = qa_get_logged_in_handle();
if (isset($handle)) {
if (qa_request() == '' && count($_GET) > 0) {
// Check if we need to associate another provider
$this->process_login();
}
// see if the account pages are accessed
$tmpl = array('account', 'favorites');
$user_pages = array('user', 'user-wall', 'user-activity', 'user-questions', 'user-answers');
$logins_page = qa_request() == 'logins' && !qa_get('confirm');
$urlhandle = qa_request_part(1);
if (in_array($this->template, $tmpl) || $logins_page || in_array($this->template, $user_pages) && $handle == $urlhandle) {
// add a navigation item
$this->content['navigation']['sub']['logins'] = array('label' => qa_lang_html('plugin_open/my_logins_nav'), 'url' => qa_path_html('logins'), 'selected' => $logins_page);
return;
}
} else {
$title = qa_lang_html('plugin_open/login_title');
$descr = qa_lang_html('plugin_open/login_description');
// hide login/register links from navigation on any page
if (qa_opt('open_login_hideform') == '1') {
unset($this->content['navigation']['user']['login']);
unset($this->content['navigation']['user']['register']);
}
// then check if login/register pages are accessed
$tmpl = array('register', 'login');
if (!in_array($this->template, $tmpl)) {
return;
}
// hide regular login/register form on those pages only
if (qa_opt('open_login_hideform') == '1') {
$this->content['title'] = $title;
$this->content['form'] = null;
}
// add some custom text
if (!empty($this->content['custom'])) {
$content = str_ireplace('<BR>', '', $this->content['custom']);
$this->content['custom'] = "<div><p>{$descr}</p>{$content}</div>";
if ($this->content['form'] != null) {
$this->content['custom'] = "<br /><br /><h1>{$title}</h1>{$this->content['custom']}";
}
}
}
}
示例12: 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>');
}
}
示例13: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
// only show for logged in users
if (qa_get_logged_in_handle() == null) {
return;
}
require_once QA_INCLUDE_DIR . 'qa-db.php';
require_once QA_INCLUDE_DIR . 'qa-db.php';
require_once QA_INCLUDE_DIR . 'mp-db-users.php';
$userid = qa_get_logged_in_userid();
$categoryid = mp_get_categoryid();
// check each property
$nameSQL = qa_db_read_one_value(qa_db_query_sub('select count(content) from ^userprofile p where p.userid =# and content="" and title=#', $userid, 'name'));
$aboutSQL = qa_db_read_one_value(qa_db_query_sub('select count(content) from ^userprofile p where p.userid =# and content="" and title=#', $userid, 'about'));
$websiteSQL = qa_db_read_one_value(qa_db_query_sub('select count(content) from ^userprofile p where p.userid =# and content="" and title=#', $userid, 'website'));
$questionSQL = qa_db_read_one_value(qa_db_query_sub('select count(userid) from ^posts p where p.userid =# and categoryid=# and type=#', $userid, $categoryid, 'Q'));
$answerSQL = qa_db_read_one_value(qa_db_query_sub('select count(userid) from ^posts p where p.userid =# and categoryid=# and type=#', $userid, $categoryid, 'A'));
$perc = 0;
if ($nameSQL == 0) {
$perc++;
}
if ($aboutSQL == 0) {
$perc++;
}
if ($websiteSQL == 0) {
$perc++;
}
if ($questionSQL > 0) {
$perc++;
}
if ($answerSQL > 0) {
$perc++;
}
$themeobject->output('<DIV CLASS="mp-widget-profile-view"><DIV CLASS="mp-widget-profile-title">Profile Progress - ' . $perc * 100 / 5 . '%</DIV>');
$data = '<DIV CLASS="mp-widget-profile-list-item"><SPAN CLASS="mp-widget-profile-list-title">Name</SPAN>' . ($nameSQL ? '<SPAN CLASS="mp-widget-profile-list-bad"></SPAN>' : '<SPAN CLASS="mp-widget-profile-list-good"></SPAN>') . '</DIV>';
// value of 0 is complete
$data .= '<DIV CLASS="mp-widget-profile-list-item"><SPAN CLASS="mp-widget-profile-list-title">About</SPAN>' . ($aboutSQL ? '<SPAN CLASS="mp-widget-profile-list-bad"></SPAN>' : '<SPAN CLASS="mp-widget-profile-list-good"></SPAN>') . '</DIV>';
// value of 0 is complete
$data .= '<DIV CLASS="mp-widget-profile-list-item"><SPAN CLASS="mp-widget-profile-list-title">Website</SPAN>' . ($websiteSQL ? '<SPAN CLASS="mp-widget-profile-list-bad"></SPAN>' : '<SPAN CLASS="mp-widget-profile-list-good"></SPAN>') . '</DIV>';
// value of 0 is complete
$data .= '<DIV CLASS="mp-widget-profile-list-item"><SPAN CLASS="mp-widget-profile-list-title">Posted a question</SPAN>' . ($questionSQL <= 0 ? '<SPAN CLASS="mp-widget-profile-list-bad"></SPAN>' : '<SPAN CLASS="mp-widget-profile-list-good"></SPAN>') . '</DIV>';
// value > 0 is complete
$data .= '<DIV CLASS="mp-widget-profile-list-item"><SPAN CLASS="mp-widget-profile-list-title">Posted an answer</SPAN>' . ($answerSQL <= 0 ? '<SPAN CLASS="mp-widget-profile-list-bad"></SPAN>' : '<SPAN CLASS="mp-widget-profile-list-good"></SPAN>') . '</DIV>';
// value > 0 is complete
$data .= '<br /><center><a CLASS="qa-page-link" href="' . qa_path_html('account') . '">Edit Profile</a></center><br />';
$themeobject->output($data);
$themeobject->output('</DIV>');
}
示例14: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
$allowEdit = !qa_user_permit_error('fb_share_permit_edit');
$parts = explode('/', qa_self_html());
if ($allowEdit && $parts[2] == qa_get_logged_in_handle()) {
$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']);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email', 'publish_actions'];
$callback = 'http://nathorr.com/qeta/fb-share/' . qa_get_logged_in_handle() . '/';
$loginUrl = $helper->getLoginUrl($callback, $permissions);
echo '<a href="' . $loginUrl . '"><img src="http://oi57.tinypic.com/f1xlbt.jpg"></a>';
}
}
示例15: 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;
}