本文整理汇总了PHP中custom_profile类的典型用法代码示例。如果您正苦于以下问题:PHP custom_profile类的具体用法?PHP custom_profile怎么用?PHP custom_profile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了custom_profile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load_cp_fields
public static function load_cp_fields($user_ids)
{
// Only get the rows for those we have not gotten already
$user_ids = array_diff($user_ids, array_keys(self::$cp_fields));
if (!sizeof($user_ids)) {
return;
}
// Load custom profile fields
if (phpbb::$config['load_cpf_viewtopic']) {
phpbb::_include('functions_profile_fields', false, 'custom_profile');
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $user_ids);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) {
self::$cp_fields[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field) {
if ($profile_field['data']['field_show_on_vt']) {
self::$cp_fields[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
}
}
开发者ID:Gfksx,项目名称:customisation-db,代码行数:25,代码来源:users.php
示例2: ucp_preregister
/**
* UCP Pre-Register Operations (Pre-Registration Captcha)
*/
public static function ucp_preregister()
{
global $config, $db, $phpbb_root_path, $phpEx, $template, $user;
if (!$config['asacp_enable']) {
return array();
}
$user->add_lang('mods/asacp');
// Profile fields stuff
$cp = new custom_profile();
foreach (self::$profile_fields as $field => $data) {
if ($data['field_type'] == 'disabled') {
continue;
}
// Special stuff for $cp->process_field_row
$data['var_name'] = $data['field_ident'] = $field;
$data['lang_default_value'] = '';
switch ($config['asacp_profile_' . $field]) {
case 1:
// Required Field
$template->assign_block_vars('profile_fields', array('FIELD_ID' => $field, 'LANG_NAME' => isset($user->lang[$data['lang']]) ? $user->lang[$data['lang']] : $data['lang'], 'S_REQUIRED' => true, 'LANG_EXPLAIN' => isset($user->lang[$data['lang'] . '_EXPLAIN']) ? $user->lang[$data['lang'] . '_EXPLAIN'] : '', 'FIELD' => $cp->process_field_row('change', $data)));
break;
case 2:
if ($config['asacp_profile_during_reg']) {
// Normal Field
$template->assign_block_vars('profile_fields', array('FIELD_ID' => $field, 'LANG_NAME' => isset($user->lang[$data['lang']]) ? $user->lang[$data['lang']] : $data['lang'], 'LANG_EXPLAIN' => isset($user->lang[$data['lang'] . '_EXPLAIN']) ? $user->lang[$data['lang'] . '_EXPLAIN'] : '', 'FIELD' => $cp->process_field_row('change', $data)));
}
break;
}
}
if (!$config['asacp_reg_captcha']) {
return array();
}
}
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:36,代码来源:asacp.php
示例3: test_dropdown_validate
/**
* @dataProvider dropdownFields
*/
public function test_dropdown_validate($field_required, $field_value, $expected, $description)
{
global $db;
$db = $this->new_dbal();
$field_data = array('field_id' => 1, 'lang_id' => 1, 'field_novalue' => 1, 'field_required' => $field_required);
$cp = new custom_profile();
$result = $cp->validate_profile_field(FIELD_DROPDOWN, $field_value, $field_data);
$this->assertEquals($expected, $result, $description);
}
开发者ID:josh-js,项目名称:phpbb,代码行数:12,代码来源:custom_test.php
示例4: smiley_text
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
}
$member['user_sig'] = smiley_text($member['user_sig']);
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
$template->assign_vars($karmamod->show_profile($member));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile'])
{
include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$cp = new custom_profile();
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
$profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
}
$template->assign_vars(array(
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '',
'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
'SIGNATURE' => $member['user_sig'],
'AVATAR_IMG' => $poster_avatar,
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:31,代码来源:karma.php
示例5: get_user_data
/**
* Get user data
*
* grabs the data on the user and places it in the self::$user array
*
* @param int|bool $id The user_id (or multiple user_ids if given an array) of the user we want to grab the data for
* @param bool $user_queue If user_queue is true then we just grab the user_ids from the user_queue, otherwise we select data from $id.
*/
public function get_user_data($id, $user_queue = false, $username = false)
{
global $user, $db, $phpbb_root_path, $phpEx, $config, $auth, $cp;
// if we are using the user_queue, set $user_id as that for consistency
if ($user_queue) {
$id = self::$user_queue;
}
blog_plugins::plugin_do('user_data_start');
// this holds the user_id's we will query
$users_to_query = array();
// if the $user_id isn't an array, make it one for consistency
if (!is_array($id)) {
$id = array(intval($id));
}
if ($username) {
$sql = 'SELECT user_id FROM ' . USERS_TABLE . ' WHERE username_clean = \'' . $db->sql_escape(utf8_clean_string($username)) . '\'';
$result = $db->sql_query($sql);
$id[] = $db->sql_fetchfield('user_id', $result);
$db->sql_freeresult($result);
}
if (!sizeof($id)) {
return;
}
$id[] = 1;
foreach ($id as $i) {
if ($i && !isset(self::$user[$i]) && !in_array($i, $users_to_query)) {
$users_to_query[] = (int) $i;
}
}
if (!sizeof($users_to_query)) {
return;
}
// Grab all profile fields from users in id cache for later use - similar to the poster cache
if ($config['user_blog_custom_profile_enable']) {
if (!class_exists('custom_profile')) {
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
}
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $users_to_query);
}
// Grab user status information
$status_data = array();
$sql = 'SELECT session_user_id, MAX(session_time) AS online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $users_to_query) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$status_data[$row['session_user_id']] = $row;
}
$db->sql_freeresult($result);
$update_time = $config['load_online_time'] * 60;
// Get the rest of the data on the users and parse everything we need
$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $users_to_query);
blog_plugins::plugin_do_ref('user_data_sql', $sql);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$user_id = $row['user_id'];
blog_plugins::plugin_do_ref('user_data_while', $row);
// view profile link
$row['view_profile'] = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . $user_id);
// Full username, with colour
$row['username_full'] = get_username_string('full', $user_id, $row['username'], $row['user_colour']);
// format the color correctly
$row['user_colour'] = get_username_string('colour', $user_id, $row['username'], $row['user_colour']);
// Avatar
$row['avatar'] = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);
// Rank
get_user_rank($row['user_rank'], $row['user_posts'], $row['rank_title'], $row['rank_img'], $row['rank_img_src']);
if ($row['user_type'] != USER_IGNORE && $row['user_id'] != ANONYMOUS) {
// Online/Offline Status
$row['status'] = isset($status_data[$user_id]) && time() - $update_time < $status_data[$user_id]['online_time'] && ($status_data[$user_id]['viewonline'] && $row['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
// IM Links
$row['aim_url'] = $row['user_aim'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=aim&u={$user_id}") : '';
$row['icq_url'] = $row['user_icq'] ? 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'] : '';
$row['jabber_url'] = $row['user_jabber'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$user_id}") : '';
$row['msn_url'] = $row['user_msnm'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=msnm&u={$user_id}") : '';
$row['yim_url'] = $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg' : '';
// PM and email links
$row['email_url'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$user_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $row['user_email']);
$row['pm_url'] = $row['user_id'] != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&mode=compose&u={$user_id}") : '';
// get the custom profile fields if the admin wants them
if ($config['user_blog_custom_profile_enable']) {
$row['cp_row'] = isset($profile_fields_cache[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array();
}
} else {
$row = array_merge($row, array('status' => false, 'aim_url' => '', 'icq_url' => '', 'jabber_url' => '', 'msn_url' => '', 'yim_url' => '', 'email_url' => '', 'pm_url' => ''));
}
// now lets put everything in the user array
self::$user[$user_id] = $row;
}
$db->sql_freeresult($result);
//.........这里部分代码省略.........
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:101,代码来源:blog_data.php
示例6: 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);
$confirm_id = request_var('confirm_id', '');
$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);
// not so fast, buddy
if (($submit && !check_form_key('ucp_register', false, '', false, $config['min_time_reg']))
|| (!$submit && !check_form_key('ucp_register_terms', false, '', false, $config['min_time_terms'])))
{
$agreed = false;
}
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 (file_exists($phpbb_root_path . 'language/' . $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 = $lang = $use_lang;
$user->lang_path = $phpbb_root_path . 'language/' . $lang . '/';
$user->lang = array();
$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 = ($confirm_id) ? array('confirm_id' => $confirm_id) : array();
// 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', '')),
'confirm_code' => request_var('confirm_code', ''),
'lang' => $user->lang_name,
'tz' => request_var('tz', (float) $config['board_timezone']),
));
}
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(
'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),
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:ucp_register.php
示例7: display
//.........这里部分代码省略.........
$id_cache[] = $poster_id;
$user_cache[$poster_id] = array('joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => isset($row['user_warnings']) ? $row['user_warnings'] : 0, 'from' => !empty($row['user_from']) ? $row['user_from'] : '', 'sig' => $user_sig, 'sig_bbcode_uid' => !empty($row['user_sig_bbcode_uid']) ? $row['user_sig_bbcode_uid'] : '', 'sig_bbcode_bitfield' => !empty($row['user_sig_bbcode_bitfield']) ? $row['user_sig_bbcode_bitfield'] : '', 'viewonline' => $row['user_allow_viewonline'], 'allow_pm' => $row['user_allow_pm'], 'avatar' => $user->optionget('viewavatars') ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'age' => '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'online' => false, 'profile' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u={$poster_id}"), 'www' => $row['user_website'], 'aim' => $row['user_aim'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=aim&u={$poster_id}") : '', 'msn' => $row['user_msnm'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=msnm&u={$poster_id}") : '', 'yim' => $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', 'jabber' => $row['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$poster_id}") : '', 'search' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$poster_id}&sr=posts") : '', 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), 'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']), 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']));
get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);
if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) {
$user_cache[$poster_id]['email'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$poster_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $row['user_email']);
} else {
$user_cache[$poster_id]['email'] = '';
}
if (!empty($row['user_icq'])) {
$user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/' . $row['user_icq'] . '/';
$user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />';
} else {
$user_cache[$poster_id]['icq_status_img'] = '';
$user_cache[$poster_id]['icq'] = '';
}
if ($config['allow_birthdays'] && !empty($row['user_birthday'])) {
list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday']));
if ($bday_year) {
$diff = $now['mon'] - $bday_month;
if ($diff == 0) {
$diff = $now['mday'] - $bday_day < 0 ? 1 : 0;
} else {
$diff = $diff < 0 ? 1 : 0;
}
$user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff);
}
}
}
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_viewtopic']) {
if (!class_exists('custom_profile')) {
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
}
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) {
$profile_fields_cache[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field) {
if ($profile_field['data']['field_show_on_vt']) {
$profile_fields_cache[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
}
// Generate online information for user
if ($config['load_onlinetrack'] && sizeof($id_cache)) {
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = $db->sql_fetchrow($result)) {
$user_cache[$row['session_user_id']]['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
}
$db->sql_freeresult($result);
}
unset($id_cache);
// Instantiate BBCode if need be
开发者ID:paul999,项目名称:profile-guestbook,代码行数:67,代码来源:class_guestbook.php
示例8: main
//.........这里部分代码省略.........
unset($sql_in);
}
if ($where_sql || $deleteall) {
$sql = 'DELETE FROM ' . LOG_TABLE . '
WHERE log_type = ' . LOG_USERS . "\n\t\t\t\t\t\t\t{$where_sql}";
$db->sql_query($sql);
add_log('admin', 'LOG_CLEAR_USER', $user_row['username']);
}
}
if ($submit && $message) {
add_log('admin', 'LOG_USER_FEEDBACK', $user_row['username']);
add_log('user', $user_id, 'LOG_USER_GENERAL', $message);
trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
// Sorting
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 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_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
$sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
// Define where and sort sql for use in displaying logs
$sql_where = $sort_days ? time() - $sort_days * 86400 : 0;
$sql_sort = $sort_by_sql[$sort_key] . ' ' . ($sort_dir == 'd' ? 'DESC' : 'ASC');
// Grab log data
$log_data = array();
$log_count = 0;
view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
$template->assign_vars(array('S_FEEDBACK' => true, 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), 'PAGINATION' => generate_pagination($this->u_action . "&u={$user_id}&{$u_sort_param}", $log_count, $config['topics_per_page'], $start, true), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs')));
foreach ($log_data as $row) {
$template->assign_block_vars('log', array('USERNAME' => $row['username'], 'IP' => $row['ip'], 'DATE' => $user->format_date($row['time']), 'ACTION' => nl2br($row['action']), 'ID' => $row['id']));
}
break;
case 'profile':
$cp = new custom_profile();
$cp_data = $cp_error = array();
$data = array();
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "\n\t\t\t\t\tWHERE lang_iso = '" . $db->sql_escape($user_row['user_lang']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$user_row['iso_lang_id'] = $row['lang_id'];
if ($submit) {
$var_ary = array('icq' => (string) '', 'aim' => (string) '', 'msn' => (string) '', 'yim' => (string) '', 'jabber' => (string) '', 'website' => (string) '', 'location' => (string) '', 'occupation' => (string) '', 'interests' => (string) '', 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0);
foreach ($var_ary as $var => $default) {
$data[$var] = in_array($var, array('location', 'occupation', 'interests')) ? request_var($var, $default, true) : ($data[$var] = request_var($var, $default));
}
$var_ary = array('icq' => array(array('string', true, 3, 15), array('match', true, '#^[0-9]+$#i')), 'aim' => array('string', true, 3, 17), 'msn' => array('string', true, 5, 255), 'jabber' => array(array('string', true, 5, 255), array('match', true, '#^[a-z0-9\\.\\-_\\+]+?@(.*?\\.)*?[a-z0-9\\-_]+?\\.[a-z]{2,4}(/.*)?$#i')), 'yim' => array('string', true, 5, 255), 'website' => array(array('string', true, 12, 255), array('match', true, '#^http[s]?://(.*?\\.)*?[a-z0-9\\-]+\\.[a-z]{2,4}#i')), 'location' => array('string', true, 2, 255), 'occupation' => array('string', true, 2, 500), 'interests' => array('string', true, 2, 500), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())));
$error = validate_data($data, $var_ary);
// validate custom profile fields
$cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error);
if (sizeof($cp_error)) {
$error = array_merge($error, $cp_error);
}
if (!sizeof($error)) {
$sql_ary = array('user_icq' => $data['icq'], 'user_aim' => $data['aim'], 'user_msnm' => $data['msn'], 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], 'user_website' => $data['website'], 'user_from' => $data['location'], 'user_occ' => $data['occupation'], 'user_interests' => $data['interests'], 'user_birthday' => sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']));
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
// Update Custom Fields
if (sizeof($cp_data)) {
$sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $cp_data) . "\n\t\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
if (!$db->sql_affectedrows()) {
$cp_data['user_id'] = (int) $user_id;
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_users.php
示例9: main
//.........这里部分代码省略.........
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if (!$row['log_operation']) {
// We do not have a log-entry anymore, so there is no data available
$row['action'] = $user->lang['USER_WARNING_LOG_DELETED'];
} else {
$row['action'] = isset($user->lang[$row['log_operation']]) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}';
if (!empty($row['log_data'])) {
$log_data_ary = @unserialize($row['log_data']);
$log_data_ary = $log_data_ary === false ? array() : $log_data_ary;
if (isset($user->lang[$row['log_operation']])) {
// Check if there are more occurrences of % than arguments, if there are we fill out the arguments array
// It doesn't matter if we add more arguments than placeholders
if (substr_count($row['action'], '%') - sizeof($log_data_ary) > 0) {
$log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), ''));
}
$row['action'] = vsprintf($row['action'], $log_data_ary);
$row['action'] = bbcode_nl2br(censor_text($row['action']));
} else {
if (!empty($log_data_ary)) {
$row['action'] .= '<br />' . implode('', $log_data_ary);
}
}
}
}
$template->assign_block_vars('warn', array('ID' => $row['warning_id'], 'USERNAME' => $row['log_operation'] ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', 'ACTION' => make_clickable($row['action']), 'DATE' => $user->format_date($row['warning_time'])));
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_WARNINGS' => true));
break;
case 'profile':
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
$cp_data = $cp_error = array();
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "\n\t\t\t\t\tWHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$user_row['iso_lang_id'] = $row['lang_id'];
$data = array('icq' => request_var('icq', $user_row['user_icq']), 'aim' => request_var('aim', $user_row['user_aim']), 'msn' => request_var('msn', $user_row['user_msnm']), 'yim' => request_var('yim', $user_row['user_yim']), 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'website' => request_var('website', $user_row['user_website']), 'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)), 'occupation' => utf8_normalize_nfc(request_var('occupation', $user_row['user_occ'], true)), 'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)), 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0);
if ($user_row['user_birthday']) {
list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']);
}
$data['bday_day'] = request_var('bday_day', $data['bday_day']);
$data['bday_month'] = request_var('bday_month', $data['bday_month']);
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
if ($submit) {
$error = validate_data($data, array('icq' => array(array('string', true, 3, 15), array('match', true, '#^[0-9]+$#i')), 'aim' => array('string', true, 3, 255), 'msn' => array('string', true, 5, 255), 'jabber' => array(array('string', true, 5, 255), array('jabber')), 'yim' => array('string', true, 5, 255), 'website' => array(array('string', true, 12, 255), array('match', true, '#^http[s]?://(.*?\\.)*?[a-z0-9\\-]+\\.[a-z]{2,4}#i')), 'location' => array('string', true, 2, 100), 'occupation' => array('string', true, 2, 500), 'interests' => array('string', true, 2, 500), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())), 'user_birthday' => array('date', true)));
// validate custom profile fields
$cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error);
if (sizeof($cp_error)) {
$error = array_merge($error, $cp_error);
}
if (!check_form_key($form_name)) {
$error[] = 'FORM_INVALID';
}
if (!sizeof($error)) {
$sql_ary = array('user_icq' => $data['icq'], 'user_aim' => $data['aim'], 'user_msnm' => $data['msn'], 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], 'user_website' => $data['website'], 'user_from' => $data['location'], 'user_occ' => $data['occupation'], 'user_interests' => $data['interests'], 'user_birthday' => $data['user_birthday']);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
// Update Custom Fields
$cp->update_profile_field_data($user_id, $cp_data);
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_users.php
示例10: custom_profile
$user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff);
}
}
}
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_viewtopic'])
{
if (!class_exists('custom_profile'))
{
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
}
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields)
{
$profile_fields_cache[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field)
{
if ($profile_field['data']['field_show_on_vt'])
{
$profile_fields_cache[$profile_user_id][$used_ident] = $profile_field;
}
开发者ID:gonzo1247,项目名称:hitman_roa,代码行数:31,代码来源:viewtopic.php
示例11: main
//.........这里部分代码省略.........
get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);
if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email'))
{
$user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']);
}
if ($row['user_birthday'])
{
list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday']));
if ($bday_year)
{
$diff = $now['mon'] - $bday_month;
if ($diff == 0)
{
$diff = ($now['mday'] - $bday_day < 0) ? 1 : 0;
}
else
{
$diff = ($diff < 0) ? 1 : 0;
}
$user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff);
}
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_viewtopic'])
{
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache);
}
// Generate online information for user
if ($config['load_onlinetrack'] && sizeof($id_cache))
{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = $db->sql_fetchrow($result))
{
$user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
}
$db->sql_freeresult($result);
}
unset($id_cache);
$cp_row = array();
foreach ($message_cache as $post_id => $row)
{
$poster_id = $row['user_id'];
//
if ($config['load_cpf_viewtopic'])
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:gallery_main.php
示例12: main
//.........这里部分代码省略.........
$messenger->replyto($config['board_contact']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('USERNAME' => html_entity_decode($username), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
}
$messenger->save_queue();
$sql_ary += array('user_type' => USER_INACTIVE, 'user_actkey' => $user_actkey);
}
if (sizeof($sql_ary)) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
}
// Need to update config, forum, topic, posting, messages, etc.
if ($username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
user_update_name($user->data['username'], $username);
}
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_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);
}
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\\w]+' => 'USERNAME_ALPHA_ONLY', '[\\w_\\+\\. \\-\\[\\]]+' => 'USERNAME_ALPHA_SPACERS');
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => isset($username) ? $username : $user->data['username'], 'EMAIL' => isset($email) ? $email : $user->data['user_email'], 'PASSWORD_CONFIRM' => isset($password_confirm) ? $password_confirm : '', 'NEW_PASSWORD' => isset($new_password) ? $new_password : '', 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang['CHANGE_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_FORCE_PASSWORD' => $config['chg_passforce'] && $user->data['user_passchg'] < time() - $config['chg_passforce'] ? true : false, 'S_CHANGE_USERNAME' => $config['allow_namechange'] && $auth->acl_get('u_chgname') ? true : false, 'S_CHANGE_EMAIL' => $auth->acl_get('u_chgemail') ? true : false, 'S_CHANGE_PASSWORD' => $auth->acl_get('u_chgpasswd') ? true : false));
break;
case 'profile_info':
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
$cp_data = $cp_error = array();
if ($submit) {
$var_ary = array('icq' => (string) '', 'aim' => (string) '', 'msn' => (string) '', 'yim' => (string) '', 'jabber' => (string) '', 'website' => (string) '', 'location' => (string) '', 'occupation' => (string) '', 'interests' => (string) '', 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0);
foreach ($var_ary as $var => $default) {
$data[$var] = in_array($var, array('location', 'occupation', 'interests')) ? request_var($var, $default, true) : request_var($var, $default);
}
$var_ary = array('icq' => array(array('string', true, 3, 15), array('match', true, '#^[0-9]+$#i')), 'aim' => array('string', true, 3, 17), 'msn' => array('string', true, 5, 255), 'jabber' => array(array('string', true, 5, 255), array('match', true, '#^[a-z0-9\\.\\-_\\+]+?@(.*?\\.)*?[a-z0-9\\-_]+?\\.[a-z]{2,4}(/.*)?$#i')), 'yim' => array('string', true, 5, 255), 'website' => array(array('string', true, 12, 255), array('match', true, '#^http[s]?://(.*?\\.)*?[a-z0-9\\-]+\\.[a-z]{2,4}#i')), 'location' => array('string', true, 2, 255), 'occupation' => array('string', true, 2, 500), 'interests' => array('string', true, 2, 500), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())));
$error = validate_data($data, $var_ary);
extract($data);
unset($data);
// validate custom profile fields
$cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error);
if (sizeof($cp_error)) {
$error = array_merge($error, $cp_error);
}
if (!sizeof($error)) {
$sql_ary = array('user_icq' => $icq, 'user_aim' => $aim, 'user_msnm' => $msn, 'user_yim' => $yim, 'user_jabber' => $jabber, 'user_website' => $website, 'user_from' => $location, 'user_occ' => $occupation, 'user_interests' => $interests, 'user_birthday' => sprintf('%2d-%2d-%4d', $bday_day, $bday_month, $bday_year));
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
// Update Custom Fields
if (sizeof($cp_data)) {
$sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $cp_data) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
if (!$db->sql_affectedrows()) {
$cp_data['user_id'] = (int) $user->data['user_id'];
$db->return_on_error = true;
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data);
$db->sql_query($sql);
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:ucp_profile.php
示例13: user_add
/**
* Adds an user
*
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group
|
请发表评论