<?php
/*======================================================================*\
|| #################################################################### ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2013 Fillip Hannisdal AKA Revan/NeoRevan/Belazor 	  # ||
|| # All Rights Reserved. 											  # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------------------------------------------------------- # ||
|| # You are not allowed to use this on your server unless the files  # ||
|| # you downloaded were done so with permission.					  # ||
|| # ---------------------------------------------------------------- # ||
|| #################################################################### ||
\*======================================================================*/

if (empty($_REQUEST['do']))
{
	$_REQUEST['do'] = 'list';
}

$emails = array(
	'dbtechbounce@aol.co.uk' 	=> 'America Online (AOL)',
	'dbtechbounce@hotmail.com' 	=> 'Microsoft Mail (Hotmail / MSN)',
	'dbtechbounce@gmail.com' 	=> 'Google Mail (GMail)',
	'dbtechbounce@yahoo.com' 	=> 'Yahoo! Mail (Yahoo / AT&T)',
);

// ######################### Start table list ####################
if ($_REQUEST['action'] == 'bouncetest' OR empty($_REQUEST['action']))
{
	$headings = array();
	$headings[] = $vbphrase['email'];
	$headings[] = "<input type=\"checkbox\" name=\"allbox\" id=\"allbox\" title=\"$vbphrase[check_all]\" onclick=\"js_check_all(this.form);\" /><label for=\"allbox\">$vbphrase[check_all]</label>";
	
	print_cp_header($vbphrase['dbtech_vbmail_bounced_mail_test']);	
	print_form_header('vbmail', 'bouncetest', 0, 1, 'cpform');
	construct_hidden_code('action', 'dotest');
	print_table_header($vbphrase['dbtech_vbmail_bounced_mail_test']);
	print_description_row($vbphrase['dbtech_vbmail_bounced_mail_test_descr']);
	print_cells_row($headings, 1);
	
	$nullcount = 0;
	foreach ($emails as $email => $key)
	{
		$cells = array();
		$cells[] = $key;
		$cells[] = "<input type=\"checkbox\" name=\"emaillist[$nullcount]\" id=\"tablelist_$nullcount\" title=\"$email\" value=\"$email\" /><label for=\"tablelist_$nullcount\">$vbphrase[yes]</label>";
		print_cells_row($cells);
		$nullcount++;
	}
	print_submit_row($vbphrase['continue']);
}

// ######################### Start do repair #####################
if ($_POST['action'] == 'dotest')
{
	$vbulletin->input->clean_array_gpc('p', array(
		'emaillist'      => TYPE_ARRAY_STR,
	));

	$emaillist = array();
	if (!empty($vbulletin->GPC['emaillist']))
	{
		foreach ($vbulletin->GPC['emaillist'] AS $email)
		{
			// Sent mail
			vbmail($email, 'Test', 'Test', true);
			$emaillist[] = $emails[$email];
		}
	}
	else
	{
		print_stop_message('nothing_to_do');
	}
	print_cp_message(
		implode('<br />', $emaillist),
		NULL,
		1,
		defined('CP_BACKURL') ? CP_BACKURL : NULL,
		defined('CP_CONTINUE') ? true : false
	);
}

print_cp_footer();

/*======================================================================*\
|| ####################################################################
|| # Downloaded: 18:55, Sun Jun 12th 2011
|| # CVS: $RCSfile$ - $Revision: 32878 $
|| ####################################################################
\*======================================================================*/
?>