/** * The UI and actualisation for sending out the confirm email. * * @return tempcode The UI */ function step2() { $title = get_page_title('RESET_PASSWORD'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('RESET_PASSWORD')))); breadcrumb_set_self(do_lang_tempcode('START')); $username = trim(post_param('username', '')); $email_address = trim(post_param('email_address', '')); if ($username == '' && $email_address == '') { warn_exit(do_lang_tempcode('PASSWORD_RESET_ERROR')); } if ($username != '') { $member = $GLOBALS['FORUM_DRIVER']->get_member_from_username($username); } else { $member = $GLOBALS['FORUM_DRIVER']->get_member_from_email_address($email_address); } if (is_null($member)) { warn_exit(do_lang_tempcode('PASSWORD_RESET_ERROR_2')); } $username = $GLOBALS['FORUM_DRIVER']->get_username($member); if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member, 'm_password_compat_scheme') == '' && has_specific_permission($member, 'disable_lost_passwords') && !$GLOBALS['IS_ACTUALLY_ADMIN']) { warn_exit(do_lang_tempcode('NO_RESET_ACCESS')); } if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member, 'm_password_compat_scheme') == 'remote') { warn_exit(do_lang_tempcode('NO_PASSWORD_RESET_REMOTE', ocp_srv('HTTP_HOST'))); } if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member, 'm_password_compat_scheme') == 'httpauth') { warn_exit(do_lang_tempcode('NO_PASSWORD_RESET_HTTPAUTH')); } $is_ldap = ocf_is_ldap_member($member); $is_httpauth = ocf_is_httpauth_member($member); if ($is_ldap) { warn_exit(do_lang_tempcode('EXT_NO_PASSWORD_CHANGE')); } $code = mt_rand(0, mt_getrandmax()); $GLOBALS['FORUM_DB']->query_update('f_members', array('m_password_change_code' => strval($code)), array('id' => $member), '', 1); $email = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member, 'm_email_address'); if ($email == '') { warn_exit(do_lang_tempcode('MEMBER_NO_EMAIL_ADDRESS_RESET_TO')); } log_it('RESET_PASSWORD', strval($member), strval($code)); // Send confirm mail $zone = get_module_zone('lostpassword'); $_url = build_url(array('page' => 'lostpassword', 'type' => 'step3', 'code' => $code, 'member' => $member), $zone, NULL, false, false, true); $url = $_url->evaluate(); $_url_simple = build_url(array('page' => 'lostpassword', 'type' => 'step3', 'code' => NULL, 'username' => NULL, 'member' => NULL), $zone, NULL, false, false, true); $url_simple = $_url_simple->evaluate(); $message = do_lang('RESET_PASSWORD_TEXT', comcode_escape(get_site_name()), comcode_escape($username), array(comcode_escape($url), $url_simple, strval($member), strval($code)), get_lang($member)); require_code('mail'); mail_wrap(do_lang('RESET_PASSWORD', NULL, NULL, NULL, get_lang($member)), $message, array($email), $GLOBALS['FORUM_DRIVER']->get_username($member), '', '', 3, NULL, false, NULL, false, false, false, 'MAIL', true); breadcrumb_set_self(do_lang_tempcode('DONE')); return inform_screen($title, do_lang_tempcode('RESET_CODE_MAILED')); }
/** * Standard modular render function for profile tabs edit hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set) */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { $order = 0; // Actualiser if (post_param('submitting_settings_tab', NULL) !== NULL) { require_code('ocf_members_action2'); $is_ldap = ocf_is_ldap_member($member_id_of); $is_httpauth = ocf_is_httpauth_member($member_id_of); $is_remote = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_password_compat_scheme') == 'remote'; if ($is_ldap || $is_httpauth || $is_remote || $member_id_of != $member_id_viewing && !has_specific_permission($member_id_viewing, 'assume_any_member')) { $password = NULL; } else { $password = post_param('edit_password'); if ($password == '') { $password = NULL; } else { $password_confirm = trim(post_param('password_confirm')); if ($password != $password_confirm) { warn_exit(make_string_tempcode(escape_html(do_lang('PASSWORD_MISMATCH')))); } } } $custom_fields = ocf_get_all_custom_fields_match($GLOBALS['FORUM_DRIVER']->get_members_groups($member_id_of), $member_id_of != $member_id_viewing && !has_specific_permission($member_id_viewing, 'view_any_profile_field') ? 1 : NULL, $member_id_of != $member_id_viewing ? NULL : 1, $member_id_of != $member_id_viewing ? NULL : 1); $actual_custom_fields = ocf_read_in_custom_fields($custom_fields, $member_id_of); $pt_allow = array_key_exists('pt_allow', $_POST) ? implode(',', $_POST['pt_allow']) : ''; $tmp_groups = $GLOBALS['OCF_DRIVER']->get_usergroup_list(true, true); $all_pt_allow = ''; foreach (array_keys($tmp_groups) as $key) { if ($key != db_get_first_id()) { if ($all_pt_allow != '') { $all_pt_allow .= ','; } $all_pt_allow .= strval($key); } } if ($pt_allow == $all_pt_allow) { $pt_allow = '*'; } $pt_rules_text = post_param('pt_rules_text', NULL); if (has_specific_permission($member_id_viewing, 'member_maintenance')) { $validated = post_param_integer('validated', 0); $primary_group = $is_ldap || !has_specific_permission($member_id_viewing, 'assume_any_member') ? NULL : post_param_integer('primary_group', NULL); $is_perm_banned = post_param_integer('is_perm_banned', 0); $old_is_perm_banned = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_is_perm_banned'); if ($old_is_perm_banned != $is_perm_banned) { if ($is_perm_banned == 1) { ocf_ban_member($member_id_of); } else { ocf_unban_member($member_id_of); } } $highlighted_name = post_param_integer('highlighted_name', 0); if (has_specific_permission($member_id_viewing, 'probate_members')) { $on_probation_until = get_input_date('on_probation_until'); $current__on_probation_until = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_on_probation_until'); if ((is_null($on_probation_until) || $on_probation_until <= time()) && $current__on_probation_until > time()) { log_it('STOP_PROBATION', strval($member_id_of), $GLOBALS['FORUM_DRIVER']->get_username($member_id_of)); } elseif (!is_null($on_probation_until) && $on_probation_until > time() && $current__on_probation_until <= time()) { log_it('START_PROBATION', strval($member_id_of), $GLOBALS['FORUM_DRIVER']->get_username($member_id_of)); } elseif (!is_null($on_probation_until) && $current__on_probation_until > $on_probation_until && $on_probation_until > time() && $current__on_probation_until > time()) { log_it('REDUCE_PROBATION', strval($member_id_of), $GLOBALS['FORUM_DRIVER']->get_username($member_id_of)); } elseif (!is_null($on_probation_until) && $current__on_probation_until < $on_probation_until && $on_probation_until > time() && $current__on_probation_until > time()) { log_it('EXTEND_PROBATION', strval($member_id_of), $GLOBALS['FORUM_DRIVER']->get_username($member_id_of)); } } else { $on_probation_until = NULL; } } else { $validated = NULL; $primary_group = NULL; $highlighted_name = NULL; $on_probation_until = NULL; } if (has_actual_page_access($member_id_viewing, 'admin_ocf_join') || has_specific_permission($member_id_of, 'rename_self')) { $username = $is_ldap || $is_remote ? NULL : post_param('edit_username', NULL); } else { $username = NULL; } $email = post_param('email_address', NULL); if (!is_null($email)) { $email = trim($email); } $theme = post_param('theme', NULL); if ($is_remote) { $preview_posts = NULL; $zone_wide = NULL; $auto_monitor_contrib_content = NULL; $views_signatures = NULL; $timezone = NULL; } else { $preview_posts = post_param_integer('preview_posts', 0); $zone_wide = post_param_integer('zone_wide', 0); $auto_monitor_contrib_content = NULL; //post_param_integer('auto_monitor_contrib_content',0); Moved to notifications tab $views_signatures = post_param_integer('views_signatures', 0); $timezone = post_param('timezone', get_site_timezone()); } ocf_edit_member($member_id_of, $email, $preview_posts, post_param_integer('dob_day', -1), post_param_integer('dob_month', -1), post_param_integer('dob_year', -1), $timezone, $primary_group, $actual_custom_fields, $theme, post_param_integer('reveal_age', 0), $views_signatures, $auto_monitor_contrib_content, post_param('language', NULL), post_param_integer('allow_emails', 0), post_param_integer('allow_emails_from_staff', 0), $validated, $username, $password, $zone_wide, $highlighted_name, $pt_allow, $pt_rules_text, $on_probation_until); if (!array_key_exists('secondary_groups', $_POST)) { $_POST['secondary_groups'] = array(); } require_code('ocf_groups_action2'); $members_groups = $GLOBALS['OCF_DRIVER']->get_members_groups($member_id_of); $group_count = $GLOBALS['FORUM_DB']->query_value('f_groups', 'COUNT(*)'); $groups = list_to_map('id', $GLOBALS['FORUM_DB']->query_select('f_groups', array('*'), $group_count > 200 ? array('g_is_private_club' => 0) : NULL)); foreach ($_POST['secondary_groups'] as $group_id) { $group = $groups[intval($group_id)]; if ($group['g_hidden'] == 1 && !in_array($group['id'], $members_groups) && !has_specific_permission($member_id_viewing, 'see_hidden_groups')) { continue; } if (!in_array($group['id'], $members_groups) && (has_specific_permission($member_id_viewing, 'assume_any_member') || $group['g_open_membership'] == 1)) { ocf_add_member_to_group($member_id_of, $group['id']); } } foreach ($members_groups as $group_id) { if (!in_array(strval($group_id), $_POST['secondary_groups'])) { ocf_member_leave_group($group_id, $member_id_of); } } $GLOBALS['FORUM_DB']->query('DELETE FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_member_known_login_ips WHERE i_member_id=' . strval($member_id_of) . ' AND ' . db_string_not_equal_to('i_val_code', '')); // So any re-confirms can happen if (addon_installed('awards')) { require_code('awards'); handle_award_setting('member', strval($member_id_of)); } attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform'); } if ($leave_to_ajax_if_possible) { return NULL; } // UI $title = do_lang_tempcode('SETTINGS'); $myrow = $GLOBALS['FORUM_DRIVER']->get_member_row($member_id_of); if (is_null($myrow)) { warn_exit(do_lang_tempcode('USER_NO_EXIST')); } require_code('ocf_members_action2'); list($fields, $hidden) = ocf_get_member_fields_settings(false, $member_id_of, NULL, $myrow['m_email_address'], $myrow['m_preview_posts'], $myrow['m_dob_day'], $myrow['m_dob_month'], $myrow['m_dob_year'], get_users_timezone($member_id_of), $myrow['m_theme'], $myrow['m_reveal_age'], $myrow['m_views_signatures'], $myrow['m_auto_monitor_contrib_content'], $myrow['m_language'], $myrow['m_allow_emails'], $myrow['m_allow_emails_from_staff'], $myrow['m_validated'], $myrow['m_primary_group'], $myrow['m_username'], $myrow['m_is_perm_banned'], '', $myrow['m_zone_wide'], $myrow['m_highlighted_name'], $myrow['m_pt_allow'], get_translated_text($myrow['m_pt_rules_text'], $GLOBALS['FORUM_DB']), $myrow['m_on_probation_until']); // Awards? if (addon_installed('awards')) { require_code('awards'); $fields->attach(get_award_fields('member', strval($member_id_of))); } $redirect = get_param('redirect', NULL); if (!is_null($redirect)) { $hidden->attach(form_input_hidden('redirect', $redirect)); } $hidden->attach(form_input_hidden('submitting_settings_tab', '1')); $javascript = "\n\t\t\tvar form=document.getElementById('email_address').form;\n\t\t\tform.prior_profile_edit_submit=form.onsubmit;\n\t\t\tform.onsubmit=function()\n\t\t\t\t{\n\t\t\t\t\tif (typeof form.elements['edit_password']!='undefined')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((form.elements['password_confirm']) && (form.elements['password_confirm'].value!=form.elements['edit_password'].value))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twindow.fauxmodal_alert('" . php_addslashes(do_lang('PASSWORD_MISMATCH')) . "');\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof form.prior_profile_edit_submit!='undefined' && form.prior_profile_edit_submit) return form.prior_profile_edit_submit();\n\t\t\t\t\treturn true;\n\t\t\t\t};\n\t\t"; $text = ''; return array($title, $fields, $text, $javascript, $order, $hidden); }
/** * 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); }