plugins/SpecialUserFuncs.php
changeset 1243 db42b7c50e57
parent 1227 bdac73ed481e
child 1253 13f8d373da67
equal deleted inserted replaced
1242:9aa09b0a7544 1243:db42b7c50e57
   547 function page_Special_Register()
   547 function page_Special_Register()
   548 {
   548 {
   549 	global $db, $session, $paths, $template, $plugins; // Common objects
   549 	global $db, $session, $paths, $template, $plugins; // Common objects
   550 	global $lang;
   550 	global $lang;
   551 	
   551 	
       
   552 	// block registration except for guests and admins
   552 	if ( $session->user_level < USER_LEVEL_ADMIN && $session->user_logged_in )
   553 	if ( $session->user_level < USER_LEVEL_ADMIN && $session->user_logged_in )
   553 	{
   554 	{
   554 		$paths->main_page();
   555 		$paths->main_page();
   555 	}
   556 	}
   556 	
   557 	
   559 	$email = '';
   560 	$email = '';
   560 	$realname = '';
   561 	$realname = '';
   561 	
   562 	
   562 	$terms = getConfig('register_tou');
   563 	$terms = getConfig('register_tou');
   563 	
   564 	
   564 	if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in ))
   565 	if ( getConfig('account_activation') == 'disable' && $session->user_level < USER_LEVEL_ADMIN )
   565 	{
   566 	{
   566 		$s = ($session->user_level >= USER_LEVEL_ADMIN) ? '<p>' . $lang->get('user_reg_err_disabled_body_adminblurb', array( 'reg_link' => makeUrl($paths->page, 'IWannaPlayToo&coppa=no', true) )) . '</p>' : '';
   567 		die_friendly($lang->get('user_reg_err_disabled_title'), '<p>' . $lang->get('user_reg_err_disabled_body') . '</p>');
   567 		die_friendly($lang->get('user_reg_err_disabled_title'), '<p>' . $lang->get('user_reg_err_disabled_body') . '</p>' . $s);
       
   568 	}
   568 	}
   569 	// are we locked out from logging in? if so, also lock out registration
   569 	// are we locked out from logging in? if so, also lock out registration
   570 	if ( getConfig('lockout_policy') === 'lockout' )
   570 	if ( getConfig('lockout_policy') === 'lockout' )
   571 	{
   571 	{
   572 		$ip = $db->escape($_SERVER['REMOTE_ADDR']);
   572 		$ip = $db->escape($_SERVER['REMOTE_ADDR']);
   586 	}
   586 	}
   587 	if(isset($_POST['submit'])) 
   587 	if(isset($_POST['submit'])) 
   588 	{
   588 	{
   589 		$_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
   589 		$_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
   590 		
   590 		
   591 		$captcharesult = $session->get_captcha($_POST['captchahash']);
   591 		if ( $session->user_level < USER_LEVEL_ADMIN )
   592 		$session->kill_captcha();
   592 		{
       
   593 			$captcharesult = $session->get_captcha($_POST['captchahash']);
       
   594 			$session->kill_captcha();
       
   595 		}
   593 		// bypass captcha if logged in (at this point, if logged in, we're admin)
   596 		// bypass captcha if logged in (at this point, if logged in, we're admin)
   594 		if ( !$session->user_logged_in && strtolower($captcharesult) != strtolower($_POST['captchacode']) )
   597 		if ( !$session->user_logged_in && strtolower($captcharesult) != strtolower($_POST['captchacode']) )
   595 		{
   598 		{
   596 			$s = $lang->get('user_reg_err_captcha');
   599 			$s = $lang->get('user_reg_err_captcha');
   597 		}
   600 		}
   680 		$email    = htmlspecialchars($_POST['email']);
   683 		$email    = htmlspecialchars($_POST['email']);
   681 		$realname = htmlspecialchars($_POST['real_name']);
   684 		$realname = htmlspecialchars($_POST['real_name']);
   682 	}
   685 	}
   683 	$template->header();
   686 	$template->header();
   684 	echo $lang->get('user_reg_msg_greatercontrol');
   687 	echo $lang->get('user_reg_msg_greatercontrol');
       
   688 	
       
   689 	if ( getConfig('account_activation') == 'disable' && $session->user_level >= USER_LEVEL_ADMIN )
       
   690 	{
       
   691 		echo '<div class="info-box">' . $lang->get('user_reg_msg_admin_forced') . '</div>';
       
   692 	}
   685 	
   693 	
   686 	if ( getConfig('enable_coppa') != '1' || ( isset($_GET['coppa']) && in_array($_GET['coppa'], array('yes', 'no')) ) )
   694 	if ( getConfig('enable_coppa') != '1' || ( isset($_GET['coppa']) && in_array($_GET['coppa'], array('yes', 'no')) ) )
   687 	{
   695 	{
   688 		$coppa = ( isset($_GET['coppa']) && $_GET['coppa'] == 'yes' );
   696 		$coppa = ( isset($_GET['coppa']) && $_GET['coppa'] == 'yes' );
   689 		$session->kill_captcha();
   697 		$session->kill_captcha();