Example #1
0
function step0()
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    global $dbcfg_type, $dbcfg_host, $dbcfg_name, $dbcfg_user, $dbcfg_password, $dbcfg_prefix, $dbcfg_port, $dbcfg_persistent, $dbcfg_path, $action;
    // Check if the main configuration file exists and can be read
    if (file_exists('../config.php') && is_readable('../config.php')) {
        $dbcfg_path = './';
        $dbcfg_type = 'MYSQL';
        $config_contents = file('../config.php');
        foreach ($config_contents as $line_num => $line) {
            // Check for constant declaration of S9YCONF_DBCFG_TYPE
            if (strpos($line, "define('S9YCONF_DBCFG_TYPE") !== FALSE) {
                // Trim the end of the line and remove everything apart from the value we want
                $line = rtrim($line);
                $line = str_replace("if(!defined('S9YCONF_DBCFG_TYPE')) define('S9YCONF_DBCFG_TYPE', '", '', $line);
                $line = str_replace("');", '', $line);
                $dbcfg_type = $line;
                continue;
            }
            // Check for constant declaration of S9YCONF_DBCFG_PATH
            if (strpos($line, "define('S9YCONF_DBCFG_PATH") !== FALSE) {
                // Trim the end of the line and remove everything apart from the value we want
                $line = rtrim($line);
                $line = str_replace("if(!defined('S9YCONF_DBCFG_PATH')) define('S9YCONF_DBCFG_PATH', '", '', $line);
                $line = str_replace("');", '', $line);
                $dbcfg_path = $line;
                continue;
            }
        }
    }
    $final_path = calc_db_path('');
    if (file_exists($final_path . 'dbconfig.php') && is_readable($final_path . 'dbconfig.php')) {
        include_once $final_path . 'dbconfig.php';
        $dbcfg_host = S9YCONF_DB_HOST;
        $dbcfg_name = S9YCONF_DB_NAME;
        $dbcfg_user = S9YCONF_DB_USER;
        $dbcfg_password = S9YCONF_DB_PWD;
        $dbcfg_prefix = S9YCONF_DB_PREFIX;
        $dbcfg_port = S9YCONF_DB_PORT;
        if (S9YCONF_DB_PERSISTENT) {
            $dbcfg_persistent = 1;
        } else {
            $dbcfg_persistent = 0;
        }
    }
    debug_msg('DBCFG_TYPE: "' . $dbcfg_type . '"', 5);
    debug_msg('DBCFG_PATH: "' . $dbcfg_path . '"', 5);
    debug_msg('DBCFG_HOST: "' . $dbcfg_host . '"', 5);
    debug_msg('DBCFG_NAME: "' . $dbcfg_name . '"', 5);
    debug_msg('DBCFG_USER: "******"', 5);
    debug_msg('DBCFG_PASSWORD: "******"', 5);
    debug_msg('DBCFG_PREFIX: "' . $dbcfg_prefix . '"', 5);
    debug_msg('DBCFG_PORT: "' . $dbcfg_port . '"', 5);
    debug_msg('DBCFG_PERSISTENT: "' . $dbcfg_persistent . '"', 5);
    steppage(0);
    ?>
<p><h2>Welcome to <?php 
    echo S9YCONF_PROGRAM_NAME;
    ?>
</h2></p>
<p>This program 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.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>
<p>See the GNU General Public License for more details.</p>
<?php 
    display_gpl_licence();
    ?>
<p>If you accept this licence, and wish to continue using this application then please click 'I Agree' below.</p>
<!-- 
<p>Welcome to <?php 
    echo S9YCONF_PROGRAM_NAME;
    ?>
 installation.</p>
<p>You can use the following steps to automate installation, providing a basic set of
data to get you started on putting <?php 
    echo S9YCONF_PROGRAM_NAME;
    ?>
 to use.</p>
 -->
 <p><form action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post">
<button name="action" value="step1" type="submit">I Agree</button>
<?php 
    if (isset($dbcfg_type)) {
        echo '<input type="hidden" name="dbcfg_type" value="' . $dbcfg_type . '" />';
    }
    if (isset($dbcfg_host)) {
        echo '<input type="hidden" name="dbcfg_host" value="' . $dbcfg_host . '" />';
    }
    if (isset($dbcfg_name)) {
        echo '<input type="hidden" name="dbcfg_name" value="' . $dbcfg_name . '" />';
    }
    if (isset($dbcfg_user)) {
        echo '<input type="hidden" name="dbcfg_user" value="' . $dbcfg_user . '" />';
    }
    if (isset($dbcfg_password)) {
        echo '<input type="hidden" name="dbcfg_password" value="' . $dbcfg_password . '" />';
    }
    if (isset($dbcfg_prefix)) {
        echo '<input type="hidden" name="dbcfg_prefix" value="' . $dbcfg_prefix . '" />';
    }
    if (isset($dbcfg_port)) {
        echo '<input type="hidden" name="dbcfg_port" value="' . $dbcfg_port . '" />';
    }
    if (isset($dbcfg_persistent)) {
        echo '<input type="hidden" name="dbcfg_persistent" value="' . $dbcfg_persistent . '" />';
    }
    if (isset($dbcfg_path)) {
        echo '<input type="hidden" name="dbcfg_path" value="' . $dbcfg_path . '" />';
    }
    ?>
</form></p>
</td>
</tr>
</table>
</div>
<?php 
    html_footer();
}
Example #2
0
    } else {
        echo '<div class="error">ERROR!</div>';
        echo '<p>The main configuration file does NOT exist!</p>';
        echo '<p>Click ';
        html_link('./install/index.php', $text = 'here', $status = 'Install S9Y_Conf', $target = '');
        echo 'to installS9Y_Conf.</p>';
    }
    exit;
}
debug_msg("FILE: " . __FILE__, 3);
db_connect();
html_header("S9Y_Conf Licence Information");
?>
<div class="textpage">
<h2>Welcome to <?php 
echo S9YCONF_PROGRAM_NAME;
?>
</h2>
<p>This program 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.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>
<p>See the GNU General Public License for more details.</p>
<?php 
//include ('inc/gpl.inc.php');
display_gpl_licence();
?>
</div>
<?php 
html_footer();