vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   ibProArcade Archive (https://vborg.vbsupport.ru/forumdisplay.php?f=174)
-   -   Small hack to allow game installations from a remote server (with 1550 or so games) (https://vborg.vbsupport.ru/showthread.php?t=128520)

fsw 10-07-2006 08:46 PM

Small hack to allow game installations from a remote server (with 1550 or so games)
 
1 Attachment(s)
I do need this tested - as the way I set it up its just a bit of a pain to test myself :(

With my limited testing, it appears to work - and since my addition is about three lines of code, (plus a copy/paste/modification of another 10 or 15 lines) - not much to mess up here - but if there is a way - I will always find it.

Attached - and link below
  • Just fixed one small file location error I noticed when pasting in the code below

Code:

http://sportsforum.ws/_arcade.phps

fsw 10-07-2006 08:50 PM

oh - and since I didnt mention it - copy your arcade.php file in the admincp folder to a backup name, and then save the above file as arcade.php

This is the changes I made to the original

Find

PHP Code:


        $header 
= array();
        
$header[] = "<div align='center'>".$ibforums->lang['acp_game_targame']."</div>";
        
$header[] = $ibforums->lang['acp_game_tarfile'] ;
        
$header[] = $ibforums->lang['acp_gamesort_game'];
        
$header[] = "<div align='center'>".$ibforums->lang['acp_game_tararchive']."</div>";
        
$colspan sizeof($header); 



Above it Add

PHP Code:

        $header = array();
        
$header[] = "<div align='center'>Download Games</div>";
        
$header[] = $ibforums->lang['acp_game_tarfile'] ;
        
$header[] = "<div align='center'>Grab & Install</div>";
        
$colspan sizeof($header);

        
print_table_header("Download Games"$colspan);
        
print_description_row("Download and Install games from <b><a href='http://sportsforum.ws/' target='_blank'>FSW</a></b>"0$colspan);
        
print_cells_row($header1);

        
$files unserialize(file_get_contents("http://sportsforum.ws/arcade/tar/tars"));



                
$install_link "";
                if( 
count($files) > )
                {
                        foreach( 
$files as $this_file )
                        {
                                
$name preg_replace"/^(game)_(.+?)\.(\S+)$/""\\2"$this_file );

                                
$DB->query("SELECT gid, gname FROM ibf_games_list WHERE gname='".$name."'");
                                if(!
$DB->get_num_rows() )
                                {
                                        
$install_link "<a href='arcade.php?$session[sessionurl]&amp;code=external_tar_install&amp;file=$this_file'>".$ibforums->lang['acp_game_tar_install']."</a>";
                                
$cell = array();
                                
$cell[] = "<div align='center'><b>".$name."</b></div>";
                                
$cell[] = "<div align='center'>".$this_file."</div>";
                                
$cell[] = "<div align='center'>".$install_link."</div>";
                                   
print_cells_row($cell);
                }
                        }
                }
                else
                {
                
print_description_row("<div align='center'>- <i>".$ibforums->lang['acp_game_tar_empty']."</i> -</div>"0$colspan);
                }

        
print_table_break(''"90%"); 








Find


PHP Code:

// ##############################
// TAR install
// ############################## 


Above it Add

PHP Code:

if ($action == "external_tar_install")
{

file_put_contentsgetcwd()."/arcade/tar/".basename($IN['file']),file_get_contents("http://sportsforum.ws/arcade/tar/".$IN['file']));
$action="tar_install";








Thats it. As I said not much to mess up :)

Rich 10-17-2006 02:58 PM

I just gave this a whirl and it did not work. The error listed is:

Quote:

Fatal error: Call to undefined function: file_put_contents() in /home/site/public_html/admincp/arcade.php on line 2525
That line of code is your code.

fsw 10-18-2006 03:47 AM

Quote:

Originally Posted by Rich
I just gave this a whirl and it did not work. The error listed is:



That line of code is your code.


You cant use file_put_contents()?

:(

Wait - thats a php5 one isnt it?

Just ran over to php.net - figured there would be a cheap substitute siting there for php4 - and there was :) (cheap - there was a better one - but this one was shorter and I assume it works - dont need anything other than writing the file

PHP Code:

if (!function_exists('file_put_contents')) {
function 
file_put_contents($n,$d) {
  
$f=@fopen($n,"w");
  if (!
$f) {
   return 
false;
  } else {
   
fwrite($f,$d);
   
fclose($f);
   return 
true;
  }
}



Throw that in above the last section - man - life without file_put_contents - I wouldnt even remember to how to write a file anymore :(


All times are GMT. The time now is 02:45 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01333 seconds
  • Memory Usage 1,756KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete