<?php

// ----------------------------------------------------------- \\
//            QuickFox setup script           (c) LION 2006    \\
// ----------------------------------------------------------- \\


// this is TAR unpacker in gz compressed format (setup.php is 5 kB now instead of 14)
$TAR_GZ_Class =
'eNrdGttu00j0HYl/GCAitpqmoSwSIpjdUhGWJ1alEhIXoYk9Try1PZE9bpou/fc9ZzxO7WTGmTSp
dkUecvO53+fYfkzznJy//3LGaPDwwT8PH5DqdUkz0slFxmjSI53zk7NRFLPhKsD7L9GMeCSkcc6G
1ZWjIyRJRjGdrMKPizBkGWB0u0twhEf+5K28uIYSc/9iBQNR3sr/SxzivHh2TMYLwXJ3DX/Go1RI
poO6iB/SkgKyjtIJUWCr6O8+jgBz1FAQ0fF/nYanRTb6kIYckE6yjC4cdyjh0XxkCrxAkgivCzqO
2cMHt/gAdMpTMHnhC571ySnYHhQixYyIKSOlLxrgJymNF9cAQjN/Gl0yIhYzdgsRFqkvIp5WDnY6
IQiR0oTVjFT3uXp1xDTKD98on4MiS7zhOnAUEucRXv/BrqJc5DUmLsmYKLJUWU/DCEHBGMBiRoEp
mMVpMnd1WOxKAAbYQ/CYz1nmVHS+duESS3PQufvdNQg7y9jkR0KFP3W6T5xvfTG5/gnvNPvWn1y7
nSfdHqmroLFPzUalU0CayTWfsfRW+R7pZuOuToYatsoe8LjOOjfrfzGwI+qAJvC8LgjdtZYwtBXQ
wFfPRXk4VB7Wm7whittKyGALawFqSmgSwY95zpz26K8JjP4x2ndyXVJrKmdvTxPdcHuyNytlBJM9
Jx9TRsriKbj6Ml6psEvDIIYshxbGedQUzeSBlTiUAnhQxNch5lMsMw7QizFCFbwU1X2Nhf3pU1Ix
hbJrjviUsQAiHVEOiZacIR9tfV7TBwTxJteMh5s9pTOe1KMhWx/IZbJK1+n1pFImqjf6v9vCa0WF
cK8ahHtQ4KY9hLDyF2Og3fRsb9ADt7st8VdNHlrsDbj1EcKcdp8Yu5DtuuPzIhVlzuWabENAmW3Q
LSXo3pNuxGEm6kQeTDyd6HXJBL8eHLj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+Nfojl4x1e028vtNxUNOMgU5/v1bF7Y2MWGS8m03K6qu6S
YVvukRkcuwWOVjhUlad0/KXt0eoUf1IScDpBhCeDHk4vcrYsjxv3tTpvHAmtbsGBfK48qqv9Fv52
SXIBn+UPE5UGPH70ve6Rtt1HwZV2blQbA6t9vf2WQAKuTUot2/xKE304ue0b/hChPFSf9E2DTcuW
/BOcL2BIdwy9yzVjtgiFL5/CyXrwqh3IcFNWrjfJz5/LmHU3cVuaI4DjRq3tN9e0akerryxt9xLW
Mh/ZWAslzTGF6bASwTA52kqAL8ELf2qkV7YMW3o3dmByV6JY1e8KGAu5DX8L3nvnO4bqdDG0CN8X
VuGrjV7XzqaqzJU4FubaRxjZqB+wkBaxsNB/X45pCQSs3wcHd7ort77oxCYGp9s0YFe47Khu+eAD
LvLMjo+vQPOdQO/UNFe14QYU57/qoB0lgGc+TP/SDU+p/7WMiu/eCpXhxlvJO4XqzVab91OLzXsZ
kPpbLuMFzHhdFa76cMQnj5wOvn8IsLfxH0hh4y7tHuPzFw4+2ftRP09ZfOMM0Nhrlb6x6Q1VAOnG
GEXmzoOM+fmkFgmWt/a259lS2ffa2ndoEzYPaN38C+UuUWs=';

foreach ($_REQUEST as $rvar=>$rval) {
    unset ($$rvar);
}

define ('QF_STARTED',True);
define ('QF_SETUP_STARTED',True);

$debug=1;

Error_Reporting(E_ALL & ~E_NOTICE);
set_magic_quotes_runtime(0);
if (ini_get('safe_mode') == 0)
    set_time_limit(0);

function init_err_parse($errno, $errstr, $errfile, $errline)
{
global $debug;
If ($debug) {
   if ($errno!=8&&$errno!=1024)
   print 'Error '.$errno.'. '.$errstr.'<hr>File: '.$errfile.'. Line: '.$errline.'<br />';
}
}

//Lets Set init_err_handler
set_error_handler('init_err_parse');

$SET_step=strval($_POST['step']);
$SET_act=strval($_POST['action']);
$error='';

if (!empty($SET_step) && file_exists('install/install.php'))
    include ('install/install.php');

else {

print '
<html>

<head>
  <title>Installing QuickFox</title>
</head>

<body>
<div align="center">
<form action="setup.php" method="post" name="mainform">
';

if ($SET_act == 'GO')
{
    $file = 'pack.tgz';
	if (!file_exists($file))
	    $file = 'upd_pack.tgz';

    eval(gzuncompress(base64_decode($TAR_GZ_Class)));

	$arch = new TGZRead($file);
	if (!$arch->stream)
	    $error='Error loading archive';
	else {
	    $arch->ExtractArchive('',True);

        if (!file_exists('index.php') || !file_exists('install/install.php'))
            $error='Error extracting pack';
    }

    if (!$error) {
	    chmod($file,octdec('600'));
	    print '
        <h3>All the data is extracted!</h3>
        <input type="hidden" name="step" value="data_acc" />
        Now We must set up some settings. <br />
        <input type="submit" name="OK" value="GO!" />
	    ';
    }
    else
        print $error;

}
else {
    print '
    <h3>Now We are ready to install QuickFox on this server!</h3>
    <input type="hidden" name="action" value="GO" />
    First We must Extract data. <br />
    <input type="submit" name="OK" value="GO!" />
    ';
}

print '</form></div>
</body>

</html>';

}
?>
