}
        if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_AVATAR) {
            $avatarvalue = $avataroptions['uploaded'];
        }
    }
    $qa_content['form_profile']['fields']['avatar'] = array('type' => 'select-radio', 'label' => qa_lang_html('users/avatar_label'), 'tags' => 'name="avatar"', 'options' => $avataroptions, 'value' => $avatarvalue, 'error' => qa_html(@$errors['avatar']));
} else {
    unset($qa_content['form_profile']['fields']['avatar']);
}
//	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');
}
                break;
        }
        if (isset($feedrequest) && $value) {
            $optionfield['note'] = '<a href="' . qa_path_html(qa_feed_request($feedrequest)) . '">' . qa_lang_html($feedisexample ? 'admin/feed_link_example' : 'admin/feed_link') . '</a>';
        }
        $qa_content['form']['fields'][$optionname] = $optionfield;
    }
}
//	Extra items for specific pages
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>';
        }
示例#3
0
                break;
        }
        if (isset($feedrequest) && $value) {
            $optionfield['note'] = '<A HREF="' . qa_path_html(qa_feed_request($feedrequest)) . '">' . qa_lang_html($feedisexample ? 'admin/feed_link_example' : 'admin/feed_link') . '</A>';
        }
        $qa_content['form']['fields'][$optionname] = $optionfield;
    }
}
//	Extra items for specific pages
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'), '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>';
        }
foreach ($userfields as $userfield) {
    if (isset($previous)) {
        $positionhtml = qa_lang_html_sub('admin/after_x', qa_html(qa_user_userfield_label($passedself ? $userfield : $previous)));
    } else {
        $positionhtml = qa_lang_html('admin/first');
    }
    $positionoptions[$userfield['position']] = $positionhtml;
    if ($userfield['fieldid'] == @$editfield['fieldid']) {
        $passedself = true;
    }
    $previous = $userfield;
}
if (isset($editfield['position'])) {
    $positionvalue = $positionoptions[$editfield['position']];
} else {
    $positionvalue = isset($previous) ? qa_lang_html_sub('admin/after_x', qa_html(qa_user_userfield_label($previous))) : qa_lang_html('admin/first');
    $positionoptions[1 + @max(array_keys($positionoptions))] = $positionvalue;
}
$typeoptions = array(0 => qa_lang_html('admin/field_single_line'), QA_FIELD_FLAGS_MULTI_LINE => qa_lang_html('admin/field_multi_line'), QA_FIELD_FLAGS_LINK_URL => qa_lang_html('admin/field_link_url'));
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_path_html($qa_request) . '"', 'style' => 'tall', 'fields' => array('name' => array('tags' => 'NAME="name" ID="name"', 'label' => qa_lang_html('admin/field_name'), 'value' => qa_html(isset($inname) ? $inname : qa_user_userfield_label($editfield)), 'error' => qa_html(@$errors['name'])), 'type' => array('id' => 'type_display', 'tags' => 'NAME="flags"', 'label' => qa_lang_html('admin/field_type'), 'type' => 'select', 'options' => $typeoptions, 'value' => @$typeoptions[isset($inflags) ? $inflags : @$editfield['flags']]), 'delete' => array('tags' => 'NAME="dodelete" ID="dodelete"', 'label' => qa_lang_html('admin/delete_field'), 'value' => 0, 'type' => 'checkbox'), 'position' => array('id' => 'position_display', 'tags' => 'NAME="position"', 'label' => qa_lang_html('admin/position'), 'type' => 'select', 'options' => $positionoptions, 'value' => $positionvalue)), 'buttons' => array('save' => array('label' => qa_lang_html(isset($editfield['fieldid']) ? 'main/save_button' : 'admin/add_field_button')), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array('dosavefield' => '1', 'edit' => @$editfield['fieldid']));
if (isset($editfield['fieldid'])) {
    qa_set_display_rules($qa_content, array('position_display' => '!dodelete'));
} else {
    unset($qa_content['form']['fields']['delete']);
}
$qa_content['focusid'] = 'name';
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
        $positionhtml = qa_lang_html_sub('admin/after_x', qa_html(qa_user_userfield_label($passedself ? $userfield : $previous)));
    } else {
        $positionhtml = qa_lang_html('admin/first');
    }
    $positionoptions[$userfield['position']] = $positionhtml;
    if ($userfield['fieldid'] == @$editfield['fieldid']) {
        $passedself = true;
    }
    $previous = $userfield;
}
if (isset($editfield['position'])) {
    $positionvalue = $positionoptions[$editfield['position']];
} else {
    $positionvalue = isset($previous) ? qa_lang_html_sub('admin/after_x', qa_html(qa_user_userfield_label($previous))) : qa_lang_html('admin/first');
    $positionoptions[1 + @max(array_keys($positionoptions))] = $positionvalue;
}
$typeoptions = array(0 => qa_lang_html('admin/field_single_line'), QA_FIELD_FLAGS_MULTI_LINE => qa_lang_html('admin/field_multi_line'), QA_FIELD_FLAGS_LINK_URL => qa_lang_html('admin/field_link_url'));
$permitoptions = qa_admin_permit_options(QA_PERMIT_ALL, QA_PERMIT_ADMINS, false, false);
$permitvalue = @$permitoptions[isset($inpermit) ? $inpermit : $editfield['permit']];
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_path_html(qa_request()) . '"', 'style' => 'tall', 'fields' => array('name' => array('tags' => 'name="name" id="name"', 'label' => qa_lang_html('admin/field_name'), 'value' => qa_html(isset($inname) ? $inname : qa_user_userfield_label($editfield)), 'error' => qa_html(@$errors['name'])), 'delete' => array('tags' => 'name="dodelete" id="dodelete"', 'label' => qa_lang_html('admin/delete_field'), 'value' => 0, 'type' => 'checkbox'), 'type' => array('id' => 'type_display', 'tags' => 'name="type"', 'label' => qa_lang_html('admin/field_type'), 'type' => 'select', 'options' => $typeoptions, 'value' => @$typeoptions[isset($intype) ? $intype : @$editfield['flags'] & (QA_FIELD_FLAGS_MULTI_LINE | QA_FIELD_FLAGS_LINK_URL)]), 'permit' => array('id' => 'permit_display', 'tags' => 'name="permit"', 'label' => qa_lang_html('admin/permit_to_view'), 'type' => 'select', 'options' => $permitoptions, 'value' => $permitvalue), 'position' => array('id' => 'position_display', 'tags' => 'name="position"', 'label' => qa_lang_html('admin/position'), 'type' => 'select', 'options' => $positionoptions, 'value' => $positionvalue), 'onregister' => array('id' => 'register_display', 'tags' => 'name="onregister"', 'label' => qa_lang_html('admin/show_on_register_form'), 'type' => 'checkbox', 'value' => isset($inonregister) ? $inonregister : @$editfield['flags'] & QA_FIELD_FLAGS_ON_REGISTER)), 'buttons' => array('save' => array('label' => qa_lang_html(isset($editfield['fieldid']) ? 'main/save_button' : 'admin/add_field_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array('dosavefield' => '1', 'edit' => @$editfield['fieldid'], 'code' => qa_get_form_security_code('admin/userfields')));
if (isset($editfield['fieldid'])) {
    qa_set_display_rules($qa_content, array('type_display' => '!dodelete', 'position_display' => '!dodelete', 'register_display' => '!dodelete', 'permit_display' => '!dodelete'));
} else {
    unset($qa_content['form']['fields']['delete']);
}
$qa_content['focusid'] = 'name';
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/