diff options
Diffstat (limited to 'phpBB/ucp.php')
| -rw-r--r-- | phpBB/ucp.php | 92 | 
1 files changed, 48 insertions, 44 deletions
diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 520ab3caad..182bc2e285 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -1,10 +1,13 @@  <?php  /**  * -* @package ucp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file.  *  */ @@ -22,7 +25,7 @@ require($phpbb_root_path . 'includes/functions_module.' . $phpEx);  $id 	= request_var('i', '');  $mode	= request_var('mode', ''); -if (in_array($mode, array('login', 'logout', 'confirm', 'sendpassword', 'activate'))) +if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassword', 'activate')))  {  	define('IN_LOGIN', true);  } @@ -81,22 +84,30 @@ switch ($mode)  		login_box(request_var('redirect', "index.$phpEx"));  	break; +	case 'login_link': +		if ($user->data['is_registered']) +		{ +			redirect(append_sid("{$phpbb_root_path}index.$phpEx")); +		} + +		$module->load('ucp', 'login_link'); +		$module->display($user->lang['UCP_LOGIN_LINK']); +	break; +  	case 'logout': -		if ($user->data['user_id'] != ANONYMOUS && isset($_GET['sid']) && !is_array($_GET['sid']) && $_GET['sid'] === $user->session_id) +		if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)  		{  			$user->session_kill(); -			$user->session_begin(); -			$message = $user->lang['LOGOUT_REDIRECT'];  		} -		else +		else if ($user->data['user_id'] != ANONYMOUS)  		{ -			$message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED']; -		} -		meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); +			meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); -		$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> '); -		trigger_error($message); +			$message = $user->lang['LOGOUT_FAILED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> '); +			trigger_error($message); +		} +		redirect(append_sid("{$phpbb_root_path}index.$phpEx"));  	break;  	case 'terms': @@ -120,7 +131,7 @@ switch ($mode)  		);  		// Disable online list -		page_header($user->lang[$title], false); +		page_header($user->lang[$title]);  		$template->assign_vars(array(  			'S_AGREEMENT'			=> true, @@ -141,8 +152,10 @@ switch ($mode)  		{  			$set_time = time() - 31536000; -			foreach ($_COOKIE as $cookie_name => $cookie_data) +			foreach ($request->variable_names(\phpbb\request\request_interface::COOKIE) as $cookie_name)  			{ +				$cookie_data = $request->variable($cookie_name, '', true, \phpbb\request\request_interface::COOKIE); +  				// Only delete board cookies, no other ones...  				if (strpos($cookie_name, $config['cookie_name'] . '_') !== 0)  				{ @@ -272,19 +285,19 @@ if ($module->is_active('zebra', 'friends'))  	// Output listing of friends online  	$update_time = $config['load_online_time'] * 60; -	$sql = $db->sql_build_query('SELECT_DISTINCT', array( +	$sql_ary = array(  		'SELECT'	=> 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline',  		'FROM'		=> array(  			USERS_TABLE		=> 'u', -			ZEBRA_TABLE		=> 'z' +			ZEBRA_TABLE		=> 'z',  		),  		'LEFT_JOIN'	=> array(  			array(  				'FROM'	=> array(SESSIONS_TABLE => 's'), -				'ON'	=> 's.session_user_id = z.zebra_id' -			) +				'ON'	=> 's.session_user_id = z.zebra_id', +			),  		),  		'WHERE'		=> 'z.user_id = ' . $user->data['user_id'] . ' @@ -294,8 +307,9 @@ if ($module->is_active('zebra', 'friends'))  		'GROUP_BY'	=> 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username',  		'ORDER_BY'	=> 'u.username_clean ASC', -	)); +	); +	$sql = $db->sql_build_query('SELECT_DISTINCT', $sql_ary);  	$result = $db->sql_query($sql);  	while ($row = $db->sql_fetchrow($result)) @@ -320,6 +334,18 @@ if (!$config['allow_topic_notify'] && !$config['allow_forum_notify'])  	$module->set_display('main', 'subscribed', false);  } +/** +* Use this event to enable and disable additional UCP modules +* +* @event core.ucp_display_module_before +* @var	p_master	module	Object holding all modules and their status +* @var	mixed		id		Active module category (can be the int or string) +* @var	string		mode	Active module +* @since 3.1.0-a1 +*/ +$vars = array('module', 'id', 'mode'); +extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars))); +  // Select the active module  $module->set_active($id, $mode); @@ -330,26 +356,4 @@ $module->load_active();  $module->assign_tpl_vars(append_sid("{$phpbb_root_path}ucp.$phpEx"));  // Generate the page, do not display/query online list -$module->display($module->get_page_title(), false); - -/** -* Function for assigning a template var if the zebra module got included -*/ -function _module_zebra($mode, &$module_row) -{ -	global $template; - -	$template->assign_var('S_ZEBRA_ENABLED', true); - -	if ($mode == 'friends') -	{ -		$template->assign_var('S_ZEBRA_FRIENDS_ENABLED', true); -	} - -	if ($mode == 'foes') -	{ -		$template->assign_var('S_ZEBRA_FOES_ENABLED', true); -	} -} - -?>
\ No newline at end of file +$module->display($module->get_page_title());  | 
