aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/ucp.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/ucp.php')
-rw-r--r--phpBB/ucp.php59
1 files changed, 40 insertions, 19 deletions
diff --git a/phpBB/ucp.php b/phpBB/ucp.php
index 520ab3caad..0c587cbf28 100644
--- a/phpBB/ucp.php
+++ b/phpBB/ucp.php
@@ -2,9 +2,8 @@
/**
*
* @package ucp
-* @version $Id$
* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -22,7 +21,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 +80,31 @@ 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':
@@ -141,8 +149,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 +282,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 +304,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 +331,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-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);
@@ -351,5 +374,3 @@ function _module_zebra($mode, &$module_row)
$template->assign_var('S_ZEBRA_FOES_ENABLED', true);
}
}
-
-?> \ No newline at end of file