IB Pro v32 Arcade Game Compatibility for v3 Arcade

This hack / modification is to add support in v3 Arcade for the many v32 IB Pro games that are out there.
Note v3 Arcade v1.0.9 and above has built in support for this. Use only on earlier versions.

OBS! I don’t guarantee this work for every v32 game.
And you should also know that this is simplified solution and it doesn’t implement all the so called security features with the v32 games.
It is pretty much the same security as v3 arcade games though.

To get full support with an improved ‘iB “Pro” Arcade – Mass Game Import’ function you also has to edit the arcadeadmin.php file.
This improvement also copies the gamedata folder in the tar package.
Note that the empty file v32game.txt is not copied (nor an empty index.html, if there are any).
This doesn’t matter if you use my plugin since that file isn’t checked anyway.

How to do it:
Download the zip packages above.
Import the file ‘iB Pro v32 Arcade Game Compatibility.xml’ as a plugin.
(Via “Plugin & Products” > “Download / Upload Plugins” > “Import Plugin Definitions XML File” in your Admin CP.)

Create the folder “arcade” in the forum root.
Create the folder “gamedata” in the newly created “arcade” folder and CHMOD it to 777.

Edit the file admincp/arcadeadmin.php
Warning! Copy the original arcadeadmin.php first, just in case…
You are doing this at your own risk. This will copy and delete files on your server. Don’t blame me if anything goes wrong.

FIND:

        @unlink($image_path . '/' . $thisgame['shortname'] . '1.gif'); 
        @unlink($image_path . '/' . $thisgame['shortname'] . '2.gif'); 
        @unlink($game_path . '/' . $thisgame['shortname'] . '.swf');  

BELOW IT ADD:

// Addition for uninstalling IBPro v32 games! 
// Tries to delete the game folder in arcade/gamedata/  
// 2007-10-28 /SK
        foreach( glob('arcade/gamedata/' . $thisgame['shortname'] . '/*.*') as $sk_fn)
        {
            @unlink( $sk_fn );
        }
        rmdir( 'arcade/gamedata/' . $thisgame['shortname'] );
// End. Addition för uninstalling IBPro v32 games 

FIND:

        if (substr($filename, strlen($filename)-4, 4) == '.tar') 
        { 
            $gametar = new tar; 
            if ($gametar->openTAR($vbulletin->GPC['filepath'] . '/' . $filename)) 
            {
               foreach ($gametar->files as $key => $val)
               { 

BELOW IT ADD:

// Addition for installing IBPro v32 games! 
// If there is a folder called gamedata in the tar it will copy all files in there to the forumroot/arcade/gamedata folder 
// 2007-10-28 /SK 
                    if( ($startpathpos = strpos( $val['name'], 'gamedata/')) !== false ) 
                    {     
                        $newpath = $real_path . '/../../arcade/gamedata'; 
                        $startpathpos += 9;
                        while( ($endpathpos = strpos( $val['name'], '/', $startpathpos )) != 0 )
                        {
                            $newpath .= '/' . substr( $val['name'], $startpathpos, $endpathpos - $startpathpos );
                            @mkdir($newpath , 0777);
 
                            $startpathpos = $endpathpos + 1;
                        }
 
                        $newfile = $newpath . '/' . substr( $val['name'], $startpathpos );
 
                        if ($handle = fopen($newfile, "wb") )
                        {
                            fputs($handle, $val['file'], strlen($val['file']));
                            fclose($handle);
                        }
                    }
// End. Addition för installing IBPro v32 games 

Done!