PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2006-04-10 22:27:29

Pandark
Member
From: France
Registered: 2005-08-28
Posts: 57
Website

PunArcade 1.1

Code:

##
##        Mod title:  PunArcade
##
##      Mod version:  1.1
##   Works on PunBB:  1.2.11
##     Release date:  2006/04/10
##           Author:  Pandark
##
##      Description:  This mod add flash games to your favorite forum.
##                         Users' scores are registered in the sql.
##
##       Affects DB:  Yes
##
##   Affected files:  none
##
##            Notes:  You can find games here:
##                       http://phpbb-amod.com/down_db.php?page=cat&id=910
##                       You can find games-packs here:
##                       http://phpbb-amod.com/down_db.php?page=cat&id=911
##
##       Disclaimer:  PunArcade is not officially supported by PunBB.
##                    Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##          License:  PunArcade is free software; you can redistribute it
##                    and/or modify it under the terms of the GNU General
##                    Public License as published by the Free Software
##                    Foundation; either version 2 of the License, or
##                    (at your option) any later version.
##                    Each flash game are the property of their authors.
##
##     Contributors:  nico_somb (Arcade Mod)
##                    Fil1958
##                    Elianora la blanche
##                    Blackstaffe (English lang file improvement)
##

Download here


.        .._ -Pandark- _..        .
         Serial Dreamer

Offline

 

#2 2006-04-10 23:22:56

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Offline

 

#3 2006-04-10 23:30:08

Pandark
Member
From: France
Registered: 2005-08-28
Posts: 57
Website

Re: PunArcade 1.1

Yes, but there are many dfference between the two mods..
Database, files names and a big part of the code have been changed.


.        .._ -Pandark- _..        .
         Serial Dreamer

Offline

 

#4 2006-04-11 00:17:48

xxtubbyxx
Member
Registered: 2005-12-15
Posts: 168

Re: PunArcade 1.1

well after i had finished installing this mod it seemed fine to me. When i had went to test it out i came up with this error. It might be a small error in this paticular file that you may need to fix.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fatalgam/public_html/forum/arcade_play.php on line 26

Thats the error im gettin.


Coming to you soon: FatalGamers

Offline

 

#5 2006-04-11 00:30:27

neod06
Guest

Re: PunArcade 1.1

Traduction en francais/In french de l'admin :

Code:

<?php

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

//===========================================================================//
//= Start the script code =//

$action = isset($_GET['action']) ? $_GET['action'] : NULL;
$shortname = isset($_GET['shortname']) ? $_GET['shortname'] : NULL;


//===========================================================================//
//= Add Action game =//
if($action == 'add')
{
    //if your saving the game
    if(isset($_POST['form_sent']))
    {
        // Check to see if the shortname, name and description were sent
        if(empty($_POST['shortname']))
            message('Vous devez entrer un ID pour votre jeu');
        if(empty($_POST['name']))
            message('Vous devez entrer un nom pour votre jeu');
        elseif(empty($_POST['description']))
            message('Vous devez entrer une description pour votre jeu');
        elseif(empty($_POST['img_ext']))
            message('Vous devez entrer une extension d\'image pour votre jeu');

        // Clean up shortname, name and description from POST
        $shortname = pun_trim($_POST['shortname']);
        $name = pun_trim($_POST['name']);
        $description = pun_linebreaks(addslashes($_POST['description']));
        $img_ext = pun_trim($_POST['img_ext']);

        //insert the game in the database
        $db->query('INSERT INTO '.$db->prefix.'arcade_games (shortname, name, description, img_ext) VALUES("'.$shortname.'", "'.$name.'", "'.$description.'", "'.$img_ext.'")') or error('Impossible de sauvegarder le jeu', __FILE__, __LINE__, $db->error());
        redirect('arcade_play.php?g='.$shortname, 'Jeu ajouté avec succès, Redirection &hellip;');
    }

    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
    <div class="blockform">
        <h2><span>Add game</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=<?php echo $action ?>">
                <input type="hidden" name="form_sent" value="TRUE" />
                <div class="inform">
                    <fieldset>
                        <legend>Entrer les reglages du jeu et la description</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <td><strong>ID du jeu</strong> <br/> <input type="text" name="shortname" size="50" tabindex="1" /><span>C'est le nom du flash sans l'extension</span></td>

                                </tr>
                                <tr>
                                    <td><strong>Nom du jeu</strong> <br/> <input type="text" name="name" size="50" tabindex="1" /></td>
                                </tr>
                                <tr>
                                    <td><textarea name="description" tabindex="2" rows="8" cols="50" style="width:100%"></textarea></td>
                                </tr>
                                <tr>
                                    <td><strong>Extension d'image</strong>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="img_ext" value="gif" checked />&nbsp;<strong>gif</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="img_ext" value="jpg" />&nbsp;<strong>jpg</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="img_ext" value="png" />&nbsp;<strong>png</strong>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="submit" value="Envoyer" tabindex="3" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>
<?php
}

//===========================================================================//
//= Edit Action game =//
elseif($action == 'edit')
{
    //if your saving the game
    if(isset($_POST['form_sent']))
    {
        // Check to see if the shortname, name and description were sent
        if(empty($_POST['shortname']))
            message('Vous devez entrer un ID pour votre jeu');
        if(empty($_POST['name']))
            message('Vous devez entrer un nom pour votre jeu');
        elseif(empty($_POST['description']))
            message('Vous devez entrer une description pour votre jeu');
        elseif(empty($_POST['img_ext']))
            message('Vous devez entrer une extension d\'image pour votre jeu');
            
        // Clean up shortname, name and description from POST
        $shortname = pun_trim($_POST['shortname']);
        $name = pun_trim($_POST['name']);
        $description = pun_linebreaks(addslashes($_POST['description']));
        $img_ext = pun_trim($_POST['img_ext']);
        $disp_position = pun_trim($_POST['disp_position']);
        
        $db->query('UPDATE '.$db->prefix.'arcade_games SET shortname="'.$shortname.'", name="'.$name.'", description="'.$description.'", disp_position="'.$disp_position.'", img_ext="'.$img_ext.'" WHERE shortname="'.$shortname.'"') or error('Impossible de mettre a jour le jeu', __FILE__, __LINE__, $db->error());
                
        redirect('admin_loader.php?plugin='.$plugin, 'Jeu ajouté avec succès, Redirection &hellip;');
    }

    //pull out game info
    $result = $db->query("SELECT shortname, name, description, img_ext, disp_position FROM ".$db_prefix."arcade_games WHERE shortname='".$shortname."'") or error('Impossible de trouver les informations du jeu', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result))
        message($lang_common['Bad request']);

    $data = $db->fetch_assoc($result);

    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
    <div class="blockform">
        <h2><span>Editer jeu</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=<?php echo $action ?>&amp;shortname=<?php echo $shortname ?>">
                <input type="hidden" name="form_sent" value="TRUE" />
                <input type="hidden" name="shortname" value="<?php echo $data['shortname']?>" size="50" tabindex="1" />
                <div class="inform">
                    <fieldset>
                        <legend>Entrer les reglages du jeu et la description</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <td><strong>ID du jeu</strong> <br/> <span><?php echo $data['shortname']?></span></td>
                                </tr>
                                <tr>
                                    <td><strong>Nom du jeu</strong> <br/> <input type="text" name="name" value="<?php echo $data['name']?>" size="50" tabindex="1" /></td>
                                </tr>
                                <tr>
                                    <td><textarea name="description" tabindex="2" rows="8" cols="50" style="width:100%"><?php echo pun_htmlspecialchars($data['description'])?></textarea></td>
                                </tr>
                                <tr>
                                    <td><strong>Extension d'image</strong>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="img_ext" value="gif"<? if ($data['img_ext'] == 'gif') { echo ' checked'; } ?> />&nbsp;<strong>gif</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="img_ext" value="jpg"<? if ($data['img_ext'] == jpg) { echo ' checked'; } ?> />&nbsp;<strong>jpg</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="img_ext" value="png"<? if ($data['img_ext'] == png) { echo ' checked'; } ?> />&nbsp;<strong>png</strong>
                                </tr>
                                <tr>
                                    <td><strong>Position</strong> <br/> <input type="text" name="disp_position" value="<?php echo $data['disp_position']?>" size="10" tabindex="1" /></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="submit" value="Envoyer" tabindex="3" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>
<?php
}
//===========================================================================//
//= Delete Action game =//
elseif($action == 'delete')
{
    if(isset($_POST['delete_comply']))
    {
        //There isnt anything to do but delete the post and redirect
        $db->query('DELETE FROM '.$db->prefix.'arcade_games WHERE shortname="'.$shortname.'"') or error('Impossible de supprimer le jeu', __FILE__, __LINE__, $db->error());
        
        redirect('admin_loader.php?plugin='.$plugin, 'Jeu supprimé avec succès, Redirection &hellip;');
    }
        
    //Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div class="blockform">
        <h2><span>Supprimer jeu</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=<?php echo $action?>&amp;shortname=<?php echo $shortname ?>">
                <div class="inform">
                    <fieldset>
                        <legend>Important: avant de supprimer</legend>
                        <div class="infldset">
                            <p>Merci de confimer que vous voulez réelement supprimer ce jeu.</p>
                            <p class="warntext"><strong>Attention : Les jeux supprimés ne peuvent être restaurés</strong></p>                                
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="delete_comply" value="Supprimer" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>

<?php
}

//===========================================================================//
//= General Config Action =//
elseif($action == 'general')
{

    //if your saving the game
    if(isset($_POST['form_sent']))
    {

        // Clean up shortname, name and description from POST
        $pam_guest_list = pun_trim(intval($_POST['pam_guest_list']));
        $pam_guest_scores = pun_trim(intval($_POST['pam_guest_scores']));
        $pam_guest_play = pun_trim(intval($_POST['pam_guest_play']));
        
        $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$pam_guest_list.' WHERE conf_name="pam_guest_list" LIMIT 1') or error('Impossible de mettre à jour la configuration', __FILE__, __LINE__, $db->error());
        $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$pam_guest_scores.' WHERE conf_name="pam_guest_scores" LIMIT 1') or error('Impossible de mettre à jour la configuration', __FILE__, __LINE__, $db->error());
        $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$pam_guest_play.' WHERE conf_name="pam_guest_play" LIMIT 1') or error('Impossible de mettre à jour la configuration', __FILE__, __LINE__, $db->error());

        // Regenerate the config cache
        require_once PUN_ROOT.'include/cache.php';
        generate_config_cache();

        redirect('admin_loader.php?plugin='.$plugin.'&amp;action=general','Jeu édité avec succès, Redirection &hellip;');

    }

    // Display the admin navigation menu
    generate_admin_menu($plugin);

    if (!function_exists('generate_config_cache')) // If the file include/cache.php wasn't already included, include it now
        require PUN_ROOT.'include/cache.php';

?>
    <div class="blockform">
        <h2><span>Configuration</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=general">
                <input type="hidden" name="form_sent" value="TRUE" />
                <div class="inform">
                    <fieldset>
                        <legend>Entrer la configuration</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <td><strong>Autoriser les invités à voir la liste des jeux</strong></td>
                                    <td><input type="radio" name="pam_guest_list" value="1"<? if ($pun_config['pam_guest_list'] == '1') { echo ' checked'; } ?> />Oui&nbsp;&nbsp;<input type="radio" name="pam_guest_list" value="0"<? if ($pun_config['pam_guest_list'] == '0') { echo ' checked'; } ?> />Non</td>
                                </tr>
                                <tr>
                                    <td><strong>Autoriser les invités à voir le tableau des scores</strong></td>
                                    <td><input type="radio" name="pam_guest_scores" value="1"<? if ($pun_config['pam_guest_scores'] == '1') { echo ' checked'; } ?> />Oui&nbsp;&nbsp;<input type="radio" name="pam_guest_scores" value="0"<? if ($pun_config['pam_guest_scores'] == '0') { echo ' checked'; } ?> />Non</td>
                                </tr>
                                <tr>
                                    <td><strong>Autoriser les invités à jouer</strong></td>
                                    <td><input type="radio" name="pam_guest_play" value="1"<? if ($pun_config['pam_guest_play'] == 1) { echo ' checked'; } ?> />Oui&nbsp;&nbsp;<input type="radio" name="pam_guest_play" value="0"<? if ($pun_config['pam_guest_play'] == 0) { echo ' checked'; } ?> />Non</td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="submit" value="Envoyer" tabindex="3" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>
<?php
}

//===========================================================================//
//= Selection game =//
else
{    
    //Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div class="blockform">
        <h2><span>Jeux</span></h2>
        <div class="box">
            <div class="fakeform">
                <p><a href="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=general">Configuration</a></p>
                <p><a href="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=add">Ajouter un jeu</a></p>
                <div class="inform">
                    <fieldset>
                    <legend>Jeux existants</legend>
                        <div class="infldset">
                            <table cellspacing="0">
<?php
    //get all games info from the DB
    $result = $db->query('SELECT shortname, name, disp_position FROM '.$db->prefix.'arcade_games ORDER BY disp_position ASC') or error('Impossible de trouver les jeux dans la base de donnée', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result))
    {
        while($data = $db->fetch_assoc($result))
            echo "\t\t\t\t\t\t\t".'<tr>'."\n\t\t\t\t\t\t\t\t".'<th scope="row">'."\n\t\t\t\t\t\t\t\t\t".'<a href="admin_loader.php?plugin='.$plugin.'&amp;action=delete&amp;shortname='.$data['shortname'].'">Supprimer</a> | '."\n\t\t\t\t\t\t\t\t\t".'<a href="admin_loader.php?plugin='.$plugin.'&amp;action=edit&amp;shortname='.$data['shortname'].'">Editer</a>'."\n\t\t\t\t\t\t\t\t".'</th>'."\n\t\t\t\t\t\t\t\t".'<td><a href="arcade_play.php?g='.$data['shortname'].'">'.$data['name'].'</a>&nbsp;&nbsp;</td><td><strong>'.$data['disp_position'].'</strong></td>'."\n\t\t\t\t\t\t\t".'</tr>'."\n";
    }
    else
        echo "\t\t\t\t\t\t\t".'<tr>'."\n\t\t\t\t\t\t\t\t".'<th scope="row">Il n\'y a aucun jeu dans la base de donnée</td>'."\n\t\t\t\t\t\t\t".'</tr>'."\n";
?>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p><a href="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=general">Configuration</a></p>
                <p><a href="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=add">Ajouter un jeu</a></p>
            </div>
        </div>
    </div>

<?php    
}

// Le script s'arrete ici, le footer sera ajouté par admin_loader.php.
 

#6 2006-04-11 00:32:56

xxtubbyxx
Member
Registered: 2005-12-15
Posts: 168

Re: PunArcade 1.1

umm im sorry im not french....im trying to understand you but could either you or someone else possibly translate all of this for me.


Coming to you soon: FatalGamers

Offline

 

#7 2006-04-11 20:01:42

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Re: PunArcade 1.1

on the topic we had came up with dieas to make it better and some one i think created a thing where you can set the size of the game for better gameplay is there any was you can add that to the mod and by the game there is a thing that says highscore By user

TOPIC:
http://forums.punbb.org/viewtopic.php?id=10882


This if you dont understand go to my arcade i am using the other script on it because it has the game dimeson setting...
http://forum1.dharmil.info/arcade.php

Offline

 

#8 2006-04-11 20:04:01

Pandark
Member
From: France
Registered: 2005-08-28
Posts: 57
Website

Re: PunArcade 1.1

xxtubbyxx wrote:

umm im sorry im not french....im trying to understand you but could either you or someone else possibly translate all of this for me.

That has nothing to see with your problem, it's a french translation of AP_PunArcade.php

I don't know how your problem occured... I've no problem on my test forum and the arcade_play.php file is the same...
What is in your database now ?

Last edited by Pandark (2006-04-11 20:09:59)


.        .._ -Pandark- _..        .
         Serial Dreamer

Offline

 

#9 2006-04-11 20:25:47

Pandark
Member
From: France
Registered: 2005-08-28
Posts: 57
Website

Re: PunArcade 1.1

dharmil wrote:

[...] you can set the size of the game for better gameplay

I think that it's not very useful, but if some people want it, I can add this smile


.        .._ -Pandark- _..        .
         Serial Dreamer

Offline

 

#10 2006-04-11 20:28:12

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Re: PunArcade 1.1

thanks you

Offline

 

#11 2006-04-11 21:11:43

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Re: PunArcade 1.1

i also thing page numbering would also be a nice addon like display 10 games per page

Offline

 

#12 2006-04-12 03:04:35

Blackstaffe
Member
From: Canada
Registered: 2006-04-09
Posts: 17

Re: PunArcade 1.1

I think A little advantage would be changing. line 58 in arcade_ranking.php  from:

Code:

<h2><?php echo 'Scores pour le jeu "'.$line['name'].'".' ?></h2>

to

Code:

<h2><? echo $lang_arcade['current high scores'] ?><?php echo ' "'.$line['name'].'".' ?></h2><? echo  ?>

and then add:

Code:

'current high scores'            =>    'Current high scores for ',

to lang/arcade.php



just to make it more language friendly smile

Last edited by Blackstaffe (2006-04-12 03:05:05)

Offline

 

#13 2006-04-12 06:39:54

psy02
Guest

Re: PunArcade 1.1

Display 8~10 games per page... I think, it would be nice smile

 

#14 2006-04-13 01:02:47

xxtubbyxx
Member
Registered: 2005-12-15
Posts: 168

Re: PunArcade 1.1

hi im sorry but if anyone has gotten this mod to work could you please post underneath and then maybe pm me or email me about it? I downloaded the files and placed them in the correctdirectories, installed the mod, removed the install_mod.php file and went to go test play the games. Every game i go to play i get an error inside my arcade_play.php  If you dont know what im talking about you can view the error by going to http://www.fatalgamers.org/forum/arcade … snakeneave for an example of my error. Also if you want to test and see if its a problem with the game or not you can jsut switch games and it will give you the same error.

Last edited by xxtubbyxx (2006-04-13 01:03:03)


Coming to you soon: FatalGamers

Offline

 

#15 2006-04-13 05:27:46

Blackstaffe
Member
From: Canada
Registered: 2006-04-09
Posts: 17

Re: PunArcade 1.1

Try adding a new game and see if it's just your mysql table is messed up.

Offline

 

#16 2006-04-15 09:08:14

ango
Member
From: Germany
Registered: 2006-03-06
Posts: 21

Re: PunArcade 1.1

Nice to see the enhancement of the arcade mod. :-)

I´ve added page links and some other optical changes to the mod in this forum: http://forums.punbb.org/viewtopic.php?id=10882&p=2 , on post number #38 you can download my little modification and lots of games for this mod I´ve converted.
You can test it here, User= punbb PW=test. Just klick on "Forum" after login to see the arcade games.

I´m not a programer but I´ve tested a lot and its working for me.

Maybe this helps to enhance this great mod.

Last edited by ango (2006-04-15 10:10:23)


My PunBB Arcade Mod & Game Packs 1-9 (update 01-06-2007):
Test and download here !

Offline

 

#17 2006-04-15 12:49:38

Pandark
Member
From: France
Registered: 2005-08-28
Posts: 57
Website

Re: PunArcade 1.1

ango wrote:

Nice to see the enhancement of the arcade mod. :-)

I´ve added page links and some other optical changes to the mod in this forum: http://forums.punbb.org/viewtopic.php?id=10882&p=2 , on post number #38 you can download my little modification and lots of games for this mod I´ve converted.
You can test it here, User= punbb PW=test. Just klick on "Forum" after login to see the arcade games.

I´m not a programer but I´ve tested a lot and its working for me.

Maybe this helps to enhance this great mod.

There are many differences between your modification and this one..
This mod is not nico_somb's original one (see install.php and files code and you will know that there are many differences..)


.        .._ -Pandark- _..        .
         Serial Dreamer

Offline

 

#18 2006-04-15 15:29:49

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Re: PunArcade 1.1

yes but is there any why you can add some of those features...

Offline

 

#19 2006-04-15 19:34:24

thething
Member
Registered: 2006-01-20
Posts: 10

Re: PunArcade 1.1

project page down ? Anyone can send a mirror for this mod?

Offline

 

#20 2006-04-15 20:10:01

Pandark
Member
From: France
Registered: 2005-08-28
Posts: 57
Website

Re: PunArcade 1.1

[removed: punres bug is fixed now]

Last edited by Pandark (2006-04-18 11:46:27)


.        .._ -Pandark- _..        .
         Serial Dreamer

Offline

 

#21 2006-04-15 20:17:43

thething
Member
Registered: 2006-01-20
Posts: 10

Re: PunArcade 1.1

Pandark wrote:

http://pandark.site.voila.fr/arcade_1_1.zip

thankx waitin long time for this mod wink

Offline

 

#22 2006-04-15 20:30:45

thething
Member
Registered: 2006-01-20
Posts: 10

Re: PunArcade 1.1

awesome mod xD

Offline

 

#23 2006-04-16 20:50:29

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Re: PunArcade 1.1

um question

i have altered your plugin for this mod and mod it so it works for another arcade mod
http://forums.punbb.org/viewtopic.php?id=10882&p=1
is this ok with you....
this is what i did to your plugins

Code:

<?php
/***********************************************************************
  This file Based On Another Mod's Plugin:
  http://www.punres.net/desc.php?pid=228
************************************************************************/

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

//===========================================================================//
//= Start the script code =//

$action = isset($_GET['action']) ? $_GET['action'] : NULL;
$id = isset($_GET['id']) ? $_GET['id'] : NULL;


//===========================================================================//
//= Add Action game =//
if($action == 'add')
{
    //if your saving the game
    if(isset($_POST['form_sent']))
    {
        // Check to see if the shortname, name and description were sent
        if(empty($_POST['flash']))
            message('You need to enter a game file');
        if(empty($_POST['name']))
            message('You need to enter a name for your game');
            if(empty($_POST['id']))
            message('You need to enter a id for your game');
                    if(empty($_POST['id']))
            message('You need to enter a width for your game');
                    if(empty($_POST['height']))
            message('You need to enter a height for your game');
        elseif(empty($_POST['description']))
            message('You need to enter description for your game');
        elseif(empty($_POST['img_ext']))
            message('You need to enter image for your game');

        // Clean up shortname, name and description from POST
        $flash = pun_trim($_POST['flash']);
        $name = pun_trim($_POST['name']);
        $id = pun_trim($_POST['id']);
        $width = pun_trim($_POST['width']);
        $height = pun_trim($_POST['height']);
        $description = pun_linebreaks(addslashes($_POST['description']));
        $img_ext = pun_trim($_POST['img_ext']);

        //insert the game in the database
        $db->query('INSERT INTO '.$db->prefix.'jeux (jeux_id, jeux_name, jeux_fichier, jeux_desc, jeux_img, width, height) VALUES("'.$id.'", "'.$name.'", "'.$flash.'", "'.$description.'", "'.$img_ext.'", "'.$width.'", "'.$height.'")') or error('Unable to Add game', __FILE__, __LINE__, $db->error());
        redirect('arcade_play.php?id='.$id, 'Game sucessfully added, Redirecting &hellip;');
    }

    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
    <div class="blockform">
        <h2><span>Add game</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=<?php echo $action ?>">
                <input type="hidden" name="form_sent" value="TRUE" />
                <div class="inform">
                    <fieldset>
                        <legend>Enter game settings and description</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <td><strong>Name:</strong> <br/> <input type="text" name="name" size="50" tabindex="1" />
                                    <span>This is the name of the game</span></td>
                                    </tr>
                                                                <tr>
                                    <td><strong>Image</strong>: <br/> <input type="text" name="img_ext" size="50" tabindex="1" />
                                    <span>Image file example : image.gif</span></td>
                                    </tr>
                                <tr>
                                    <td><strong>ID - Location</strong> <br/> <input type="text" name="id" size="50" tabindex="1" /><span>This is the id of the game <strong>very important</strong> This also sets a location for the game.</span></td>
                                </tr>
                                <tr>
                                  <td><strong>Flash file Name</strong> <br/> <input type="text" name="flash" size="50" tabindex="1" />.swf</td>
                                    
                                </tr>
                                <tr>
                                    <td><strong>Description:</strong><br /><textarea name="description" tabindex="2" rows="8" cols="50" style="width:100%"></textarea></td>
                                </tr>
                            <tr>
                                    <td><strong>Width</strong> <input type="text" name="width" size="50" tabindex="1" /><br />
 <strong>height</strong> <input type="text" name="height" size="50" tabindex="1" /><br />

 <span>Width/ Height of game</span></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="submit" value="Submit" tabindex="3" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>
<?php
}

//===========================================================================//
//= Edit Action game =//
elseif($action == 'edit')
{
    //if your saving the game
    if(isset($_POST['form_sent']))
    {
        if(empty($_POST['flash']))
            message('You need to enter a shortname for your game');
        if(empty($_POST['name']))
            message('You need to enter a name for your game');
            if(empty($_POST['id']))
            message('You need to enter a name for your game');
                    if(empty($_POST['id']))
            message('You need to enter a width for your game');
                    if(empty($_POST['height']))
            message('You need to enter a height for your game');
        elseif(empty($_POST['description']))
            message('You need to enter description for your game');
        elseif(empty($_POST['img_ext']))
            message('You need to enter image extension for your game');

        // Clean up shortname, name and description from POST
        $flash = pun_trim($_POST['flash']);
        $name = pun_trim($_POST['name']);
        $id = pun_trim($_POST['id']);
        $width = pun_trim($_POST['width']);
        $height = pun_trim($_POST['height']);
        $description = pun_linebreaks(addslashes($_POST['description']));
        $img_ext = pun_trim($_POST['img_ext']);
        
        $db->query('UPDATE '.$db->prefix.'jeux SET jeux_name="'.$name.'", jeux_fichier="'.$flash.'", jeux_desc="'.$description.'", jeux_id="'.$id.'",  jeux_img="'.$img_ext.'", width="'.$width.'", height="'.$height.'" WHERE jeux_id="'.$id.'"') or error('Unable to update game', __FILE__, __LINE__, $db->error());
                
        redirect('admin_loader.php?plugin='.$plugin, 'game Sucessfully edited, Redirecting &hellip;');
    }

    //pull out game info
    $result = $db->query("SELECT jeux_id, jeux_name, jeux_fichier, jeux_desc, jeux_img, width, height FROM ".$db_prefix."jeux WHERE jeux_id='".$id."'") or error('Unable to fetch game information', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result))
        message($lang_common['Bad request']);

    $data = $db->fetch_assoc($result);

    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
    <div class="blockform">
        <h2><span>Edit Game</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=<?php echo $action ?>&amp;id=<?php echo $id ?>">
                <input type="hidden" name="form_sent" value="TRUE" />
                <input type="hidden" name="shortname" value="<?php echo $data['id']?>" size="50" tabindex="1" />
                <div class="inform">
                    <fieldset>
                        <legend>Enter game settings and description</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <td><strong>Game Name</strong> <br/> <input type="text" name="name" value="<?php echo $data['jeux_name']?>" size="50" tabindex="1" /></td>
                                </tr>
                                                                <tr>
                                    <td><strong>Game Id</strong> <br/> <input type="text" name="id" value="<?php echo $data['jeux_id']?>" size="50" tabindex="1" /></td>
                                </tr>
                                <tr>
                                    <td><textarea name="description" tabindex="2" rows="8" cols="50" style="width:100%"><?php echo pun_htmlspecialchars($data['jeux_desc'])?></textarea></td>
                                </tr>
                                <tr>
                                    <td><strong>Image</strong> <br/> <input type="text" name="img_ext" value="<?php echo $data['jeux_img']?>" size="50" tabindex="1" /></td>
                                </tr>
                                <tr>
                                    <td><strong>Flash FIle</strong> <br/> <input type="text" name="flash" value="<?php echo $data['jeux_fichier']?>" size="50" tabindex="1" />.swf</td>
                                </tr>
                                <tr>
                                    <td><strong>Width</strong> <br/> <input type="text" name="width" value="<?php echo $data['width']?>" size="50" tabindex="1" /></td>
                                </tr>
                                                                <tr>
                                    <td><strong>Height</strong> <br/> <input type="text" name="height" value="<?php echo $data['height']?>" size="50" tabindex="1" /></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="submit" value="Submit" tabindex="3" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>
<?php
}
//===========================================================================//
//= Delete Action game =//
elseif($action == 'delete')
{
    if(isset($_POST['delete_comply']))
    {
        //There isnt anything to do but delete the post and redirect
        $db->query('DELETE FROM '.$db->prefix.'jeux WHERE jeux_id="'.$id.'"') or error('Unable to delete game', __FILE__, __LINE__, $db->error());
        
        redirect('admin_loader.php?plugin='.$plugin, 'Game Sucessfully Deleted, Redirecting &hellip;');
    }
        
    //Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div class="blockform">
        <h2><span>Delete Game</span></h2>
        <div class="box">
            <form id="example" method="post" action="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=<?php echo $action?>&amp;id=<?php echo $id ?>">
                <div class="inform">
                    <fieldset>
                        <legend>Important: read before deleting</legend>
                        <div class="infldset">
                            <p>Please confirm that you want to delete this game.</p>
                            <p class="warntext"><strong>Warning! Deleted Games cannot be restored</strong></p>                                
                        </div>
                    </fieldset>
                </div>
                <p><input type="submit" name="delete_comply" value="Delete" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
            </form>
        </div>
    </div>

<?php
}

//===========================================================================//
//= Selection game =//
else
{    
    //Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div class="blockform">
        <h2><span>PunArcade Games</span></h2>
        <div class="box">
            <div class="fakeform">

                <p><a href="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=add">Add New Game</a></p>
                <div class="inform">
                    <fieldset>
                    <legend>Existing games</legend>
                        <div class="infldset">
                            <table cellspacing="0">
<?php
    //get all games info from the DB
    $result = $db->query('SELECT jeux_name, jeux_id FROM '.$db->prefix.'jeux ORDER BY jeux_id ASC') or error('Unable to select games from database', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result))
    {
        while($data = $db->fetch_assoc($result))
            echo "\t\t\t\t\t\t\t".'<tr>'."\n\t\t\t\t\t\t\t\t".'<th scope="row">'."\n\t\t\t\t\t\t\t\t\t".'<a href="admin_loader.php?plugin='.$plugin.'&amp;action=delete&amp;id='.$data['jeux_id'].'">Delete</a> | '."\n\t\t\t\t\t\t\t\t\t".'<a href="admin_loader.php?plugin='.$plugin.'&amp;action=edit&amp;id='.$data['jeux_id'].'">Edit</a>'."\n\t\t\t\t\t\t\t\t".'</th>'."\n\t\t\t\t\t\t\t\t".'<td><a href="arcade_play.php?id='.$data['jeux_id'].'">'.$data['jeux_name'].'</a>&nbsp;&nbsp;</td><td><strong>'.$data['jeux_id'].'</strong></td>'."\n\t\t\t\t\t\t\t".'</tr>'."\n";
    }
    else
        echo "\t\t\t\t\t\t\t".'<tr>'."\n\t\t\t\t\t\t\t\t".'<th scope="row">There are no games in the database</td>'."\n\t\t\t\t\t\t\t".'</tr>'."\n";
?>
                            </table>
                        </div>
                    </fieldset>
                </div>

                <p><a href="admin_loader.php?plugin=<?php echo $plugin ?>&amp;action=add">Add New Game</a></p>
            </div>
        </div>
    </div>

<?php    
}

// Note that the script just ends here. The footer will be included by admin_loader.php.

Well i also gave you credit as you can see at the top

Code:

/***********************************************************************
  This file Based On Another Mod's Plugin:
  http://www.punres.net/desc.php?pid=228
************************************************************************/

Offline

 

#24 2006-04-16 21:01:31

Blackstaffe
Member
From: Canada
Registered: 2006-04-09
Posts: 17

Re: PunArcade 1.1

Why post it here?

Offline

 

#25 2006-04-16 21:13:12

dharmil
Member
Registered: 2006-03-18
Posts: 20
Website

Re: PunArcade 1.1

um i wanted to ask him its his mod...

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.