本文整理汇总了PHP中language_select函数的典型用法代码示例。如果您正苦于以下问题:PHP language_select函数的具体用法?PHP language_select怎么用?PHP language_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了language_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email_friend
/**
* Ignore this for now!
* Moving it to the side for later...
*/
public function email_friend()
{
phpbb::$user->add_lang('memberlist');
if (!phpbb::$config['email_enable']) {
titania::error_box('ERROR', 'EMAIL_DISABLED', TITANIA_ERROR, HEADER_SERVICE_UNAVAILABLE);
return false;
}
if (!phpbb::$user->data['is_registered'] || phpbb::$user->data['is_bot'] || !phpbb::$auth->acl_get('u_sendemail')) {
if (phpbb::$user->data['user_id'] == ANONYMOUS) {
login_box(titania::$page, phpbb::$user->lang['ERROR_CONTRIB_EMAIL_FRIEND']);
}
titania::error_box('ERROR', 'ERROR_CONTRIB_EMAIL_FRIEND', TITANIA_ERROR, HEADER_FORBIDDEN);
return false;
}
// Are we trying to abuse the facility?
if (titania::$time - phpbb::$user->data['user_emailtime'] < phpbb::$config['flood_interval']) {
trigger_error('FLOOD_EMAIL_LIMIT', E_USER_NOTICE);
}
$name = utf8_normalize_nfc(request_var('name', '', true));
$email = request_var('email', '');
$email_lang = request_var('lang', phpbb::$config['default_lang']);
$message = utf8_normalize_nfc(request_var('message', '', true));
$cc = isset($_POST['cc_email']) ? true : false;
$submit = isset($_POST['submit']) ? true : false;
add_form_key('contrib_email');
phpbb::$template->assign_vars(array('S_LANG_OPTIONS' => language_select($email_lang), 'S_POST_ACTION' => phpbb::append_sid(titania::$page, array('id' => 'email', 'contrib_id' => $this->contrib_id))));
$error = array();
if ($submit) {
if (!check_form_key('contrib_email')) {
$error[] = 'FORM_INVALID';
}
if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email)) {
$error[] = 'EMPTY_ADDRESS_EMAIL';
}
if (!$name) {
$error[] = 'EMPTY_NAME_EMAIL';
}
if (!empty($error)) {
titania::error_box('ERROR', $error, TITANIA_ERROR);
return false;
}
phpbb::_include('functions_messenger', false, 'messenger');
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_emailtime = ' . titania::$time . '
WHERE user_id = ' . (int) phpbb::$user->data['user_id'];
$result = phpbb::$db->sql_query($sql);
$mail_to_users = array();
$mail_to_users[] = array('email_lang' => $email_lang, 'email' => $email, 'name' => $name);
// Ok, now the same email if CC specified, but without exposing the users email address
if ($cc) {
$mail_to_users[] = array('email_lang' => phpbb::$user->data['user_lang'], 'email' => phpbb::$user->data['user_email'], 'name' => phpbb::$user->data['username']);
}
$lang_path = phpbb::$user->lang_path;
phpbb::$user->set_custom_lang_path(titania::$config->language_path);
$messenger = new messenger(false);
foreach ($mail_to_users as $row) {
$messenger->template('contrib_recommend', $row['email_lang']);
$messenger->replyto(phpbb::$user->data['user_email']);
$messenger->to($row['email'], $row['name']);
$messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . (int) phpbb::$user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip);
$messenger->assign_vars(array('BOARD_CONTACT' => phpbb::$config['board_contact'], 'TO_USERNAME' => htmlspecialchars_decode($name), 'FROM_USERNAME' => htmlspecialchars_decode(phpbb::$user->data['username']), 'MESSAGE' => htmlspecialchars_decode($message), 'CONTRIB_NAME' => htmlspecialchars_decode($this->contrib_name), 'U_CONTRIB' => phpbb::append_sid(titania::$page, array('contrib_id' => $this->contrib_id, 'id' => 'details'), true, '')));
$messenger->send(NOTIFY_EMAIL);
}
phpbb::$user->set_custom_lang_path($lang_path);
titania::error_box('SUCCESS', 'EMAIL_SENT', TITANIA_SUCCESS);
return true;
}
return false;
}
示例2: str_replace
$new['server_name'] = str_replace('http://', '', $new['server_name']);
}
if (isset($HTTP_POST_VARS['submit'])) {
$sql = "UPDATE " . CONFIG_TABLE . " SET\r\n\t\t\t\tconfig_value = '" . str_replace("\\'", "''", $new[$config_name]) . "'\r\n\t\t\t\tWHERE config_name = '{$config_name}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, "Failed to update general configuration for {$config_name}", "", __LINE__, __FILE__, $sql);
}
}
}
if (isset($HTTP_POST_VARS['submit'])) {
$message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid("admin_board.{$phpEx}") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.{$phpEx}?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
$style_select = style_select($new['default_style'], 'default_style', "../templates");
$lang_select = language_select($new['default_lang'], 'default_lang', "../language");
$timezone_select = tz_select($new['board_timezone'], 'board_timezone');
$disable_board_yes = $new['board_disable'] ? "checked=\"checked\"" : "";
$disable_board_no = !$new['board_disable'] ? "checked=\"checked\"" : "";
$cookie_secure_yes = $new['cookie_secure'] ? "checked=\"checked\"" : "";
$cookie_secure_no = !$new['cookie_secure'] ? "checked=\"checked\"" : "";
$html_tags = $new['allow_html_tags'];
$override_user_style_yes = $new['override_user_style'] ? "checked=\"checked\"" : "";
$override_user_style_no = !$new['override_user_style'] ? "checked=\"checked\"" : "";
$html_yes = $new['allow_html'] ? "checked=\"checked\"" : "";
$html_no = !$new['allow_html'] ? "checked=\"checked\"" : "";
$bbcode_yes = $new['allow_bbcode'] ? "checked=\"checked\"" : "";
$bbcode_no = !$new['allow_bbcode'] ? "checked=\"checked\"" : "";
$activation_none = $new['require_activation'] == USER_ACTIVATION_NONE ? "checked=\"checked\"" : "";
$activation_user = $new['require_activation'] == USER_ACTIVATION_SELF ? "checked=\"checked\"" : "";
$activation_admin = $new['require_activation'] == USER_ACTIVATION_ADMIN ? "checked=\"checked\"" : "";
示例3: phpversion
$custom_title_status_regdate = "checked=\"checked\"";
break;
case CUSTOM_TITLE_DISABLED:
$custom_title_status_disabled = "checked=\"checked\"";
break;
case CUSTOM_TITLE_ENABLED:
$custom_title_status_enabled = "checked=\"checked\"";
break;
}
//
// Let's do an overall check for settings/versions which would prevent
// us from doing file uploads....
//
$ini_val = phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
$form_enctype = !@$ini_val('file_uploads') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ? '' : 'enctype="multipart/form-data"';
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'USER_TYPE_SELECT' => user_type_select($user_type), 'YIM' => $yim, 'ICQ' => $icq, 'MSN' => $msn, 'AIM' => $aim, 'OCCUPATION' => $occupation, 'INTERESTS' => $interests, 'LOCATION' => $location, 'WEBSITE' => $website, 'SIGNATURE' => str_replace('<br />', "\n", $signature), 'CUSTOM_TITLE' => $custom_title, 'CUSTOM_TITLE_STATUS_REGDATE' => $custom_title_status_regdate, 'CUSTOM_TITLE_STATUS_DISABLED' => $custom_title_status_disabled, 'CUSTOM_TITLE_STATUS_ENABLED' => $custom_title_status_enabled, 'VIEW_EMAIL_YES' => $viewemail ? 'checked="checked"' : '', 'VIEW_EMAIL_NO' => !$viewemail ? 'checked="checked"' : '', 'HIDE_USER_YES' => !$allowviewonline ? 'checked="checked"' : '', 'HIDE_USER_NO' => $allowviewonline ? 'checked="checked"' : '', 'NOTIFY_PM_YES' => $notifypm ? 'checked="checked"' : '', 'NOTIFY_PM_NO' => !$notifypm ? 'checked="checked"' : '', 'POPUP_PM_YES' => $popuppm ? 'checked="checked"' : '', 'POPUP_PM_NO' => !$popuppm ? 'checked="checked"' : '', 'ALWAYS_ADD_SIGNATURE_YES' => $attachsig ? 'checked="checked"' : '', 'ALWAYS_ADD_SIGNATURE_NO' => !$attachsig ? 'checked="checked"' : '', 'NOTIFY_REPLY_YES' => $notifyreply ? 'checked="checked"' : '', 'NOTIFY_REPLY_NO' => !$notifyreply ? 'checked="checked"' : '', 'ALWAYS_ALLOW_BBCODE_YES' => $allowbbcode ? 'checked="checked"' : '', 'ALWAYS_ALLOW_BBCODE_NO' => !$allowbbcode ? 'checked="checked"' : '', 'ALWAYS_ALLOW_HTML_YES' => $allowhtml ? 'checked="checked"' : '', 'ALWAYS_ALLOW_HTML_NO' => !$allowhtml ? 'checked="checked"' : '', 'ALWAYS_ALLOW_SMILIES_YES' => $allowsmilies ? 'checked="checked"' : '', 'ALWAYS_ALLOW_SMILIES_NO' => !$allowsmilies ? 'checked="checked"' : '', 'AVATAR' => $avatar, 'LANGUAGE_SELECT' => language_select($user_lang), 'TIMEZONE_SELECT' => tz_select($user_timezone), 'STYLE_SELECT' => style_select($user_style, 'style'), 'DATE_FORMAT' => $user_dateformat, 'ALLOW_PM_YES' => $user_allowpm ? 'checked="checked"' : '', 'ALLOW_PM_NO' => !$user_allowpm ? 'checked="checked"' : '', 'ALLOW_AVATAR_YES' => $user_allowavatar ? 'checked="checked"' : '', 'ALLOW_AVATAR_NO' => !$user_allowavatar ? 'checked="checked"' : '', 'USER_ACTIVE_YES' => $user_status ? 'checked="checked"' : '', 'USER_ACTIVE_NO' => !$user_status ? 'checked="checked"' : '', 'BANCARD' => $user_ycard, 'RANK_SELECT_BOX' => $rank_select_box, 'L_USERNAME' => $lang['Username'], 'L_USER_TITLE' => $lang['User_admin'], 'L_USER_EXPLAIN' => $lang['User_admin_explain'], 'L_USER_TYPE' => $lang['User_Type'], 'L_USER_TYPE_EXPLAIN' => $lang['User_Type_explain'], 'L_NEW_PASSWORD' => $lang['New_password'], 'L_PASSWORD_IF_CHANGED' => $lang['password_if_changed'], 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'], 'L_PASSWORD_CONFIRM_IF_CHANGED' => $lang['password_confirm_if_changed'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_ICQ_NUMBER' => $lang['ICQ'], 'L_MESSENGER' => $lang['MSNM'], 'L_YAHOO' => $lang['YIM'], 'L_WEBSITE' => $lang['Website'], 'L_AIM' => $lang['AIM'], 'L_LOCATION' => $lang['Location'], 'L_OCCUPATION' => $lang['Occupation'], 'L_BOARD_LANGUAGE' => $lang['Board_lang'], 'L_BOARD_STYLE' => $lang['Board_style'], 'L_TIMEZONE' => $lang['Timezone'], 'L_DATE_FORMAT' => $lang['Date_format'], 'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_INTERESTS' => $lang['Interests'], 'L_BANCARD' => $lang['ban_card'], 'L_BANCARD_EXPLAIN' => sprintf($lang['ban_card_explain'], $board_config['max_user_bancard']), 'L_CUSTOM_TITLE' => $lang['Custom_title'], 'L_CUSTOM_TITLE_STATUS' => $lang['Custom_title_status'], 'L_CUSTOM_TITLE_STATUS_REGDATE' => $lang['Custom_title_status_regdate'], 'L_CUSTOM_TITLE_STATUS_DISABLED' => $lang['Custom_title_status_disabled'], 'L_CUSTOM_TITLE_STATUS_ENABLED' => $lang['Custom_title_status_enabled'], 'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'], 'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'], 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'], 'L_HIDE_USER' => $lang['Hide_user'], 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 'L_SPECIAL' => $lang['User_special'], 'L_SPECIAL_EXPLAIN' => $lang['User_special_explain'], 'L_USER_ACTIVE' => $lang['User_status'], 'L_ALLOW_PM' => $lang['User_allowpm'], 'L_ALLOW_AVATAR' => $lang['User_allowavatar'], 'L_AVATAR_PANEL' => $lang['Avatar_panel'], 'L_AVATAR_EXPLAIN' => $lang['Admin_avatar_explain'], 'L_DELETE_AVATAR' => $lang['Delete_Image'], 'L_CURRENT_IMAGE' => $lang['Current_Image'], 'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'], 'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'], 'L_AVATAR_GALLERY' => $lang['Select_from_gallery'], 'L_SHOW_GALLERY' => $lang['View_avatar_gallery'], 'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'], 'L_SIGNATURE' => $lang['Signature'], 'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']), 'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'], 'L_NOTIFY_ON_REPLY' => $lang['Always_notify'], 'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'], 'L_PREFERENCES' => $lang['Preferences'], 'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'], 'L_ITEMS_REQUIRED' => $lang['Items_required'], 'L_REGISTRATION_INFO' => $lang['Registration_info'], 'L_PROFILE_INFO' => $lang['Profile_info'], 'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'], 'L_EMAIL_ADDRESS' => $lang['Email_address'], 'S_FORM_ENCTYPE' => $form_enctype, 'HTML_STATUS' => $html_status, 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . append_sid("faq.{$phpEx}?mode=bbcode") . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => $smilies_status, 'L_DELETE_USER' => $lang['User_delete'], 'L_DELETE_USER_EXPLAIN' => $lang['User_delete_explain'], 'L_SELECT_RANK' => $lang['Rank_title'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_PROFILE_ACTION' => append_sid("admin_users.{$phpEx}")));
if (file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'])) && $board_config['allow_avatar_upload'] == TRUE) {
if ($form_enctype != '') {
$template->assign_block_vars('avatar_local_upload', array());
}
$template->assign_block_vars('avatar_remote_upload', array());
}
if (file_exists(@phpbb_realpath('./../' . $board_config['avatar_gallery_path'])) && $board_config['allow_avatar_local'] == TRUE) {
$template->assign_block_vars('avatar_local_gallery', array());
}
if ($board_config['allow_avatar_remote'] == TRUE) {
$template->assign_block_vars('avatar_remote_link', array());
}
}
$template->pparse('body');
} else {
示例4: main
//.........这里部分代码省略.........
}
// Instantiate passwords manager
$passwords_manager = $phpbb_container->get('passwords.manager');
$user_row = array('username' => $data['username'], 'user_password' => $passwords_manager->hash($data['new_password']), 'user_email' => $data['email'], 'group_id' => (int) $group_id, 'user_timezone' => $data['tz'], 'user_lang' => $data['lang'], 'user_type' => $user_type, 'user_actkey' => $user_actkey, 'user_ip' => $this->user->ip, 'user_regdate' => time(), 'user_inactive_reason' => $user_inactive_reason, 'user_inactive_time' => $user_inactive_time);
if ($this->config['allow_birthdays']) {
$user_row['user_birthday'] = $data['user_birthday'];
}
// Register user...
$user_id = user_add($user_row, $cp_data);
if (!empty($data['group'])) {
if (!empty($group_default)) {
group_user_add($data['group'], array($user_id), false, false, true);
} else {
group_user_add($data['group'], array($user_id));
}
}
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USER_ADDED', time(), array($data['username']));
// This should not happen, because the required variables are listed above...
if ($user_id === false) {
trigger_error($this->user->lang['NO_USER'], E_USER_ERROR);
}
// send a message to the user...if needed
$message = array();
if ($this->config['require_activation'] == USER_ACTIVATION_SELF && $this->config['email_enable']) {
$message[] = $this->user->lang['ACP_ACCOUNT_INACTIVE'];
$email_template = '@phpbbmodders_adduser/user_added_inactive';
} else {
if ($this->config['require_activation'] == USER_ACTIVATION_ADMIN && $this->config['email_enable'] && !$admin_activate) {
$message[] = $this->user->lang['ACP_ACCOUNT_INACTIVE_ADMIN'];
$email_template = '@phpbbmodders_adduser/user_added_admin_welcome_inactive';
} else {
$message[] = $this->user->lang['ACP_ACCOUNT_ADDED'];
$email_template = '@phpbbmodders_adduser/user_added_welcome';
}
}
if ($config['email_enable']) {
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$messenger = new \messenger(false);
$messenger->template($email_template, $data['lang']);
$messenger->to($data['email'], $data['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $this->user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $this->user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $this->user->ip);
$messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($this->user->lang['WELCOME_SUBJECT'], $this->config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_id}&k={$user_actkey}"));
$messenger->send(NOTIFY_EMAIL);
}
if ($this->config['require_activation'] == USER_ACTIVATION_ADMIN && !$admin_activate) {
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->add_notifications('notification.type.admin_activate_user', array('user_id' => $user_id, 'user_actkey' => $user_row['user_actkey'], 'user_regdate' => $user_row['user_regdate']));
}
$message[] = sprintf($user->lang['CONTINUE_EDIT_USER'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=users&mode=overview&u=' . $user_id) . '">', $data['username'], '</a>');
$message[] = sprintf($user->lang['EDIT_USER_GROUPS'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=users&mode=groups&u=' . $user_id) . '">', '</a>');
$message[] = adm_back_link($this->u_action);
trigger_error(implode('<br />', $message));
}
}
$l_reg_cond = '';
switch ($this->config['require_activation']) {
case USER_ACTIVATION_SELF:
$l_reg_cond = $this->user->lang['ACP_EMAIL_ACTIVATE'];
break;
case USER_ACTIVATION_ADMIN:
$l_reg_cond = $this->user->lang['ACP_ADMIN_ACTIVATE'];
break;
default:
$l_reg_cond = $this->user->lang['ACP_INSTANT_ACTIVATE'];
break;
}
if ($this->config['allow_birthdays']) {
$s_birthday_day_options = '<option value="0"' . (!$data['bday_day'] ? ' selected="selected"' : '') . '>--</option>';
for ($i = 1; $i < 32; $i++) {
$selected = $i == $data['bday_day'] ? ' selected="selected"' : '';
$s_birthday_day_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
}
$s_birthday_month_options = '<option value="0"' . (!$data['bday_month'] ? ' selected="selected"' : '') . '>--</option>';
for ($i = 1; $i < 13; $i++) {
$selected = $i == $data['bday_month'] ? ' selected="selected"' : '';
$s_birthday_month_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
}
$s_birthday_year_options = '';
$now = getdate();
$s_birthday_year_options = '<option value="0"' . (!$data['bday_year'] ? ' selected="selected"' : '') . '>--</option>';
for ($i = $now['year'] - 100; $i <= $now['year']; $i++) {
$selected = $i == $data['bday_year'] ? ' selected="selected"' : '';
$s_birthday_year_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
}
unset($now);
$this->template->assign_vars(array('S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, 'S_BIRTHDAYS_ENABLED' => true));
}
// Get the groups, so that the user can be added to them
$s_group_options = $this->get_groups($group_selected);
$timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true);
$this->template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'NEW_USERNAME' => $data['username'], 'EMAIL' => $data['email'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'L_PASSWORD_EXPLAIN' => $this->user->lang($config['pass_complex'] . '_EXPLAIN', $this->user->lang('CHARACTERS', (int) $this->config['min_pass_chars']), $this->user->lang('CHARACTERS', (int) $this->config['max_pass_chars'])) . ' ' . $this->user->lang['PASSWORD_EXPLAIN'], 'L_USERNAME_EXPLAIN' => $this->user->lang($config['allow_name_chars'] . '_EXPLAIN', $this->user->lang('CHARACTERS', (int) $this->config['min_name_chars']), $this->user->lang('CHARACTERS', (int) $this->config['max_name_chars'])), 'L_ADD_USER_EXPLAIN' => sprintf($this->user->lang['ADD_USER_EXPLAIN'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=acp_board&mode=registration') . '">', '</a>'), 'L_REG_COND' => $l_reg_cond, 'L_MOD_VERSION' => sprintf($this->user->lang['MOD_VERSION'], $this->config['adduser_version']), 'S_USER_ADD' => true, 'S_GROUP_OPTIONS' => $s_group_options, 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_ADMIN_ACTIVATE' => $this->config['require_activation'] == USER_ACTIVATION_ADMIN ? true : false, 'U_ADMIN_ACTIVATE' => $admin_activate ? 'checked="checked"' : '', 'U_GROUP_DEFAULT' => $group_default ? 'checked="checked"' : ''));
$this->user->profile_fields = array();
// Generate profile fields -> Template Block Variable profile_fields
$cp->generate_profile_fields('register', $user->get_iso_lang_id());
}
示例5: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
$submit = isset($_POST['submit']) ? true : false;
$error = $data = array();
$s_hidden_fields = '';
switch ($mode) {
case 'personal':
add_form_key('ucp_prefs_personal');
$data = array('notifymethod' => request_var('notifymethod', $user->data['user_notify_type']), 'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true), 'lang' => basename(request_var('lang', $user->data['user_lang'])), 'style' => request_var('style', (int) $user->data['user_style']), 'tz' => request_var('tz', (double) $user->data['user_timezone']), 'dst' => request_var('dst', (bool) $user->data['user_dst']), 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']), 'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']), 'hideonline' => request_var('hideonline', (bool) (!$user->data['user_allow_viewonline'])), 'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']), 'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')), 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']));
if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) {
// Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct.
$data['notifymethod'] = NOTIFY_BOTH;
}
if ($submit) {
$data['style'] = $config['override_user_style'] ? $config['default_style'] : $data['style'];
$error = validate_data($data, array('dateformat' => array('string', false, 1, 30), 'lang' => array('match', false, '#^[a-z0-9_\\-]{2,}$#i'), 'tz' => array('num', false, -14, 14)));
if (!check_form_key('ucp_prefs_personal')) {
$error[] = 'FORM_INVALID';
}
if (!sizeof($error)) {
$user->optionset('popuppm', $data['popuppm']);
$sql_ary = array('user_allow_pm' => $data['allowpm'], 'user_allow_viewemail' => $data['viewemail'], 'user_allow_massemail' => $data['massemail'], 'user_allow_viewonline' => $auth->acl_get('u_hideonline') ? !$data['hideonline'] : $user->data['user_allow_viewonline'], 'user_notify_type' => $data['notifymethod'], 'user_notify_pm' => $data['notifypm'], 'user_options' => $user->data['user_options'], 'user_dst' => $data['dst'], 'user_dateformat' => $data['dateformat'], 'user_lang' => $data['lang'], 'user_timezone' => $data['tz'], 'user_style' => $data['style']);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$dateformat_options = '';
foreach ($user->lang['dateformats'] as $format => $null) {
$dateformat_options .= '<option value="' . $format . '"' . ($format == $data['dateformat'] ? ' selected="selected"' : '') . '>';
$dateformat_options .= $user->format_date(time(), $format, false) . (strpos($format, '|') !== false ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
$dateformat_options .= '</option>';
}
$s_custom = false;
$dateformat_options .= '<option value="custom"';
if (!isset($user->lang['dateformats'][$data['dateformat']])) {
$dateformat_options .= ' selected="selected"';
$s_custom = true;
}
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_NOTIFY_EMAIL' => $data['notifymethod'] == NOTIFY_EMAIL ? true : false, 'S_NOTIFY_IM' => $data['notifymethod'] == NOTIFY_IM ? true : false, 'S_NOTIFY_BOTH' => $data['notifymethod'] == NOTIFY_BOTH ? true : false, 'S_VIEW_EMAIL' => $data['viewemail'], 'S_MASS_EMAIL' => $data['massemail'], 'S_ALLOW_PM' => $data['allowpm'], 'S_HIDE_ONLINE' => $data['hideonline'], 'S_NOTIFY_PM' => $data['notifypm'], 'S_POPUP_PM' => $data['popuppm'], 'S_DST' => $data['dst'], 'DATE_FORMAT' => $data['dateformat'], 'A_DATE_FORMAT' => addslashes($data['dateformat']), 'S_DATEFORMAT_OPTIONS' => $dateformat_options, 'S_CUSTOM_DATEFORMAT' => $s_custom, 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => $config['override_user_style'] ? '' : style_select($data['style']), 'S_TZ_OPTIONS' => tz_select($data['tz'], true), 'S_CAN_HIDE_ONLINE' => $auth->acl_get('u_hideonline') ? true : false, 'S_SELECT_NOTIFY' => $config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml') ? true : false));
break;
case 'view':
add_form_key('ucp_prefs_view');
$data = array('topic_sk' => request_var('topic_sk', !empty($user->data['user_topic_sortby_type']) ? $user->data['user_topic_sortby_type'] : 't'), 'topic_sd' => request_var('topic_sd', !empty($user->data['user_topic_sortby_dir']) ? $user->data['user_topic_sortby_dir'] : 'd'), 'topic_st' => request_var('topic_st', !empty($user->data['user_topic_show_days']) ? $user->data['user_topic_show_days'] : 0), 'post_sk' => request_var('post_sk', !empty($user->data['user_post_sortby_type']) ? $user->data['user_post_sortby_type'] : 't'), 'post_sd' => request_var('post_sd', !empty($user->data['user_post_sortby_dir']) ? $user->data['user_post_sortby_dir'] : 'a'), 'post_st' => request_var('post_st', !empty($user->data['user_post_show_days']) ? $user->data['user_post_show_days'] : 0), 'images' => request_var('images', (bool) $user->optionget('viewimg')), 'flash' => request_var('flash', (bool) $user->optionget('viewflash')), 'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')), 'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')), 'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')), 'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')));
if ($submit) {
$error = validate_data($data, array('topic_sk' => array('string', false, 1, 1), 'topic_sd' => array('string', false, 1, 1), 'post_sk' => array('string', false, 1, 1), 'post_sd' => array('string', false, 1, 1)));
if (!check_form_key('ucp_prefs_view')) {
$error[] = 'FORM_INVALID';
}
if (!sizeof($error)) {
$user->optionset('viewimg', $data['images']);
$user->optionset('viewflash', $data['flash']);
$user->optionset('viewsmilies', $data['smilies']);
$user->optionset('viewsigs', $data['sigs']);
$user->optionset('viewavatars', $data['avatars']);
if ($auth->acl_get('u_chgcensors')) {
$user->optionset('viewcensors', $data['wordcensor']);
}
$sql_ary = array('user_options' => $user->data['user_options'], 'user_topic_sortby_type' => $data['topic_sk'], 'user_post_sortby_type' => $data['post_sk'], 'user_topic_sortby_dir' => $data['topic_sd'], 'user_post_sortby_dir' => $data['post_sd'], 'user_topic_show_days' => $data['topic_st'], 'user_post_show_days' => $data['post_st']);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
// Topic ordering options
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
// Post ordering options
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_post_sql = array('a' => 'u.username_clean', 't' => 'p.post_id', 's' => 'p.post_subject');
$_options = array('topic', 'post');
foreach ($_options as $sort_option) {
${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
foreach (${'limit_' . $sort_option . '_days'} as $day => $text) {
$selected = $data[$sort_option . '_st'] == $day ? ' selected="selected"' : '';
${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
}
${'s_limit_' . $sort_option . '_days'} .= '</select>';
${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text) {
$selected = $data[$sort_option . '_sk'] == $key ? ' selected="selected"' : '';
${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
}
//.........这里部分代码省略.........
示例6: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
global $request, $phpbb_container, $phpbb_dispatcher;
//
if ($config['require_activation'] == USER_ACTIVATION_DISABLE || in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable']) {
trigger_error('UCP_REGISTER_DISABLE');
}
$coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false;
$agreed = $request->variable('agreed', false);
$submit = $request->is_set_post('submit');
$change_lang = $request->variable('change_lang', '');
$user_lang = $request->variable('lang', $user->lang_name);
if ($agreed) {
add_form_key('ucp_register');
} else {
add_form_key('ucp_register_terms');
}
if ($change_lang || $user_lang != $config['default_lang']) {
$use_lang = $change_lang ? basename($change_lang) : basename($user_lang);
if (!validate_language_iso_name($use_lang)) {
if ($change_lang) {
$submit = false;
// Setting back agreed to let the user view the agreement in his/her language
$agreed = false;
}
$user_lang = $use_lang;
} else {
$change_lang = '';
$user_lang = $user->lang_name;
}
}
/* @var $cp \phpbb\profilefields\manager */
$cp = $phpbb_container->get('profilefields.manager');
$error = $cp_data = $cp_error = array();
$s_hidden_fields = array();
// Handle login_link data added to $_hidden_fields
$login_link_data = $this->get_login_link_data_array();
if (!empty($login_link_data)) {
// Confirm that we have all necessary data
/* @var $provider_collection \phpbb\auth\provider_collection */
$provider_collection = $phpbb_container->get('auth.provider_collection');
$auth_provider = $provider_collection->get_provider($request->variable('auth_provider', ''));
$result = $auth_provider->login_link_has_necessary_data($login_link_data);
if ($result !== null) {
$error[] = $user->lang[$result];
}
$s_hidden_fields = array_merge($s_hidden_fields, $this->get_login_link_data_for_hidden_fields($login_link_data));
}
if (!$agreed || $coppa === false && $config['coppa_enable'] || $coppa && !$config['coppa_enable']) {
$add_coppa = $coppa !== false ? '&coppa=' . $coppa : '';
$s_hidden_fields = array_merge($s_hidden_fields, array('change_lang' => ''));
// If we change the language, we want to pass on some more possible parameter.
if ($change_lang) {
// We do not include the password
$s_hidden_fields = array_merge($s_hidden_fields, array('username' => $request->variable('username', '', true), 'email' => strtolower($request->variable('email', '')), 'lang' => $user->lang_name, 'tz' => $request->variable('tz', $config['board_timezone'])));
}
// Checking amount of available languages
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE;
$result = $db->sql_query($sql);
$lang_row = array();
while ($row = $db->sql_fetchrow($result)) {
$lang_row[] = $row;
}
$db->sql_freeresult($result);
if ($coppa === false && $config['coppa_enable']) {
$now = getdate();
$coppa_birthday = $user->create_datetime()->setDate($now['year'] - 13, $now['mon'], $now['mday'] - 1)->setTime(0, 0, 0)->format($user->lang['DATE_FORMAT'], true);
unset($now);
$template->assign_vars(array('S_LANG_OPTIONS' => sizeof($lang_row) > 1 ? language_select($user_lang) : '', 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register&coppa=0'), 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register&coppa=1'), 'S_SHOW_COPPA' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register'), 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path']));
} else {
$template->assign_vars(array('S_LANG_OPTIONS' => sizeof($lang_row) > 1 ? language_select($user_lang) : '', 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register' . $add_coppa), 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path']));
}
unset($lang_row);
/**
* Allows to modify the agreements.
*
* To assign data to the template, use $template->assign_vars()
*
* @event core.ucp_register_agreement
* @since 3.1.6-RC1
*/
$phpbb_dispatcher->dispatch('core.ucp_register_agreement');
$this->tpl_name = 'ucp_agreement';
return;
}
// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
if ($config['enable_confirm']) {
$captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REG);
}
$timezone = $config['board_timezone'];
$data = array('username' => $request->variable('username', '', true), 'new_password' => $request->variable('new_password', '', true), 'password_confirm' => $request->variable('password_confirm', '', true), 'email' => strtolower($request->variable('email', '')), 'lang' => basename($request->variable('lang', $user->lang_name)), 'tz' => $request->variable('tz', $timezone));
/**
* Add UCP register data before they are assigned to the template or submitted
*
* To assign data to the template, use $template->assign_vars()
*
* @event core.ucp_register_data_before
//.........这里部分代码省略.........
示例7: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
//
if ($config['require_activation'] == USER_ACTIVATION_DISABLE) {
trigger_error('UCP_REGISTER_DISABLE');
}
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$coppa = isset($_REQUEST['coppa']) ? !empty($_REQUEST['coppa']) ? 1 : 0 : false;
$agreed = !empty($_POST['agreed']) ? 1 : 0;
$submit = isset($_POST['submit']) ? true : false;
$change_lang = request_var('change_lang', '');
$user_lang = request_var('lang', $user->lang_name);
if ($agreed) {
add_form_key('ucp_register');
} else {
add_form_key('ucp_register_terms');
}
if ($change_lang || $user_lang != $config['default_lang']) {
$use_lang = $change_lang ? basename($change_lang) : basename($user_lang);
if (!validate_language_iso_name($use_lang)) {
if ($change_lang) {
$submit = false;
// Setting back agreed to let the user view the agreement in his/her language
$agreed = empty($_GET['change_lang']) ? 0 : $agreed;
}
$user->lang_name = $user_lang = $use_lang;
$user->lang = array();
$user->data['user_lang'] = $user->lang_name;
$user->add_lang(array('common', 'ucp'));
} else {
$change_lang = '';
$user_lang = $user->lang_name;
}
}
$cp = new custom_profile();
$error = $cp_data = $cp_error = array();
if (!$agreed || $coppa === false && $config['coppa_enable'] || $coppa && !$config['coppa_enable']) {
$add_lang = $change_lang ? '&change_lang=' . urlencode($change_lang) : '';
$add_coppa = $coppa !== false ? '&coppa=' . $coppa : '';
$s_hidden_fields = array('change_lang' => $change_lang);
// If we change the language, we want to pass on some more possible parameter.
if ($change_lang) {
// We do not include the password
$s_hidden_fields = array_merge($s_hidden_fields, array('username' => utf8_normalize_nfc(request_var('username', '', true)), 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => $user->lang_name, 'tz' => request_var('tz', (double) $config['board_timezone'])));
}
// Checking amount of available languages
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE;
$result = $db->sql_query($sql);
$lang_row = array();
while ($row = $db->sql_fetchrow($result)) {
$lang_row[] = $row;
}
$db->sql_freeresult($result);
if ($coppa === false && $config['coppa_enable']) {
$now = getdate();
$coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']);
unset($now);
$template->assign_vars(array('S_LANG_OPTIONS' => sizeof($lang_row) > 1 ? language_select($user_lang) : '', 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register&coppa=0' . $add_lang), 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register&coppa=1' . $add_lang), 'S_SHOW_COPPA' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register' . $add_lang)));
} else {
$template->assign_vars(array('S_LANG_OPTIONS' => sizeof($lang_row) > 1 ? language_select($user_lang) : '', 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register' . $add_lang . $add_coppa)));
}
unset($lang_row);
$this->tpl_name = 'ucp_agreement';
return;
}
// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
if ($config['enable_confirm']) {
include $phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx;
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REG);
}
// Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1
$timezone = date('Z') / 3600;
$is_dst = date('I');
if ($config['board_timezone'] == $timezone || $config['board_timezone'] == $timezone - 1) {
$timezone = $is_dst ? $timezone - 1 : $timezone;
if (!isset($user->lang['tz_zones'][(string) $timezone])) {
$timezone = $config['board_timezone'];
}
} else {
$is_dst = $config['board_dst'];
$timezone = $config['board_timezone'];
}
$data = array('username' => utf8_normalize_nfc(request_var('username', '', true)), 'new_password' => request_var('new_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => basename(request_var('lang', $user->lang_name)), 'tz' => request_var('tz', (double) $timezone));
// Check and initialize some variables if needed
if ($submit) {
$error = validate_data($data, array('username' => array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username', '')), 'new_password' => array(array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), array('password')), 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('email')), 'email_confirm' => array('string', false, 6, 60), 'tz' => array('num', false, -14, 14), 'lang' => array('language_iso_name')));
if (!check_form_key('ucp_register')) {
$error[] = $user->lang['FORM_INVALID'];
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
if ($config['enable_confirm']) {
$vc_response = $captcha->validate($data);
if ($vc_response !== false) {
$error[] = $vc_response;
}
if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) {
//.........这里部分代码省略.........
示例8: select_style_lang_link
/**
* select_style_lang_link()
*/
function select_style_lang_link($select_type)
{
global $db, $cache, $config, $user, $lang, $template, $theme, $images;
$link = array('lang' => 'Profile', 'link' => CMS_PAGE_PROFILE_MAIN, 'auth' => AUTH_CMS_REG);
if (!defined('IN_CMS') && ($select_type == 'style' && empty($config['select_theme']) || $select_type == 'lang' && empty($config['select_lang']))) {
return $link;
}
global $block_id;
if ($select_type == 'style') {
$default_style = $config['default_style'];
$select_name = STYLE_URL;
$dirname = 'templates';
$style_select = '<select name="' . $select_name . '" onchange="SetTheme_' . $block_id . '();" class="gensmall">';
$styles = $cache->obtain_styles(true);
foreach ($styles as $k => $v) {
$selected = $k == $default_style ? ' selected="selected"' : '';
$style_select .= '<option value="' . $k . '"' . $selected . '>' . htmlspecialchars($v) . '</option>';
}
$style_select .= '</select>';
$full_link = '<form name="ChangeTheme_' . $block_id . '" method="post" action="' . htmlspecialchars(urldecode($_SERVER['REQUEST_URI'])) . '">' . $style_select . '</form>';
$link = array('full_link' => $full_link, 'lang' => 'Change_Style', 'link' => CMS_PAGE_PROFILE_MAIN, 'auth' => AUTH_CMS_ALL);
} else {
$full_link = '';
if (!function_exists('language_select')) {
@(include_once IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT);
}
$lang_installed = language_select(LANG_URL, $config['default_lang'], 'language', true);
while (list($displayname) = @each($lang_installed)) {
$lang_value = $displayname;
$lang_name = ucwords($displayname);
$lang_url = append_sid(CMS_PAGE_HOME . '?' . LANG_URL . '=' . $lang_value);
$lang_icon = '<img src="language/lang_' . $displayname . '/flag.png" alt="" title="" style="vertical-align: middle;" /> ';
$full_link .= '<a href="' . $lang_url . '">' . $lang_icon . $lang_name . ' <br /></a>';
}
$link = array('full_link' => $full_link, 'lang' => 'Change_Lang', 'link' => CMS_PAGE_PROFILE_MAIN, 'auth' => AUTH_CMS_GUESTS_ONLY, 'noicon' => true);
}
return $link;
}
示例9: main
//.........这里部分代码省略.........
{
$s_hidden_fields['coppa'] = $coppa;
}
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
$confirm_image = '';
// Visual Confirmation - Show images
if ($config['enable_confirm'])
{
$str = '';
if (!$change_lang)
{
$user->confirm_gc(CONFIRM_REG);
$sql = 'SELECT COUNT(session_id) AS attempts
FROM ' . CONFIRM_TABLE . "
WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
AND confirm_type = " . CONFIRM_REG;
$result = $db->sql_query($sql);
$attempts = (int) $db->sql_fetchfield('attempts');
$db->sql_freeresult($result);
if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts'])
{
trigger_error('TOO_MANY_REGISTERS');
}
$code = gen_rand_string(mt_rand(5, 8));
$confirm_id = md5(unique_id($user->ip));
$seed = hexdec(substr(unique_id(), 4, 10));
// compute $seed % 0x7fffffff
$seed -= 0x7fffffff * floor($seed / 0x7fffffff);
$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'confirm_id' => (string) $confirm_id,
'session_id' => (string) $user->session_id,
'confirm_type' => (int) CONFIRM_REG,
'code' => (string) $code,
'seed' => (int) $seed)
);
$db->sql_query($sql);
}
else
{
$str .= '&change_lang=' . $change_lang;
}
$confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . $str) . '" alt="" title="" />';
$s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
}
//
$l_reg_cond = '';
switch ($config['require_activation'])
{
case USER_ACTIVATION_SELF:
$l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
break;
case USER_ACTIVATION_ADMIN:
$l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
break;
}
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'USERNAME' => $data['username'],
'PASSWORD' => $data['new_password'],
'PASSWORD_CONFIRM' => $data['password_confirm'],
'EMAIL' => $data['email'],
'EMAIL_CONFIRM' => $data['email_confirm'],
'CONFIRM_IMG' => $confirm_image,
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
'L_REG_COND' => $l_reg_cond,
'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
'S_LANG_OPTIONS' => language_select($data['lang']),
'S_TZ_OPTIONS' => tz_select($data['tz']),
'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false,
'S_COPPA' => $coppa,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
'S_TIME' => 1000 * ((int) $config['min_time_reg']),
)
);
//
$user->profile_fields = array();
// Generate profile fields -> Template Block Variable profile_fields
$cp->generate_profile_fields('register', $user->get_iso_lang_id());
//
$this->tpl_name = 'ucp_register';
$this->page_title = 'UCP_REGISTRATION';
}
示例10: show_coppa
function show_coppa()
{
global $config, $user, $template, $lang;
// Load the appropriate Rules file
$lang_file = 'lang_rules';
$l_title = $lang['BoardRules'];
// Include the rules settings
setup_extra_lang(array($lang_file));
//
// Pull the array data from the lang pack
//
$j = 0;
$counter = 0;
$counter_2 = 0;
$rules_block = array();
$rules_block_titles = array();
for ($i = 0; $i < sizeof($rules); $i++) {
if ($rules[$i][0] != '--') {
$rules_block[$j][$counter]['id'] = $counter_2;
$rules_block[$j][$counter]['question'] = $rules[$i][0];
$rules_block[$j][$counter]['answer'] = $rules[$i][1];
$counter++;
$counter_2++;
} else {
$j = $counter != 0 ? $j + 1 : 0;
$rules_block_titles[$j] = $rules[$i][1];
$counter = 0;
}
}
$template->set_filenames(array('body' => 'agreement.tpl'));
if (!function_exists('language_select')) {
@(include_once IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT);
}
$available_networks = array();
$social_connect_append = '';
$social_network = request_get_var('social_network', '');
if ($config['enable_social_connect']) {
include_once IP_ROOT_PATH . 'includes/class_social_connect.' . PHP_EXT;
$available_networks = SocialConnect::get_available_networks();
$login_admin = request_get_var('admin', 0);
$redirect_url = CMS_LOGIN_REDIRECT_PAGE;
$template->assign_var('SOCIAL_CONNECT', true);
foreach ($available_networks as $social_network_item) {
$template->assign_block_vars('social_connect_button', array('L_SOCIAL_CONNECT' => sprintf($lang['SOCIAL_CONNECT_LOGIN'], $social_network_item->get_name()), 'U_SOCIAL_CONNECT' => append_sid(CMS_PAGE_LOGIN . '?social_network=' . $social_network_item->get_name_clean() . '&redirect=' . urlencode($redirect_url) . '&admin=' . $login_admin), 'IMG_SOCIAL_CONNECT' => '<img src="' . IP_ROOT_PATH . 'images/social_connect/' . $social_network_item->get_name_clean() . '_button_connect.png" alt="" title="" />'));
}
if (!empty($social_network)) {
if (!empty($available_networks[$social_network])) {
$social_connect_append = '&social_network=' . $social_network;
}
}
}
$template->assign_vars(array('L_PAGE_TITLE' => $lang['Registration'], 'REGISTRATION' => $lang['Registration'], 'AGREEMENT' => $lang['Reg_agreement'], 'L_AGREEMENT' => $lang['Agreement'], 'L_PRIVACY_DISCLAIMER' => $lang['PrivacyDisclaimer'], 'AGREE_OVER_13' => $lang['Agree_over_13'], 'AGREE_UNDER_13' => $lang['Agree_under_13'], 'DO_NOT_AGREE' => $lang['Agree_not'], 'AGREE_CHECKBOX' => $lang['Agree_checkbox'], 'S_LANG_CHANGE_ACTION' => append_sid(CMS_PAGE_PROFILE . '?mode=register' . $social_connect_append), 'LANGUAGE_SELECT' => language_select('l', $config['default_lang']), 'L_RULES_TITLE' => $l_title, 'L_BACK_TO_TOP' => $lang['Back_to_top'], 'S_AGREE_ACTION' => append_sid(CMS_PAGE_PROFILE . '?mode=register&agreed=true' . $social_connect_append), 'U_AGREE_OVER13' => append_sid(CMS_PAGE_PROFILE . '?mode=register&agreed=true' . $social_connect_append), 'U_AGREE_UNDER13' => append_sid(CMS_PAGE_PROFILE . '?mode=register&agreed=true&coppa=true' . $social_connect_append)));
for ($i = 0; $i < sizeof($rules_block); $i++) {
if (sizeof($rules_block[$i])) {
$template->assign_block_vars('rules_block', array('BLOCK_TITLE' => $rules_block_titles[$i]));
$template->assign_block_vars('rules_block_link', array('BLOCK_TITLE' => $rules_block_titles[$i]));
for ($j = 0; $j < sizeof($rules_block[$i]); $j++) {
$row_class = !($j % 2) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('rules_block.rules_row', array('ROW_CLASS' => $row_class, 'RULES_QUESTION' => $rules_block[$i][$j]['question'], 'RULES_ANSWER' => $rules_block[$i][$j]['answer'], 'U_RULES_ID' => $rules_block[$i][$j]['id']));
$template->assign_block_vars('rules_block_link.rules_row_link', array('ROW_CLASS' => $row_class, 'RULES_LINK' => $rules_block[$i][$j]['question'], 'U_RULES_LINK' => '#' . $rules_block[$i][$j]['id']));
}
}
}
$template->pparse('body');
}
示例11: bb_die
}
}
$sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_special = 1 ORDER BY rank_title";
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain ranks data');
}
$rank_select_box = '';
if (DB()->num_rows($result) != 0) {
$template->assign_block_vars('ranks_exist', array());
while ($row = DB()->sql_fetchrow($result)) {
$rank = $row['rank_title'];
$rank_id = $row['rank_id'];
$rank_select_box .= '<option value="' . $rank_id . '">' . $rank . '</option>';
}
}
$language_list = language_select('', 'language_type');
$timezone_list = tz_select('', 'timezone_type');
$sql = "SELECT f.forum_id, f.forum_name, f.forum_parent, c.cat_id, c.cat_title\n\t\t\t\tFROM ( " . BB_FORUMS . " AS f INNER JOIN " . BB_CATEGORIES . " AS c ON c.cat_id = f.cat_id )\n\t\t\t\tORDER BY c.cat_order, f.forum_order ASC";
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not select forum data');
}
$forums = array();
if (DB()->num_rows($result) != 0) {
$template->assign_block_vars('forums_exist', array());
$last_cat_id = -1;
$forums_list = '';
while ($row = DB()->sql_fetchrow($result)) {
if ($row['cat_id'] != $last_cat_id) {
$forums_list .= '<optgroup label="' . htmlCHR($row['cat_title']) . '">';
$last_cat_id = $row['cat_id'];
}
示例12: meta_refresh
$emailer->reset();
$message = $lang['PROFILE_UPDATED_INACTIVE'];
$user->session_end();
} else {
meta_refresh('index.php', 10);
$message = $lang['PROFILE_UPDATED'];
}
$sql_args = DB()->build_array('UPDATE', $db_data);
DB()->query("UPDATE " . BB_USERS . " SET {$sql_args} WHERE user_id = {$pr_data['user_id']} LIMIT 1");
if ($pr_data['user_id'] != $userdata['user_id']) {
if ($pr_data['user_level'] == MOD && !empty($db_data['username'])) {
$datastore->update('moderators');
}
}
cache_rm_user_sessions($pr_data['user_id']);
if ($adm_edit) {
bb_die($lang['PROFILE_USER'] . ' <b>' . profile_url($pr_data) . '</b> ' . $lang['GOOD_UPDATE']);
} elseif (!$pr_data['user_active']) {
bb_die($lang['PROFILE_UPDATED_INACTIVE']);
} else {
meta_refresh('index.php', 10);
bb_die($lang['PROFILE_UPDATED']);
}
} else {
bb_die($lang['NOTHING_HAS_CHANGED']);
}
}
}
$template->assign_vars($tp_data);
$template->assign_vars(array('PAGE_TITLE' => $mode == 'editprofile' ? $lang['EDIT_PROFILE'] . ($adm_edit ? " :: {$pr_data['username']}" : '') : $lang['REGISTER'], 'SHOW_REG_AGREEMENT' => $mode == 'register' && !IS_ADMIN, 'ERROR_MESSAGE' => $errors ? join('<br />', array_unique($errors)) : '', 'MODE' => $mode, 'EDIT_PROFILE' => $mode == 'editprofile', 'ADM_EDIT' => $adm_edit, 'SHOW_PASS' => $adm_edit || $mode == 'register' && IS_ADMIN, 'CAPTCHA_HTML' => $need_captcha ? bb_captcha('get') : '', 'LANGUAGE_SELECT' => language_select($pr_data['user_lang'], 'user_lang'), 'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'), 'USER_TIMEZONE' => $pr_data['user_timezone'], 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], round($bb_cfg['avatars']['max_size'] / 1024)), 'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'), 'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']), 'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')), 'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], $bb_cfg['max_sig_chars']), 'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'), 'PR_USER_ID' => $pr_data['user_id'], 'U_RESET_AUTOLOGIN' => LOGIN_URL . "?logout=1&reset_autologin=1&sid={$userdata['session_id']}"));
print_page('usercp_register.tpl');
示例13: strtr
$mailer->cc($_CLASS['core_user']->data['user_email'], $_CLASS['core_user']->data['username']);
}
//$mailer->extra_header('X-AntiAbuse: Board servername - ' . $config['server_name']);
$mailer->extra_header('X-AntiAbuse: User_id - ' . $_CLASS['core_user']->data['user_id']);
$mailer->extra_header('X-AntiAbuse: Username - ' . $_CLASS['core_user']->data['username']);
$mailer->extra_header('X-AntiAbuse: User IP - ' . $_CLASS['core_user']->ip);
$_CLASS['core_template']->assign_array(array('SITENAME' => $_CORE_CONFIG['global']['site_name'], 'BOARD_EMAIL' => $config['board_contact'], 'FROM_USERNAME' => $_CLASS['core_user']->data['username'], 'TO_USERNAME' => $topic_id ? $name : $row['username'], 'MESSAGE' => $message, 'TOPIC_NAME' => $topic_id ? strtr($row['topic_title'], array_flip(get_html_translation_table(HTML_ENTITIES))) : '', 'U_TOPIC' => $topic_id ? generate_link('Forums&file=viewforum&f=' . $row['forum_id'] . "&t={$topic_id}", array('full' => true, 'sid' => false)) : ''));
$mailer->message = trim($_CLASS['core_template']->display('email/members_list/' . $template, true));
$mailer->send();
$_CLASS['core_display']->meta_refresh(3, generate_link());
$message = !$topic_id ? sprintf($_CLASS['core_user']->lang['RETURN_INDEX'], '<a href="' . generate_link() . '">', '</a>') : sprintf($_CLASS['core_user']->lang['RETURN_TOPIC'], '<a href="' . generate_link("Forums&file=viewtopic&f={$forum_id}&t=" . $row['topic_id']) . '">', '</a>');
trigger_error($_CLASS['core_user']->lang['EMAIL_SENT'] . '<br /><br />' . $message);
}
}
if ($topic_id) {
$_CLASS['core_template']->assign_array(array('EMAIL' => htmlspecialchars($email), 'NAME' => htmlspecialchars($name), 'TOPIC_TITLE' => $row['topic_title'], 'U_TOPIC' => generate_link("Forums&file=viewtopic&f={$row['forum_id']}&t={$topic_id}"), 'S_LANG_OPTIONS' => $topic_id ? language_select($email_lang) : ''));
}
$_CLASS['core_template']->assign_array(array('USERNAME' => !$topic_id ? $row['username'] : '', 'ERROR_MESSAGE' => empty($error) ? '' : implode('<br />', $error), 'L_EMAIL_BODY_EXPLAIN' => $_CLASS['core_user']->get_lang(!$topic_id ? 'EMAIL_BODY_EXPLAIN' : 'EMAIL_TOPIC_EXPLAIN'), 'S_POST_ACTION' => !$topic_id ? generate_link('Members_List&mode=email&u=' . $user_id, array('full' => true)) : generate_link("Members_List&mode=email&f={$row['forum_id']}&t={$topic_id}", array('full' => true)), 'S_SEND_USER' => !$topic_id));
break;
case 'group':
$_CLASS['core_user']->add_lang('groups', 'Forums');
default:
// The basic memberlist
$page_title = $_CLASS['core_user']->lang['MEMBERLIST'];
$template_html = 'memberlist_body.html';
// Sorting
$sort_key_text = array('a' => $_CLASS['core_user']->lang['SORT_USERNAME'], 'b' => $_CLASS['core_user']->lang['SORT_LOCATION'], 'c' => $_CLASS['core_user']->lang['SORT_JOINED'], 'd' => $_CLASS['core_user']->lang['SORT_POST_COUNT'], 'e' => $_CLASS['core_user']->lang['SORT_EMAIL'], 'f' => $_CLASS['core_user']->lang['WEBSITE'], 'g' => $_CLASS['core_user']->lang['ICQ'], 'h' => $_CLASS['core_user']->lang['AIM'], 'i' => $_CLASS['core_user']->lang['MSNM'], 'j' => $_CLASS['core_user']->lang['YIM'], 'k' => $_CLASS['core_user']->lang['JABBER'], 'l' => $_CLASS['core_user']->lang['SORT_LAST_ACTIVE'], 'm' => $_CLASS['core_user']->lang['SORT_RANK']);
$sort_key_sql = array('a' => 'u.username', 'b' => 'u.user_from', 'c' => 'u.user_reg_date', 'd' => 'u.user_posts', 'e' => 'u.user_email', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber', 'l' => 'u.user_last_visit', 'm' => 'u.user_rank DESC, u.user_posts');
$sort_dir_text = array('a' => $_CLASS['core_user']->lang['ASCENDING'], 'd' => $_CLASS['core_user']->lang['DESCENDING']);
$s_sort_key = '';
foreach ($sort_key_text as $key => $value) {
示例14: main
//.........这里部分代码省略.........
$result = $db->sql_query($sql);
$user->data['user_topics'] = (int) $db->sql_fetchfield('user_topics');
$db->sql_freeresult();
// Days of membership
$user->data['user_memberdays'] = floor((time() - $user->data['user_regdate']) / 86400);
// Calculate the available amount of invitations
foreach ($limit_periods as $k => $v) {
if ($invite->config['enable_' . $v]) {
$user->data['user_' . $v] = (int) $invite->config[$v . '_basic'];
foreach ($limit_criteria as $ck => $cv) {
// Don't divide by zero
$user->data['user_' . $v] += $invite->config[$v . '_' . $cv] == 0 ? 0 : floor($user->data['user_' . $cv] / $invite->config[$v . '_' . $cv]) * $invite->config[$v . '_' . $cv . '_invitations'];
}
// Single recipient
if ($user->data['user_invitations_' . $v] >= $user->data['user_' . $v]) {
$error[] = sprintf($user->lang['INVITATION_' . strtoupper($v)], $user->data['user_' . $v]);
$disable_form = true;
}
// Multiple recipients
if ($recipient_count > 1 && $user->data['user_invitations_' . $v] + $recipient_count > $user->data['user_' . $v]) {
// $reduce = $recipient_count - ($user->data['user_' . $v] - $user->data['user_invitations_' . $v]);
$error[] = sprintf($user->lang['REDUCE_RECIPIENTS']) . ' ' . sprintf($user->lang['INVITATION_' . strtoupper($v) . '_MULTI'], $user->data['user_invitations_' . $v], $user->data['user_' . $v], $recipient_count);
$disable_form = true;
}
}
}
}
// Requirements met?
if ($user->data['user_posts'] < $invite->config['invite_required_posts']) {
$error[] = sprintf($user->lang['TOO_FEW_POSTS'], $invite->config['invite_required_posts']);
$disable_form = true;
}
// Set up the array containing the important information
$email_data = array('message_type' => $INVITE_MESSAGE_TYPE['invite'], 'method' => EMAIL, 'method_user_id' => $user->data['user_id'], 'invite_language' => $invite->config['invite_language_select'] == 'opt' ? utf8_normalize_nfc(request_var('form_invite_language_select', $user->data['user_lang'], true)) : ($invite->config['invite_language_select'] == 'user' ? $user->data['user_lang'] : $invite->config['invite_language_select']), 'priority' => $invite->config['invite_priority_flag'] == MAIL_LOW_PRIORITY + 1 ? request_var('form_priority', 0) : $invite->config['invite_priority_flag'], 'subject' => utf8_normalize_nfc(request_var('form_subject', '', true)), 'message' => utf8_normalize_nfc(request_var('form_message', '', true)), 'register_key' => $invite->generate_key(), 'register_key_used' => 0, 'register_user_id' => 0, 'invite_user_id' => $user->data['user_id'], 'invite_session_ip' => $user->data['session_ip'], 'invite_time' => time(), 'expiration_time' => time() + $invite->config['invite_expiration_time'] * 86400, 'invite_zebra' => request_var('form_invite_zebra', 0), 'confirm_code' => request_var('confirm_code', ''), 'confirm_id' => request_var('confirm_id', ''));
// Additional email data concerning the templates
foreach ($INVITE_MESSAGE_TYPE as $string => $int) {
$email_data['invite_' . $string] = request_var('form_invite_' . $string, 0);
$email_data['invite_' . $string . '_method'] = request_var('form_invite_' . $string . '_method', 0);
}
// The CAPTCHA kicks in here
if ($invite->config['invite_confirm_code']) {
if (!class_exists('phpbb_captcha_factory')) {
include $phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx;
}
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}
// Prevalidate the static data so we don't have to do it in the loop later
if ($submit) {
if (!check_form_key('ucp_invite')) {
$error[] = 'FORM_INVALID';
}
$check_ary = array('subject' => array('string', false, $invite->config['subject_min_chars'], $invite->config['subject_max_chars']), 'message' => array('string', false, $invite->config['message_min_chars'], $invite->config['message_max_chars']));
$error = validate_data($email_data, $check_ary);
// Visual Confirmation handling
if ($invite->config['invite_confirm_code']) {
$vc_response = $captcha->validate($email_data);
if ($vc_response !== false) {
$error[] = $vc_response;
}
}
}
// Send out multiple invitations
for ($i = 0; $i < $recipient_count; $i++) {
// Add index specific values to the data array
$form_register_email = utf8_normalize_nfc(request_var('form_register_email_' . $i, '', true));
示例15: language_select
/**
* Pick a language, any language ... or no language
*/
function language_select($default = '')
{
global $user;
return '<option value="">' . $user->lang['DISABLED'] . '</option>' . language_select($default);
}