Kod: Markera allt
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_from_flag, user_interests, user_car_mark, user_car_mark_choice, user_car_model, user_car_model_choice, user_car_year, user_car_year_choice, user_car_engine, user_car_engine_choice, user_car_wheel, user_car_trans, user_car_color, user_car_rt, user_car_sixty, user_car_three, user_car_eigth, user_car_eigthm, user_car_thou, user_car_quart, user_car_quartm, user_mod_engine, user_mod_exterior, user_mod_interior, user_mod_rims, user_mod_audio, user_mod_future, user_name_first, user_name_last, user_allow_new_img_popup, user_modell, user_absence_mode, user_absence, user_absence_text, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_setbm, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_passwd_change, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '$user_flag', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $car_mark) . "', '" . str_replace("\'", "''", $car_mark_choice) . "', '" . str_replace("\'", "''", $car_model) . "', '" . str_replace("\'", "''", $car_model_choice) . "', '" . str_replace("\'", "''", $car_year) . "', '" . str_replace("\'", "''", $car_year_choice) . "', '" . str_replace("\'", "''", $car_engine) . "', '" . str_replace("\'", "''", $car_engine_choice) . "', '" . str_replace("\'", "''", $car_wheel) . "', '" . str_replace("\'", "''", $car_trans) . "', '" . str_replace("\'", "''", $car_color) . "', '" . str_replace("\'", "''", $car_rt) . "', '" . str_replace("\'", "''", $car_sixty) . "', '" . str_replace("\'", "''", $car_three) . "', '" . str_replace("\'", "''", $car_eigth) . "', '" . str_replace("\'", "''", $car_eigthm) . "', '" . str_replace("\'", "''", $car_thou) . "', '" . str_replace("\'", "''", $car_quart) . "', '" . str_replace("\'", "''", $car_quartm) . "', '" . str_replace("\'", "''", $mod_engine) . "', '" . str_replace("\'", "''", $mod_exterior) . "', '" . str_replace("\'", "''", $mod_interior) . "', '" . str_replace("\'", "''", $mod_rims) . "', '" . str_replace("\'", "''", $mod_audio) . "', '" . str_replace("\'", "''", $mod_future) . "', '" . str_replace("\'", "''", $name_first) . "', '" . str_replace("\'", "''", $name_last) . "', $user_allow_new_img_popup, '" . str_replace("\'", "''", $info) . "', $user_absence_mode, $user_absence, '" . str_replace("\'", "''", $user_absence_text) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $setbm, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, '$gender', 0, 1, '$birthday', '$next_birthday_greeting', ".time().",";
if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
{
$user_actkey = gen_rand_string(true);
$key_len = 54 - (strlen($server_url));
$key_len = ( $key_len > 6 ) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
}
else
{
$sql .= "1, '')";
}
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
VALUES ('', 'Personal User', 1, 0)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
}
$group_id = $db->sql_nextid();
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES ($user_id, $group_id, 0)";
if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
}
if ( $coppa )
{
$message = $lang['COPPA'];
$email_template = 'coppa_welcome_inactive';
}
else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
{
$message = $lang['Account_inactive'];
$email_template = 'user_welcome_inactive';
}
else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
$message = $lang['Account_inactive_admin'];
$email_template = 'admin_welcome_inactive';
}
else
{
$message = $lang['Account_added'];
$email_template = 'user_welcome';
}
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template($email_template, stripslashes($user_lang));
$emailer->email_address($email);
$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
if( $coppa )
{
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
'PASSWORD' => $password_confirm,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'FAX_INFO' => $board_config['coppa_fax'],
'MAIL_INFO' => $board_config['coppa_mail'],
'EMAIL_ADDRESS' => $email,
'ICQ' => $icq,
'AIM' => $aim,
'YIM' => $yim,
'MSN' => $msn,
'WEB_SITE' => $website,
'FROM' => $location,
'OCC' => $occupation,
'INTERESTS' => $interests,
'SITENAME' => $board_config['sitename']));
}
else
{
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
'PASSWORD' => $password_confirm,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
);
}
$emailer->send();
$emailer->reset();
if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
$sql = "SELECT user_email, user_lang
FROM " . USERS_TABLE . "
WHERE user_level = " . ADMIN;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->email_address(trim($row['user_email']));
$emailer->use_template("admin_activate", $row['user_lang']);
$emailer->set_subject($lang['New_account_subject']);
$emailer->assign_vars(array(
'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
);
$emailer->send();
$emailer->reset();
}
$db->sql_freeresult($result);
}
$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
} // if mode == register
}
} // End of submit
if ( $error )
{
//
// If an error occured we need to stripslashes on returned data
//
$username = stripslashes($username);
$name_first = stripslashes($name_first);
$name_last = stripslashes($name_last);
$email = stripslashes($email);
$new_password = '';
$password_confirm = '';
$icq = stripslashes($icq);
$aim = str_replace('+', ' ', stripslashes($aim));
$msn = stripslashes($msn);
$yim = stripslashes($yim);
$website = stripslashes($website);
$location = stripslashes($location);
$occupation = stripslashes($occupation);
$interests = stripslashes($interests);
//
// START Joe's Car Mod
//
$car_mark = stripslashes($car_mark);
$car_mark_choice = stripslashes($car_mark_choice);
$car_model = stripslashes($car_model);
$car_model_choice = stripslashes($car_model_choice);
$car_year = stripslashes($car_year);
$car_year_choice = stripslashes($car_year_choice);
$car_engine = stripslashes($car_engine);
$car_engine_choice = stripslashes($car_engine_choice);
$car_wheel = stripslashes($car_wheel);
$car_trans = stripslashes($car_trans);
$car_color = stripslashes($car_color);
$car_rt = stripslashes($car_rt);
$car_sixty = stripslashes($car_sixty);
$car_three = stripslashes($car_three);
$car_eigth = stripslashes($car_eigth);
$car_eigthm = stripslashes($car_eigthm);
$car_thou = stripslashes($car_thou);
$car_quart = stripslashes($car_quart);
$car_quartm = stripslashes($car_quartm);
$mod_engine = stripslashes($mod_engine);
$mod_exterior = stripslashes($mod_exterior);
$mod_interior = stripslashes($mod_interior);
$mod_rims = stripslashes($mod_rims);
$mod_audio = stripslashes($mod_audio);
$mod_future = stripslashes($mod_future);
//
// END Joe's Car Mod
//
//
// START Joe's Car Mod
//
$car_mark = stripslashes($car_mark);
$car_mark_choice = stripslashes($car_mark_choice);
$car_model = stripslashes($car_model);
$car_model_choice = stripslashes($car_model_choice);
$car_year = stripslashes($car_year);
$car_year_choice = stripslashes($car_year_choice);
$car_engine = stripslashes($car_engine);
$car_engine_choice = stripslashes($car_engine_choice);
$car_wheel = stripslashes($car_wheel);
$car_trans = stripslashes($car_trans);
$car_color = stripslashes($car_color);
$car_rt = stripslashes($car_rt);
$car_sixty = stripslashes($car_sixty);
$car_three = stripslashes($car_three);
$car_eigth = stripslashes($car_eigth);
$car_eigthm = stripslashes($car_eigthm);
$car_thou = stripslashes($car_thou);
$car_quart = stripslashes($car_quart);
$car_quartm = stripslashes($car_quartm);
$mod_engine = stripslashes($mod_engine);
$mod_exterior = stripslashes($mod_exterior);
$mod_interior = stripslashes($mod_interior);
$mod_rims = stripslashes($mod_rims);
$mod_audio = stripslashes($mod_audio);
$mod_future = stripslashes($mod_future);
//
// END Joe's Car Mod
//
$info = stripslashes($info);
$user_absence_text = stripslashes($user_absence_text);
$signature = stripslashes($signature);
$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $signature) : $signature;
$user_lang = stripslashes($user_lang);
$user_dateformat = stripslashes($user_dateformat);
}
else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($HTTP_POST_VARS['cancelavatar']) )
{
$user_id = $userdata['user_id'];
$username = $userdata['username'];
$name_first = $userdata['user_name_first'];
$name_last = $userdata['user_name_last'];
$email = $userdata['user_email'];
$new_password = '';
$password_confirm = '';
$icq = $userdata['user_icq'];
$aim = str_replace('+', ' ', $userdata['user_aim']);
$msn = $userdata['user_msnm'];
$yim = $userdata['user_yim'];
$website = $userdata['user_website'];
$location = $userdata['user_from'];
// FLAGHACK-start
$user_flag = $userdata['user_from_flag'];
// FLAGHACK-end
$occupation = $userdata['user_occ'];
$interests = $userdata['user_interests'];
//
// START Joe's Car Mod
//
$car_mark = $userdata['user_car_mark'];
$car_mark_choice = $userdata['user_car_mark_choice'];
$car_model = $userdata['user_car_model'];
$car_model_choice = $userdata['user_car_model_choice'];
$car_year = $userdata['user_car_year'];
$car_year_choice = $userdata['user_car_year_choice'];
$car_engine = $userdata['user_car_engine'];
$car_engine_choice = $userdata['user_car_engine_choice'];
$car_wheel = $userdata['user_car_wheel'];
$car_trans = $userdata['user_car_trans'];
$car_color = $userdata['user_car_color'];
$car_rt = $userdata['user_car_rt'];
$car_sixty = $userdata['user_car_sixty'];
$car_three = $userdata['user_car_three'];
$car_eigth = $userdata['user_car_eigth'];
$car_eigthm = $userdata['user_car_eigthm'];
$car_thou = $userdata['user_car_thou'];
$car_quart = $userdata['user_car_quart'];
$car_quartm = $userdata['user_car_quartm'];
$mod_engine = $userdata['user_mod_engine'];
$mod_exterior = $userdata['user_mod_exterior'];
$mod_interior = $userdata['user_mod_interior'];
$mod_rims = $userdata['user_mod_rims'];
$mod_audio = $userdata['user_mod_audio'];
$mod_future = $userdata['user_mod_future'];
//
// END Joe's Car Mod
//
$info = $userdata['user_modell'];
// Start add - Gender MOD
$gender = $userdata['user_gender'];
// End add - Gender MOD
// Start add - Birthday MOD
$birthday = $userdata['user_birthday'];
// End add - Birthday MOD
$signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $userdata['user_sig']) : $userdata['user_sig'];
$viewemail = $userdata['user_viewemail'];
$user_allow_new_img_popup = $userdata['user_allow_new_img_popup'];
$user_absence_mode = $userdata['user_absence_mode'];
$user_absence = $userdata['user_absence'];
$user_absence_text = $userdata['user_absence_text'];
$notifypm = $userdata['user_notify_pm'];
$popup_pm = $userdata['user_popup_pm'];
$notifyreply = $userdata['user_notify'];
$attachsig = $userdata['user_attachsig'];
$setbm = $userdata['user_setbm'];
$allowhtml = $userdata['user_allowhtml'];
$allowbbcode = $userdata['user_allowbbcode'];
$allowsmilies = $userdata['user_allowsmile'];
$allowviewonline = $userdata['user_allow_viewonline'];
$user_avatar = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar'] : '';
$user_avatar_type = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar_type'] : USER_AVATAR_NONE;
$user_style = $userdata['user_style'];
$user_lang = $userdata['user_lang'];
$user_timezone = $userdata['user_timezone'];
$user_dateformat = $userdata['user_dateformat'];
}
//
// Default pages
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
make_jumpbox('viewforum.'.$phpEx);
if ( $mode == 'editprofile' )
{
if ( $user_id != $userdata['user_id'] )
{
$error = TRUE;
$error_msg = $lang['Wrong_Profile'];
}
}
if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
{
include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
$avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarcategory']) : '';
$template->set_filenames(array(
'body' => 'profile_avatar_gallery.tpl')
);
$allowviewonline = !$allowviewonline;
display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $new_password, $cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $name_first, $name_last, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $car_mark, $car_mark_choice, $car_model, $car_model_choice, $car_year, $car_year_choice, $car_engine, $car_engine_choice, $car_wheel, $car_trans, $car_color, $car_rt, $car_sixty, $car_three, $car_eigth, $car_eigthm, $car_thou, $car_quart, $car_quartm, $mod_engine, $mod_exterior, $mod_interior, $mod_rims, $mod_audio, $mod_future, $user_allow_new_img_popup, $userdata['session_id']);
}
else
{
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
if ( !isset($coppa) )
{
$coppa = FALSE;
}
if ( !isset($user_style) )
{
$user_style = $board_config['default_style'];
}
$avatar_img = '';
if ( $user_avatar_type )
{
switch( $user_avatar_type )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
break;
}
}
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
if( $mode == 'editprofile' )
{
$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
//
// Send the users current email address. If they change it, and account activation is turned on
// the user account will be disabled and the user will have to reactivate their account.
//
$s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $userdata['user_email'] . '" />';
}
if ( !empty($user_avatar_local) )
{
$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />';
}
$html_status = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
$bbcode_status = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode'] ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
$smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
// Start add - Gender MOD
switch ($gender)
{
case 1: $gender_male_checked="checked=\"checked\"";break;
case 2: $gender_female_checked="checked=\"checked\"";break;
default:$gender_no_specify_checked="checked=\"checked\"";
}
// End add - Gender MOD
// Start add - Birthday MOD
if ( $birthday!=999999 )
{
$b_day = realdate('j', $birthday);
$b_md = realdate('n', $birthday);
$b_year = realdate('Y', $birthday);
$birthday = realdate($lang['Submit_date_format'], $birthday);
} else
{
$b_day = '';
$b_md = '';
$b_year = '';
$birthday = '';
}
// End add - Birthday MOD
if ( $error )
{
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg)
);
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
$template->set_filenames(array(
'body' => 'profile_add_body.tpl')
);
$s_car_model_choice = '<select name="car_model_choice">';
for($i = 0; $i < count($lang['Car_Model_Choice']); $i++ )
{
$s_car_model_choice .= '<option value="' . $lang['Car_Model_Choice'][$i] . '">' . $lang['Car_Model_Choice'][$i]. '</option>';
}
$s_car_model_choice .= '</select>';
$s_car_model_choice = str_replace("value=\"".$car_model_choice."\">", "value=\"".$car_model_choice."\" SELECTED>" ,$s_car_model_choice);
$s_car_year_choice = '<select name="car_year_choice">';
for($i = 0; $i < count($lang['Car_Year_Choice']); $i++ )
{
$s_car_year_choice .= '<option value="' . $lang['Car_Year_Choice'][$i] . '">' . $lang['Car_Year_Choice'][$i]. '</option>';
}
$s_car_year_choice .= '</select>';
$s_car_year_choice = str_replace("value=\"".$car_year_choice."\">", "value=\"".$car_year_choice."\" SELECTED>" ,$s_car_year_choice);
$s_car_mark_choice = '<select name="car_mark_choice">';
for($i = 0; $i < count($lang['Car_Mark_Choice']); $i++ )
{
$s_car_mark_choice .= '<option value="' . $lang['Car_Mark_Choice'][$i] . '">' . $lang['Car_Mark_Choice'][$i]. '</option>';
}
$s_car_mark_choice .= '</select>';
$s_car_mark_choice = str_replace("value=\"".$car_mark_choice."\">", "value=\"".$car_mark_choice."\" SELECTED>" ,$s_car_mark_choice);
$s_car_engine_choice = '<select name="car_engine_choice">';
for($i = 0; $i < count($lang['Car_Engine_Choice']); $i++ )
{
$s_car_engine_choice .= '<option value="' . $lang['Car_Engine_Choice'][$i] . '">' . $lang['Car_Engine_Choice'][$i]. '</option>';
}
$s_car_engine_choice .= '</select>';
$s_car_engine_choice = str_replace("value=\"".$car_engine_choice."\">", "value=\"".$car_engine_choice."\" SELECTED>" ,$s_car_engine_choice);
if ( ($userdata['user_level'] == USER && $board_config['users_allow_absence'] == TRUE) || ($userdata['user_level'] != USER && $userdata['user_level'] != ANONYMOUS) )
{
$template->assign_block_vars('allow_absence', array());
}
$s_user_absence_mode = '<select name = "user_absence_mode">';
$s_user_absence_mode .= '<option value = "1">' . $lang['On_holidays'] . '</option>';
$s_user_absence_mode .= '<option value = "2">' . $lang['User_ill'] . '</option>';
$s_user_absence_mode .= '<option value = "3">' . $lang['Longer_absenct'] . '</option>';
$s_user_absence_mode .= '</select>';
$s_user_absence_mode = str_replace('value = "' . $userdata['user_absence_mode'] . '">', 'value = "' . $userdata['user_absence_mode'] . '" SELECTED>' ,$s_user_absence_mode);
if ( $mode == 'editprofile' )
{
$template->assign_block_vars('switch_edit_profile', array());
}
// FLAGHACK-start
// query to get the list of flags
$sql = "SELECT *
FROM " . FLAG_TABLE . "
ORDER BY flag_id";
if(!$flags_result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
}
$flag_row = $db->sql_fetchrowset($ranksresult);
$num_flags = $db->sql_numrows($ranksresult) ;
// build the html select statement
$flag_start_image = 'blank.gif' ;
$selected = ( isset($user_flag) ) ? '' : ' selected="selected"' ;
$flag_select = "<select name=\"user_flag\" onChange=\"document.images['user_flag'].src = 'images/flags/'
+ this.value;\" >";
$flag_select .= "<option value=\"blank.gif\"$selected>" . $lang['Select_Country'] . "</option>";
for ($i = 0; $i < $num_flags; $i++)
{
$flag_name = $flag_row[$i]['flag_name'];
$flag_image = $flag_row[$i]['flag_image'];
$selected = ( isset( $user_flag) ) ? (($user_flag == $flag_image) ? 'selected="selected"' : '' ) : '' ;
$flag_select .= "\t<option value=\"$flag_image\"$selected>$flag_name</option>";
if ( isset( $user_flag) && ($user_flag == $flag_image))
{
$flag_start_image = $flag_image ;
}
}
$flag_select .= '</select>';
// FLAGHACK-end
if ( ($mode == 'register') || ($board_config['allow_namechange']) )
{
$template->assign_block_vars('switch_namechange_allowed', array());
}
else
{
$template->assign_block_vars('switch_namechange_disallowed', array());
}
// Start add - Birthday MOD
$s_b_day = '<span class="genmed">' . $lang['Day'] . ' </span><select name="b_day" size="1" class="gensmall">
<option value="0"> - </option>
<option value="1"> 1 </option>
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
<option value="11"> 11 </option>
<option value="12"> 12 </option>
<option value="13"> 13 </option>
<option value="14"> 14 </option>
<option value="15"> 15 </option>
<option value="16"> 16 </option>
<option value="17"> 17 </option>
<option value="18"> 18 </option>
<option value="19"> 19 </option>
<option value="20"> 20 </option>
<option value="21"> 21 </option>
<option value="22"> 22 </option>
<option value="23"> 23 </option>
<option value="24"> 24 </option>
<option value="25"> 25 </option>
<option value="26"> 26 </option>
<option value="27"> 27 </option>
<option value="28"> 28 </option>
<option value="29"> 29 </option>
<option value="30"> 30 </option>
<option value="31"> 31 </option>
</select> ';
$s_b_md = '<span class="genmed">' . $lang['Month'] . ' </span><select name="b_md" size="1" class="gensmall">
<option value="0"> - </option>
<option value="1"> '.$lang['datetime']['January'].' </option>
<option value="2"> '.$lang['datetime']['February'].' </option>
<option value="3"> '.$lang['datetime']['March'].' </option>
<option value="4"> '.$lang['datetime']['April'].' </option>
<option value="5"> '.$lang['datetime']['May'].' </option>
<option value="6"> '.$lang['datetime']['June'].' </option>
<option value="7"> '.$lang['datetime']['July'].' </option>
<option value="8"> '.$lang['datetime']['August'].' </option>
<option value="9"> '.$lang['datetime']['September'].' </option>
<option value="10"> '.$lang['datetime']['October'].' </option>
<option value="11"> '.$lang['datetime']['November'].' </option>
<option value="12"> '.$lang['datetime']['December'].' </option>
</select> ';
$s_b_day= str_replace("value=\"".$b_day."\">", "value=\"".$b_day."\" SELECTED>" ,$s_b_day);
$s_b_md = str_replace("value=\"".$b_md."\">", "value=\"".$b_md."\" SELECTED>" ,$s_b_md);
$s_b_year = '<span class="genmed">' . $lang['Year'] . ' </span><input type="text" class="post" style="width: 50px" name="b_year" size="4" maxlength="4" value="' . $b_year . '" /> ';
$i = 0;
$s_birthday = '';
for ($i=0; $i<=strlen($lang['Submit_date_format']); $i++)
{
switch ($lang['Submit_date_format'][$i])
{
case d: $s_birthday .= $s_b_day;break;
case m: $s_birthday .= $s_b_md;break;
case Y: $s_birthday .= $s_b_year;break;
}
}
// End add - Birthday MOD
//
// 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') == '0' || strtolower(@$ini_val('file_uploads') == 'off') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
//
// Anti Robotic Registration
//
if ($mode == 'register')
{
$sql = "DELETE FROM " . ANTI_ROBOT_TABLE . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . $userdata['session_id'] . "'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete validation key', '', __LINE__, __FILE__, $sql);
}
$reg_key = gen_reg_key();
$sql = "INSERT INTO ". ANTI_ROBOT_TABLE . " VALUES ('" . $userdata['session_id'] . "', '" . $reg_key . "', '" . time() . "')";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not check registration information', '', __LINE__, __FILE__, $sql);
}
}
//-----------------------
//
$template->assign_vars(array(
'USERNAME' => $username,
'NAME_FIRST' => $name_first,
'NAME_LAST' => $name_last,
'CUR_PASSWORD' => $cur_password,
'NEW_PASSWORD' => $new_password,
'PASSWORD_CONFIRM' => $password_confirm,
'EMAIL' => $email,
//signature editor
'SIG_EDIT_LINK' => append_sid("profile.$phpEx?mode=signature"),
'SIG_DESC' => $lang['sig_description'],
'SIG_BUTTON_DESC' => $lang['sig_edit'],
//signature editor
'YIM' => $yim,
'ICQ' => $icq,
'MSN' => $msn,
'AIM' => $aim,
'OCCUPATION' => $occupation,
'INTERESTS' => $interests,
//
// START Joe's Car Mod
//
'CAR_MARK' => $car_mark,
'L_CAR_MARK' => $lang['Car_Mark'],
'CAR_MODEL' => $car_model,
'L_CAR_MODEL' => $lang['Car_Model'],
'S_CAR_ENGINE_CHOICE' => $s_car_engine_choice,
'S_CAR_MARK_CHOICE' => $s_car_mark_choice,
'S_CAR_MODEL_CHOICE' => $s_car_model_choice,
'S_CAR_YEAR_CHOICE' => $s_car_year_choice,
'CAR_YEAR' => $car_year,
'L_CAR_YEAR' => $lang['Car_Year'],
'CAR_ENGINE' => $car_engine,
'L_CAR_ENGINE' => $lang['Car_Engine'],
'CAR_WHEEL' => $car_wheel,
'L_CAR_WHEEL' => $lang['Car_Wheel'],
'CAR_TRANS' => $car_trans,
'L_CAR_TRANS' => $lang['Car_Trans'],
'CAR_COLOR' => $car_color,
'L_CAR_COLOR' => $lang['Car_Color'],
'CAR_RT' => $car_rt,
'L_CAR_RT' => $lang['Car_Rt'],
'CAR_SIXTY' => $car_sixty,
'L_CAR_SIXTY' => $lang['Car_Sixty'],
'CAR_THREE' => $car_three,
'L_CAR_THREE' => $lang['Car_Three'],
'CAR_EIGTH' => $car_eigth,
'L_CAR_EIGTH' => $lang['Car_Eigth'],
'CAR_EIGTHM' => $car_eigthm,
'L_CAR_EIGTHM' => $lang['Car_Eigthm'],
'CAR_THOU' => $car_thou,
'L_CAR_THOU' => $lang['Car_Thou'],
'CAR_QUART' => $car_quart,
'L_CAR_QUART' => $lang['Car_Quart'],
'CAR_QUARTM' => $car_quartm,
'L_CAR_QUARTM' => $lang['Car_Quartm'],
'MOD_ENGINE' => $mod_engine,
'L_MOD_ENGINE' => $lang['Car_Engine'],
'MOD_EXTERIOR' => $mod_exterior,
'L_MOD_EXTERIOR' => $lang['Car_Exterior'],
'MOD_INTERIOR' => $mod_interior,
'L_MOD_INTERIOR' => $lang['Car_Interior'],
'MOD_RIMS' => $mod_rims,
'L_MOD_RIMS' => $lang['Car_Rims'],
'MOD_AUDIO' => $mod_audio,
'L_MOD_AUDIO' => $lang['Car_Audio'],
'MOD_FUTURE' => $mod_future,
'L_MOD_FUTURE' => $lang['Car_Future'],
//
// END Joe's Car Mod
//
'ALLOW_NEW_IMG_POPUP_YES' => ( $user_allow_new_img_popup ) ? 'checked="checked"' : '',
'ALLOW_NEW_IMG_POPUP_NO' => ( !$user_allow_new_img_popup ) ? 'checked="checked"' : '',
'L_ALLOW_NEW_IMG_POPUP' => $lang['User_allow_new_img_popup'],
'INFO' => $info,
'L_INFO' => $lang['Info'],
'L_USER_ABSENCE' => $lang['User_absence'],
'L_USER_ABSENCE_MODE' => $lang['User_absence_mode'],
'L_USER_ABSENCE_TEXT' => $lang['User_absence_text'],
'USER_ABSENCE_YES' => ($user_absence) ? 'checked="checked"' : '',
'USER_ABSENCE_NO' => (!$user_absence) ? 'checked="checked"' : '',
'S_USER_ABSENCE_MODE' => $s_user_absence_mode,
'S_USER_ABSENCE_TEXT' => $user_absence_text,
// Start add - Birthday MOD
'S_BIRTHDAY' => $s_birthday,
'BIRTHDAY_REQUIRED' => ($board_config['birthday_required']) ? '*' : '',
// End add - Birthday MOD
'LOCATION' => $location,
// FLAGHACK-start
'L_FLAG' => $lang['Country_Flag'],
'FLAG_SELECT' => $flag_select,
'FLAG_START' => $flag_start_image,
// FLAGHACK-end
'WEBSITE' => $website,
'SIGNATURE' => str_replace('<br />', "\n", $signature),
// Start add - Gender MOD
'LOCK_GENDER' =>($mode!='register') ? 'DISABLED':'',
'GENDER' => $gender,
'GENDER_NO_SPECIFY_CHECKED' => $gender_no_specify_checked,
'GENDER_MALE_CHECKED' => $gender_male_checked,
'GENDER_FEMALE_CHECKED' => $gender_female_checked,
// End add - Gender MOD
'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' => ( $popup_pm ) ? 'checked="checked"' : '',
'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
'ALWAYS_SET_BOOKMARK_YES' => ( $setbm ) ? 'checked="checked"' : '',
'ALWAYS_SET_BOOKMARK_NO' => ( !$setbm ) ? '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"' : '',
'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
'AVATAR' => $avatar_img,
'AVATAR_SIZE' => $board_config['avatar_filesize'],
'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
'STYLE_SELECT' => style_select($user_style, 'style'),
'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
'DATE_FORMAT_SELECT' => date_format_select($user_dateformat, $user_timezone),
'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_NAME_FIRST' => $lang['name_first'],
'L_NAME_LAST' => $lang['name_last'],
'L_NAME_FIRST_DISPLAY_WARNING' => $lang['name_first_display_warning'],
'L_NAME_LAST_DISPLAY_WARNING' => $lang['name_last_display_warning'],
'L_CURRENT_PASSWORD' => $lang['Current_password'],
'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $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'],
// Start add - Gender MOD
'L_GENDER' =>$lang['Gender'],
'L_GENDER_MALE' =>$lang['Male'],
'L_GENDER_FEMALE' =>$lang['Female'],
'L_GENDER_NOT_SPECIFY' =>$lang['No_gender_specify'],
// End add - Gender MOD
// Start add - Birthday MOD
'L_BIRTHDAY' => $lang['Birthday'],
// End add - Birthday MOD
'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_ALWAYS_SET_BOOKMARK' => $lang['Always_set_bm'],
'L_AVATAR_PANEL' => $lang['Avatar_panel'],
'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], (round($board_config['avatar_filesize'] / 1024))),
'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
'L_DELETE_AVATAR' => $lang['Delete_Image'],
'L_CURRENT_IMAGE' => $lang['Current_Image'],
'L_SIGNATURE' => $lang['Signature'],
'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
'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'],
// Anti Robotic Registration MOD
'L_VALIDATION' => $lang['Validation'],
'L_VALIDATION_EXPLAIN' => $lang['Validation_explain'],
'S_ANTI_ROBOT1' => append_sid('antirobot_pic.'.$phpEx.'?id=1'),
'S_ANTI_ROBOT2' => append_sid('antirobot_pic.'.$phpEx.'?id=2'),
'S_ANTI_ROBOT3' => append_sid('antirobot_pic.'.$phpEx.'?id=3'),
'S_ANTI_ROBOT4' => append_sid('antirobot_pic.'.$phpEx.'?id=4'),
'S_ANTI_ROBOT5' => append_sid('antirobot_pic.'.$phpEx.'?id=5'),
'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FORM_ENCTYPE' => $form_enctype,
'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);
//
// This is another cheat using the block_var capability
// of the templates to 'fake' an IF...ELSE...ENDIF solution
// it works well :)
//
if ( $mode != 'register' )
{
if ( $userdata['session_logged_in'] || $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
{
$template->assign_block_vars('switch_avatar_block', array() );
if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
{
if ( $form_enctype != '' )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
}
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
}
if ( $board_config['allow_avatar_remote'] )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
}
if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
}
}
}
else
{
$template->assign_block_vars('switch_validation', array() );
}
}
///
/// Begin Names in Profile MOD
///
if ( $board_config['name_first_required'] )
{
$template->assign_block_vars('switch_name_first_required',array() );
}
if ( $board_config['name_last_required'] )
{
$template->assign_block_vars('switch_name_last_required',array() );
}
if ( $board_config['name_first_display'] )
{
$template->assign_block_vars('switch_name_first_display', array());
}
if ( $board_config['name_last_display'] )
{
$template->assign_block_vars('switch_name_last_display', array());
}
///
/// End Names in Profile MOD
///
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>