} elseif (!$wallposterrorhtml) { qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $useraccount['userid'], $useraccount['handle'], $inmessage, ''); qa_redirect(qa_request()); } } // Prepare content for theme $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html_sub('profile/wall_for_x', $userhtml); $qa_content['error'] = @$errors['page']; $qa_content['script_rel'][] = 'qa-content/qa-user.js?' . QA_VERSION; $qa_content['message_list'] = array('tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'hidden' => array('qa_click' => '', 'handle' => qa_html($useraccount['handle']), 'start' => qa_html($start), 'code' => qa_get_form_security_code('wall-' . $useraccount['handle']))), 'messages' => array()); if ($start == 0) { // only allow posting on first page if ($wallposterrorhtml) { $qa_content['message_list']['error'] = $wallposterrorhtml; } else { $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message']))); $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, false);"', 'label' => qa_lang_html('profile/post_wall_button'))); } } foreach ($usermessages as $message) { $qa_content['message_list']['messages'][] = qa_wall_post_view($message); } $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next')); // Sub menu for navigation in user pages $ismyuser = isset($loginuserid) && $loginuserid == (QA_FINAL_EXTERNAL_USERS ? $userid : $useraccount['userid']); $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'wall', $ismyuser); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
} // Other profile fields foreach ($userfields as $userfield) { $value = @$inprofile[$userfield['fieldid']]; if (!isset($value)) { $value = @$userprofile[$userfield['title']]; } $label = trim(qa_user_userfield_label($userfield), ':'); if (strlen($label)) { $label .= ':'; } $qa_content['form_profile']['fields'][$userfield['title']] = array('label' => qa_html($label), 'tags' => 'name="field_' . $userfield['fieldid'] . '"', 'value' => qa_html($value), 'error' => qa_html(@$errors[$userfield['fieldid']]), 'rows' => $userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE ? 8 : null, 'type' => $isblocked ? 'static' : 'text'); } // Raw information for plugin layers to access $qa_content['raw']['account'] = $useraccount; $qa_content['raw']['profile'] = $userprofile; $qa_content['raw']['points'] = $userpoints; // Change password form $qa_content['form_password'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'title' => qa_lang_html('users/change_password'), 'fields' => array('old' => array('label' => qa_lang_html('users/old_password'), 'tags' => 'name="oldpassword"', 'value' => qa_html(@$inoldpassword), 'type' => 'password', 'error' => qa_html(@$errors['oldpassword'])), 'new_1' => array('label' => qa_lang_html('users/new_password_1'), 'tags' => 'name="newpassword1"', 'type' => 'password', 'error' => qa_html(@$errors['password'])), 'new_2' => array('label' => qa_lang_html('users/new_password_2'), 'tags' => 'name="newpassword2"', 'type' => 'password', 'error' => qa_html(@$errors['newpassword2']))), 'buttons' => array('change' => array('label' => qa_lang_html('users/change_password'))), 'hidden' => array('dochangepassword' => '1', 'code' => qa_get_form_security_code('password'))); if (!$haspassword) { $qa_content['form_password']['fields']['old']['type'] = 'static'; $qa_content['form_password']['fields']['old']['value'] = qa_lang_html('users/password_none'); } if (qa_get_state() == 'password-changed') { $qa_content['form_profile']['ok'] = qa_lang_html('users/password_changed'); } $qa_content['navigation']['sub'] = qa_user_sub_navigation($useraccount['handle'], 'account', true); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
function process_request($request) { require_once QA_INCLUDE_DIR . 'qa-db-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-users.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once $this->directory . 'qa-open-utils.php'; // Check we're not using single-sign on integration, that we're logged in if (QA_FINAL_EXTERNAL_USERS) { qa_fatal_error('User accounts are handled by external code'); } $userid = qa_get_logged_in_userid(); if (!isset($userid)) { qa_redirect('login'); } // Get current information on user $useraccount = qa_db_user_find_by_id__open($userid); // Check if settings were updated $this->check_settings(); // Check if we're unlinking an account $mylogins = $this->check_unlink($useraccount); // Check if we need to associate another provider $tolink = $this->check_associate($useraccount); // Check if we're merging multiple accounts $otherlogins = $this->check_merge($useraccount, $mylogins, $tolink); // Prepare content for theme $disp_conf = qa_get('confirm') || !empty($tolink); $qa_content = qa_content_prepare(); // Build page if (!$disp_conf) { // just visiting the regular page $qa_content['title'] = qa_lang_html('plugin_open/my_logins_title'); $qa_content['navigation']['sub'] = qa_user_sub_navigation($useraccount['handle'], '', true); $qa_content['script_onloads'][] = '$(function(){ window.setTimeout(function() { qa_conceal(".form-notification-ok"); }, 1500); });'; $this->display_summary($qa_content, $useraccount); $this->display_logins($qa_content, $useraccount, $mylogins); $this->display_duplicates($qa_content, $useraccount, $otherlogins); $this->display_services($qa_content, !empty($mylogins) || !empty($otherlogins)); } else { // logged in and there are duplicates $qa_content['title'] = qa_lang_html('plugin_open/other_logins_conf_title'); if (!$this->display_duplicates($qa_content, $useraccount, $otherlogins)) { $tourl = qa_get('to'); if (!empty($tourl)) { qa_redirect($tourl); } else { if ($tolink) { // unable to link the login $provider = ucfirst($tolink['source']); qa_redirect('logins', array('provider' => $provider, 'code' => 99)); } else { // no merge to confirm qa_redirect('', array('provider' => '', 'code' => 98)); } } } } return $qa_content; }
$qa_content['form_activity']['fields']['questions']['value'] .= $userpoints['aselects'] == 1 ? qa_lang_html_sub('profile/1_with_best_chosen', '<span class="qa-uf-user-q-selects">1</span>', '1') : qa_lang_html_sub('profile/x_with_best_chosen', '<span class="qa-uf-user-q-selects">' . number_format($userpoints['aselects']) . '</span>'); } if (@$userpoints['aselecteds']) { $qa_content['form_activity']['fields']['answers']['value'] .= $userpoints['aselecteds'] == 1 ? qa_lang_html_sub('profile/1_chosen_as_best', '<span class="qa-uf-user-a-selecteds">1</span>', '1') : qa_lang_html_sub('profile/x_chosen_as_best', '<span class="qa-uf-user-a-selecteds">' . number_format($userpoints['aselecteds']) . '</span>'); } // For plugin layers to access $qa_content['raw']['userid'] = $userid; $qa_content['raw']['points'] = $userpoints; $qa_content['raw']['rank'] = $userrank; // Wall posts if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) { $qa_content['message_list'] = array('title' => '<a name="wall">' . qa_lang_html_sub('profile/wall_for_x', $userhtml) . '</a>', 'tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '#wall"', 'style' => 'tall', 'hidden' => array('qa_click' => '', 'handle' => qa_html($useraccount['handle']), 'start' => 0, 'code' => qa_get_form_security_code('wall-' . $useraccount['handle']))), 'messages' => array()); if ($wallposterrorhtml) { $qa_content['message_list']['error'] = $wallposterrorhtml; } else { $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message']))); $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, true);"', 'label' => qa_lang_html('profile/post_wall_button'))); } foreach ($usermessages as $message) { $qa_content['message_list']['messages'][] = qa_wall_post_view($message); } if ($useraccount['wallposts'] > count($usermessages)) { $qa_content['message_list']['messages'][] = qa_wall_view_more_link($handle, count($usermessages)); } } // Sub menu for navigation in user pages $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'profile', isset($loginuserid) && $loginuserid == (QA_FINAL_EXTERNAL_USERS ? $userid : $useraccount['userid'])); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) { // check the user exists return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Get information on user references $questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs)); $questions = array_slice($questions, 0, qa_opt('page_size_activity')); $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false); // Prepare content for theme $qa_content = qa_content_prepare(true); if (count($questions)) { $qa_content['title'] = qa_lang_html_sub('profile/recent_activity_by_x', $userhtml); } else { $qa_content['title'] = qa_lang_html_sub('profile/no_posts_by_x', $userhtml); } // Recent activity by this user $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))); $qa_content['q_list']['qs'] = array(); $htmldefaults = qa_post_html_defaults('Q'); $htmldefaults['whoview'] = false; $htmldefaults['voteview'] = false; $htmldefaults['avatarsize'] = 0; foreach ($questions as $question) { $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults)); } // Sub menu for navigation in user pages $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'activity'); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
// check the user exists return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Get information on user questions $pagesize = qa_opt('page_size_qs'); $count = (int) @$userpoints['qposts']; $questions = array_slice($questions, 0, $pagesize); $usershtml = qa_userids_handles_html($questions, false); // Prepare content for theme $qa_content = qa_content_prepare(true); if (count($questions)) { $qa_content['title'] = qa_lang_html_sub('profile/questions_by_x', $userhtml); } else { $qa_content['title'] = qa_lang_html_sub('profile/no_questions_by_x', $userhtml); } // Recent questions by this user $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))); $qa_content['q_list']['qs'] = array(); $htmldefaults = qa_post_html_defaults('Q'); $htmldefaults['whoview'] = false; $htmldefaults['avatarsize'] = 0; foreach ($questions as $question) { $qa_content['q_list']['qs'][] = qa_post_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $htmldefaults)); } $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next')); // Sub menu for navigation in user pages $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'questions'); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
if (@$userpoints['aselecteds']) { $qa_content['form_activity']['fields']['answers']['value'] .= $userpoints['aselecteds'] == 1 ? qa_lang_html_sub('profile/1_chosen_as_best', '<span class="qa-uf-user-a-selecteds">1</span>', '1') : qa_lang_html_sub('profile/x_chosen_as_best', '<span class="qa-uf-user-a-selecteds">' . number_format($userpoints['aselecteds']) . '</span>'); } // For plugin layers to access $qa_content['raw']['userid'] = $userid; $qa_content['raw']['points'] = $userpoints; $qa_content['raw']['rank'] = $userrank; // Wall posts if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) { $qa_content['message_list'] = array('title' => '<a name="wall">' . qa_lang_html_sub('profile/wall_for_x', $userhtml) . '</a>', 'tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '#wall"', 'style' => 'tall', 'hidden' => array('qa_click' => '')), 'messages' => array()); if ($wallposterrorhtml) { $qa_content['message_list']['error'] = $wallposterrorhtml; } else { $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message']))); $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, true);"', 'label' => qa_lang_html('profile/post_wall_button'))); $qa_content['message_list']['form']['hidden']['handle'] = qa_html($useraccount['handle']); $qa_content['message_list']['form']['hidden']['code'] = qa_get_form_security_code('wall-' . $useraccount['handle']); } foreach ($usermessages as $message) { $qa_content['message_list']['messages'][] = qa_wall_post_view($message); } if ($useraccount['wallposts'] > count($usermessages)) { $qa_content['message_list']['messages'][] = qa_wall_view_more_link($handle, count($usermessages)); } } // Sub menu for navigation in user pages $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'profile'); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
$pagesize = qa_opt('page_size_activity'); $count = (int) @$userpoints['aposts']; $questions = array_slice($questions, 0, $pagesize); $usershtml = qa_userids_handles_html($questions, false); // Prepare content for theme $qa_content = qa_content_prepare(true); if (count($questions)) { $qa_content['title'] = qa_lang_html_sub('profile/answers_by_x', $userhtml); } else { $qa_content['title'] = qa_lang_html_sub('profile/no_answers_by_x', $userhtml); } // Recent questions by this user $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))); $qa_content['q_list']['qs'] = array(); $htmldefaults = qa_post_html_defaults('Q'); $htmldefaults['whoview'] = false; $htmldefaults['avatarsize'] = 0; $htmldefaults['ovoteview'] = true; $htmldefaults['answersview'] = false; foreach ($questions as $question) { $options = qa_post_html_options($question, $htmldefaults); $options['voteview'] = qa_get_vote_view('A', false, false); $qa_content['q_list']['qs'][] = qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, $options); } $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next')); // Sub menu for navigation in user pages $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'answers'); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
} // Favorite users if (!QA_FINAL_EXTERNAL_USERS) { $qa_content['ranking_users'] = qa_favorite_users_view($users, $usershtml); $qa_content['ranking_users']['title'] = count($users) ? qa_lang_html('main/nav_users') : qa_lang_html('misc/no_favorite_users'); if ($numUsers['count'] > count($users)) { $url = qa_path_html('favorites/users', array('start' => $pagesize_users)); $qa_content['ranking_users']['footer'] = '<p class="qa-link-next"><a href="' . $url . '">' . qa_lang_html('misc/more_favorite_users') . '</a></p>'; } } // Favorite tags if (qa_using_tags()) { $qa_content['ranking_tags'] = qa_favorite_tags_view($tags); $qa_content['ranking_tags']['title'] = count($tags) ? qa_lang_html('main/nav_tags') : qa_lang_html('misc/no_favorite_tags'); if ($numTags['count'] > count($tags)) { $url = qa_path_html('favorites/tags', array('start' => $pagesize_tags)); $qa_content['ranking_tags']['footer'] = '<p class="qa-link-next"><a href="' . $url . '">' . qa_lang_html('misc/more_favorite_tags') . '</a></p>'; } } // Favorite categories (no pagination) if (qa_using_categories()) { $qa_content['nav_list_categories'] = qa_favorite_categories_view($categories); $qa_content['nav_list_categories']['title'] = count($categories) ? qa_lang_html('main/nav_categories') : qa_lang_html('misc/no_favorite_categories'); } // Sub navigation for account pages and suggestion $qa_content['suggest_next'] = qa_lang_html_sub('misc/suggest_favorites_add', '<span class="qa-favorite-image"> </span>'); $qa_content['navigation']['sub'] = qa_user_sub_navigation(qa_get_logged_in_handle(), 'favorites', true); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */