phpBB

Code Changes

File: includes/acp/acp_inactive.php

  Unmodified   Added   Modified   Removed
Line 50Line 50

$form_key = 'acp_inactive';
add_form_key($form_key);


$form_key = 'acp_inactive';
add_form_key($form_key);

 

// We build the sort key and per page settings here, because they may be needed later

// Number of entries to display
$per_page = request_var('users_per_page', (int) $config['topics_per_page']);

// Sorting
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'd' => $user->lang['SORT_LAST_REMINDER'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME'], 'p' => $user->lang['SORT_POSTS'], 'e' => $user->lang['SORT_REMINDER']);
$sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'd' => 'user_reminded_time', 'r' => 'user_inactive_reason', 'u' => 'username_clean', 'p' => 'user_posts', 'e' => 'user_reminded');

$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);


if ($submit && sizeof($mark))
{


if ($submit && sizeof($mark))
{

Line 76Line 89
					$db->sql_freeresult($result);

if ($action == 'activate')

					$db->sql_freeresult($result);

if ($action == 'activate')

					{
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)

 
						{
// Get those 'being activated'...

						{
// Get those 'being activated'...

							$sql = 'SELECT user_id, username, user_email, user_lang

						$sql = 'SELECT user_id, username' . (($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ', user_email, user_lang' : '') . '

								FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $mark) . '
AND user_type = ' . USER_INACTIVE;

								FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $mark) . '
AND user_type = ' . USER_INACTIVE;

Line 92Line 103
								$inactive_users[] = $row;
}
$db->sql_freeresult($result);

								$inactive_users[] = $row;
}
$db->sql_freeresult($result);

						}

 

user_active_flip('activate', $mark);



user_active_flip('activate', $mark);


Line 100Line 110
						{
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);


						{
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);


							$messenger = new messenger();

							$messenger = new messenger(false);


foreach ($inactive_users as $row)
{


foreach ($inactive_users as $row)
{

Line 108Line 118

$messenger->to($row['user_email'], $row['username']);



$messenger->to($row['user_email'], $row['username']);


								$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);

								$messenger->anti_abuse_headers($config, $user);




$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']))


$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']))

Line 121Line 129

$messenger->save_queue();
}


$messenger->save_queue();
}

 

if (!empty($inactive_users))
{
foreach ($inactive_users as $row)
{
add_log('admin', 'LOG_USER_ACTIVE', $row['username']);
add_log('user', $row['user_id'], 'LOG_USER_ACTIVE_USER');
}
}

// For activate we really need to redirect, else a refresh can result in users being deactivated again
$u_action = $this->u_action . "&$u_sort_param&start=$start";
$u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : '';

redirect($u_action);

					}
else if ($action == 'delete')
{

					}
else if ($action == 'delete')
{

Line 161Line 184

$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
FROM ' . USERS_TABLE . '


$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
FROM ' . USERS_TABLE . '

						WHERE ' . $db->sql_in_set('user_id', $mark);





						WHERE ' . $db->sql_in_set('user_id', $mark) . '
AND user_inactive_reason';

$sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL;


					$result = $db->sql_query($sql);

if ($row = $db->sql_fetchrow($result))

					$result = $db->sql_query($sql);

if ($row = $db->sql_fetchrow($result))

Line 170Line 197
						include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

$messenger = new messenger();

						include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

$messenger = new messenger();

						$usernames = array();

						$usernames = $user_ids = array();


do
{


do
{

Line 178Line 205

$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);


$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);

 

$messenger->anti_abuse_headers($config, $user);


$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']),


$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']),

								'REGISTER_DATE'	=> $user->format_date($row['user_regdate']),

								'REGISTER_DATE'	=> $user->format_date($row['user_regdate'], false, true),

								'U_ACTIVATE'	=> generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
);

$messenger->send($row['user_notify_type']);

$usernames[] = $row['username'];

								'U_ACTIVATE'	=> generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
);

$messenger->send($row['user_notify_type']);

$usernames[] = $row['username'];

 
							$user_ids[] = (int) $row['user_id'];

						}
while ($row = $db->sql_fetchrow($result));

$messenger->save_queue();

						}
while ($row = $db->sql_fetchrow($result));

$messenger->save_queue();

 

// Add the remind state to the database
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_reminded = user_reminded + 1,
user_reminded_time = ' . time() . '
WHERE ' . $db->sql_in_set('user_id', $user_ids);
$db->sql_query($sql);


add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames));
unset($usernames);
}
$db->sql_freeresult($result);


add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames));
unset($usernames);
}
$db->sql_freeresult($result);

 

// For remind we really need to redirect, else a refresh can result in more than one reminder
$u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
$u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';

redirect($u_action);

		
break;
}
}

		
break;
}
}


// Sorting
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME']);
$sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username_clean');

$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);

 

// Define where and sort sql for use in displaying logs
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;


// Define where and sort sql for use in displaying logs
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;

Line 217Line 252
		$inactive = array();
$inactive_count = 0;


		$inactive = array();
$inactive_count = 0;


		$start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);

		$start = view_inactive_users($inactive, $inactive_count, $per_page, $start, $sql_where, $sql_sort);


foreach ($inactive as $row)
{
$template->assign_block_vars('inactive', array(
'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),


foreach ($inactive as $row)
{
$template->assign_block_vars('inactive', array(
'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),

 
				'REMINDED_DATE'	=> $user->format_date($row['user_reminded_time']),

				'JOINED'		=> $user->format_date($row['user_regdate']),
'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),

				'JOINED'		=> $user->format_date($row['user_regdate']),
'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),

 


				'REASON'		=> $row['inactive_reason'],
'USER_ID' => $row['user_id'],

				'REASON'		=> $row['inactive_reason'],
'USER_ID' => $row['user_id'],

				'USERNAME'		=> $row['username'],
'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
);










				'POSTS'			=> ($row['user_posts']) ? $row['user_posts'] : 0,
'REMINDED' => $row['user_reminded'],

'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])),

'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview')),
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),

'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"),
'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&amp;sr=posts") : '',
));

		}

$option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');

		}

$option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');

Line 245Line 291
			'S_LIMIT_DAYS'	=> $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir,

			'S_LIMIT_DAYS'	=> $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir,

			'S_ON_PAGE'		=> on_page($inactive_count, $config['topics_per_page'], $start),
'PAGINATION' => generate_pagination($this->u_action . "&amp;$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true),


			'S_ON_PAGE'		=> on_page($inactive_count, $per_page, $start),
'PAGINATION' => generate_pagination($this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page", $inactive_count, $per_page, $start, true),
'USERS_PER_PAGE' => $per_page,

			

			

			'U_ACTION'		=> $this->u_action . '&amp;start=' . $start,

			'U_ACTION'		=> $this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page&amp;start=$start",

		));

$this->tpl_name = 'acp_inactive';

		));

$this->tpl_name = 'acp_inactive';