<?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 ("MG Shootout", "mgshootout", "Mardi Gras Shootout ist eine gute Elfmeter-Simulation, bei der Du abwechselnd fünf Elfmeter schießen und halten musst.<br>Bei Erfolg gelangst Du in die nächste Runde und stehst einem besseren Spieler gegenüber.", "mgshootout.jpg", 600, 450, 9)') or error('Unable to add game Mardi Gras Shootout', __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 ("Beckham Shootout", "beckhamsoccer", "Versuche dem Ball soviel Drall zu geben, dass er an der Mauer vorbei und unerreichbar für den Torwart ins Netz geht.", "beckhamsoccer.jpg", 640, 480, 9)') or error('Unable to add game Beckham Shootout', __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 ("Card Toss", "cardtoss", "Bei diesem Spiel muss man Spielkarten in einen Hut werfen.<br>Einen Bonus gibt es wenn man mehrere Karten hintereinander schafft. Damit es nicht allzu leicht wird kommt ab und zu ein bischen Wind auf.", "cardtoss.jpg", 650, 450, 4)') or error('Unable to add game Beckham Shootout', __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 ("World Cup Pinball", "wcpinball", "Mit World Cup Pinball kann die Fußball WM nun auch schon mal als Flipper-Simulation gespielt werden.", "wcpinball.jpg", 535, 650, 4)') or error('Unable to add game World Cup Pinball', __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 ("Knife Throw", "knifethrow", "Werfe die Messer auf das Ziel. Aber treffe nicht das Mädchen!", "knifethrow.jpg", 550, 400, 4)') or error('Unable to add game World Cup Pinball', __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 ("City Jumper", "cityjumper", "City Jumper gibt es schon ewig und hat riesige Fangemeinde gewonnen.<br>Die Grafik und Steuerung sind simpel wie eh und je, aber wie so oft glänzt ein gutes Minigame nicht durch seine Optik sondern durch seinen Suchtfaktor.", "cityjumper.jpg", 800, 600, 4)') or error('Unable to add game World Cup Pinball', __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 ("Bottle Shoot", "bottleshoot", "Shiess auf die Flaschen und nicht auf die Katzen.", "bottleshoot.jpg", 551, 451, 2)') or error('Unable to add game World Cup Pinball', __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 ("Nanaca Crash", "nanacacrash", "Der Sinn des Spieles ist es, Taichi so weit wie möglich fliegen zu lassen. Während des Fluges muss man verschiedene Charaktere treffen oder diesen ausweichen. Als Hilfe gibt es 3 Aerial Crashes. Rot = Aufwärts-, Blau = Abwärts-Beschleunigung. Aktiviert werden diese durch Klicken der Maustaste und bei Aufleuchten des Aerial Symbols.", "nanacacrash.jpg", 700, 400, 4)') or error('Unable to add game World Cup Pinball', __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 ("Maple Story", "maplestory", "Ein niedliches Jump n Run Game ist Maple Story.<br>Die Steuerung erfolgt über die Tastatur und wird im Help Screen beschrieben.", "maplestory.jpg", 560, 490, 7)') or error('Unable to add game Maple Story', __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 ("Clash N Slash", "clash_n_slash", "Dein Heimatplanet wird von zahlreichen feindlichen UFOs angegriffen.<br>Deine Aufgabe besteht darin die feindlichen Flugobjekte abzuschießen, damit sie deine Heimat nicht plündern oder gar vernichten.", "clash_n_slash.jpg", 480, 360, 7)') or error('Unable to add game Clash N Slash', __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 ("Plops", "plops", "Produziere soviele Plops wie möglich ohne das sie das Spielfeld verlassen.", "plops.jpg", 398, 398, 7)') or error('Unable to add game Plops', __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 ("UFO", "ufo", "Versuche innerhalb von 60 Sekunden soviele UFOs wie möglich abzuschiessen.", "ufo.jpg", 550, 400, 7)') or error('Unable to add game UFO', __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 ("Hot Air", "hotair", "Hot Air ist eines der schönsten Flash Action Puzzles.<br> Benutze einen Ventilator um den Ballon durch die 24 verschiedenen Level zu lenken.", "hotair.jpg", 550, 400, 4)') or error('Unable to add game Hot Air', __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 ("Flash Strike Rookie", "flashstriker", "Das Spiel ein erstklassiger Counter-Strike Ego Shooter bei dem der Spieler in die Rolle eines Elite-Soldaten schlüpft und mit Waffengewalt Terroristen aufhalten muss.", "flashstrike.jpg", 650, 450, 2)') or error('Unable to add game Hot Air', __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 ("Flash Strike Veteran", "flashstrikev", "Das Spiel ein erstklassiger Counter-Strike Ego Shooter bei dem der Spieler in die Rolle eines Elite-Soldaten schlüpft und mit Waffengewalt Terroristen aufhalten muss.", "flashstrike.jpg", 650, 450, 2)') or error('Unable to add game Hot Air', __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 ("IBM Soccer", "ibm", "Schiesse innerhalb von 4 Minuten soviele Tore wie möglich.", "ibm.jpg", 700, 500, 9)') or error('Unable to add game IBM Soccer', __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 ("3 on 1", "3on1", "Drei Angreifer gegen einen Abwehspieler. Klingt einfach oder?", "3on1.jpg", 700, 525, 9)') or error('Unable to add game 3 on 1', __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 ("Freekick", "freekick", "In diesem Spiel schlüpft der Spieler in die Rolle des Freistossschützen und muss versuchen den Torwart zu überwinden.<br>Per Mausklick kann die Schussrichtung, Drall und Power bestimmt werden.", "freekick.jpg", 720, 480, 9)') or error('Unable to add game Hot Air', __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 ("Shoot Em In", "shootemin", "Ziel des Spiels ist es die Freistöße hintereinander zu verwandeln.<br>Du hast 10  Versuche um alle 9 Level zu meistern.", "shootemin.jpg", 352, 416, 9)') or error('Unable to add game Shoot Em In', __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 ("Add It Up", "additup", "Um eine bestimmte Zahl zu erreichen muss man einzelne Zahlen durch anklicken addieren.", "additup.jpg", 550, 400, 3)') or error('Unable to add game Add It Up', __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 ("Driving Mad", "drivingmad", "Bei diesem Golfspiel muss Du eine bestimmte Anzahl an Bällen auf das Grün schlagen.", "drivingmad.jpg", 800, 600, 9)') or error('Unable to add game Driving Mad', __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 ("Word Spell", "wordspell", "Hier musst Du aus den vorgegebene Buchstaben sinnvolle Wörter bilden.", "wordspell.jpg", 640, 460, 3)') or error('Unable to add game Freekick', __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 ("Newtons Nightmare", "newtonsnightmare", "Hier muss man durch anklicken zweier Äpfel diese so drehen das Kombinationen aus mindestens drei gleichen Äpfeln entstehen.", "newtonsnightmare.jpg", 525, 325, 3)') or error('Unable to add game Newtons Nightmare', __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 ("Zig Zag", "zigzag", "Hier müssen zwei gleiche Teile angeklickt werden um diese vom Brett zu entfernen.", "zigzag.jpg", 500, 370, 3)') or error('Unable to add game Zig Zag', __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>