2004-08-02 14:32:04 +00:00
|
|
|
<?php
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package ucp
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2006-05-05 17:56:33 +00:00
|
|
|
* @ignore
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
2002-03-18 13:35:43 +00:00
|
|
|
define('IN_PHPBB', true);
|
|
|
|
$phpbb_root_path = './';
|
2003-09-07 13:46:51 +00:00
|
|
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
2006-06-06 20:53:46 +00:00
|
|
|
require($phpbb_root_path . 'common.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
|
2004-08-02 14:32:04 +00:00
|
|
|
|
|
|
|
// Basic parameter data
|
2005-10-04 21:31:35 +00:00
|
|
|
$id = request_var('i', '');
|
2004-08-02 14:32:04 +00:00
|
|
|
$mode = request_var('mode', '');
|
|
|
|
|
2007-01-17 01:36:51 +00:00
|
|
|
if ($mode == 'login' || $mode == 'logout' || $mode == 'confirm')
|
2004-06-01 17:02:20 +00:00
|
|
|
{
|
|
|
|
define('IN_LOGIN', true);
|
|
|
|
}
|
2004-08-02 14:32:04 +00:00
|
|
|
|
|
|
|
// Start session management
|
2005-10-04 21:31:35 +00:00
|
|
|
$user->session_begin();
|
2004-08-02 14:32:04 +00:00
|
|
|
$auth->acl($user->data);
|
|
|
|
$user->setup('ucp');
|
|
|
|
|
2006-06-19 21:30:32 +00:00
|
|
|
// Setting a variable to let the style designer know where he is...
|
|
|
|
$template->assign_var('S_IN_UCP', true);
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
$module = new p_master();
|
2003-05-10 17:19:27 +00:00
|
|
|
|
2003-05-19 15:24:14 +00:00
|
|
|
// Basic "global" modes
|
2003-05-10 17:19:27 +00:00
|
|
|
switch ($mode)
|
2001-10-10 17:27:34 +00:00
|
|
|
{
|
2003-05-10 17:19:27 +00:00
|
|
|
case 'activate':
|
2005-10-04 21:31:35 +00:00
|
|
|
$module->load('ucp', 'activate');
|
|
|
|
$module->display($user->lang['UCP_ACTIVATE']);
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2005-10-04 21:31:35 +00:00
|
|
|
break;
|
2003-03-17 00:53:38 +00:00
|
|
|
|
2005-04-09 12:26:45 +00:00
|
|
|
case 'resend_act':
|
2005-10-04 21:31:35 +00:00
|
|
|
$module->load('ucp', 'resend');
|
|
|
|
$module->display($user->lang['UCP_RESEND']);
|
|
|
|
break;
|
2005-04-09 12:26:45 +00:00
|
|
|
|
2003-10-12 15:29:18 +00:00
|
|
|
case 'sendpassword':
|
2005-10-04 21:31:35 +00:00
|
|
|
$module->load('ucp', 'remind');
|
|
|
|
$module->display($user->lang['UCP_REMIND']);
|
|
|
|
break;
|
2003-05-19 15:24:14 +00:00
|
|
|
|
2003-05-10 17:19:27 +00:00
|
|
|
case 'register':
|
2005-04-10 18:07:12 +00:00
|
|
|
if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
|
2003-05-10 17:19:27 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2003-05-10 17:19:27 +00:00
|
|
|
}
|
2003-03-17 00:53:38 +00:00
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
$module->load('ucp', 'register');
|
2005-12-26 21:02:39 +00:00
|
|
|
$module->display($user->lang['REGISTER']);
|
2005-10-04 21:31:35 +00:00
|
|
|
break;
|
2003-03-17 00:53:38 +00:00
|
|
|
|
2003-05-19 15:24:14 +00:00
|
|
|
case 'confirm':
|
2005-10-04 21:31:35 +00:00
|
|
|
$module->load('ucp', 'confirm');
|
|
|
|
exit;
|
|
|
|
break;
|
2003-05-19 15:24:14 +00:00
|
|
|
|
2003-05-10 17:19:27 +00:00
|
|
|
case 'login':
|
2005-04-10 18:07:12 +00:00
|
|
|
if ($user->data['is_registered'])
|
2003-05-10 17:19:27 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2003-05-10 17:19:27 +00:00
|
|
|
}
|
2003-03-17 00:53:38 +00:00
|
|
|
|
2007-01-03 18:58:19 +00:00
|
|
|
login_box(request_var('redirect', "index.$phpEx"));
|
2006-01-25 21:01:52 +00:00
|
|
|
break;
|
2003-05-10 17:19:27 +00:00
|
|
|
|
|
|
|
case 'logout':
|
2007-05-15 17:38:57 +00:00
|
|
|
if ($user->data['user_id'] != ANONYMOUS && (!empty($_GET['sid']) && ($_GET['sid'] == $user->session_id)))
|
|
|
|
{
|
|
|
|
$user->session_kill();
|
|
|
|
$user->session_begin();
|
|
|
|
$message = $user->lang['LOGOUT_REDIRECT'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED'];
|
|
|
|
}
|
|
|
|
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
|
2007-05-15 16:02:00 +00:00
|
|
|
|
2007-05-15 17:38:57 +00:00
|
|
|
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
|
|
|
|
trigger_error($message);
|
|
|
|
|
2006-01-25 21:01:52 +00:00
|
|
|
break;
|
2004-05-31 18:00:10 +00:00
|
|
|
|
2006-03-18 12:17:22 +00:00
|
|
|
case 'terms':
|
|
|
|
case 'privacy':
|
|
|
|
|
|
|
|
$message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY';
|
|
|
|
$title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY';
|
|
|
|
|
|
|
|
if (empty($user->lang[$message]))
|
|
|
|
{
|
|
|
|
if ($user->data['is_registered'])
|
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2006-03-18 12:17:22 +00:00
|
|
|
}
|
2006-06-06 20:53:46 +00:00
|
|
|
|
2006-05-04 18:25:01 +00:00
|
|
|
login_box();
|
2006-03-18 12:17:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$template->set_filenames(array(
|
|
|
|
'body' => 'ucp_agreement.html')
|
|
|
|
);
|
|
|
|
|
2006-06-12 22:16:27 +00:00
|
|
|
// Disable online list
|
|
|
|
page_header($user->lang[$title], false);
|
2006-03-18 12:17:22 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
|
|
|
'S_AGREEMENT' => true,
|
|
|
|
'AGREEMENT_TITLE' => $user->lang[$title],
|
2006-03-18 22:53:14 +00:00
|
|
|
'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()),
|
2006-06-06 20:53:46 +00:00
|
|
|
'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
|
2006-03-18 12:17:22 +00:00
|
|
|
'L_BACK' => $user->lang['BACK_TO_LOGIN'])
|
|
|
|
);
|
2006-06-06 20:53:46 +00:00
|
|
|
|
2006-03-18 12:17:22 +00:00
|
|
|
page_footer();
|
|
|
|
|
2006-01-25 21:01:52 +00:00
|
|
|
break;
|
2005-04-09 12:26:45 +00:00
|
|
|
|
2004-05-31 18:00:10 +00:00
|
|
|
case 'delete_cookies':
|
2006-03-01 21:48:02 +00:00
|
|
|
|
2004-05-31 18:00:10 +00:00
|
|
|
// Delete Cookies with dynamic names (do NOT delete poll cookies)
|
2004-06-06 21:44:49 +00:00
|
|
|
if (confirm_box(true))
|
2004-05-31 18:00:10 +00:00
|
|
|
{
|
2004-06-06 21:44:49 +00:00
|
|
|
$set_time = time() - 31536000;
|
2006-06-06 20:53:46 +00:00
|
|
|
|
2004-06-06 21:44:49 +00:00
|
|
|
foreach ($_COOKIE as $cookie_name => $cookie_data)
|
2004-05-31 18:00:10 +00:00
|
|
|
{
|
2004-06-06 21:44:49 +00:00
|
|
|
$cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name);
|
2007-01-07 14:08:47 +00:00
|
|
|
|
|
|
|
// Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_
|
|
|
|
if (strpos($cookie_name, 'poll_') !== 0)
|
2004-06-06 21:44:49 +00:00
|
|
|
{
|
|
|
|
$user->set_cookie($cookie_name, '', $set_time);
|
|
|
|
}
|
2004-05-31 18:00:10 +00:00
|
|
|
}
|
2006-06-06 20:53:46 +00:00
|
|
|
|
2004-06-06 21:44:49 +00:00
|
|
|
$user->set_cookie('track', '', $set_time);
|
2005-07-08 12:29:45 +00:00
|
|
|
$user->set_cookie('u', '', $set_time);
|
|
|
|
$user->set_cookie('k', '', $set_time);
|
2004-06-06 21:44:49 +00:00
|
|
|
$user->set_cookie('sid', '', $set_time);
|
2004-05-31 18:00:10 +00:00
|
|
|
|
2004-06-06 21:44:49 +00:00
|
|
|
// We destroy the session here, the user will be logged out nevertheless
|
2005-08-19 10:48:39 +00:00
|
|
|
$user->session_kill();
|
2006-01-05 21:24:22 +00:00
|
|
|
$user->session_begin();
|
2004-05-31 18:00:10 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
|
2004-05-31 18:00:10 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
$message = $user->lang['COOKIES_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
|
2004-06-06 21:44:49 +00:00
|
|
|
trigger_error($message);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
confirm_box(false, 'DELETE_COOKIES', '');
|
|
|
|
}
|
2006-06-06 20:53:46 +00:00
|
|
|
|
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2006-03-01 21:48:02 +00:00
|
|
|
|
2006-01-25 21:01:52 +00:00
|
|
|
break;
|
2006-04-17 13:09:50 +00:00
|
|
|
|
|
|
|
case 'switch_perm':
|
|
|
|
|
|
|
|
$user_id = request_var('u', 0);
|
|
|
|
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM ' . USERS_TABLE . '
|
|
|
|
WHERE user_id = ' . (int) $user_id;
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
$user_row = $db->sql_fetchrow($result);
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
|
|
|
if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'])
|
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2006-04-17 13:09:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
|
|
|
|
|
|
|
|
$auth_admin = new auth_admin();
|
|
|
|
if (!$auth_admin->ghost_permissions($user_id, $user->data['user_id']))
|
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2006-04-17 13:09:50 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
add_log('admin', 'LOG_ACL_TRANSFER_PERMISSIONS', $user_row['username']);
|
2006-04-17 13:09:50 +00:00
|
|
|
|
2007-01-21 18:33:45 +00:00
|
|
|
$message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
|
2006-04-17 13:09:50 +00:00
|
|
|
trigger_error($message);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'restore_perm':
|
|
|
|
|
|
|
|
if (!$user->data['user_perm_from'] || !$auth->acl_get('a_switchperm'))
|
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2006-04-17 13:09:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$auth->acl_cache($user->data);
|
|
|
|
|
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
|
|
|
SET user_perm_from = 0
|
|
|
|
WHERE user_id = " . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
$sql = 'SELECT username
|
|
|
|
FROM ' . USERS_TABLE . '
|
|
|
|
WHERE user_id = ' . $user->data['user_perm_from'];
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
$username = $db->sql_fetchfield('username');
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
|
|
|
add_log('admin', 'LOG_ACL_RESTORE_PERMISSIONS', $username);
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
$message = $user->lang['PERMISSIONS_RESTORED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
|
2006-04-17 13:09:50 +00:00
|
|
|
trigger_error($message);
|
|
|
|
|
|
|
|
break;
|
2003-01-30 20:04:21 +00:00
|
|
|
}
|
|
|
|
|
2003-05-10 17:19:27 +00:00
|
|
|
// Only registered users can go beyond this point
|
2005-04-10 18:07:12 +00:00
|
|
|
if (!$user->data['is_registered'])
|
2003-05-10 17:19:27 +00:00
|
|
|
{
|
2005-04-10 18:07:12 +00:00
|
|
|
if ($user->data['is_bot'])
|
2004-05-30 19:24:53 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
2004-05-30 19:24:53 +00:00
|
|
|
}
|
2004-08-02 14:32:04 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
login_box('', $user->lang['LOGIN_EXPLAIN_UCP']);
|
2003-05-10 17:19:27 +00:00
|
|
|
}
|
2003-03-04 17:52:50 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
// Instantiate module system and generate list of available modules
|
|
|
|
$module->list_modules('ucp');
|
2003-03-04 17:52:50 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
// Check if the zebra module is set
|
2007-03-26 15:42:05 +00:00
|
|
|
if ($module->is_active('zebra', 'friends'))
|
2007-03-24 18:00:21 +00:00
|
|
|
{
|
|
|
|
// Output listing of friends online
|
|
|
|
$update_time = $config['load_online_time'] * 60;
|
2006-05-05 22:06:17 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
$sql = $db->sql_build_query('SELECT_DISTINCT', array(
|
|
|
|
'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, u.user_allow_viewonline, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline',
|
2006-05-05 22:06:17 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
'FROM' => array(
|
|
|
|
USERS_TABLE => 'u',
|
|
|
|
ZEBRA_TABLE => 'z'
|
|
|
|
),
|
2006-05-05 22:06:17 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
'LEFT_JOIN' => array(
|
|
|
|
array(
|
|
|
|
'FROM' => array(SESSIONS_TABLE => 's'),
|
|
|
|
'ON' => 's.session_user_id = z.zebra_id'
|
|
|
|
)
|
|
|
|
),
|
2006-05-05 22:06:17 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
'WHERE' => 'z.user_id = ' . $user->data['user_id'] . '
|
|
|
|
AND z.friend = 1
|
|
|
|
AND u.user_id = z.zebra_id',
|
2006-05-21 16:54:19 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_allow_viewonline, u.user_colour, u.username',
|
2006-05-05 22:06:17 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
'ORDER_BY' => 'u.username_clean ASC',
|
|
|
|
));
|
2003-03-17 00:53:38 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2003-05-09 14:11:55 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$which = (time() - $update_time < $row['online_time'] && $row['viewonline'] && $row['user_allow_viewonline']) ? 'online' : 'offline';
|
2006-11-16 16:51:19 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
$template->assign_block_vars("friends_{$which}", array(
|
|
|
|
'USER_ID' => $row['user_id'],
|
2003-03-04 17:52:50 +00:00
|
|
|
|
2007-03-24 18:00:21 +00:00
|
|
|
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
|
'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
|
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
|
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
}
|
2005-10-04 21:31:35 +00:00
|
|
|
|
2007-04-29 12:30:22 +00:00
|
|
|
// Do not display subscribed topics/forums if not allowed
|
|
|
|
if (!$config['allow_topic_notify'] && !$config['allow_forum_notify'])
|
|
|
|
{
|
|
|
|
$module->set_display('main', 'subscribed', false);
|
|
|
|
}
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
// Select the active module
|
|
|
|
$module->set_active($id, $mode);
|
2003-10-01 17:24:53 +00:00
|
|
|
|
|
|
|
// Load and execute the relevant module
|
2005-10-04 21:31:35 +00:00
|
|
|
$module->load_active();
|
|
|
|
|
|
|
|
// Assign data to the template engine for the list of modules
|
2006-06-06 20:53:46 +00:00
|
|
|
$module->assign_tpl_vars(append_sid("{$phpbb_root_path}ucp.$phpEx"));
|
2005-10-04 21:31:35 +00:00
|
|
|
|
2006-06-12 22:16:27 +00:00
|
|
|
// Generate the page, do not display/query online list
|
|
|
|
$module->display($module->get_page_title(), false);
|
2006-04-08 13:01:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2007-03-26 15:42:05 +00:00
|
|
|
|
|
|
|
if ($mode == 'friends')
|
|
|
|
{
|
|
|
|
$template->assign_var('S_ZEBRA_FRIENDS_ENABLED', true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($mode == 'foes')
|
|
|
|
{
|
|
|
|
$template->assign_var('S_ZEBRA_FOES_ENABLED', true);
|
|
|
|
}
|
2006-04-08 13:01:04 +00:00
|
|
|
}
|
|
|
|
|
2002-07-14 14:45:26 +00:00
|
|
|
?>
|