';
return FALSE;
}
else
{
echo 'There seem to be no existing installation here. ';
return TRUE;
}
}
// Check for PHP extensions.
function platform_is_ok ()
{
$nerrs = 0;
echo "
check item
result
\n";
echo '
PDO extension
';
if (class_exists ('PDO'))
echo '
Ok';
else
{
echo '
not found';
$nerrs++;
}
echo '
';
echo '
PDO-MySQL
';
if (defined ('PDO::MYSQL_ATTR_READ_DEFAULT_FILE'))
echo '
Ok';
else
{
echo '
not found';
$nerrs++;
}
echo '
';
echo '
hash functions
';
if (function_exists ('hash_algos'))
echo '
Ok';
else
{
echo '
not found';
$nerrs++;
}
echo '
';
echo '
SNMP extension
';
if (defined ('SNMP_NULL'))
echo '
Ok';
else
echo '
Not found. Live SNMP tab will not function properly until the extension is installed.';
echo '
';
echo '
GD functions
';
if (defined ('IMG_PNG'))
echo '
Ok';
else
{
echo '
not found';
$nerrs++;
}
echo '
';
echo "
\n";
return !$nerrs;
}
// Check that we can write to configuration file.
// If so, ask for DB connection paramaters and test
// the connection. Neither save the parameters nor allow
// going further until we succeed with the given
// credentials.
function init_config ()
{
if (!is_writable ('inc/secret.php'))
{
echo "The inc/secret.php file is not writable by web-server. Make sure it is.";
echo "The following commands should suffice:
touch inc/secret.php\nchmod 666 inc/secret.php
";
return FALSE;
}
if
(
!isset ($_REQUEST['save_config']) or
empty ($_REQUEST['mysql_host']) or
empty ($_REQUEST['mysql_db']) or
empty ($_REQUEST['mysql_username']) or
empty ($_REQUEST['mysql_password'])
)
{
echo "\n";
echo '
The above parameters did not work. Check and try again.
\n";
echo '
';
return FALSE;
}
$conf = fopen ('inc/secret.php', 'w+');
if ($conf === FALSE)
{
echo "Error: failed to open inc/secret.php for writing";
return FALSE;
}
fwrite ($conf, "\n");
fclose ($conf);
echo "The configuration file has been written successfully. ";
return TRUE;
}
function init_database ()
{
echo 'Initializing the database... ';
foreach (array ('structure', 'dictbase', 'dictvendors') as $part)
{
echo $part;
}
return TRUE;
}
function congrats ()
{
echo 'Congratulations! RackTables installation is complete. Press Next to open your main page.';
return TRUE;
}
?>