function qa_post_html_defaults($basetype, $full = false) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } require_once QA_INCLUDE_DIR . 'qa-app-users.php'; return array('tagsview' => $basetype == 'Q' && qa_using_tags(), 'categoryview' => $basetype == 'Q' && qa_using_categories(), 'contentview' => $full, 'voteview' => qa_get_vote_view($basetype, $full), 'flagsview' => qa_opt('flagging_of_posts') && $full, 'answersview' => $basetype == 'Q', 'viewsview' => $basetype == 'Q' && qa_opt('do_count_q_views') && qa_opt('show_view_counts'), 'whatview' => true, 'whatlink' => qa_opt('show_a_c_links'), 'whenview' => qa_opt('show_when_created'), 'ipview' => !qa_user_permit_error('permit_anon_view_ips'), 'whoview' => true, 'avatarsize' => qa_opt('avatar_q_list_size'), 'pointsview' => qa_opt('show_user_points'), 'pointstitle' => qa_opt('show_user_titles') ? qa_get_points_to_titles() : array(), 'updateview' => true, 'blockwordspreg' => qa_get_block_words_preg(), 'showurllinks' => qa_opt('show_url_links'), 'linksnewwindow' => qa_opt('links_in_new_window'), 'microformats' => $full, 'fulldatedays' => qa_opt('show_full_date_days')); }
} } else { $qa_content['form_profile']['buttons']['block'] = array('tags' => 'NAME="doblock"', 'label' => qa_lang_html('users/block_user_button')); } } } } if (!is_array($qa_content['form_profile']['fields']['removeavatar'])) { unset($qa_content['form_profile']['fields']['removeavatar']); } $qa_content['raw']['account'] = $useraccount; // for plugin layers to access $qa_content['raw']['profile'] = $userprofile; } // Information about user activity, available also with single sign-on integration $qa_content['form_activity'] = array('title' => '<A NAME="activity">' . qa_lang_html_sub('profile/activity_by_x', $userhtml) . '</A>', 'style' => 'wide', 'fields' => array('bonus' => array('label' => qa_lang_html('profile/bonus_points'), 'tags' => 'NAME="bonus"', 'value' => qa_html($userpoints['bonus']), 'type' => 'number', 'note' => qa_lang_html('users/only_shown_admins')), 'points' => array('type' => 'static', 'label' => qa_lang_html('profile/score'), 'value' => @$userpoints['points'] == 1 ? qa_lang_html_sub('main/1_point', '<SPAN CLASS="qa-uf-user-points">1</SPAN>', '1') : qa_lang_html_sub('main/x_points', '<SPAN CLASS="qa-uf-user-points">' . qa_html(number_format(@$userpoints['points'])) . '</SPAN>')), 'title' => array('type' => 'static', 'label' => qa_lang_html('profile/title'), 'value' => qa_get_points_title_html(@$userpoints['points'], qa_get_points_to_titles())), 'questions' => array('type' => 'static', 'label' => qa_lang_html('profile/questions'), 'value' => '<SPAN CLASS="qa-uf-user-q-posts">' . qa_html(number_format(@$userpoints['qposts'])) . '</SPAN>'), 'answers' => array('type' => 'static', 'label' => qa_lang_html('profile/answers'), 'value' => '<SPAN CLASS="qa-uf-user-a-posts">' . qa_html(number_format(@$userpoints['aposts'])) . ' (each reaction you write<br>will generate 3 points)<br></SPAN>'))); if ($loginlevel >= QA_USER_LEVEL_ADMIN) { $qa_content['form_activity']['tags'] = 'METHOD="POST" ACTION="' . qa_self_html() . '"'; $qa_content['form_activity']['buttons'] = array('setbonus' => array('tags' => 'NAME="dosetbonus"', 'label' => qa_lang_html('profile/set_bonus_button'))); } else { unset($qa_content['form_activity']['fields']['bonus']); } if (!isset($qa_content['form_activity']['fields']['title']['value'])) { unset($qa_content['form_activity']['fields']['title']); } if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) { // only show comment count if comments are enabled $qa_content['form_activity']['fields']['comments'] = array('type' => 'static', 'label' => qa_lang_html('profile/comments'), 'value' => '<SPAN CLASS="qa-uf-user-c-posts">' . qa_html(number_format(@$userpoints['cposts'])) . '</SPAN>'); } if (qa_opt('voting_on_qs') || qa_opt('voting_on_as')) { // only show vote record if voting is enabled
switch ($adminsection) { case 'users': if (!QA_FINAL_EXTERNAL_USERS) { $userfields = qa_db_single_select(qa_db_userfields_selectspec()); $listhtml = ''; foreach ($userfields as $userfield) { $listhtml .= '<li><b>' . qa_html(qa_user_userfield_label($userfield)) . '</b>'; $listhtml .= strtr(qa_lang_html('admin/edit_field'), array('^1' => '<a href="' . qa_path_html('admin/userfields', array('edit' => $userfield['fieldid'])) . '">', '^2' => '</a>')); $listhtml .= '</li>'; } $listhtml .= '<li><b><a href="' . qa_path_html('admin/userfields') . '">' . qa_lang_html('admin/add_new_field') . '</a></b></li>'; $qa_content['form']['fields'][] = array('type' => 'blank'); $qa_content['form']['fields']['userfields'] = array('label' => qa_lang_html('admin/profile_fields'), 'id' => 'profile_fields', 'style' => 'tall', 'type' => 'custom', 'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">' . $listhtml . '</ul>' : null); } $qa_content['form']['fields'][] = array('type' => 'blank'); $pointstitle = qa_get_points_to_titles(); $listhtml = ''; foreach ($pointstitle as $points => $title) { $listhtml .= '<li><b>' . $title . '</b> - ' . ($points == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html(number_format($points)))); $listhtml .= strtr(qa_lang_html('admin/edit_title'), array('^1' => '<a href="' . qa_path_html('admin/usertitles', array('edit' => $points)) . '">', '^2' => '</a>')); $listhtml .= '</li>'; } $listhtml .= '<li><b><a href="' . qa_path_html('admin/usertitles') . '">' . qa_lang_html('admin/add_new_title') . '</a></b></li>'; $qa_content['form']['fields']['usertitles'] = array('label' => qa_lang_html('admin/user_titles'), 'style' => 'tall', 'type' => 'custom', 'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">' . $listhtml . '</ul>' : null); break; case 'layout': $listhtml = ''; $widgetmodules = qa_load_modules_with('widget', 'allow_template'); foreach ($widgetmodules as $tryname => $trywidget) { if (method_exists($trywidget, 'allow_region')) { $listhtml .= '<li><b>' . qa_html($tryname) . '</b>';
$qa_content['form_profile']['buttons']['block'] = array('tags' => 'name="doblock"', 'label' => qa_lang_html('users/block_user_button')); } $qa_content['form_profile']['hidden'] = array('code' => qa_get_form_security_code('user-' . $handle)); } } elseif (isset($loginuserid) && $loginuserid == $userid) { $qa_content['form_profile']['buttons'] = array('account' => array('tags' => 'name="doaccount"', 'label' => qa_lang_html('users/edit_profile'))); } if (!is_array($qa_content['form_profile']['fields']['removeavatar'])) { unset($qa_content['form_profile']['fields']['removeavatar']); } $qa_content['raw']['account'] = $useraccount; // for plugin layers to access $qa_content['raw']['profile'] = $userprofile; } // Information about user activity, available also with single sign-on integration $qa_content['form_activity'] = array('title' => '<a name="activity">' . qa_lang_html_sub('profile/activity_by_x', $userhtml) . '</a>', 'style' => 'wide', 'fields' => array('bonus' => array('label' => qa_lang_html('profile/bonus_points'), 'tags' => 'name="bonus"', 'value' => qa_html(isset($inbonus) ? $inbonus : $userpoints['bonus']), 'type' => 'number', 'note' => qa_lang_html('users/only_shown_admins'), 'id' => 'bonus'), 'points' => array('type' => 'static', 'label' => qa_lang_html('profile/score'), 'value' => @$userpoints['points'] == 1 ? qa_lang_html_sub('main/1_point', '<span class="qa-uf-user-points">1</span>', '1') : qa_lang_html_sub('main/x_points', '<span class="qa-uf-user-points">' . qa_html(number_format(@$userpoints['points'])) . '</span>'), 'id' => 'points'), 'title' => array('type' => 'static', 'label' => qa_lang_html('profile/title'), 'value' => qa_get_points_title_html(@$userpoints['points'], qa_get_points_to_titles()), 'id' => 'title'), 'questions' => array('type' => 'static', 'label' => qa_lang_html('profile/questions'), 'value' => '<span class="qa-uf-user-q-posts">' . qa_html(number_format(@$userpoints['qposts'])) . '</span>', 'id' => 'questions'), 'answers' => array('type' => 'static', 'label' => qa_lang_html('profile/answers'), 'value' => '<span class="qa-uf-user-a-posts">' . qa_html(number_format(@$userpoints['aposts'])) . '</span>', 'id' => 'answers'))); if ($loginlevel >= QA_USER_LEVEL_ADMIN) { $qa_content['form_activity']['tags'] = 'method="post" action="' . qa_self_html() . '"'; $qa_content['form_activity']['buttons'] = array('setbonus' => array('tags' => 'name="dosetbonus"', 'label' => qa_lang_html('profile/set_bonus_button'))); $qa_content['form_activity']['hidden'] = array('code' => qa_get_form_security_code('user-activity-' . $handle)); } else { unset($qa_content['form_activity']['fields']['bonus']); } if (!isset($qa_content['form_activity']['fields']['title']['value'])) { unset($qa_content['form_activity']['fields']['title']); } if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) { // only show comment count if comments are enabled $qa_content['form_activity']['fields']['comments'] = array('type' => 'static', 'label' => qa_lang_html('profile/comments'), 'value' => '<span class="qa-uf-user-c-posts">' . qa_html(number_format(@$userpoints['cposts'])) . '</span>', 'id' => 'comments'); } if (qa_opt('voting_on_qs') || qa_opt('voting_on_as')) {
$qa_content['form_profile']['buttons'] = array('edit' => array('tags' => 'NAME="doedit"', 'label' => qa_lang_html($fieldseditable ? 'users/edit_user_button' : 'users/edit_level_button'))); if (isset($maxlevelassign) && $useraccount['level'] < QA_USER_LEVEL_MODERATOR) { if ($useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED) { $qa_content['form_profile']['buttons']['unblock'] = array('tags' => 'NAME="dounblock"', 'label' => qa_lang_html('users/unblock_user_button')); if (count($questions) && !qa_user_permit_error('permit_hide_show')) { $qa_content['form_profile']['buttons']['hideall'] = array('tags' => 'NAME="dohideall"', 'label' => qa_lang_html('users/hide_all_user_button')); } } else { $qa_content['form_profile']['buttons']['block'] = array('tags' => 'NAME="doblock"', 'label' => qa_lang_html('users/block_user_button')); } } } } } // Information about user activity, available also with single sign-on integration $qa_content['form_activity'] = array('title' => qa_lang_html_sub('profile/activity_by_x', $userhtml), 'style' => 'wide', 'fields' => array('points' => array('type' => 'static', 'label' => qa_lang_html('profile/score'), 'value' => @$userpoints['points'] == 1 ? qa_lang_html_sub('main/1_point', '<SPAN CLASS="qa-uf-user-points">1</SPAN>', '1') : qa_lang_html_sub('main/x_points', '<SPAN CLASS="qa-uf-user-points">' . qa_html(number_format(@$userpoints['points'])) . '</SPAN>')), 'title' => array('type' => 'static', 'label' => qa_lang_html('profile/title'), 'value' => qa_get_points_title_html(@$userpoints['points'], qa_get_points_to_titles())), 'questions' => array('type' => 'static', 'label' => qa_lang_html('profile/questions'), 'value' => '<SPAN CLASS="qa-uf-user-q-posts">' . qa_html(number_format(@$userpoints['qposts'])) . '</SPAN>'), 'answers' => array('type' => 'static', 'label' => qa_lang_html('profile/answers'), 'value' => '<SPAN CLASS="qa-uf-user-a-posts">' . qa_html(number_format(@$userpoints['aposts'])) . '</SPAN>'))); if (!isset($qa_content['form_activity']['fields']['title']['value'])) { unset($qa_content['form_activity']['fields']['title']); } if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) { // only show comment count if comments are enabled $qa_content['form_activity']['fields']['comments'] = array('type' => 'static', 'label' => qa_lang_html('profile/comments'), 'value' => '<SPAN CLASS="qa-uf-user-c-posts">' . qa_html(number_format(@$userpoints['cposts'])) . '</SPAN>'); } if (qa_opt('voting_on_qs') || qa_opt('voting_on_as')) { // only show vote record if voting is enabled $votedonvalue = ''; if (qa_opt('voting_on_qs')) { $qvotes = @$userpoints['qupvotes'] + @$userpoints['qdownvotes']; $innervalue = '<SPAN CLASS="qa-uf-user-q-votes">' . number_format($qvotes) . '</SPAN>'; $votedonvalue .= $qvotes == 1 ? qa_lang_html_sub('main/1_question', $innervalue, '1') : qa_lang_html_sub('main/x_questions', $innervalue); if (qa_opt('voting_on_as')) {