本文整理汇总了PHP中qa_get_logged_in_flags函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_get_logged_in_flags函数的具体用法?PHP qa_get_logged_in_flags怎么用?PHP qa_get_logged_in_flags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_get_logged_in_flags函数的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: 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;
}
示例3: 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>');
}
}
示例4: is_expert_user
function is_expert_user()
{
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())) {
return 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) {
return true;
}
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));
return $cats;
}
}
}
return false;
}
示例5: qa_lang_html
if (!qa_check_form_security_code('message-' . $handle, qa_post_text('code'))) {
$pageerror = qa_lang_html('misc/form_security_again');
} else {
if (empty($inmessage)) {
$errors['message'] = qa_lang('misc/message_empty');
}
if (empty($errors)) {
require_once QA_INCLUDE_DIR . 'qa-db-messages.php';
require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
if (qa_opt('show_message_history')) {
$messageid = qa_db_message_create($loginuserid, $toaccount['userid'], $inmessage, '', false);
} else {
$messageid = null;
}
$fromhandle = qa_get_logged_in_handle();
$canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
$more = strtr(qa_lang($canreply ? 'emails/private_message_reply' : 'emails/private_message_info'), array('^f_handle' => $fromhandle, '^url' => qa_path_absolute($canreply ? 'message/' . $fromhandle : 'user/' . $fromhandle)));
$subs = array('^message' => $inmessage, '^f_handle' => $fromhandle, '^f_url' => qa_path_absolute('user/' . $fromhandle), '^more' => $more, '^a_url' => qa_path_absolute('account'));
if (qa_send_notification($toaccount['userid'], $toaccount['email'], $toaccount['handle'], qa_lang('emails/private_message_subject'), qa_lang('emails/private_message_body'), $subs)) {
$messagesent = true;
} else {
$pageerror = qa_lang_html('main/general_error');
}
qa_report_event('u_message', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $toaccount['userid'], 'handle' => $toaccount['handle'], 'messageid' => $messageid, 'message' => $inmessage));
if ($messagesent && qa_opt('show_message_history')) {
// show message as part of general history
qa_redirect(qa_request(), array('state' => 'message-sent'));
}
}
}
}
示例6: qa_redirect
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
// $handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
// Redirect to 'My Account' page if button clicked
if (qa_clicked('doaccount')) {
qa_redirect('account');
}
// Find the user profile and questions and answers for this handle
$loginuserid = qa_get_logged_in_userid();
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), QA_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), qa_db_user_points_selectspec($identifier), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_category_nav_selectspec(null, true), qa_db_user_rank_selectspec($identifier));
if (!QA_FINAL_EXTERNAL_USERS) {
foreach ($userfields as $index => $userfield) {
if (isset($userfield['permit']) && qa_permit_value_error($userfield['permit'], $loginuserid, qa_get_logged_in_level(), qa_get_logged_in_flags())) {
unset($userfields[$index]);
}
}
}
// don't pay attention to user fields we're not allowed to view
// Check the user exists and work out what can and can't be set (if not using single sign-on)
$errors = array();
$loginlevel = qa_get_logged_in_level();
if (!QA_FINAL_EXTERNAL_USERS) {
// if we're using integrated user management, we can know and show more
require_once QA_INCLUDE_DIR . 'qa-app-messages.php';
if (!is_array($userpoints) && !is_array($useraccount)) {
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
$userid = $useraccount['userid'];
示例7: qa_navigation_add_page
function qa_navigation_add_page(&$navigation, $page)
{
if (!qa_permit_value_error($page['permit'], qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags()) || !isset($page['permit'])) {
$url = qa_custom_page_url($page);
$navigation[$page['flags'] & QA_PAGE_FLAGS_EXTERNAL ? 'custom-' . $page['pageid'] : $page['tags'] . '$'] = array('url' => qa_html($url), 'label' => qa_html($page['title']), 'opposite' => $page['nav'] == 'O', 'target' => $page['flags'] & QA_PAGE_FLAGS_NEW_WINDOW ? '_blank' : null, 'selected' => $page['flags'] & QA_PAGE_FLAGS_EXTERNAL && ($url == qa_path(qa_request()) || $url == qa_self_html()));
}
}
示例8: qa_user_use_captcha
function qa_user_use_captcha($captchaoption)
{
$usecaptcha = false;
if (qa_opt($captchaoption)) {
$userid = qa_get_logged_in_userid();
if (!isset($userid) || !(QA_FINAL_EXTERNAL_USERS || !qa_opt('captcha_on_unconfirmed') || !qa_opt('confirm_user_emails') || qa_get_logged_in_level() >= QA_USER_LEVEL_EXPERT || qa_get_logged_in_flags() & QA_USER_FLAGS_EMAIL_CONFIRMED)) {
$usecaptcha = true;
}
}
return $usecaptcha;
}
示例9: ra_user_avatar
function ra_user_avatar()
{
if (qw_hook_exist(__FUNCTION__)) {
$args = func_get_args();
array_unshift($args, $this);
return qw_event_hook(__FUNCTION__, $args, NULL);
}
if (qa_is_logged_in()) {
// output user avatar to login bar
$img_html = 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);
preg_match('@src="([^"]+)"@', $img_html, $match);
$this->output($match[1]);
}
}
示例10: get_user_data
function get_user_data()
{
$userid = qa_get_logged_in_userid();
$user = array();
$user['userid'] = $userid;
if (QA_FINAL_EXTERNAL_USERS) {
$obj = get_userdata($userid);
$user['display_name'] = $obj->display_name;
$user['username'] = $obj->user_nicename;
} else {
$userprofile = qa_db_select_with_pending(qa_db_user_profile_selectspec($userid, true));
$user['display_name'] = @$userprofile['name'] ? $userprofile['name'] : qa_get_logged_in_handle();
$user['username'] = qa_get_logged_in_handle();
}
$user['level'] = qa_get_logged_in_level();
$user['flags'] = qa_get_logged_in_flags();
return $user;
}
示例11: site_top
function site_top()
{
$this->output('<div id="site-top" class="container">');
$this->page_title_error();
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>');
} else {
$this->output('<ul class="pull-right top-buttons clearfix">', '<li><a href="#" class="btn">' . qa_lang_html('cleanstrap/login') . '</a></li>', '<li><a href="#" class="btn">' . qa_lang_html('cleanstrap/register') . '</a></li>', '</ul>');
}
$this->output('</div>');
}
示例12: qw_get_email_body
function qw_get_email_body($event = "")
{
if (!!$event) {
switch ($event) {
case 'a_post':
$value = qa_lang("notification/a_post_body_email");
break;
case 'c_post':
$value = qa_lang("notification/c_post_body_email");
break;
case 'q_reshow':
$value = qa_lang("notification/q_reshow_body_email");
break;
case 'a_reshow':
$value = qa_lang("notification/a_reshow_body_email");
break;
case 'c_reshow':
$value = qa_lang("notification/c_reshow_body_email");
break;
case 'a_select':
$value = qa_lang("notification/a_select_body_email");
break;
case 'q_vote_up':
$value = qa_lang("notification/q_vote_up_body_email");
break;
case 'a_vote_up':
$value = qa_lang("notification/a_vote_up_body_email");
break;
case 'q_vote_down':
$value = qa_lang("notification/q_vote_down_body_email");
break;
case 'a_vote_down':
$value = qa_lang("notification/a_vote_down_body_email");
break;
case 'q_vote_nil':
$value = qa_lang("notification/q_vote_nil_body_email");
break;
case 'a_vote_nil':
$value = qa_lang("notification/a_vote_nil_body_email");
break;
case 'q_approve':
$value = qa_lang("notification/q_approve_body_email");
break;
case 'a_approve':
$value = qa_lang("notification/a_approve_body_email");
break;
case 'c_approve':
$value = qa_lang("notification/c_approve_body_email");
break;
case 'q_reject':
$value = qa_lang("notification/q_reject_body_email");
break;
case 'a_reject':
$value = qa_lang("notification/a_reject_body_email");
break;
case 'c_reject':
$value = qa_lang("notification/c_reject_body_email");
break;
case 'q_favorite':
$value = qa_lang("notification/q_favorite_body_email");
break;
case 'q_post':
case 'q_post_user_fl':
case 'q_post_tag_fl':
case 'q_post_cat_fl':
$value = qa_lang("notification/q_post_body_email");
break;
case 'u_favorite':
$value = qa_lang("notification/u_favorite_body_email");
break;
case 'u_message':
$body = qa_lang("notification/u_message_body_email");
$canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
$more = qa_lang($canreply ? 'notification/u_message_reply_email' : 'notification/u_message_info');
return $body . $more;
break;
case 'u_wall_post':
$value = qa_lang("notification/u_wall_post_body_email");
break;
case 'u_level':
$value = qa_lang("notification/u_level_body_email");
break;
case 'related':
$value = qa_lang("notification/related_body_email");
break;
default:
break;
}
return $value;
}
}
示例13: qw_notify_users_by_email
function qw_notify_users_by_email($event, $postid, $userid, $effecteduserid, $params)
{
if (!!$effecteduserid) {
//get the working user data
$logged_in_handle = qa_get_logged_in_handle();
$logged_in_user_name = qw_get_name_from_userid($userid);
$logged_in_user_name = !!$logged_in_user_name ? $logged_in_user_name : $logged_in_handle;
$name = qw_get_name_from_userid($effecteduserid);
switch ($event) {
case 'a_post':
case 'related':
$parent = isset($params['parent']) ? $params['parent'] : "";
if (!!$parent) {
$name = !!$name ? $name : $parent['handle'];
$email = $parent['email'];
$handle = $parent['handle'];
} else {
//seems proper values are not available
return;
}
break;
case 'c_post':
case 'q_reshow':
case 'a_reshow':
case 'c_reshow':
case 'a_select':
case 'q_vote_up':
case 'q_vote_down':
case 'a_vote_up':
case 'a_vote_down':
case 'q_favorite':
case 'u_favorite':
case 'u_message':
case 'u_wall_post':
case 'u_level':
case 'q_post_user_fl':
case 'q_post_tag_fl':
case 'q_post_cat_fl':
//this is because we wont have the $parent['email'] for each effected userids when a these selected events occurs
$user_details = qw_get_user_details_from_userid($effecteduserid);
$handle = $user_details['handle'];
$name = !!$name ? $name : $user_details['handle'];
$email = $user_details['email'];
break;
case 'q_approve':
case 'q_reject':
$oldquestion = $params['oldquestion'];
$handle = $oldquestion['handle'];
$name = !!$name ? $name : $oldquestion['handle'];
$email = $oldquestion['email'];
break;
case 'a_approve':
case 'a_reject':
$oldanswer = $params['oldanswer'];
$handle = $oldquestion['handle'];
$name = !!$name ? $name : $oldanswer['handle'];
$email = $oldanswer['email'];
break;
case 'c_approve':
case 'c_reject':
$oldcomment = $params['oldcomment'];
$handle = $oldcomment['handle'];
$name = !!$name ? $name : $oldcomment['handle'];
$email = $oldcomment['email'];
break;
default:
break;
}
include_once QA_INCLUDE_DIR . 'qa-util-string.php';
$notifying_user['userid'] = $effecteduserid;
$notifying_user['name'] = $name;
$notifying_user['email'] = $email;
$notifying_user['handle'] = isset($handle) ? $handle : qa_lang('main/anonymous');
//consider only first 50 characters for saving notification
if ($event === 'u_message') {
$content = isset($params['message']) && !empty($params['message']) ? $params['message'] : "";
$title = "";
$canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
$url = qa_path_absolute($canreply ? 'message/' . $logged_in_handle : 'user/' . $logged_in_handle);
} else {
if ($event === 'u_wall_post') {
$content = isset($params['text']) && !empty($params['text']) ? $params['text'] : "";
if (!!$content) {
$blockwordspreg = qa_get_block_words_preg();
$content = qa_block_words_replace($content, $blockwordspreg);
}
$title = "";
$url = qa_path_absolute('user/' . $params['handle'] . '/wall', null, null);
} else {
if ($event === 'u_level') {
$title = "";
$url = qa_path_absolute('user/' . $params['handle']);
$old_level = $params['oldlevel'];
$new_level = $params['level'];
if ($new_level < $old_level) {
return;
}
$approved_only = "";
if ($new_level == QA_USER_LEVEL_APPROVED && $old_level < QA_USER_LEVEL_APPROVED) {
$approved_only = true;
//.........这里部分代码省略.........
示例14: array_slice
$slugs = array_slice($requestparts, 1);
} elseif (strlen($requestparts[0])) {
$slugs = $requestparts;
} else {
$slugs = array();
}
$countslugs = count($slugs);
// Get list of questions, other bits of information that might be useful
$userid = qa_get_logged_in_userid();
list($questions1, $questions2, $categories, $categoryid, $custompage) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $slugs, null, false, false, qa_opt_if_loaded('page_size_activity')), qa_db_recent_a_qs_selectspec($userid, 0, $slugs), qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null, $countslugs == 1 && !$explicitqa ? qa_db_page_full_selectspec($slugs[0], false) : null);
// First, if this matches a custom page, return immediately with that page's content
if (isset($custompage) && !($custompage['flags'] & QA_PAGE_FLAGS_EXTERNAL)) {
qa_set_template('custom-' . $custompage['pageid']);
$qa_content = qa_content_prepare();
$level = qa_get_logged_in_level();
if (!qa_permit_value_error($custompage['permit'], $userid, $level, qa_get_logged_in_flags()) || !isset($custompage['permit'])) {
$qa_content['title'] = qa_html($custompage['heading']);
$qa_content['custom'] = $custompage['content'];
if ($level >= QA_USER_LEVEL_ADMIN) {
$qa_content['navigation']['sub'] = array('admin/pages' => array('label' => qa_lang('admin/edit_custom_page'), 'url' => qa_path_html('admin/pages', array('edit' => $custompage['pageid']))));
}
} else {
$qa_content['error'] = qa_lang_html('users/no_permission');
}
return $qa_content;
}
// Then, see if we should redirect because the 'qa' page is the same as the home page
if ($explicitqa && !qa_is_http_post() && !qa_has_custom_home()) {
qa_redirect(qa_category_path_request($categories, $categoryid), $_GET);
}
// Then, if there's a slug that matches no category, check page modules provided by plugins
示例15: qa_content_prepare
//.........这里部分代码省略.........
foreach ($navpages as $page) {
if ($page['nav'] == 'M' || $page['nav'] == 'O' || $page['nav'] == 'F') {
qa_navigation_add_page($qa_content['navigation'][$page['nav'] == 'F' ? 'footer' : 'main'], $page);
}
}
$regioncodes = array('F' => 'full', 'M' => 'main', 'S' => 'side');
$placecodes = array('T' => 'top', 'H' => 'high', 'L' => 'low', 'B' => 'bottom');
foreach ($widgets as $widget) {
if (is_numeric(strpos(',' . $widget['tags'] . ',', ',' . $qa_template . ',')) || is_numeric(strpos(',' . $widget['tags'] . ',', ',all,'))) {
// see if it has been selected for display on this template
$region = @$regioncodes[substr($widget['place'], 0, 1)];
$place = @$placecodes[substr($widget['place'], 1, 2)];
if (isset($region) && isset($place)) {
// check region/place codes recognized
$module = qa_load_module('widget', $widget['title']);
if (isset($module) && method_exists($module, 'allow_template') && $module->allow_template(substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $qa_template) && method_exists($module, 'allow_region') && $module->allow_region($region) && method_exists($module, 'output_widget')) {
$qa_content['widgets'][$region][$place][] = $module;
}
// if module loaded and happy to be displayed here, tell theme about it
}
}
}
$logoshow = qa_opt('logo_show');
$logourl = qa_opt('logo_url');
$logowidth = qa_opt('logo_width');
$logoheight = qa_opt('logo_height');
if ($logoshow) {
$qa_content['logo'] = '<a href="' . qa_path_html('') . '" class="qa-logo-link" title="' . qa_html(qa_opt('site_title')) . '">' . '<img src="' . qa_html(is_numeric(strpos($logourl, '://')) ? $logourl : qa_path_to_root() . $logourl) . '"' . ($logowidth ? ' width="' . $logowidth . '"' : '') . ($logoheight ? ' height="' . $logoheight . '"' : '') . ' border="0" alt="' . qa_html(qa_opt('site_title')) . '"/></a>';
} else {
$qa_content['logo'] = '<a href="' . qa_path_html('') . '" class="qa-logo-link">' . qa_html(qa_opt('site_title')) . '</a>';
}
$topath = qa_get('to');
// lets user switch between login and register without losing destination page
$userlinks = qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
$qa_content['navigation']['user'] = array();
if (qa_is_logged_in()) {
$qa_content['loggedin'] = qa_lang_html_sub_split('main/logged_in_x', QA_FINAL_EXTERNAL_USERS ? qa_get_logged_in_user_html(qa_get_logged_in_user_cache(), qa_path_to_root(), false) : qa_get_one_user_html(qa_get_logged_in_handle(), false));
$qa_content['navigation']['user']['updates'] = array('url' => qa_path_html('updates'), 'label' => qa_lang_html('main/nav_updates'));
if (!empty($userlinks['logout'])) {
$qa_content['navigation']['user']['logout'] = array('url' => qa_html(@$userlinks['logout']), 'label' => qa_lang_html('main/nav_logout'));
}
if (!QA_FINAL_EXTERNAL_USERS) {
$source = qa_get_logged_in_source();
if (strlen($source)) {
$loginmodules = qa_load_modules_with('login', 'match_source');
foreach ($loginmodules as $module) {
if ($module->match_source($source) && method_exists($module, 'logout_html')) {
ob_start();
$module->logout_html(qa_path('logout', array(), qa_opt('site_url')));
$qa_content['navigation']['user']['logout'] = array('label' => ob_get_clean());
}
}
}
}
$notices = qa_db_get_pending_result('notices');
foreach ($notices as $notice) {
$qa_content['notices'][] = qa_notice_form($notice['noticeid'], qa_viewer_html($notice['content'], $notice['format']), $notice);
}
} else {
require_once QA_INCLUDE_DIR . 'util/string.php';
if (!QA_FINAL_EXTERNAL_USERS) {
$loginmodules = qa_load_modules_with('login', 'login_html');
foreach ($loginmodules as $tryname => $module) {
ob_start();
$module->login_html(isset($topath) ? qa_opt('site_url') . $topath : qa_path($request, $_GET, qa_opt('site_url')), 'menu');
$label = ob_get_clean();
if (strlen($label)) {
$qa_content['navigation']['user'][implode('-', qa_string_to_words($tryname))] = array('label' => $label);
}
}
}
if (!empty($userlinks['login'])) {
$qa_content['navigation']['user']['login'] = array('url' => qa_html(@$userlinks['login']), 'label' => qa_lang_html('main/nav_login'));
}
if (!empty($userlinks['register'])) {
$qa_content['navigation']['user']['register'] = array('url' => qa_html(@$userlinks['register']), 'label' => qa_lang_html('main/nav_register'));
}
}
if (QA_FINAL_EXTERNAL_USERS || !qa_is_logged_in()) {
if (qa_opt('show_notice_visitor') && !isset($topath) && !isset($_COOKIE['qa_noticed'])) {
$qa_content['notices'][] = qa_notice_form('visitor', qa_opt('notice_visitor'));
}
} else {
setcookie('qa_noticed', 1, time() + 86400 * 3650, '/', QA_COOKIE_DOMAIN);
// don't show first-time notice if a user has logged in
if (qa_opt('show_notice_welcome') && qa_get_logged_in_flags() & QA_USER_FLAGS_WELCOME_NOTICE) {
if ($requestlower != 'confirm' && $requestlower != 'account') {
// let people finish registering in peace
$qa_content['notices'][] = qa_notice_form('welcome', qa_opt('notice_welcome'));
}
}
}
$qa_content['script_rel'] = array('qa-content/jquery-1.11.2.min.js');
$qa_content['script_rel'][] = 'qa-content/qa-page.js?' . QA_VERSION;
if ($voting) {
$qa_content['error'] = @$qa_page_error_html;
}
$qa_content['script_var'] = array('qa_root' => qa_path_to_root(), 'qa_request' => $request);
return $qa_content;
}