(file) Return to usercp_register.php CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / phpBB2 / includes

  1 rizwank 1.1 <?php
  2             /***************************************************************************
  3              *                            usercp_register.php
  4              *                            -------------------
  5              *   begin                : Saturday, Feb 13, 2001
  6              *   copyright            : (C) 2001 The phpBB Group
  7              *   email                : support@phpbb.com
  8              *
  9              *   $Id: usercp_register.php,v 1.20.2.35 2003/01/10 21:28:08 psotfx Exp $
 10              *
 11              *
 12              ***************************************************************************/
 13             
 14             /***************************************************************************
 15              *
 16              *   This program is free software; you can redistribute it and/or modify
 17              *   it under the terms of the GNU General Public License as published by
 18              *   the Free Software Foundation; either version 2 of the License, or
 19              *   (at your option) any later version.
 20              *
 21              *
 22 rizwank 1.1  ***************************************************************************/
 23             
 24             if ( !defined('IN_PHPBB') )
 25             {
 26             	die("Hacking attempt");
 27             	exit;
 28             }
 29             
 30             // ---------------------------------------
 31             // Load agreement template since user has not yet
 32             // agreed to registration conditions/coppa
 33             //
 34             function show_coppa()
 35             {
 36             	global $userdata, $template, $lang, $phpbb_root_path, $phpEx;
 37             
 38             	$template->set_filenames(array(
 39             		'body' => 'agreement.tpl')
 40             	);
 41             
 42             	$template->assign_vars(array(
 43 rizwank 1.1 		'REGISTRATION' => $lang['Registration'],
 44             		'AGREEMENT' => $lang['Reg_agreement'],
 45             		"AGREE_OVER_13" => $lang['Agree_over_13'],
 46             		"AGREE_UNDER_13" => $lang['Agree_under_13'],
 47             		'DO_NOT_AGREE' => $lang['Agree_not'],
 48             
 49             		"U_AGREE_OVER13" => "profile.$phpEx?mode=register&amp;agreed=true&amp;sid=" . $userdata['session_id'],
 50             		"U_AGREE_UNDER13" => "profile.$phpEx?mode=register&amp;agreed=true&amp;coppa=true&amp;sid=" . $userdata['session_id'])
 51             	);
 52             
 53             	$template->pparse('body');
 54             
 55             }
 56             //
 57             // ---------------------------------------
 58             
 59             $error = FALSE;
 60             $page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];
 61             
 62             if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
 63             {
 64 rizwank 1.1 	include($phpbb_root_path . 'includes/page_header.'.$phpEx);
 65             
 66             	show_coppa();
 67             
 68             	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
 69             }
 70             
 71             $coppa = ( empty($HTTP_POST_VARS['coppa']) && empty($HTTP_GET_VARS['coppa']) ) ? 0 : TRUE;
 72             
 73             //
 74             // Check and initialize some variables if needed
 75             //
 76             if (
 77             	isset($HTTP_POST_VARS['submit']) ||
 78             	isset($HTTP_POST_VARS['avatargallery']) ||
 79             	isset($HTTP_POST_VARS['submitavatar']) ||
 80             	isset($HTTP_POST_VARS['cancelavatar']) ||
 81             	$mode == 'register' )
 82             {
 83             	// session id check
 84             	if ($sid == '' || $sid != $userdata['session_id'])
 85 rizwank 1.1 	{
 86             		message_die(GENERAL_ERROR, 'Invalid_session');
 87             	}
 88             
 89             	include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
 90             	include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
 91             	include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
 92             
 93             	if ( $mode == 'editprofile' )
 94             	{
 95             		$user_id = intval($HTTP_POST_VARS['user_id']);
 96             		$current_email = trim(htmlspecialchars($HTTP_POST_VARS['current_email']));
 97             	}
 98             
 99             	$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests');
100             
101             	// Strip all tags from data ... may p**s some people off, bah, strip_tags is
102             	// doing the job but can still break HTML output ... have no choice, have
103             	// to use htmlspecialchars ... be prepared to be moaned at.
104             	while( list($var, $param) = @each($strip_var_list) )
105             	{
106 rizwank 1.1 		if ( !empty($HTTP_POST_VARS[$param]) )
107             		{
108             			$$var = trim(htmlspecialchars($HTTP_POST_VARS[$param]));
109             		}
110             	}
111             
112             	$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');
113             
114             	while( list($var, $param) = @each($trim_var_list) )
115             	{
116             		if ( !empty($HTTP_POST_VARS[$param]) )
117             		{
118             			$$var = trim($HTTP_POST_VARS[$param]);
119             		}
120             	}
121             
122             	$signature = str_replace('<br />', "\n", $signature);
123             
124             	// Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
125             	// empty strings if they fail.
126             	validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
127 rizwank 1.1 
128             	$viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;
129             	$allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;
130             	$notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
131             	$notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
132             	$popuppm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
133             
134             	if ( $mode == 'register' )
135             	{
136             		$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];
137             
138             		$allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $board_config['allow_html'];
139             		$allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $board_config['allow_bbcode'];
140             		$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $board_config['allow_smilies'];
141             	}
142             	else
143             	{
144             		$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : 0;
145             
146             		$allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $userdata['user_allowhtml'];
147             		$allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $userdata['user_allowbbcode'];
148 rizwank 1.1 		$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];
149             	}
150             
151             	$user_style = ( isset($HTTP_POST_VARS['style']) ) ? intval($HTTP_POST_VARS['style']) : $board_config['default_style'];
152             
153             	if ( !empty($HTTP_POST_VARS['language']) )
154             	{
155             		if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['language']) )
156             		{
157             			$user_lang = htmlspecialchars($HTTP_POST_VARS['language']);
158             		}
159             		else
160             		{
161             			$error = true;
162             			$error_msg = $lang['Fields_empty'];
163             		}
164             	}
165             	else
166             	{
167             		$user_lang = $board_config['default_lang'];
168             	}
169 rizwank 1.1 
170             	$user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
171             	$user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];
172             
173             	$user_avatar_local = ( isset($HTTP_POST_VARS['avatarselect']) && !empty($HTTP_POST_VARS['submitavatar']) && $board_config['allow_avatar_local'] ) ? $HTTP_POST_VARS['avatarselect'] : ( ( isset($HTTP_POST_VARS['avatarlocal'])  ) ? htmlspecialchars($HTTP_POST_VARS['avatarlocal']) : '' );
174             
175             	$user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
176             	$user_avatar_upload = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim($HTTP_POST_VARS['avatarurl']) : ( ( $HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : '' );
177             	$user_avatar_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
178             	$user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
179             	$user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
180             
181             	$user_avatar = ( empty($user_avatar_loc) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : '';
182             	$user_avatar_type = ( empty($user_avatar_loc) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
183             
184             	if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
185             	{
186             		$username = stripslashes($username);
187             		$email = stripslashes($email);
188             		$cur_password = htmlspecialchars(stripslashes($cur_password));
189             		$new_password = htmlspecialchars(stripslashes($new_password));
190 rizwank 1.1 		$password_confirm = htmlspecialchars(stripslashes($password_confirm));
191             
192             		$icq = stripslashes($icq);
193             		$aim = stripslashes($aim);
194             		$msn = stripslashes($msn);
195             		$yim = stripslashes($yim);
196             
197             		$website = stripslashes($website);
198             		$location = stripslashes($location);
199             		$occupation = stripslashes($occupation);
200             		$interests = stripslashes($interests);
201             		$signature = stripslashes($signature);
202             
203             		$user_lang = stripslashes($user_lang);
204             		$user_dateformat = stripslashes($user_dateformat);
205             
206             		if ( !isset($HTTP_POST_VARS['cancelavatar']))
207             		{
208             			$user_avatar = $user_avatar_local;
209             			$user_avatar_type = USER_AVATAR_GALLERY;
210             		}
211 rizwank 1.1 	}
212             }
213             //
214             // Let's make sure the user isn't logged in while registering,
215             // and ensure that they were trying to register a second time
216             // (Prevents double registrations)
217             //
218             if ( $userdata['session_logged_in'] && $mode =="register" && $username == $userdata['username'])
219             {
220             	message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
221             }
222             
223             //
224             // Did the user submit? In this case build a query to update the users profile in the DB
225             //
226             if ( isset($HTTP_POST_VARS['submit']) )
227             {
228             	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
229             
230             	$passwd_sql = '';
231             	if ( $mode == 'editprofile' )
232 rizwank 1.1 	{
233             		if ( $user_id != $userdata['user_id'] )
234             		{
235             			$error = TRUE;
236             			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
237             		}
238             	}
239             	else if ( $mode == 'register' )
240             	{
241             		if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
242             		{
243             			$error = TRUE;
244             			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
245             		}
246             	}
247             
248             	$passwd_sql = '';
249             	if ( !empty($new_password) && !empty($password_confirm) )
250             	{
251             		if ( $new_password != $password_confirm )
252             		{
253 rizwank 1.1 			$error = TRUE;
254             			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
255             		}
256             		else if ( strlen($new_password) > 32 )
257             		{
258             			$error = TRUE;
259             			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_long'];
260             		}
261             		else
262             		{
263             			if ( $mode == 'editprofile' )
264             			{
265             				$sql = "SELECT user_password
266             					FROM " . USERS_TABLE . "
267             					WHERE user_id = $user_id";
268             				if ( !($result = $db->sql_query($sql)) )
269             				{
270             					message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
271             				}
272             
273             				$row = $db->sql_fetchrow($result);
274 rizwank 1.1 
275             				if ( $row['user_password'] != md5($cur_password) )
276             				{
277             					$error = TRUE;
278             					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
279             				}
280             			}
281             
282             			if ( !$error )
283             			{
284             				$new_password = md5($new_password);
285             				$passwd_sql = "user_password = '$new_password', ";
286             			}
287             		}
288             	}
289             	else if ( ( empty($new_password) && !empty($password_confirm) ) || ( !empty($new_password) && empty($password_confirm) ) )
290             	{
291             		$error = TRUE;
292             		$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
293             	}
294             
295 rizwank 1.1 	//
296             	// Do a ban check on this email address
297             	//
298             	if ( $email != $userdata['user_email'] || $mode == 'register' )
299             	{
300             		$result = validate_email($email);
301             		if ( $result['error'] )
302             		{
303             			$email = $userdata['user_email'];
304             
305             			$error = TRUE;
306             			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
307             		}
308             
309             		if ( $mode == 'editprofile' )
310             		{
311             			$sql = "SELECT user_password
312             				FROM " . USERS_TABLE . "
313             				WHERE user_id = $user_id";
314             			if ( !($result = $db->sql_query($sql)) )
315             			{
316 rizwank 1.1 				message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
317             			}
318             
319             			$row = $db->sql_fetchrow($result);
320             
321             			if ( $row['user_password'] != md5($cur_password) )
322             			{
323             				$email = $userdata['user_email'];
324             
325             				$error = TRUE;
326             				$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
327             			}
328             		}
329             	}
330             
331             	$username_sql = '';
332             	if ( $board_config['allow_namechange'] || $mode == 'register' )
333             	{
334             		if ( empty($username) )
335             		{
336             			$error = TRUE;
337 rizwank 1.1 			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Username_disallowed'];
338             		}
339             		else if ( $username != $userdata['username'] || $mode == 'register' )
340             		{
341             			if (strtolower($username) != strtolower($userdata['username']))
342             			{
343             				$result = validate_username($username);
344             				if ( $result['error'] )
345             				{
346             					$error = TRUE;
347             					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
348             				}
349             			}
350             
351             			if (!$error)
352             			{
353             				$username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
354             			}
355             		}
356             	}
357             
358 rizwank 1.1 	if ( $signature != '' )
359             	{
360             		if ( strlen($signature) > $board_config['max_sig_chars'] )
361             		{
362             			$error = TRUE;
363             			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
364             		}
365             
366             		if ( $signature_bbcode_uid == '' )
367             		{
368             			$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
369             		}
370             		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
371             	}
372             
373             	//??
374             	if ( $website != '' )
375             	{
376             		rawurlencode($website);
377             	}
378             
379 rizwank 1.1 	$avatar_sql = '';
380             
381             	if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
382             	{
383             		$avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
384             	}
385             
386             	if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
387             	{
388             		if ( !empty($user_avatar_upload) )
389             		{
390             			$avatar_mode = ( !empty($user_avatar_name) ) ? 'local' : 'remote';
391             			$avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
392             		}
393             		else if ( !empty($user_avatar_name) )
394             		{
395             			$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
396             
397             			$error = true;
398             			$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $l_avatar_size;
399             		}
400 rizwank 1.1 	}
401             	else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
402             	{
403             		if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
404             		{
405             			@unlink(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']));
406             		}
407             		$avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
408             	}
409             	else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
410             	{
411             		if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
412             		{
413             			@unlink(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']));
414             		}
415             		$avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local);
416             	}
417             
418             	if ( !$error )
419             	{
420             		if ( $avatar_sql == '' )
421 rizwank 1.1 		{
422             			$avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
423             		}
424             
425             		if ( $mode == 'editprofile' )
426             		{
427             			if ( $email != $userdata['user_email'] && $board_config['require_activation'] != USER_ACTIVATION_NONE && $userdata['user_level'] != ADMIN )
428             			{
429             				$user_active = 0;
430             
431             				$user_actkey = gen_rand_string(true);
432             				$key_len = 54 - ( strlen($server_url) );
433             				$key_len = ( $key_len > 6 ) ? $key_len : 6;
434             				$user_actkey = substr($user_actkey, 0, $key_len);
435             
436             				if ( $userdata['session_logged_in'] )
437             				{
438             					session_end($userdata['session_id'], $userdata['user_id']);
439             				}
440             			}
441             			else
442 rizwank 1.1 			{
443             				$user_active = 1;
444             				$user_actkey = '';
445             			}
446             
447             			$sql = "UPDATE " . USERS_TABLE . "
448             				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
449             				WHERE user_id = $user_id";
450             			if ( !($result = $db->sql_query($sql)) )
451             			{
452             				message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
453             			}
454             
455             			if ( !$user_active )
456             			{
457             				//
458             				// The users account has been deactivated, send them an email with a new activation key
459             				//
460             				include($phpbb_root_path . 'includes/emailer.'.$phpEx);
461             				$emailer = new emailer($board_config['smtp_delivery']);
462             
463 rizwank 1.1 				$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
464             
465             				$emailer->use_template('user_activate', stripslashes($user_lang));
466             				$emailer->email_address($email);
467             				$emailer->set_subject($lang['Reactivate']);
468             				$emailer->extra_headers($email_headers);
469             
470             				$emailer->assign_vars(array(
471             					'SITENAME' => $board_config['sitename'],
472             					'USERNAME' => $username,
473             					'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
474             
475             					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
476             				);
477             				$emailer->send();
478             				$emailer->reset();
479             
480             				$message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
481             			}
482             			else
483             			{
484 rizwank 1.1 				$message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
485             			}
486             
487             			$template->assign_vars(array(
488             				"META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
489             			);
490             
491             			message_die(GENERAL_MESSAGE, $message);
492             		}
493             		else
494             		{
495             			$sql = "SELECT MAX(user_id) AS total
496             				FROM " . USERS_TABLE;
497             			if ( !($result = $db->sql_query($sql)) )
498             			{
499             				message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
500             			}
501             
502             			if ( !($row = $db->sql_fetchrow($result)) )
503             			{
504             				message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
505 rizwank 1.1 			}
506             			$user_id = $row['total'] + 1;
507             
508             			//
509             			// Get current date
510             			//
511             			$sql = "INSERT INTO " . USERS_TABLE . "	(user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, 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_level, user_allow_pm, user_active, user_actkey)
512             				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) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
513             			if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
514             			{
515             				$user_actkey = gen_rand_string(true);
516             				$key_len = 54 - (strlen($server_url));
517             				$key_len = ( $key_len > 6 ) ? $key_len : 6;
518             				$user_actkey = substr($user_actkey, 0, $key_len);
519             				$sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
520             			}
521             			else
522             			{
523             				$sql .= "1, '')";
524             			}
525             
526 rizwank 1.1 			if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
527             			{
528             				message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
529             			}
530             
531             			$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
532             				VALUES ('', 'Personal User', 1, 0)";
533             			if ( !($result = $db->sql_query($sql)) )
534             			{
535             				message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
536             			}
537             
538             			$group_id = $db->sql_nextid();
539             
540             			$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
541             				VALUES ($user_id, $group_id, 0)";
542             			if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
543             			{
544             				message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
545             			}
546             
547 rizwank 1.1 			if ( $coppa )
548             			{
549             				$message = $lang['COPPA'];
550             				$email_template = 'coppa_welcome_inactive';
551             			}
552             			else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
553             			{
554             				$message = $lang['Account_inactive'];
555             				$email_template = 'user_welcome_inactive';
556             			}
557             			else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
558             			{
559             				$message = $lang['Account_inactive_admin'];
560             				$email_template = 'admin_welcome_inactive';
561             			}
562             			else
563             			{
564             				$message = $lang['Account_added'];
565             				$email_template = 'user_welcome';
566             			}
567             
568 rizwank 1.1 			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
569             			$emailer = new emailer($board_config['smtp_delivery']);
570             
571             			$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
572             
573             			$emailer->use_template($email_template, stripslashes($user_lang));
574             			$emailer->email_address($email);
575             			$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
576             			$emailer->extra_headers($email_headers);
577             
578             			if( $coppa )
579             			{
580             				$emailer->assign_vars(array(
581             					'SITENAME' => $board_config['sitename'],
582             					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
583             					'USERNAME' => $username,
584             					'PASSWORD' => $password_confirm,
585             					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
586             
587             					'FAX_INFO' => $board_config['coppa_fax'],
588             					'MAIL_INFO' => $board_config['coppa_mail'],
589 rizwank 1.1 					'EMAIL_ADDRESS' => $email,
590             					'ICQ' => $icq,
591             					'AIM' => $aim,
592             					'YIM' => $yim,
593             					'MSN' => $msn,
594             					'WEB_SITE' => $website,
595             					'FROM' => $location,
596             					'OCC' => $occupation,
597             					'INTERESTS' => $interests,
598             					'SITENAME' => $board_config['sitename']));
599             			}
600             			else
601             			{
602             				$emailer->assign_vars(array(
603             					'SITENAME' => $board_config['sitename'],
604             					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
605             					'USERNAME' => $username,
606             					'PASSWORD' => $password_confirm,
607             					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
608             
609             					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
610 rizwank 1.1 				);
611             			}
612             
613             			$emailer->send();
614             			$emailer->reset();
615             
616             			if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
617             			{
618             				//$emailer->use_template("admin_activate", stripslashes($user_lang));
619             				$emailer->use_template("admin_activate", $board_config['default_lang']);
620             				$emailer->email_address($board_config['board_email']);
621             				$emailer->set_subject($lang['New_account_subject']);
622             				$emailer->extra_headers($email_headers);
623             
624             				$emailer->assign_vars(array(
625             					'USERNAME' => $username,
626             					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
627             
628             					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
629             				);
630             				$emailer->send();
631 rizwank 1.1 				$emailer->reset();
632             			}
633             
634             			$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
635             
636             			message_die(GENERAL_MESSAGE, $message);
637             		} // if mode == register
638             	}
639             } // End of submit
640             
641             
642             if ( $error )
643             {
644             	//
645             	// If an error occured we need to stripslashes on returned data
646             	//
647             	$username = stripslashes($username);
648             	$email = stripslashes($email);
649             	$new_password = '';
650             	$password_confirm = '';
651             
652 rizwank 1.1 	$icq = stripslashes($icq);
653             	$aim = str_replace('+', ' ', stripslashes($aim));
654             	$msn = stripslashes($msn);
655             	$yim = stripslashes($yim);
656             
657             	$website = stripslashes($website);
658             	$location = stripslashes($location);
659             	$occupation = stripslashes($occupation);
660             	$interests = stripslashes($interests);
661             	$signature = stripslashes($signature);
662             	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid\]/si", ']', $signature) : $signature;
663             
664             	$user_lang = stripslashes($user_lang);
665             	$user_dateformat = stripslashes($user_dateformat);
666             
667             }
668             else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($HTTP_POST_VARS['cancelavatar']) )
669             {
670             	$user_id = $userdata['user_id'];
671             	$username = $userdata['username'];
672             	$email = $userdata['user_email'];
673 rizwank 1.1 	$new_password = '';
674             	$password_confirm = '';
675             
676             	$icq = $userdata['user_icq'];
677             	$aim = str_replace('+', ' ', $userdata['user_aim']);
678             	$msn = $userdata['user_msnm'];
679             	$yim = $userdata['user_yim'];
680             
681             	$website = $userdata['user_website'];
682             	$location = $userdata['user_from'];
683             	$occupation = $userdata['user_occ'];
684             	$interests = $userdata['user_interests'];
685             	$signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
686             	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid\]/si", ']', $userdata['user_sig']) : $userdata['user_sig'];
687             
688             	$viewemail = $userdata['user_viewemail'];
689             	$notifypm = $userdata['user_notify_pm'];
690             	$popuppm = $userdata['user_popup_pm'];
691             	$notifyreply = $userdata['user_notify'];
692             	$attachsig = $userdata['user_attachsig'];
693             	$allowhtml = $userdata['user_allowhtml'];
694 rizwank 1.1 	$allowbbcode = $userdata['user_allowbbcode'];
695             	$allowsmilies = $userdata['user_allowsmile'];
696             	$allowviewonline = $userdata['user_allow_viewonline'];
697             
698             	$user_avatar = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar'] : '';
699             	$user_avatar_type = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar_type'] : USER_AVATAR_NONE;
700             
701             	$user_style = $userdata['user_style'];
702             	$user_lang = $userdata['user_lang'];
703             	$user_timezone = $userdata['user_timezone'];
704             	$user_dateformat = $userdata['user_dateformat'];
705             }
706             
707             //
708             // Default pages
709             //
710             include($phpbb_root_path . 'includes/page_header.'.$phpEx);
711             
712             make_jumpbox('viewforum.'.$phpEx);
713             
714             if ( $mode == 'editprofile' )
715 rizwank 1.1 {
716             	if ( $user_id != $userdata['user_id'] )
717             	{
718             		$error = TRUE;
719             		$error_msg = $lang['Wrong_Profile'];
720             	}
721             }
722             
723             if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
724             {
725             	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
726             
727             	$avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? $HTTP_POST_VARS['avatarcategory'] : '';
728             
729             	$template->set_filenames(array(
730             		'body' => 'profile_avatar_gallery.tpl')
731             	);
732             
733             	$allowviewonline = !$allowviewonline;
734             
735             	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, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
736 rizwank 1.1 }
737             else
738             {
739             	include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
740             
741             	if ( !isset($coppa) )
742             	{
743             		$coppa = FALSE;
744             	}
745             
746             	if ( !isset($user_template) )
747             	{
748             		$selected_template = $board_config['system_template'];
749             	}
750             
751             	$avatar_img = '';
752             	if ( $user_avatar_type )
753             	{
754             		switch( $user_avatar_type )
755             		{
756             			case USER_AVATAR_UPLOAD:
757 rizwank 1.1 				$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
758             				break;
759             			case USER_AVATAR_REMOTE:
760             				$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
761             				break;
762             			case USER_AVATAR_GALLERY:
763             				$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
764             				break;
765             		}
766             	}
767             
768             	$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
769             	if( $mode == 'editprofile' )
770             	{
771             		$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
772             		//
773             		// Send the users current email address. If they change it, and account activation is turned on
774             		// the user account will be disabled and the user will have to reactivate their account.
775             		//
776             		$s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $userdata['user_email'] . '" />';
777             	}
778 rizwank 1.1 
779             	if ( !empty($user_avatar_local) )
780             	{
781             		$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" />';
782             	}
783             
784             	$html_status =  ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
785             	$bbcode_status = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode']  ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
786             	$smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies']  ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
787             
788             	if ( $error )
789             	{
790             		$template->set_filenames(array(
791             			'reg_header' => 'error_body.tpl')
792             		);
793             		$template->assign_vars(array(
794             			'ERROR_MESSAGE' => $error_msg)
795             		);
796             		$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
797             	}
798             
799 rizwank 1.1 	$template->set_filenames(array(
800             		'body' => 'profile_add_body.tpl')
801             	);
802             
803             	if ( $mode == 'editprofile' )
804             	{
805             		$template->assign_block_vars('switch_edit_profile', array());
806             	}
807             
808             	//
809             	// Let's do an overall check for settings/versions which would prevent
810             	// us from doing file uploads....
811             	//
812             	$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
813             	$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"';
814             
815             	$template->assign_vars(array(
816             		'USERNAME' => $username,
817             		'CUR_PASSWORD' => $cur_password,
818             		'NEW_PASSWORD' => $new_password,
819             		'PASSWORD_CONFIRM' => $password_confirm,
820 rizwank 1.1 		'EMAIL' => $email,
821             		'YIM' => $yim,
822             		'ICQ' => $icq,
823             		'MSN' => $msn,
824             		'AIM' => $aim,
825             		'OCCUPATION' => $occupation,
826             		'INTERESTS' => $interests,
827             		'LOCATION' => $location,
828             		'WEBSITE' => $website,
829             		'SIGNATURE' => str_replace('<br />', "\n", $signature),
830             		'VIEW_EMAIL_YES' => ( $viewemail ) ? 'checked="checked"' : '',
831             		'VIEW_EMAIL_NO' => ( !$viewemail ) ? 'checked="checked"' : '',
832             		'HIDE_USER_YES' => ( !$allowviewonline ) ? 'checked="checked"' : '',
833             		'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
834             		'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
835             		'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
836             		'POPUP_PM_YES' => ( $popuppm ) ? 'checked="checked"' : '',
837             		'POPUP_PM_NO' => ( !$popuppm ) ? 'checked="checked"' : '',
838             		'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
839             		'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
840             		'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
841 rizwank 1.1 		'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
842             		'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
843             		'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
844             		'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
845             		'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
846             		'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
847             		'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
848             		'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
849             		'AVATAR' => $avatar_img,
850             		'AVATAR_SIZE' => $board_config['avatar_filesize'],
851             		'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
852             		'STYLE_SELECT' => style_select($user_style, 'style'),
853             		'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
854             		'DATE_FORMAT' => $user_dateformat,
855             		'HTML_STATUS' => $html_status,
856             		'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
857             		'SMILIES_STATUS' => $smilies_status,
858             
859             		'L_CURRENT_PASSWORD' => $lang['Current_password'],
860             		'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
861             		'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
862 rizwank 1.1 		'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
863             		'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
864             		'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
865             		'L_SUBMIT' => $lang['Submit'],
866             		'L_RESET' => $lang['Reset'],
867             		'L_ICQ_NUMBER' => $lang['ICQ'],
868             		'L_MESSENGER' => $lang['MSNM'],
869             		'L_YAHOO' => $lang['YIM'],
870             		'L_WEBSITE' => $lang['Website'],
871             		'L_AIM' => $lang['AIM'],
872             		'L_LOCATION' => $lang['Location'],
873             		'L_OCCUPATION' => $lang['Occupation'],
874             		'L_BOARD_LANGUAGE' => $lang['Board_lang'],
875             		'L_BOARD_STYLE' => $lang['Board_style'],
876             		'L_TIMEZONE' => $lang['Timezone'],
877             		'L_DATE_FORMAT' => $lang['Date_format'],
878             		'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
879             		'L_YES' => $lang['Yes'],
880             		'L_NO' => $lang['No'],
881             		'L_INTERESTS' => $lang['Interests'],
882             		'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
883 rizwank 1.1 		'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
884             		'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
885             		'L_HIDE_USER' => $lang['Hide_user'],
886             		'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
887             
888             		'L_AVATAR_PANEL' => $lang['Avatar_panel'],
889             		'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], (round($board_config['avatar_filesize'] / 1024))),
890             		'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
891             		'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
892             		'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
893             		'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
894             		'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
895             		'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
896             		'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
897             		'L_DELETE_AVATAR' => $lang['Delete_Image'],
898             		'L_CURRENT_IMAGE' => $lang['Current_Image'],
899             
900             		'L_SIGNATURE' => $lang['Signature'],
901             		'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
902             		'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
903             		'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
904 rizwank 1.1 		'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
905             		'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
906             		'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
907             		'L_PREFERENCES' => $lang['Preferences'],
908             		'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
909             		'L_ITEMS_REQUIRED' => $lang['Items_required'],
910             		'L_REGISTRATION_INFO' => $lang['Registration_info'],
911             		'L_PROFILE_INFO' => $lang['Profile_info'],
912             		'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
913             		'L_EMAIL_ADDRESS' => $lang['Email_address'],
914             
915             		'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
916             		'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
917             		'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],
918             		'S_HIDDEN_FIELDS' => $s_hidden_fields,
919             		'S_FORM_ENCTYPE' => $form_enctype,
920             		'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
921             	);
922             
923             	//
924             	// This is another cheat using the block_var capability
925 rizwank 1.1 	// of the templates to 'fake' an IF...ELSE...ENDIF solution
926             	// it works well :)
927             	//
928             	if ( $mode != 'register' )
929             	{
930             		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
931             		{
932             			$template->assign_block_vars('switch_avatar_block', array() );
933             
934             			if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
935             			{
936             				if ( $form_enctype != '' )
937             				{
938             					$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
939             				}
940             				$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
941             			}
942             
943             			if ( $board_config['allow_avatar_remote'] )
944             			{
945             				$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
946 rizwank 1.1 			}
947             
948             			if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
949             			{
950             				$template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
951             			}
952             		}
953             	}
954             }
955             
956             $template->pparse('body');
957             
958             include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
959             
960             ?>

Rizwan Kassim
Powered by
ViewCVS 0.9.2