<?php
/***********************************************************************/

// Some info about your mod.
$mod_title      = 'punBB Arcade Games';
$mod_version    = '';
$release_date   = '2006-06-05';
$author         = 'ANGO';
$author_email   = '';

// Versions of PunBB this mod was created for. Minor variations (i.e. 1.2.4 vs 1.2.5) will be allowed, but a warning will be displayed.
$punbb_versions	= array('1.2.10', '1.2.11', '1.2.12');

// Set this to false if you haven't implemented the restore function (see below)
$mod_restore	= false;


// This following function will be called when the user presses the "Install" button
function install()
{
	global $db, $db_type, $pun_config;
	
	
$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Kaboom", "kaboom", "Catch the black bombs and avoid the red ones.", "kaboom.jpg", 550, 400, 4)') or error('Unable to add game Kaboom', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Speed Biker", "speedbiker", "Dodge cars and other obstacles in this ultra-fast street bike.", "speedbiker.jpg", 550, 400, 8)') or error('Unable to add game Speed Biker', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Virus 2", "virus2", "Grow your colored virus so it fills the cells before you run out of attempts.", "virus2.jpg", 466, 350, 3)') or error('Unable to add game Trampolean', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Thrust", "thrust", "Can you land before your fuel runs out?", "thrust.jpg", 550, 400, 4)') or error('Unable to add game Thrust', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Power Driver", "powerdriver", "Its all about how far you can hit the sucker.", "powerdriver.jpg", 700, 400, 9)') or error('Unable to add game Power Driver', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Scrambled Eggs", "scrambledeggs", "Farmer Teds chickens are laying eggs like crazy.<br>Help him out by catching them in your little egg basket!", "scrambledeggs.jpg", 550, 395, 4)') or error('Unable to add game Balloon Hunter', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Jump n Glide", "jumpnglide", "The object of the game is to collect all the yellow balloons as you glide through the air.<br>Try to jump and Glide toward them, but be careful not to disturb the balloons with bombs in or BANG.", "jumpnglide.jpg", 550, 400, 2)') or error('Unable to add game Jump n Glide', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Little Geek", "littlegeek", "Jump n run style. Dont get frozen.", "littlegeek.jpg", 750, 250, 2)') or error('Unable to add game Little Geek', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Formula Fun", "formulafun", "Overhaul 50 cars on as short a Distanz. Pushing the opponents aside gives points of bonus.", "formulafun.jpg", 550, 400, 8)') or error('Unable to add game Formula Fun', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Ice Age 1 L1", "iceagescratjump", "Scrat Jump Level 1.<br>Help Scrat catch air as he shreds down the mountain on his snowboard.<br>Sid is waiting on the bottom and catapults him as far as possible.<br>This is level 1, Scrat tries to make the best out of your hit automatically.", "iceagescratjump.jpg", 550, 400, 4)') or error('Unable to add game Ice Age - Scrat Jump', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Ice Age 1 L2", "iceagescratjump", "Scrat Jump Level 2.<br>Help Scrat catch air as he shreds down the mountain on his snowboard.<br>Sid is waiting on the bottom and catapults him as far as possible.<br>Use keys to control Scrat in air.", "iceagescratjump.jpg", 550, 400, 4)') or error('Unable to add game Ice Age - Scrat Jump', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Ice Age 2", "iceagerisingwater", "Rising Water.<br>The ice is melting - and the water is rising. Help Scrat on his way up and collect as many acorns as possible without falling into the water.", "iceagerisingwater.jpg", 550, 400, 4)') or error('Unable to add game Ice Age - Rising Water', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Ice Age 3", "iceage5acorns", "5 Acorns.<br>Eddie and Crash perform an incredible balancing act whilst throwing acorns into Scrats basket as fast as possible.", "iceageacorns.jpg", 550, 400, 4)') or error('Unable to add game Ice Age - 5 Acorns', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Ice Age 4", "iceagepteroglide", "Ptero Glide.<br>Sid is king of the heavens.At least when he is gliding on the back of the Pterodactyl.<br>It’s in your hands to keep him up there as long as possible.", "iceagepteroglide.jpg", 550, 400, 4)') or error('Unable to add game Ice Age - Ptero Glide', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Polar Jump", "polarjump", "Jump from one ice float to another.<br>Use the mouse to control the direction and power of the squirrels jump.", "polarjump.jpg", 550, 400, 4)') or error('Unable to add game Polar Jump', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Shark Attack", "sharkattack", "Feed the hungry shark!", "sharkattack.jpg", 760, 500, 4)') or error('Unable to add game Shark Attack', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Zeitenwende", "zeitenwende", "A balancing circus type of game where you have to walk on a tight rope in a straight as long as possible.", "zeitenwende.jpg", 700, 400, 4)') or error('Unable to add game Zeitenwende', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Sonic MC Mini", "sonic", "Race Sonic to the end of the level while destroying enemies and collecting rings on the way.<br>Try for the high score! To send your highscore you must click on NO at the end of the game.", "sonic.jpg", 500, 400, 2)') or error('Unable to add game Sonic Megacollection Mini', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Blob Twist", "blobtwist", "The Blobs are back!<br>Spin the board with the arrow keys, launch Blobs with the space bar and see how far you can get.", "blobtwist.jpg", 550, 400, 3)') or error('Unable to add game Blob Twist', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Pinball Smashup", "pinballsmashup", "Its like Break-Out, in a Pinball table, except you can warp time.", "pinballsmashup.jpg", 410, 530, 4)') or error('Unable to add game Pinball Smashup', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Sea Dogs", "seadogs", "The goal of the game is to reduce you enemys health to zero and sink him before he can do the same to you.", "seadogs.jpg", 550, 400, 2)') or error('Unable to add game Sea Dogs', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Little Johns Archery", "littlejohn", "You are john who is out on the field shooting targets.<br>Simply click the mouse and drag to create an angle and power of your shot. Try to hit the target as precisely as you can.<br>The closer to the bulls eye you get the more points your recieve.", "littlejohn.jpg", 600, 500, 9)') or error('Unable to add game Little Johns Archery', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Gyroball", "gyroball", "Navigate your gyroball to the glowing goal of each level without falling off the platforms.<br>Use arrow keys to control the ball.", "gyroball.jpg", 800, 600, 4)') or error('Unable to add game Gyroball', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Bowling", "bowling", "Bowling is a 10 pin bowling game. Where just like in real life the aim is to take ten turns and attempt to accumulate as many points as possible.", "bowling.jpg", 400, 570, 9)') or error('Unable to add game Bowling', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("1992", "1992", "The Battle of the Isles.<br>Defeat the 4 Massive Enemy Aircraft planes, to defeat the plans of the evil capitalist Elvis Presley, and claim to be the worlds best pilot.", "1992.jpg", 550, 400, 1)') or error('Unable to add game Pinball Smashup', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db->prefix.'arcade_games (game_name, game_filename, game_desc, game_image, game_width, game_height, game_cat) VALUES ("Ball", "ball", "Use the arrow keys to keep the white ball away from the red balls.<br>Collect the greens to earn points and the yellow to get a random powerup", "ball.jpg", 600, 520, 4)') or error('Unable to add game Sea Dogs', __FILE__, __LINE__, $db->error());

}



// This following function will be called when the user presses the "Restore" button (only if $mod_uninstall is true (see above))
function restore()
{
	global $db, $db_type, $pun_config;
	switch ($db_type)
	{
		default:

			break;
	}

}

/***********************************************************************/

// DO NOT EDIT ANYTHING BELOW THIS LINE!


// Circumvent maintenance mode
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

// We want the complete error message if the script fails
if (!defined('PUN_DEBUG'))
	define('PUN_DEBUG', 1);

// Make sure we are running a PunBB version that this mod works with
$version_warning = false;
if(!in_array($pun_config['o_cur_version'], $punbb_versions))
{
	foreach ($punbb_versions as $temp)
	{
		if (substr($temp, 0, 3) == substr($pun_config['o_cur_version'], 0, 3))
		{
			$version_warning = true;
			break;
		}
	}

	if (!$version_warning)
		exit('You are running a version of PunBB ('.$pun_config['o_cur_version'].') that this mod does not support. This mod supports PunBB versions: '.implode(', ', $punbb_versions));
}


$style = (isset($cur_user)) ? $cur_user['style'] : $pun_config['o_default_style'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $mod_title ?> installation</title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_config['o_default_style'].'.css' ?>" />
</head>
<body>

<div id="punwrap">
<div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">

<?php

if (isset($_POST['form_sent']))
{
	if (isset($_POST['install']))
	{
		// Run the install function (defined above)
		install();

?>
<div class="block">
	<h2><span>Installation successful</span></h2>
	<div class="box">
		<div class="inbox">
			<p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
		</div>
	</div>
</div>
<?php

	}
	else
	{
		// Run the restore function (defined above)
		restore();

?>
<div class="block">
	<h2><span>Restore successful</span></h2>
	<div class="box">
		<div class="inbox">
			<p>Your database has been successfully restored.</p>
		</div>
	</div>
</div>
<?php

	}
}
else
{

?>
<div class="blockform">
	<h2><span>Mod installation</span></h2>
	<div class="box">
		<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar">
			<div><input type="hidden" name="form_sent" value="1" /></div>
			<div class="inform">
				<p>This script will update your database to work with the following modification:</p>
				<p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title).' '.$mod_version ?></p>
				<p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p>
				<p><strong>Disclaimer:</strong> Mods are not officially supported by PunBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p>
<?php if ($mod_restore): ?>				<p>If you've previously installed this mod and would like to uninstall it, you can click the restore button below to restore the database.</p>
<?php endif; ?><?php if ($version_warning): ?>				<p style="color: #a00"><strong>Warning:</strong> The mod you are about to install was not made specifically to support your current version of PunBB (<?php echo $pun_config['o_cur_version']; ?>). However, in most cases this is not a problem and the mod will most likely work with your version as well. If you are uncertain about installning the mod due to this potential version conflict, contact the mod author.</p>
<?php endif; ?>			</div>
			<p><input type="submit" name="install" value="Install" /><?php if ($mod_restore): ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p>
		</form>
	</div>
</div>
<?php

}

?>

</div>
</div>

</body>
</html>