mirror of
https://github.com/e107inc/e107.git
synced 2025-08-07 23:26:41 +02:00
Additional installation checks
This commit is contained in:
@@ -176,5 +176,7 @@ define("LANINS_117", "Website Preferences");
|
|||||||
define("LANINS_118", "Install Plugins");
|
define("LANINS_118", "Install Plugins");
|
||||||
define("LANINS_119", "Install all plugins that the theme may require.");
|
define("LANINS_119", "Install all plugins that the theme may require.");
|
||||||
define("LANINS_120", "8");
|
define("LANINS_120", "8");
|
||||||
|
define('LANINS_121', 'e107_config.php is not an empty file');
|
||||||
|
define('LANINS_122', 'Possibly you have an existing installation');
|
||||||
|
|
||||||
|
|
||||||
|
34
install_.php
34
install_.php
@@ -456,6 +456,10 @@ class e_install
|
|||||||
$this->previous_steps['mysql']['createdb'] = (isset($_POST['createdb']) && $_POST['createdb'] == TRUE ? TRUE : FALSE);
|
$this->previous_steps['mysql']['createdb'] = (isset($_POST['createdb']) && $_POST['createdb'] == TRUE ? TRUE : FALSE);
|
||||||
$this->previous_steps['mysql']['prefix'] = trim($_POST['prefix']);
|
$this->previous_steps['mysql']['prefix'] = trim($_POST['prefix']);
|
||||||
$success = $this->check_name($this->previous_steps['mysql']['db'], FALSE) && $this->check_name($this->previous_steps['mysql']['prefix'], TRUE);
|
$success = $this->check_name($this->previous_steps['mysql']['db'], FALSE) && $this->check_name($this->previous_steps['mysql']['prefix'], TRUE);
|
||||||
|
if ($success)
|
||||||
|
{
|
||||||
|
$success = $this->checkDbFields($this->previous_steps['mysql']); // Check for invalid characters
|
||||||
|
}
|
||||||
if(!$success || $this->previous_steps['mysql']['server'] == "" || $this->previous_steps['mysql']['user'] == "")
|
if(!$success || $this->previous_steps['mysql']['server'] == "" || $this->previous_steps['mysql']['user'] == "")
|
||||||
{
|
{
|
||||||
$this->stage = 3;
|
$this->stage = 3;
|
||||||
@@ -603,6 +607,12 @@ class e_install
|
|||||||
}
|
}
|
||||||
$perms_notes = LANINS_106;
|
$perms_notes = LANINS_106;
|
||||||
}
|
}
|
||||||
|
elseif (filesize('e107_config.php') > 1)
|
||||||
|
{ // Must start from an empty e107_config.php
|
||||||
|
$perms_pass = FALSE;
|
||||||
|
$perms_errors = LANINS_121;
|
||||||
|
$perms_notes = LANINS_122;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$perms_pass = true;
|
$perms_pass = true;
|
||||||
@@ -1240,6 +1250,30 @@ class e_install
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check an array of db-related fields for illegal characters
|
||||||
|
*
|
||||||
|
* @return boolean TRUE for OK, FALSE for invalid character
|
||||||
|
*/
|
||||||
|
function checkDbFields($fields)
|
||||||
|
{
|
||||||
|
if (!is_array($fields)) return FALSE;
|
||||||
|
foreach (array('server', 'user', 'db', 'prefix') as $key)
|
||||||
|
{
|
||||||
|
if (isset($fields[$key]))
|
||||||
|
{
|
||||||
|
if (strtr($fields[$key],"';", ' ') != $fields[$key])
|
||||||
|
{
|
||||||
|
return FALSE; // Invalid character found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_lan_file()
|
function get_lan_file()
|
||||||
{
|
{
|
||||||
if(!isset($this->previous_steps['language']))
|
if(!isset($this->previous_steps['language']))
|
||||||
|
Reference in New Issue
Block a user