/*
+--------------------------------------------------------------------------
| GU Portal Install Script v2.0
| ========================================
| by Jeremy Privett
| (c) 2001 - 2003 Games Unlimited
| http://www.gu2portal.ledohost.com
| ========================================
| Web: http://www.gu2portal.ledohost.com
| Email: zero@gu2portal.ledohost.com
| Terms of Service: http://www.gu2portal.ledohost.com/index.php?page=tos
| Rules: http://www.gu2portal.ledohost.com/index.php?page=rules
+---------------------------------------------------------------------------
|
| > Installer File
| > File written by Jeremy Privett
| > Date started: 4th August 2003
| > Current State: RC 1
|
+--------------------------------------------------------------------------
*/
error_reporting (E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);
$root = "./";
$template = new template;
$std = new installer;
$VARS = $std->parse_incoming();
if ( file_exists($root.'install.lock') )
{
install_error("This installer is locked!
Please (via FTP) remove the 'install.lock' file in this directory");
exit();
}
switch($VARS['a'])
{
case '1':
do_setup_form();
break;
case '2':
do_install();
break;
case '3':
do_finish();
break;
default:
do_intro();
break;
}
function do_finish()
{
global $std, $template, $root, $VARS, $SQL;
// Attempt to lock the installer
if ($FH = @fopen( $root.'', 'w' ) )
{
@fwrite( $FH, 'bleh', 4 );
@fclose($FH);
@chmod( $root.'', 0666 );
@chmod( $root.'https://www.angelfire.com/games5/gaming_revolution//text/banned.txt', 0666 );
@chmod( $root.'https://www.angelfire.com/games5/gaming_revolution//text/iplog.txt', 0666 );
$template->print_top('Success!');
$msg="
Click Here To View The Terms of Service
CLICK HERE TO VIEW YOUR NEW PORTAL!";
}
else
{
$template->print_top('Success!');
$msg = "PLEASE REMOVE THE INSTALLER ('install.php') BEFORE CONTINUING!
Failure to do so will enable ANYONE to delete your Portal at any time!
Click Here To View The Terms of Service
CLICK HERE TO VIEW YOUR NEW PORTAL!";
}
$template->contents .= "
Success
The installation is now complete!
$msg
";
$template->output();
}
function do_install()
{
global $std, $template, $root, $VARS, $HTTP_POST_VARS;
$NEW_INFO = array();
$need = array('boardurl','boardname','css','heading','timezone','fader','lycos','vidtopq','disptop','vidtopc','adminname','adminpass','adminpass2','adminmail');
foreach($need as $greed)
{
if ($VARS[ $greed ] == "")
{
install_error("You must complete all of the form!");
}
}
$VARS['boardurl'] = preg_replace( "#/$#", "", $VARS['boardurl'] );
if ($VARS['adminpassword2'] != $VARS['adminpassword'])
{
install_error("Your passwords did not match");
}
if ($root == './')
{
$root = str_replace( '\\', '/', getcwd() ) . '/';
}
$require = $root."config.php";
if ( ! file_exists($require) )
{
install_error("Could not locate '$require'. You may need to enter a value for the root path in this installer script, to do this, simply open up this script in a text editor and enter a value in \$root - remember to add a trailing slash. NT users will need to use double backslashes");
}
include($require);
if ( count($INFO) < 1 )
{
install_error("Possible corruption in 'config.php', please re-upload in ASCII format");
}
$new = array( 'boardurl' => $VARS['https://www.angelfire.com/games5/gaming_revolution/'],
'boardname' => $VARS['Gaming Revolution Portal'],
'Seymour' => $VARS['TommyV001'],
'toocool' => $VARS['toocool'],
'Undert8ker1@aol.com' => $VARS['Undert8ker1@aol.com'],
'css' => $VARS['css'],
'heading' => $VARS['heading'],
'timezone' => $VARS['timezone'],
'fader' => $VARS['fader'],
'lycos' => $VARS['lycos'],
'vidtopq' => $VARS['vidtopq'],
'disptop' => $VARS['disptop'],
'vidtopc' => $VARS['vidtopc'],
'vidtop' => $VARS['vidtop'],
'vidbot' => $VARS['vidbot']
);
foreach( $new as $k => $v )
{
$v = preg_replace( "/'/", "\\'" , $v );
$v = preg_replace( "/\r/", "" , $v );
$INFO[ $k ] = $v;
}
$file_string = "\n";
foreach( $INFO as $k => $v )
{
if ($k == 'skin' or $k == 'languages')
{
continue;
}
$file_string .= '$INFO['."'".$k."'".']'."\t\t\t=\t'".$v."';\n";
}
$file_string .= "include \"sources/errors.php\";"."\n".'?'.'>';
if ( $fh = fopen( $require, 'w' ) )
{
fputs($fh, $file_string, strlen($file_string) );
fclose($fh);
}
else
{
install_error("Could not write to 'config.php'");
}
$template->print_top('Success!');
$template->contents .= "
Success
Your GU Portal has now been installed!
The installation process is almost complete.
The next and final step will attempt to lock this install file, and CHMOD all important files.
Please note that going any further indicates an agreement
to the GU Portal Terms of Service!!
CLICK HERE TO CONTINUE
";
$template->output();
}
function do_setup_form()
{
global $std, $template, $root, $HTTP_SERVER_VARS;
$template->print_top('Set Up form');
$template->contents .= "
";
$template->output();
}
function do_intro()
{
global $std, $template, $root;
$template->print_top('Welcome');
$template->contents .= "
Installing a new Portal
Before we go any further, please ensure that all the files have been uploaded, and that the
file 'config.php' has suitable permissions to allow this script to write to it ( 0666 should be sufficient ).
Once you have clicked on proceed, you will be taken to a form to enter information the installer needs to set up your portal.";
$file = $root."config.php";
$warnings = array();
if ( ! file_exists($file) )
{
$warnings[] = "Cannot locate the file 'config.php'. This should be uploaded into the same directory as this script!";
}
if ( ! is_writeable($file) )
{
$warnings[] = "Cannot write to 'config.php'. Please adjust the permissions to allow this script to write to the file. if in doubt, CHMOD via FTP to 0777";
}
$phpversion = phpversion();
if ($phpversion < '4.0.0') {
$warnings[] = "You cannot install the GU Portal. The GU Portal requires PHP version 4.0.0 or better.";
}
if ( count($warnings) > 0 )
{
$err_string = "- ".implode( "
- ", $warnings )."
";
$template->contents .= "
Warning!
The following errors must be rectified before continuing!
$err_string
";
}
else
{
$template->contents .= "
";
}
$template->contents .= " |
";
$template->output();
}
function install_error($msg="")
{
global $std, $template, $root;
$template->print_top('Warning!');
$template->contents .= "
Warning!
The following errors must be rectified before continuing!
Please go back and try again!
$msg
";
$template->output();
}
class template
{
var $contents = "";
function output()
{
echo $this->contents;
echo "
GU Portal © 2003 Games Unlimited.