$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: "'.$dbcfg_user.'"', 5); debug_msg('DBCFG_PASSWORD: "'.$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); ?>
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.
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.
See the GNU General Public License for more details.
If you accept this licence, and wish to continue using this application then please click 'I Agree' below.
'; // Look for main configuration file and check if it can be written if (file_exists('../config.php')) { // Check if the main configuration file exists if ((is_readable('../config.php')) && (is_writable('../config.php'))) { // and readable and writeable $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; } // 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; } } echo '#: chmod 0666 '.realpath('../').'/config.php
#: chmod 0666 '.realpath('../').'/config.php
#: chmod 0666 '.realpath('../').'/config.php
#: chmod 0777 '.realpath('../').'
#: chmod 0777 '.realpath('../').'
#: chmod 0777 '.realpath('../').'
Excellent
';
echo 'The database configuration exists and is readable and writeable.
';
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(defined('S9YCONF_DB_PERSISTENT')) {
$dbcfg_persistent = 1;
}else{
$dbcfg_persistent = 0;
}
$continue = true;
}elseif ((is_readable($final_path.'dbconfig.php')) && (!is_writable($final_path.'dbconfig.php'))) { // Readable but NOT writeable
echo '
#: chmod 0666 '.$final_path.'dbconfig.php
#: chmod 0666 '.$final_path.'dbconfig.php
#: chmod 0666 '.$final_path.'dbconfig.php
#: chmod 0666 '.$final_path.'dbconfig.php
'.$final_path.''; echo 'You may do this using:'; echo '
#: mkdir -m 0777 '.$final_path.''; $continue = false; }elseif ((is_readable($final_path)) && (is_writable($final_path))) { // is the directory readable and writeable echo '
'.$final_path.''; $continue = true; }elseif (( is_readable($final_path)) && (!is_writable($final_path))) { // Readable but NOT writeable echo '
'.$final_path.''; echo 'Please make the directory readable and writeable by the webserver.
#: chmod 0777 '.$final_path.''; $continue = false; }elseif ((!is_readable($final_path)) && (is_writable($final_path))) { // NOT Readable but writeable echo '
'.$final_path.''; echo 'Please make the directory readable and writeable by the webserver.
#: chmod 0777 '.$final_path.''; $continue = false; }else{ // NOT readable and NOT writeable echo '
'.$final_path.''; echo 'Please make the directory readable and writeable by the webserver.
#: chmod 0777 '.$final_path.''; $continue = false; } } ?>
('.mysql_errno().') '.mysql_error().'
Database Host: | '.S9YCONF_DB_HOST.' |
Database Name: | '.S9YCONF_DB_NAME.' |
Database User: | '.S9YCONF_DB_USER.' |
Database Password: | '.str_repeat('*',strlen(S9YCONF_DB_PWD)).' |
The database configuration file will be written to
The database parameters are:
Database host: | |
Database name: | |
Database user: | |
Database password: | |
Database table prefix: | Database port: | (blank = 3306) |
Use persistent connections: |
The main configuration file has been written.
'; break; case '1': // Unable to open main configuration file echo 'Unable to write to the main configuration file!
'; echo 'Please make the main configuration file readable and writeable by the webserver.#: chmod 0666 '.realpath('../').'/config.phptogether with
#: chmod 0777 '.realpath('../').'Which will ensure that the file WILL be readable and writeable by the webserver.
Unable to write to the main configuration file!
'; echo 'Please make the main configuration file readable and writeable by the webserver.#: chmod 0666 '.realpath('../').'/config.phptogether with
#: chmod 0777 '.realpath('../').'Which will ensure that the file WILL be readable and writeable by the webserver.
The main configuration file has been written, BUT it cannot be read by the webserver!
'; echo 'Please make the main configuration file readable and writeable by the webserver.#: chmod 0666 '.realpath('../').'/config.php'; break; } include_once('./dbconfig.write.php'); $dbconfig_result = dbconfig_write(); debug_msg('DBCONFIG RESULT:'.$dbconfig_result, 5); switch ($dbconfig_result) { case '0': // Write to main configuration file succeeded echo '
The database configuration file has been written.
'; break; case '1': // Unable to open main configuration file echo 'Unable to write to the database configuration file!
'; echo 'Please make the database configuration file readable and writeable by the webserver.#: chmod 0666 '.$final_path.'dbconfig.phptogether with
#: mkdir -m 0777 '.$final_path.'Which will ensure that the file WILL be readable and writeable by the webserver.'; break; case '2': // Write to main configuration file failed echo '
Unable to write to the database configuration file!
'; echo 'Please make the database configuration file readable and writeable by the webserver.#: chmod 0666 '.$final_path.'dbconfig.phptogether with
#: mkdir -m 0777 '.$final_path.'Which will ensure that the file WILL be readable and writeable by the webserver.'; break; case '4': // Database configuration file created NOT readable echo '
The database configuration file has been written, BUT it cannot be read by the webserver!
'; echo 'Please make the database configuration file readable and writeable by the webserver.#: chmod 0666 '.$final_path.'dbconfig.phptogether with
#: mkdir -m 0777 '.$final_path.'Which will ensure that the file WILL be readable and writeable by the webserver.'; break; } if (($dbconfig_result != 0) || ($dbconfig_result != 0)) { $continue = FALSE; }else{ $continue = TRUE; } ?>
Do you really want to install the database tables for ?
Installing will overwrite any existing tables with the same names in your database !
ERROR!'; echo 'There was an error creating the database tables!
'; echo '('.mysql_errno().') '.mysql_error().'
Database Host: | '.S9YCONF_DB_HOST.' |
Database Name: | '.S9YCONF_DB_NAME.' |
Database User: | '.S9YCONF_DB_USER.' |
Database Password: | '.str_repeat('*',strlen(S9YCONF_DB_PWD)).' |
The database tables have been created succesfully, and filled with default data.
'; } echo ' Site Security'; // Check site security and suggest changes // Check DBConfig still exists if (file_exists($final_path.'dbconfig.php')) { // Check if the database configuration file exists // Check DBConfig readable if (!is_readable($final_path.'dbconfig.php')) { $badsecurity = $badsecurity | 0x01; // Flag DBConfig NOT Readable $continue = FALSE; } /* dbconfig.php file created as rw-,r--,r-- wwwrun:www on a new installation with no config file so standard user unable to chown/chmod // Check DBConfig writeable if (is_writable($final_path.'dbconfig.php')) { $badsecurity = $badsecurity | 0x02; // Flag DBConfig Writeable $continue = FALSE; } */ }else{ // File does NOT exist! $badsecurity = $badsecurity | 0x04; // Flag DBConfig does NOT exist! $continue = FALSE; } // Check Main Config still exists if (file_exists('../config.php')) { // Check if the main configuration file exists // Check Main Config readable if (!is_readable('../config.php')) { $badsecurity = $badsecurity | 0x08; // Flag main Config NOT Readable $continue = FALSE; } /* config.php file created as rw-,r--,r-- wwwrun:www on a new installation with no config file so standard user unable to chown/chmod // Check Main Config writeable if (is_writable('../config.php')) { $badsecurity = $badsecurity | 0x10; // Flag main Config Writeable $continue = FALSE; } */ }else{ // File does NOT exist! $badsecurity = $badsecurity | 0x20; // Flag main Config does NOT exist! $continue = FALSE; } // DBconfig directory if (is_dir($final_path)) { // Does path exist? if (!is_readable($final_path)) { // NOT Readable $badsecurity = $badsecurity | 0x40; // Flag DBConfig path NOT Readable $continue = FALSE; } if (is_writable($final_path)) { // Writable $badsecurity = $badsecurity | 0x80; // Flag DBConfig path writeable $continue = FALSE; } }else{ // Directory Doesn't exist $badsecurity = $badsecurity | 0x100; // Flag DBConfig path does NOT exist! $continue = FALSE; } if (!is_readable('../')) { // NOT Readable $badsecurity = $badsecurity | 0x200; // Flag main Config path NOT Readable $continue = FALSE; } if (is_writable('../')) { // Writable $badsecurity = $badsecurity | 0x400; // Flag main Config path writeable $continue = FALSE; } /* Bitwise flags held in $badsecurity | Bit | Value | Decimal | Hex | Flag DBConfig NOT Readable ------------ 1| 2^0 | 1 0x01 Flag DBConfig Writeable -------------- 2| 2^1 | 2 0x02 Flag DBConfig does NOT exist! -------- 3| 2^2 | 4 0x04 Flag main Config NOT Readable -------- 4| 2^3 | 8 0x08 Flag main Config Writeable ----------- 5| 2^4 | 16 0x10 Flag main Config does NOT exist! ----- 6| 2^5 | 32 0x20 Flag DBConfig path NOT Readable ------ 7| 2^6 | 64 0x40 Flag DBConfig path writeable --------- 8| 2^7 | 128 0x80 Flag DBConfig path does NOT exist! --- 9| 2^8 | 256 0x100 Flag main Config path NOT Readable --- 10| 2^9 | 512 0x200 Flag main Config path writeable ------ 11| 2^10 | 1024 0x400 */ echo '
|