Example #1
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     require_css('side_blocks');
     $langs = nice_get_langs(user_lang());
     return do_template('BLOCK_SIDE_LANGUAGE', array('_GUID' => '5dd7dd434722d7fd958773bd08e838c7', 'LANGS' => $langs));
 }
Example #2
0
 /**
  * The UI to choose a language.
  *
  * @param  tempcode		The title to show when choosing a language
  * @param  boolean		Whether to also choose a language file
  * @param  boolean		Whether the user may add a language
  * @param  mixed			Text message to show (Tempcode or string)
  * @param  boolean		Whether to provide an N/A choice
  * @param  ID_TEXT		The name of the parameter for specifying language
  * @return tempcode		The UI
  */
 function choose_lang($title, $choose_lang_file = false, $add_lang = false, $text = '', $provide_na = true, $param_name = 'lang')
 {
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/language';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_intl';
     require_code('form_templates');
     $langs = new ocp_tempcode();
     if ($provide_na) {
         $langs->attach(form_input_list_entry('', false, do_lang_tempcode('NA')));
     }
     $langs->attach(nice_get_langs(NULL, $add_lang));
     $fields = form_input_list(do_lang_tempcode('LANGUAGE'), do_lang_tempcode('DESCRIPTION_LANGUAGE'), $param_name, $langs, NULL, false, false);
     $javascript = '';
     if ($add_lang) {
         $fields->attach(form_input_codename(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('LANGUAGE')), do_lang_tempcode('DESCRIPTION_NEW_LANG'), 'lang_new', '', false));
         $javascript .= 'standardAlternateFields(\'lang\',\'lang_new\');';
     }
     if ($choose_lang_file) {
         $lang_files = new ocp_tempcode();
         $lang_files->attach(form_input_list_entry('', false, do_lang_tempcode('NA_EM')));
         $lang_files->attach(nice_get_lang_files());
         $fields->attach(form_input_list(do_lang_tempcode('LANGUAGE_FILE'), do_lang_tempcode('DESCRIPTION_LANGUAGE_FILE'), 'lang_file', $lang_files, NULL, true));
         $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang('SEARCH')), '', 'search', '', false));
         $javascript .= 'standardAlternateFields(\'lang_file\',\'search\');';
     }
     $post_url = get_self_url(false, false, NULL, false, true);
     return do_template('FORM_SCREEN', array('_GUID' => 'ee6bdea3661cb4736173cac818a769e5', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('CHOOSE'), 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => $text, 'JAVASCRIPT' => $javascript));
 }
Example #3
0
 /**
  * The UI to choose a theme.
  *
  * @param  tempcode		The title to show when choosing a theme
  * @param  boolean		Whether to also choose a language
  * @return tempcode		The UI
  */
 function choose_theme($title, $lang_too = false)
 {
     $themes = new ocp_tempcode();
     $_themes = find_all_themes();
     require_code('form_templates');
     foreach ($_themes as $theme => $theme_title) {
         $themes->attach(form_input_list_entry($theme, $theme == $GLOBALS['FORUM_DRIVER']->get_theme(), $theme_title));
     }
     $fields = form_input_list(do_lang_tempcode('THEME'), '', 'theme', $themes, NULL, true);
     if ($lang_too) {
         $langs = nice_get_langs();
         $fields->attach(form_input_list(do_lang_tempcode('LANGUAGE'), do_lang_tempcode('DESCRIPTION_LANGUAGE'), 'lang', $langs, NULL, true));
     }
     $post_url = get_self_url(false, false, NULL, false, true);
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_THEMES'))));
     breadcrumb_set_self(do_lang_tempcode('CHOOSE'));
     return do_template('FORM_SCREEN', array('_GUID' => '01030dc8f338138ac36ff4f59c7892fc', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('CHOOSE'), 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => ''));
 }
Example #4
0
/**
 * Get form fields for adding/editing a chatroom.
 *
 * @param  boolean		Whether the room is being made as a private room by the current member
 * @param  SHORT_TEXT	The room name
 * @param  LONG_TEXT		The welcome message
 * @param  SHORT_TEXT	The owner username
 * @param  LONG_TEXT		The comma-separated list of users that may access it (blank: no restriction)
 * @param  LONG_TEXT		The comma-separated list of usergroups that may access it (blank: no restriction)
 * @param  LONG_TEXT		The comma-separated list of users that may NOT access it (blank: no restriction)
 * @param  LONG_TEXT		The comma-separated list of usergroups that may NOT access it (blank: no restriction)
 * @return tempcode		The fields
 */
function get_chatroom_fields($is_made_by_me = false, $room_name = '', $welcome = '', $username = '', $allow2 = '', $allow2_groups = '', $disallow2 = '', $disallow2_groups = '')
{
    require_code('form_templates');
    $fields = new ocp_tempcode();
    $fields->attach(form_input_line(do_lang_tempcode('ROOM_NAME'), do_lang_tempcode('DESCRIPTION_ROOM_NAME'), 'room_name', $room_name, true));
    $fields->attach(form_input_line_comcode(do_lang_tempcode('WELCOME_MESSAGE'), do_lang_tempcode('DESCRIPTION_WELCOME_MESSAGE'), 'c_welcome', $welcome, false));
    if (!$is_made_by_me) {
        $fields->attach(form_input_username(do_lang_tempcode('ROOM_OWNER'), do_lang_tempcode('DESCRIPTION_ROOM_OWNER'), 'room_owner', $username, false));
    }
    $langs = find_all_langs();
    if (count($langs) > 1) {
        $fields->attach(form_input_list(do_lang_tempcode('ROOM_LANG'), do_lang_tempcode('DESCRIPTION_ROOM_LANG'), 'room_lang', nice_get_langs()));
    }
    require_lang('permissions');
    $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => $allow2 == '' && $allow2_groups == '' && !$is_made_by_me, 'TITLE' => do_lang_tempcode($is_made_by_me ? 'PERMISSIONS' : 'LOWLEVEL_PERMISSIONS'))));
    $fields->attach(form_input_username_multi(do_lang_tempcode('ALLOW_LIST'), do_lang_tempcode('DESCRIPTION_ALLOW_LIST'), 'allow_list', array_map(array($GLOBALS['FORUM_DRIVER'], 'get_username'), $allow2 == '' ? array() : array_map('intval', explode(',', $allow2))), 0, true));
    if (!$is_made_by_me || get_option('group_private_chatrooms') == '1') {
        $usergroup_list = new ocp_tempcode();
        $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
        foreach ($groups as $key => $val) {
            if ($key != db_get_first_id()) {
                if (get_forum_type() == 'ocf') {
                    require_code('ocf_groups2');
                    $num_members = ocf_get_group_members_raw_count($key);
                    if ($num_members >= 1 && $num_members <= 6) {
                        $group_members = ocf_get_group_members_raw($key);
                        $group_member_usernames = '';
                        foreach ($group_members as $group_member) {
                            if ($group_member_usernames != '') {
                                $group_member_usernames = do_lang('LIST_SEP');
                            }
                            $group_member_usernames .= $GLOBALS['FORUM_DRIVER']->get_username($group_member);
                        }
                        $val = do_lang('GROUP_MEMBERS_SPECIFIC', $val, $group_member_usernames);
                    } else {
                        $val = do_lang('GROUP_MEMBERS', $val, number_format($num_members));
                    }
                }
                $usergroup_list->attach(form_input_list_entry(strval($key), $allow2_groups == '*' || count(array_intersect(array($key), $allow2_groups == '' ? array() : explode(',', $allow2_groups))) != 0, $val));
            }
        }
        $fields->attach(form_input_multi_list(do_lang_tempcode('ALLOW_LIST_GROUPS'), do_lang_tempcode($is_made_by_me ? 'DESCRIPTION_ALLOW_LIST_GROUPS_SIMPLE' : 'DESCRIPTION_ALLOW_LIST_GROUPS'), 'allow_list_groups', $usergroup_list));
    }
    $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => $disallow2 == '' && $disallow2_groups == '', 'TITLE' => do_lang_tempcode('ADVANCED'))));
    $fields->attach(form_input_username_multi(do_lang_tempcode('DISALLOW_LIST'), do_lang_tempcode('DESCRIPTION_DISALLOW_LIST'), 'disallow_list', array_map(array($GLOBALS['FORUM_DRIVER'], 'get_username'), $disallow2 == '' ? array() : array_map('intval', explode(',', $disallow2))), 0, true));
    if (!$is_made_by_me || get_option('group_private_chatrooms') == '1') {
        $usergroup_list = new ocp_tempcode();
        $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
        foreach ($groups as $key => $val) {
            if ($key != db_get_first_id()) {
                if (get_forum_type() == 'ocf') {
                    require_code('ocf_groups2');
                    $num_members = ocf_get_group_members_raw_count($key);
                    if ($num_members >= 1 && $num_members <= 6) {
                        $group_members = ocf_get_group_members_raw($key);
                        $group_member_usernames = '';
                        foreach ($group_members as $group_member) {
                            if ($group_member_usernames != '') {
                                $group_member_usernames = do_lang('LIST_SEP');
                            }
                            $group_member_usernames .= $GLOBALS['FORUM_DRIVER']->get_username($group_member);
                        }
                        $val = do_lang('GROUP_MEMBERS_SPECIFIC', $val, $group_member_usernames);
                    } else {
                        $val = do_lang('GROUP_MEMBERS', $val, number_format($num_members));
                    }
                }
                $usergroup_list->attach(form_input_list_entry(strval($key), $disallow2_groups == '*' || count(array_intersect(array($key), $disallow2_groups == '' ? array() : explode(',', $disallow2_groups))) != 0, $val));
            }
        }
        $fields->attach(form_input_multi_list(do_lang_tempcode('DISALLOW_LIST_GROUPS'), do_lang_tempcode('DESCRIPTION_DISALLOW_LIST_GROUPS'), 'disallow_list_groups', $usergroup_list));
    }
    return $fields;
}
Example #5
0
 /**
  * The UI to sign up to the newsletter (actually, generally manage subscription).
  *
  * @return tempcode		The UI
  */
 function newsletter_form()
 {
     $title = get_page_title('_NEWSLETTER_JOIN', true, array(escape_html(get_option('newsletter_title'))));
     $newsletters = $GLOBALS['SITE_DB']->query_select('newsletters', array('*'));
     if (count($newsletters) == 0) {
         warn_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $post_url = build_url(array('page' => '_SELF', 'type' => 'do'), '_SELF');
     $submit_name = do_lang_tempcode('NEWSLETTER_JOIN');
     if (!is_guest()) {
         $their_email = get_param('email', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member()));
     } else {
         $their_email = get_param('email', '');
     }
     $forename = '';
     $surname = '';
     $message = get_option('newsletter_text');
     if (has_actual_page_access(get_member(), 'admin_config')) {
         if ($message != '') {
             $message .= ' [[page="_SEARCH:admin_config:category:FEATURE#group_NEWSLETTER"]' . do_lang('EDIT') . '[/page]]';
         }
     }
     $text = comcode_to_tempcode($message, NULL, true);
     // Build up the join form
     $fields = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_line(do_lang_tempcode('EMAIL_ADDRESS'), do_lang_tempcode('DESCRIPTION_SUBSCRIBE_ADDRESS'), 'email', $their_email, true));
     $fields->attach(form_input_line(do_lang_tempcode('FORENAME'), '', 'forename', $forename, false));
     $fields->attach(form_input_line(do_lang_tempcode('SURNAME'), '', 'surname', $surname, false));
     $fields->attach(form_input_password(do_lang_tempcode('YOUR_PASSWORD'), do_lang_tempcode('DESCRIPTION_MAINTENANCE_PASSWORD'), 'password', true));
     $fields->attach(form_input_password(do_lang_tempcode('CONFIRM_PASSWORD'), '', 'password_confirm', true));
     if (count(find_all_langs()) != 1) {
         $fields->attach(form_input_list(do_lang_tempcode('LANGUAGE'), '', 'lang', nice_get_langs(user_lang())));
     }
     $level = get_param_integer('level', NULL);
     if (is_null($level)) {
         $level = 3;
     }
     $l = form_input_list_entry('0', false, do_lang_tempcode('NEWSLETTER_0'));
     $l->attach(form_input_list_entry('1', $level == 1, do_lang_tempcode('NEWSLETTER_1')));
     $l->attach(form_input_list_entry('2', $level == 2, do_lang_tempcode('NEWSLETTER_2')));
     $l->attach(form_input_list_entry('3', $level == 3, do_lang_tempcode('NEWSLETTER_3')));
     $l->attach(form_input_list_entry('4', $level == 4, do_lang_tempcode('NEWSLETTER_4')));
     $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('NEWSLETTER_SUBSCRIPTIONS'))));
     foreach ($newsletters as $newsletter) {
         $newsletter_title = get_translated_text($newsletter['title']);
         $newsletter_description = get_translated_text($newsletter['description']);
         if (get_option('interest_levels') == '1') {
             $fields->attach(form_input_list(do_lang_tempcode('SUBSCRIPTION_LEVEL_FOR', make_string_tempcode(escape_html($newsletter_title))), do_lang_tempcode('DESCRIPTION_SUBSCRIPTION_LEVEL', escape_html($newsletter_description)), 'level' . strval($newsletter['id']), $l));
         } else {
             $fields->attach(form_input_tick(do_lang_tempcode('SUBSCRIBE_TO', make_string_tempcode(escape_html($newsletter_title))), make_string_tempcode(escape_html($newsletter_description)), 'level' . strval($newsletter['id']), $level != 0));
         }
     }
     $text->attach(paragraph(do_lang_tempcode('CHANGE_SETTINGS_BY_RESUBSCRIBING')));
     $javascript = "\n\t\t\tvar form=document.getElementById('password').form;\n\t\t\tform.old_submit=form.onsubmit;\n\t\t\tform.onsubmit=function()\n\t\t\t\t{\n\t\t\t\t\tif ((form.elements['password_confirm']) && (form.elements['password_confirm'].value!=form.elements['password'].value))\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.fauxmodal_alert('" . php_addslashes(do_lang('PASSWORD_MISMATCH')) . "');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\treturn true;\n\t\t\t\t};\n\t\t";
     return do_template('FORM_SCREEN', array('_GUID' => '24d7575465152f450c5a8e62650bf6c8', 'JAVASCRIPT' => $javascript, 'HIDDEN' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text));
 }
Example #6
0
/**
 * UI to choose a language.
 *
 * @param  tempcode			Title for the form
 * @param  boolean			Whether to give a tip about edit order
 * @param  boolean			Whether to add an 'all' entry to the list
 * @return mixed				The UI (tempcode) or the language to use (string/LANGUAGE_NAME)
 */
function choose_language($title, $tip = false, $allow_all_selection = false)
{
    if (!multi_lang()) {
        return user_lang();
    }
    $lang = either_param('lang', NULL);
    if (!is_null($lang)) {
        return filter_naughty($lang);
    }
    if (!$tip) {
        $text = do_lang_tempcode('CHOOSE_LANG_DESCRIP');
    } else {
        global $LANGS_MAP;
        if ($LANGS_MAP === NULL) {
            $map_a = get_file_base() . '/lang/langs.ini';
            $map_b = get_custom_file_base() . '/lang_custom/langs.ini';
            if (!is_file($map_b)) {
                $map_b = $map_a;
            }
            $LANGS_MAP = better_parse_ini_file($map_b);
        }
        $lang_name = get_site_default_lang();
        if (array_key_exists($lang_name, $LANGS_MAP)) {
            $lang_name = $LANGS_MAP[$lang_name];
        }
        $text = do_lang_tempcode('CHOOSE_LANG_DESCRIP_ADD_TO_MAIN_LANG_FIRST', escape_html($lang_name));
    }
    $langs = new ocp_tempcode();
    if ($allow_all_selection) {
        $langs->attach(form_input_list_entry('', false, do_lang_tempcode('_ALL')));
    }
    $langs->attach(nice_get_langs());
    require_code('form_templates');
    $fields = form_input_list(do_lang_tempcode('LANGUAGE'), do_lang_tempcode('DESCRIPTION_LANGUAGE'), 'lang', $langs, NULL, true);
    $hidden = build_keep_post_fields();
    $url = get_self_url();
    return do_template('FORM_SCREEN', array('_GUID' => '1a2823d450237aa299c095bf9c689a2a', 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'SUBMIT_NAME' => do_lang_tempcode('PROCEED'), 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $url, 'TEXT' => $text));
}
/**
 * Get form fields for adding/editing/finishing a member profile.
 *
 * @param  boolean			Whether we are only handling the essential details of a profile.
 * @param  ?MEMBER			The ID of the member we are handling (NULL: new member).
 * @param  ?array				A list of usergroups (NULL: default/current usergroups).
 * @param  SHORT_TEXT		The e-mail address.
 * @param  BINARY				Whether posts are previewed before they are made.
 * @param  ?integer			Day of date of birth (NULL: not known).
 * @param  ?integer			Month of date of birth (NULL: not known).
 * @param  ?integer			Year of date of birth (NULL: not known).
 * @param  ?ID_TEXT			The member timezone (NULL: site default).
 * @param  ?ID_TEXT			The members default theme (NULL: not known).
 * @param  BINARY				Whether the members age may be shown.
 * @param  BINARY				Whether the member sees signatures in posts.
 * @param  ?BINARY			Whether the member automatically is enabled for notifications for content they contribute to (NULL: get default from config).
 * @param  ?LANGUAGE_NAME	The members language (NULL: auto detect).
 * @param  BINARY				Whether the member allows e-mails via the site.
 * @param  BINARY				Whether the member allows e-mails from staff via the site.
 * @param  BINARY				Whether the profile has been validated.
 * @param  ?GROUP				The members primary (NULL: not known).
 * @param  SHORT_TEXT		The username.
 * @param  BINARY				Whether the member is permanently banned.
 * @param  ID_TEXT			The special type of profile this is (blank: not a special type).
 * @param  BINARY				Whether the member likes to view zones without menus, when a choice is available.
 * @param  BINARY				Whether the member username will be highlighted.
 * @param  SHORT_TEXT		Usergroups that may PT the member.
 * @param  LONG_TEXT			Rules that other members must agree to before they may start a PT with the member.
 * @param  ?TIME				When the member is on probation until (NULL: just finished probation / or effectively was never on it)
 * @return array				A pair: The form fields, Hidden fields (both Tempcode).
 */
function ocf_get_member_fields_settings($mini_mode = true, $member_id = NULL, $groups = NULL, $email_address = '', $preview_posts = 0, $dob_day = NULL, $dob_month = NULL, $dob_year = NULL, $timezone = NULL, $theme = NULL, $reveal_age = 1, $views_signatures = 1, $auto_monitor_contrib_content = NULL, $language = NULL, $allow_emails = 1, $allow_emails_from_staff = 1, $validated = 1, $primary_group = NULL, $username = '', $is_perm_banned = 0, $special_type = '', $zone_wide = 1, $highlighted_name = 0, $pt_allow = '*', $pt_rules_text = '', $on_probation_until = NULL)
{
    if (is_null($auto_monitor_contrib_content)) {
        $auto_monitor_contrib_content = get_value('no_auto_notifications') === '1' ? 0 : 1;
    }
    $hidden = new ocp_tempcode();
    if (has_actual_page_access(get_member(), 'admin_ocf_join')) {
        $dob_optional = true;
    } else {
        $dob_optional = get_option('no_dob_ask') == '2';
    }
    if ($member_id === $GLOBALS['OCF_DRIVER']->get_guest_id()) {
        fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
    }
    require_code('form_templates');
    require_code('encryption');
    if ($special_type == '' && !is_null($member_id)) {
        if (ocf_is_ldap_member($member_id)) {
            $special_type = 'ldap';
        }
        if (ocf_is_httpauth_member($member_id)) {
            $special_type = 'httpauth';
        }
        if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_password_compat_scheme') == 'remote') {
            $special_type = 'remote';
        }
    }
    if (is_null($groups)) {
        $groups = is_null($member_id) ? ocf_get_all_default_groups(true) : $GLOBALS['OCF_DRIVER']->get_members_groups($member_id);
    }
    $fields = new ocp_tempcode();
    // Human name / Username
    if ($special_type != 'ldap' && $special_type != 'remote' && $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_password_compat_scheme') != 'facebook') {
        if (is_null($member_id) || has_actual_page_access(get_member(), 'admin_ocf_join') || has_specific_permission($member_id, 'rename_self')) {
            if (get_option('signup_fullname') == '1') {
                $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('_DESCRIPTION_NAME'), is_null($member_id) ? 'username' : 'edit_username', $username, true));
            } else {
                $prohibit_username_whitespace = get_option('prohibit_username_whitespace', true);
                if ($prohibit_username_whitespace == '1') {
                    $fields->attach(form_input_codename(do_lang_tempcode('USERNAME'), do_lang_tempcode('DESCRIPTION_USERNAME'), is_null($member_id) ? 'username' : 'edit_username', $username, true));
                } else {
                    $fields->attach(form_input_line(do_lang_tempcode('USERNAME'), do_lang_tempcode('DESCRIPTION_USERNAME'), is_null($member_id) ? 'username' : 'edit_username', $username, true));
                }
            }
        }
    }
    // Password
    if ($special_type == '') {
        if (is_null($member_id) || $member_id == get_member() || has_specific_permission(get_member(), 'assume_any_member')) {
            $fields->attach(form_input_password(do_lang_tempcode('PASSWORD'), do_lang_tempcode('DESCRIPTION_PASSWORD' . (!is_null($member_id) ? '_EDIT' : '')), is_null($member_id) ? 'password' : 'edit_password', $mini_mode));
            $fields->attach(form_input_password(do_lang_tempcode('CONFIRM_PASSWORD'), '', 'password_confirm', $mini_mode));
        }
    }
    // E-mail address
    if ($email_address == '') {
        $email_address = trim(get_param('email_address', ''));
    }
    if ($special_type != 'remote') {
        $fields->attach(form_input_email(do_lang_tempcode('EMAIL_ADDRESS'), get_option('skip_email_confirm_join') == '1' ? new ocp_tempcode() : do_lang_tempcode('MUST_BE_REAL_ADDRESS'), 'email_address', $email_address, !has_specific_permission(get_member(), 'member_maintenance')));
        if (is_null($member_id) && $email_address == '' && get_option('skip_email_confirm_join') == '0') {
            $fields->attach(form_input_email(do_lang_tempcode('CONFIRM_EMAIL_ADDRESS'), '', 'email_address_confirm', '', !has_specific_permission(get_member(), 'member_maintenance')));
        }
    }
    // DOB
    $default_time = is_null($dob_month) ? NULL : usertime_to_utctime(mktime(0, 0, 0, $dob_month, $dob_day, $dob_year));
    if (get_option('no_dob_ask') != '1') {
        $fields->attach(form_input_date(do_lang_tempcode(get_option('no_dob_ask') == '2' ? 'BIRTHDAY' : 'DATE_OF_BIRTH'), '', 'dob', $dob_optional, false, false, $default_time, -130));
        if (addon_installed('ocf_forum')) {
            $fields->attach(form_input_tick(do_lang_tempcode('RELATED_FIELD', do_lang_tempcode('REVEAL_AGE')), do_lang_tempcode('DESCRIPTION_REVEAL_AGE'), 'reveal_age', $reveal_age == 1));
        }
    }
    // Work out what options we need to present
    $doing_international = get_option('allow_international') == '1' && $special_type != 'remote';
    $_langs = find_all_langs();
    $doing_langs = multi_lang() && $special_type != 'remote';
    $doing_email_option = get_option('allow_email_disable') == '1';
    $doing_email_from_staff_option = get_option('allow_email_from_staff_disable') == '1';
    $unspecced_width_zone_exists = $GLOBALS['SITE_DB']->query_value_null_ok('zones', 'zone_name', array('zone_wide' => NULL));
    $unspecced_theme_zone_exists = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'zones WHERE ' . db_string_equal_to('zone_theme', '') . ' OR ' . db_string_equal_to('zone_theme', '-1'));
    $doing_wide_option = $special_type != 'remote' && !is_null($unspecced_width_zone_exists) && !$mini_mode;
    $doing_theme_option = $unspecced_theme_zone_exists != 0 && !$mini_mode;
    $doing_local_forum_options = addon_installed('ocf_forum') && $special_type != 'remote' && !$mini_mode;
    if ($doing_international || $doing_langs || $doing_email_option || $doing_wide_option || $doing_theme_option || $doing_local_forum_options) {
        $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('FORCE_OPEN' => is_null($member_id) ? true : NULL, 'TITLE' => do_lang_tempcode('SETTINGS'))));
    }
    require_lang('config');
    // Timezones, if enabled
    if ($doing_international) {
        $timezone_list = nice_get_timezone_list($timezone);
        $fields->attach(form_input_list(do_lang_tempcode('TIME_ZONE'), do_lang_tempcode('DESCRIPTION_TIMEZONE_MEMBER'), 'timezone', $timezone_list));
    }
    // Language choice, if we have multiple languages on site
    if ($doing_langs) {
        $lang_list = new ocp_tempcode();
        $no_lang_set = is_null($language) || $language == '';
        $allow_no_lang_set = get_value('allow_no_lang_selection') === '1';
        if ($allow_no_lang_set) {
            $lang_list->attach(form_input_list_entry('', $no_lang_set, do_lang_tempcode('UNSET')));
        } else {
            if ($no_lang_set) {
                $language = user_lang();
            }
        }
        $lang_list->attach(nice_get_langs($language));
        $fields->attach(form_input_list(do_lang_tempcode('LANGUAGE'), '', 'language', $lang_list, NULL, false, !$allow_no_lang_set));
    }
    // Email privacy
    if ($doing_email_option) {
        $fields->attach(form_input_tick(do_lang_tempcode('ALLOW_EMAILS'), do_lang_tempcode('DESCRIPTION_ALLOW_EMAILS'), 'allow_emails', $allow_emails == 1));
    }
    if ($doing_email_from_staff_option) {
        $fields->attach(form_input_tick(do_lang_tempcode('ALLOW_EMAILS_FROM_STAFF'), do_lang_tempcode('DESCRIPTION_ALLOW_EMAILS_FROM_STAFF'), 'allow_emails_from_staff', $allow_emails_from_staff == 1));
    }
    if (!$mini_mode) {
        // Wide-option, if we have any zones giving a choice
        require_lang('zones');
        if ($doing_wide_option) {
            $fields->attach(form_input_tick(do_lang_tempcode('WIDE'), do_lang_tempcode('DESCRIPTION_MEMBER_ZONE_WIDE'), 'zone_wide', $zone_wide == 1));
        }
        // Theme, if we have any zones giving a choice
        require_code('themes2');
        $entries = nice_get_themes($theme, false, false, 'RELY_SITE_DEFAULT');
        require_lang('themes');
        if ($doing_theme_option) {
            $fields->attach(form_input_list(do_lang_tempcode('THEME'), do_lang_tempcode('DESCRIPTION_THEME'), 'theme', $entries));
        }
        // Various forum options
        if (addon_installed('ocf_forum')) {
            if ($special_type != 'remote') {
                if (get_option('forced_preview_option') == '1') {
                    $fields->attach(form_input_tick(do_lang_tempcode('PREVIEW_POSTS'), do_lang_tempcode('DESCRIPTION_PREVIEW_POSTS'), 'preview_posts', $preview_posts == 1));
                }
                if (get_value('disable_views_sigs_option') !== '1') {
                    if (addon_installed('ocf_signatures')) {
                        $fields->attach(form_input_tick(do_lang_tempcode('VIEWS_SIGNATURES'), do_lang_tempcode('DESCRIPTION_VIEWS_SIGNATURES'), 'views_signatures', $views_signatures == 1));
                    }
                } else {
                    $hidden->attach(form_input_hidden('views_signatures', '1'));
                }
                //$fields->attach(form_input_tick(do_lang_tempcode('AUTO_NOTIFICATION_CONTRIB_CONTENT'),do_lang_tempcode('DESCRIPTION_AUTO_NOTIFICATION_CONTRIB_CONTENT'),'auto_monitor_contrib_content',$auto_monitor_contrib_content==1));
                $usergroup_list = new ocp_tempcode();
                $lgroups = $GLOBALS['OCF_DRIVER']->get_usergroup_list(true, true);
                foreach ($lgroups as $key => $val) {
                    if ($key != db_get_first_id()) {
                        $usergroup_list->attach(form_input_list_entry(strval($key), $pt_allow == '*' || count(array_intersect(array(strval($key)), explode(',', $pt_allow))) != 0, $val));
                    }
                }
                if (get_value('disable_pt_restrict') !== '1') {
                    $fields->attach(form_input_multi_list(do_lang_tempcode('PT_ALLOW'), addon_installed('chat') ? do_lang_tempcode('PT_ALLOW_DESCRIPTION_CHAT') : do_lang_tempcode('PT_ALLOW_DESCRIPTION'), 'pt_allow', $usergroup_list));
                    $fields->attach(form_input_text_comcode(do_lang_tempcode('PT_RULES_TEXT'), do_lang_tempcode('PT_RULES_TEXT_DESCRIPTION'), 'pt_rules_text', $pt_rules_text, false));
                }
            }
        }
        // Prepare list of usergroups, if maybe we are gonna let (a) usergroup-change field(s)
        $group_count = $GLOBALS['FORUM_DB']->query_value('f_groups', 'COUNT(*)');
        $rows = $GLOBALS['FORUM_DB']->query_select('f_groups', array('id', 'g_name', 'g_hidden', 'g_open_membership'), $group_count > 200 ? array('g_is_private_club' => 0) : NULL, 'ORDER BY g_order');
        $_groups = new ocp_tempcode();
        $default_primary_group = get_first_default_group();
        $current_primary_group = NULL;
        foreach ($rows as $group) {
            if ($group['id'] != db_get_first_id()) {
                $selected = $group['id'] == $primary_group || is_null($primary_group) && $group['id'] == $default_primary_group;
                if ($selected) {
                    $current_primary_group = $group['id'];
                }
                $_groups->attach(form_input_list_entry(strval($group['id']), $selected, get_translated_text($group['g_name'], $GLOBALS['FORUM_DB'])));
            }
        }
        // Some admin options...
        if (has_specific_permission(get_member(), 'member_maintenance')) {
            $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('MEMBER_ACCESS'))));
            // Probation
            if (has_specific_permission(get_member(), 'probate_members')) {
                $fields->attach(form_input_date(do_lang_tempcode('ON_PROBATION_UNTIL'), do_lang_tempcode('DESCRIPTION_ON_PROBATION_UNTIL'), 'on_probation_until', true, is_null($on_probation_until) || $on_probation_until <= time(), true, $on_probation_until, 2));
            }
            // Primary usergroup
            if ($special_type != 'ldap') {
                if (has_specific_permission(get_member(), 'assume_any_member')) {
                    if (is_null($member_id) || !$GLOBALS['FORUM_DRIVER']->is_super_admin($member_id) || count($GLOBALS['FORUM_DRIVER']->member_group_query($GLOBALS['FORUM_DRIVER']->get_super_admin_groups(), 2)) > 1) {
                        $fields->attach(form_input_list(do_lang_tempcode('PRIMARY_GROUP'), do_lang_tempcode('DESCRIPTION_PRIMARY_GROUP'), 'primary_group', $_groups));
                    }
                }
            }
        }
        // Secondary usergroups
        if ($special_type != 'ldap') {
            $_groups2 = new ocp_tempcode();
            $members_groups = is_null($member_id) ? array() : $GLOBALS['OCF_DRIVER']->get_members_groups($member_id, false, false);
            foreach ($rows as $group) {
                if ($group['g_hidden'] == 1 && !array_key_exists($group['id'], $members_groups) && !has_specific_permission(get_member(), 'see_hidden_groups')) {
                    continue;
                }
                if ($group['id'] != db_get_first_id() && $group['id'] != $current_primary_group && (array_key_exists($group['id'], $members_groups) || has_specific_permission(get_member(), 'assume_any_member') || $group['g_open_membership'] == 1)) {
                    $selected = array_key_exists($group['id'], $members_groups);
                    $_groups2->attach(form_input_list_entry(strval($group['id']), $selected, get_translated_text($group['g_name'], $GLOBALS['FORUM_DB'])));
                }
            }
            $sec_url = build_url(array('page' => 'groups', 'type' => 'misc'), get_module_zone('groups'));
            if (!$_groups2->is_empty()) {
                $fields->attach(form_input_multi_list(do_lang_tempcode('SECONDARY_GROUP_MEMBERSHIP'), do_lang_tempcode('DESCRIPTION_SECONDARY_GROUP', escape_html($sec_url->evaluate())), 'secondary_groups', $_groups2));
            }
        }
        // Special admin options
        if (has_specific_permission(get_member(), 'member_maintenance')) {
            if ($validated == 0) {
                $validated = get_param_integer('validated', 0);
                if ($validated == 1) {
                    attach_message(do_lang_tempcode('WILL_BE_VALIDATED_WHEN_SAVING'));
                }
            }
            if (addon_installed('unvalidated')) {
                $fields->attach(form_input_tick(do_lang_tempcode('VALIDATED'), do_lang_tempcode('DESCRIPTION_MEMBER_VALIDATED'), 'validated', $validated == 1));
            }
            if (get_value('disable_highlight_name') !== '1') {
                $fields->attach(form_input_tick(do_lang_tempcode('HIGHLIGHTED_NAME'), do_lang_tempcode(addon_installed('pointstore') ? 'DESCRIPTION_HIGHLIGHTED_NAME_P' : 'DESCRIPTION_HIGHLIGHTED_NAME'), 'highlighted_name', $highlighted_name == 1));
            }
            if (!is_null($member_id) && $member_id != get_member()) {
                // Can't ban someone new, and can't ban yourself
                $fields->attach(form_input_tick(do_lang_tempcode('_BANNED'), do_lang_tempcode('DESCRIPTION_MEMBER_BANNED'), 'is_perm_banned', $is_perm_banned == 1));
            }
        }
    }
    return array($fields, $hidden);
}