|
|
|
|
@@ -30,10 +30,12 @@
|
|
|
|
|
* @package Install
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
class FroxlorInstall {
|
|
|
|
|
class FroxlorInstall
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* define froxlor basepath e.g. /var/www/froxlor
|
|
|
|
|
* define froxlor basepath e.g.
|
|
|
|
|
* /var/www/froxlor
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
@@ -71,6 +73,7 @@ class FroxlorInstall {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* currently used language
|
|
|
|
|
*
|
|
|
|
|
* @var unknown
|
|
|
|
|
*/
|
|
|
|
|
private $_activelng = 'english';
|
|
|
|
|
@@ -78,7 +81,8 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* Class constructor
|
|
|
|
|
*/
|
|
|
|
|
public function __construct() {
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->_basepath = dirname(dirname(dirname(__FILE__)));
|
|
|
|
|
$this->_data = array();
|
|
|
|
|
}
|
|
|
|
|
@@ -86,7 +90,8 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* FC
|
|
|
|
|
*/
|
|
|
|
|
public function run() {
|
|
|
|
|
public function run()
|
|
|
|
|
{
|
|
|
|
|
// send headers
|
|
|
|
|
$this->_sendHeaders();
|
|
|
|
|
// check if we have a valid installation already
|
|
|
|
|
@@ -104,15 +109,13 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* build up and show the install-process-pages
|
|
|
|
|
*/
|
|
|
|
|
private function _showPage() {
|
|
|
|
|
private function _showPage()
|
|
|
|
|
{
|
|
|
|
|
// set theme for templates
|
|
|
|
|
$theme = $this->_theme;
|
|
|
|
|
eval("echo \"" . $this->_getTemplate("header") . "\";");
|
|
|
|
|
// check install-state
|
|
|
|
|
if ((isset($_POST['installstep'])
|
|
|
|
|
&& $_POST['installstep'] == '1')
|
|
|
|
|
|| (isset($_GET['check']) && $_GET['check'] == '1')
|
|
|
|
|
) {
|
|
|
|
|
if ((isset($_POST['installstep']) && $_POST['installstep'] == '1') || (isset($_GET['check']) && $_GET['check'] == '1')) {
|
|
|
|
|
$pagetitle = $this->_lng['install']['title'];
|
|
|
|
|
if ($this->_checkPostData()) {
|
|
|
|
|
// ceck data and create userdata etc.etc.etc.
|
|
|
|
|
@@ -146,7 +149,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
private function _checkPostData() {
|
|
|
|
|
private function _checkPostData()
|
|
|
|
|
{
|
|
|
|
|
$this->_guessServerName();
|
|
|
|
|
$this->_guessServerIP();
|
|
|
|
|
$this->_guessWebserver();
|
|
|
|
|
@@ -166,9 +170,7 @@ class FroxlorInstall {
|
|
|
|
|
$posixgroup = posix_getgrgid(posix_getgid());
|
|
|
|
|
$this->_getPostField('httpgroup', $posixgroup['name']);
|
|
|
|
|
|
|
|
|
|
if ($this->_data['mysql_host'] == 'localhost'
|
|
|
|
|
|| $this->_data['mysql_host'] == '127.0.0.1'
|
|
|
|
|
) {
|
|
|
|
|
if ($this->_data['mysql_host'] == 'localhost' || $this->_data['mysql_host'] == '127.0.0.1') {
|
|
|
|
|
$this->_data['mysql_access_host'] = $this->_data['mysql_host'];
|
|
|
|
|
} else {
|
|
|
|
|
$this->_data['mysql_access_host'] = $this->_data['serverip'];
|
|
|
|
|
@@ -179,19 +181,7 @@ class FroxlorInstall {
|
|
|
|
|
$this->_data['servername'] = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['installstep'])
|
|
|
|
|
&& $_POST['installstep'] == '1'
|
|
|
|
|
&& $this->_data['admin_pass1'] == $this->_data['admin_pass2']
|
|
|
|
|
&& $this->_data['admin_pass1'] != ''
|
|
|
|
|
&& $this->_data['admin_pass2'] != ''
|
|
|
|
|
&& $this->_data['mysql_unpriv_pass'] != ''
|
|
|
|
|
&& $this->_data['mysql_root_pass'] != ''
|
|
|
|
|
&& $this->_data['servername'] != ''
|
|
|
|
|
&& $this->_data['serverip'] != ''
|
|
|
|
|
&& $this->_data['httpuser'] != ''
|
|
|
|
|
&& $this->_data['httpgroup'] != ''
|
|
|
|
|
&& $this->_data['mysql_unpriv_user'] != $this->_data['mysql_root_user']
|
|
|
|
|
) {
|
|
|
|
|
if (isset($_POST['installstep']) && $_POST['installstep'] == '1' && $this->_data['admin_pass1'] == $this->_data['admin_pass2'] && $this->_data['admin_pass1'] != '' && $this->_data['admin_pass2'] != '' && $this->_data['mysql_unpriv_pass'] != '' && $this->_data['mysql_root_pass'] != '' && $this->_data['servername'] != '' && $this->_data['serverip'] != '' && $this->_data['httpuser'] != '' && $this->_data['httpgroup'] != '' && $this->_data['mysql_unpriv_user'] != $this->_data['mysql_root_user']) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
@@ -202,31 +192,31 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
private function _doInstall() {
|
|
|
|
|
|
|
|
|
|
private function _doInstall()
|
|
|
|
|
{
|
|
|
|
|
$content = "<table class=\"noborder\">";
|
|
|
|
|
|
|
|
|
|
// check for mysql-root-connection
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['install']['testing_mysql']);
|
|
|
|
|
|
|
|
|
|
$options = array('PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8');
|
|
|
|
|
$options = array(
|
|
|
|
|
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8'
|
|
|
|
|
);
|
|
|
|
|
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";";
|
|
|
|
|
$fatal_fail = false;
|
|
|
|
|
try {
|
|
|
|
|
$db_root = new PDO(
|
|
|
|
|
$dsn, $this->_data['mysql_root_user'], $this->_data['mysql_root_pass'], $options
|
|
|
|
|
);
|
|
|
|
|
$db_root = new PDO($dsn, $this->_data['mysql_root_user'], $this->_data['mysql_root_pass'], $options);
|
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
|
// possibly without passwd?
|
|
|
|
|
try {
|
|
|
|
|
$db_root = new PDO(
|
|
|
|
|
$dsn, $this->_data['mysql_root_user'], '', $options
|
|
|
|
|
);
|
|
|
|
|
$db_root = new PDO($dsn, $this->_data['mysql_root_user'], '', $options);
|
|
|
|
|
// set the given password
|
|
|
|
|
$passwd_stmt = $db_root->prepare("
|
|
|
|
|
SET PASSWORD = PASSWORD(:passwd)
|
|
|
|
|
");
|
|
|
|
|
$passwd_stmt->execute(array('passwd' => $this->_data['mysql_root_pass']));
|
|
|
|
|
$passwd_stmt->execute(array(
|
|
|
|
|
'passwd' => $this->_data['mysql_root_pass']
|
|
|
|
|
));
|
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
|
// nope
|
|
|
|
|
$content .= $this->_status_message('red', $e->getMessage());
|
|
|
|
|
@@ -245,18 +235,19 @@ class FroxlorInstall {
|
|
|
|
|
// importing data to new database
|
|
|
|
|
$content .= $this->_importDatabaseData();
|
|
|
|
|
// create DB object for new database
|
|
|
|
|
$options = array('PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8');
|
|
|
|
|
$options = array(
|
|
|
|
|
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8'
|
|
|
|
|
);
|
|
|
|
|
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
|
|
|
|
|
$another_fail = false;
|
|
|
|
|
try {
|
|
|
|
|
$db = new PDO(
|
|
|
|
|
$dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options
|
|
|
|
|
);
|
|
|
|
|
$db = new PDO($dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options);
|
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
|
// dafuq? this should have happened in _importDatabaseData()
|
|
|
|
|
$content .= $this->_status_message('red', $e->getMessage());
|
|
|
|
|
$another_fail = true;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (! $another_fail) {
|
|
|
|
|
// change settings accordingly
|
|
|
|
|
@@ -290,14 +281,17 @@ class FroxlorInstall {
|
|
|
|
|
|
|
|
|
|
eval("\$navigation .= \"" . $this->_getTemplate("pagebottom") . "\";");
|
|
|
|
|
|
|
|
|
|
return array('pagecontent' => $content, 'pagenavigation' => $navigation);
|
|
|
|
|
return array(
|
|
|
|
|
'pagecontent' => $content,
|
|
|
|
|
'pagenavigation' => $navigation
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create userdata.inc.php file
|
|
|
|
|
*/
|
|
|
|
|
private function _createUserdataConf() {
|
|
|
|
|
|
|
|
|
|
private function _createUserdataConf()
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['install']['creating_configfile']);
|
|
|
|
|
@@ -319,8 +313,7 @@ class FroxlorInstall {
|
|
|
|
|
@fclose($fp);
|
|
|
|
|
$content .= $this->_status_message('green', 'OK');
|
|
|
|
|
chmod('../lib/userdata.inc.php', 0440);
|
|
|
|
|
}
|
|
|
|
|
elseif ($fp = @fopen('/tmp/userdata.inc.php', 'w')) {
|
|
|
|
|
} elseif ($fp = @fopen('/tmp/userdata.inc.php', 'w')) {
|
|
|
|
|
$result = @fputs($fp, $userdata, strlen($userdata));
|
|
|
|
|
@fclose($fp);
|
|
|
|
|
$content .= $this->_status_message('orange', $this->_lng['install']['creating_configfile_temp']);
|
|
|
|
|
@@ -341,8 +334,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string status messages
|
|
|
|
|
*/
|
|
|
|
|
private function _doDataEntries(&$db) {
|
|
|
|
|
|
|
|
|
|
private function _doDataEntries(&$db)
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['install']['creating_entries']);
|
|
|
|
|
@@ -356,7 +349,9 @@ class FroxlorInstall {
|
|
|
|
|
`vhostcontainer` = '1',
|
|
|
|
|
`vhostcontainer_servername_statement` = '1'
|
|
|
|
|
");
|
|
|
|
|
$stmt->execute(array('serverip' => $this->_data['serverip']));
|
|
|
|
|
$stmt->execute(array(
|
|
|
|
|
'serverip' => $this->_data['serverip']
|
|
|
|
|
));
|
|
|
|
|
$defaultip = $db->lastInsertId();
|
|
|
|
|
|
|
|
|
|
// insert the defaultip
|
|
|
|
|
@@ -365,7 +360,9 @@ class FroxlorInstall {
|
|
|
|
|
`value` = :defaultip
|
|
|
|
|
WHERE `settinggroup` = 'system' AND `varname` = 'defaultip'
|
|
|
|
|
");
|
|
|
|
|
$upd_stmt->execute(array('defaultip' => $defaultip));
|
|
|
|
|
$upd_stmt->execute(array(
|
|
|
|
|
'defaultip' => $defaultip
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$content .= $this->_status_message('green', 'OK');
|
|
|
|
|
|
|
|
|
|
@@ -419,7 +416,8 @@ class FroxlorInstall {
|
|
|
|
|
* @param string $varname
|
|
|
|
|
* @param string $value
|
|
|
|
|
*/
|
|
|
|
|
private function _updateSetting(&$stmt = null, $value = null, $group = null, $varname = null) {
|
|
|
|
|
private function _updateSetting(&$stmt = null, $value = null, $group = null, $varname = null)
|
|
|
|
|
{
|
|
|
|
|
$stmt->execute(array(
|
|
|
|
|
'group' => $group,
|
|
|
|
|
'varname' => $varname,
|
|
|
|
|
@@ -434,8 +432,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string status messages
|
|
|
|
|
*/
|
|
|
|
|
private function _doSettings(&$db) {
|
|
|
|
|
|
|
|
|
|
private function _doSettings(&$db)
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['install']['changing_data']);
|
|
|
|
|
@@ -502,21 +500,22 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string status messages
|
|
|
|
|
*/
|
|
|
|
|
private function _importDatabaseData() {
|
|
|
|
|
|
|
|
|
|
private function _importDatabaseData()
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['install']['testing_new_db']);
|
|
|
|
|
$options = array('PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8');
|
|
|
|
|
$options = array(
|
|
|
|
|
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8'
|
|
|
|
|
);
|
|
|
|
|
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
|
|
|
|
|
$fatal_fail = false;
|
|
|
|
|
try {
|
|
|
|
|
$db = new PDO(
|
|
|
|
|
$dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options
|
|
|
|
|
);
|
|
|
|
|
$db = new PDO($dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options);
|
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
|
$content .= $this->_status_message('red', $e->getMessage());
|
|
|
|
|
$fatal_fail = true;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (! $fatal_fail) {
|
|
|
|
|
|
|
|
|
|
@@ -547,8 +546,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string status messages
|
|
|
|
|
*/
|
|
|
|
|
private function _createDatabaseAndUser(&$db_root) {
|
|
|
|
|
|
|
|
|
|
private function _createDatabaseAndUser(&$db_root)
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
|
|
|
|
|
// so first we have to delete the database and
|
|
|
|
|
@@ -556,16 +555,28 @@ class FroxlorInstall {
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['install']['prepare_db']);
|
|
|
|
|
|
|
|
|
|
$del_stmt = $db_root->prepare("DELETE FROM `mysql`.`user` WHERE `User` = :user AND `Host` = :accesshost");
|
|
|
|
|
$del_stmt->execute(array('user' => $this->_data['mysql_unpriv_user'], 'accesshost' => $this->_data['mysql_access_host']));
|
|
|
|
|
$del_stmt->execute(array(
|
|
|
|
|
'user' => $this->_data['mysql_unpriv_user'],
|
|
|
|
|
'accesshost' => $this->_data['mysql_access_host']
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$del_stmt = $db_root->prepare("DELETE FROM `mysql`.`db` WHERE `User` = :user AND `Host` = :accesshost");
|
|
|
|
|
$del_stmt->execute(array('user' => $this->_data['mysql_unpriv_user'], 'accesshost' => $this->_data['mysql_access_host']));
|
|
|
|
|
$del_stmt->execute(array(
|
|
|
|
|
'user' => $this->_data['mysql_unpriv_user'],
|
|
|
|
|
'accesshost' => $this->_data['mysql_access_host']
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$del_stmt = $db_root->prepare("DELETE FROM `mysql`.`tables_priv` WHERE `User` = :user AND `Host` =:accesshost");
|
|
|
|
|
$del_stmt->execute(array('user' => $this->_data['mysql_unpriv_user'], 'accesshost' => $this->_data['mysql_access_host']));
|
|
|
|
|
$del_stmt->execute(array(
|
|
|
|
|
'user' => $this->_data['mysql_unpriv_user'],
|
|
|
|
|
'accesshost' => $this->_data['mysql_access_host']
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$del_stmt = $db_root->prepare("DELETE FROM `mysql`.`columns_priv` WHERE `User` = :user AND `Host` = :accesshost");
|
|
|
|
|
$del_stmt->execute(array('user' => $this->_data['mysql_unpriv_user'], 'accesshost' => $this->_data['mysql_access_host']));
|
|
|
|
|
$del_stmt->execute(array(
|
|
|
|
|
'user' => $this->_data['mysql_unpriv_user'],
|
|
|
|
|
'accesshost' => $this->_data['mysql_access_host']
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$del_stmt = $db_root->prepare("DROP DATABASE IF EXISTS `" . str_replace('`', '', $this->_data['mysql_database']) . "`;");
|
|
|
|
|
$del_stmt->execute();
|
|
|
|
|
@@ -580,15 +591,11 @@ class FroxlorInstall {
|
|
|
|
|
|
|
|
|
|
$mysql_access_host_array = array_map('trim', explode(',', $this->_data['mysql_access_host']));
|
|
|
|
|
|
|
|
|
|
if (in_array('127.0.0.1', $mysql_access_host_array)
|
|
|
|
|
&& !in_array('localhost', $mysql_access_host_array)
|
|
|
|
|
) {
|
|
|
|
|
if (in_array('127.0.0.1', $mysql_access_host_array) && ! in_array('localhost', $mysql_access_host_array)) {
|
|
|
|
|
$mysql_access_host_array[] = 'localhost';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!in_array('127.0.0.1', $mysql_access_host_array)
|
|
|
|
|
&& in_array('localhost', $mysql_access_host_array)
|
|
|
|
|
) {
|
|
|
|
|
if (! in_array('127.0.0.1', $mysql_access_host_array) && in_array('localhost', $mysql_access_host_array)) {
|
|
|
|
|
$mysql_access_host_array[] = '127.0.0.1';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -598,11 +605,17 @@ class FroxlorInstall {
|
|
|
|
|
$stmt = $db_root->prepare("
|
|
|
|
|
GRANT ALL PRIVILEGES ON `" . $_db . "`.*
|
|
|
|
|
TO :username@:host
|
|
|
|
|
IDENTIFIED BY 'password'"
|
|
|
|
|
);
|
|
|
|
|
$stmt->execute(array("username" => $this->_data['mysql_unpriv_user'], "host" => $mysql_access_host));
|
|
|
|
|
IDENTIFIED BY 'password'");
|
|
|
|
|
$stmt->execute(array(
|
|
|
|
|
"username" => $this->_data['mysql_unpriv_user'],
|
|
|
|
|
"host" => $mysql_access_host
|
|
|
|
|
));
|
|
|
|
|
$stmt = $db_root->prepare("SET PASSWORD FOR :username@:host = PASSWORD(:password)");
|
|
|
|
|
$stmt->execute(array("username" => $this->_data['mysql_unpriv_user'], "host" => $mysql_access_host, "password" => $this->_data['mysql_unpriv_pass']));
|
|
|
|
|
$stmt->execute(array(
|
|
|
|
|
"username" => $this->_data['mysql_unpriv_user'],
|
|
|
|
|
"host" => $mysql_access_host,
|
|
|
|
|
"password" => $this->_data['mysql_unpriv_pass']
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$db_root->query("FLUSH PRIVILEGES;");
|
|
|
|
|
@@ -619,15 +632,17 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string status messages
|
|
|
|
|
*/
|
|
|
|
|
private function _backupExistingDatabase(&$db_root) {
|
|
|
|
|
|
|
|
|
|
private function _backupExistingDatabase(&$db_root)
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
|
|
|
|
|
// check for existing of former database
|
|
|
|
|
$tables_exist = false;
|
|
|
|
|
$sql = "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = :database";
|
|
|
|
|
$result_stmt = $db_root->prepare($sql);
|
|
|
|
|
$result_stmt->execute(array('database' => $this->_data['mysql_database']));
|
|
|
|
|
$result_stmt->execute(array(
|
|
|
|
|
'database' => $this->_data['mysql_database']
|
|
|
|
|
));
|
|
|
|
|
$rows = $db_root->query("SELECT FOUND_ROWS()")->fetchColumn();
|
|
|
|
|
|
|
|
|
|
// check result
|
|
|
|
|
@@ -671,8 +686,8 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* show form to collect all needed data for the install
|
|
|
|
|
*/
|
|
|
|
|
private function _showDataForm() {
|
|
|
|
|
|
|
|
|
|
private function _showDataForm()
|
|
|
|
|
{
|
|
|
|
|
$content = "";
|
|
|
|
|
// form action
|
|
|
|
|
$formaction = htmlspecialchars($_SERVER['PHP_SELF']);
|
|
|
|
|
@@ -701,25 +716,29 @@ class FroxlorInstall {
|
|
|
|
|
// unpriv-user has to be different from root
|
|
|
|
|
if ($this->_data['mysql_unpriv_user'] == $this->_data['mysql_root_user']) {
|
|
|
|
|
$style = 'blue';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('mysql_unpriv_user', true, $style);
|
|
|
|
|
// is we posted and no password was given -> red
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['mysql_unpriv_pass'] == '') {
|
|
|
|
|
$style = 'red';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('mysql_unpriv_pass', true, $style, 'password');
|
|
|
|
|
// unpriv-user has to be different from root
|
|
|
|
|
if ($this->_data['mysql_unpriv_user'] == $this->_data['mysql_root_user']) {
|
|
|
|
|
$style = 'blue';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('mysql_root_user', true, $style);
|
|
|
|
|
// is we posted and no password was given -> red
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['mysql_root_pass'] == '') {
|
|
|
|
|
$style = 'red';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('mysql_root_pass', true, $style, 'password');
|
|
|
|
|
|
|
|
|
|
@@ -731,21 +750,17 @@ class FroxlorInstall {
|
|
|
|
|
// user
|
|
|
|
|
$formdata .= $this->_getSectionItemString('admin_user', true);
|
|
|
|
|
// check for admin passwords to be equal
|
|
|
|
|
if (!empty($_POST['installstep']) &&
|
|
|
|
|
($this->_data['admin_pass1'] == ''
|
|
|
|
|
|| $this->_data['admin_pass1'] != $this->_data['admin_pass2'])
|
|
|
|
|
) {
|
|
|
|
|
if (! empty($_POST['installstep']) && ($this->_data['admin_pass1'] == '' || $this->_data['admin_pass1'] != $this->_data['admin_pass2'])) {
|
|
|
|
|
$style = 'color:red;';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('admin_pass1', true, $style, 'password');
|
|
|
|
|
// check for admin passwords to be equal
|
|
|
|
|
if (!empty($_POST['installstep']) &&
|
|
|
|
|
($this->_data['admin_pass2'] == ''
|
|
|
|
|
|| $this->_data['admin_pass1'] != $this->_data['admin_pass2'])
|
|
|
|
|
) {
|
|
|
|
|
if (! empty($_POST['installstep']) && ($this->_data['admin_pass2'] == '' || $this->_data['admin_pass1'] != $this->_data['admin_pass2'])) {
|
|
|
|
|
$style = 'color:red;';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('admin_pass2', true, $style, 'password');
|
|
|
|
|
// activate newsfeed?
|
|
|
|
|
@@ -759,19 +774,22 @@ class FroxlorInstall {
|
|
|
|
|
// servername
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['servername'] == '') {
|
|
|
|
|
$style = 'color:red;';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('servername', true, $style);
|
|
|
|
|
// serverip
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['serverip'] == '') {
|
|
|
|
|
$style = 'color:red;';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('serverip', true, $style);
|
|
|
|
|
// webserver
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['webserver'] == '') {
|
|
|
|
|
$websrvstyle = 'color:red;';
|
|
|
|
|
} else { $websrvstyle = '';
|
|
|
|
|
} else {
|
|
|
|
|
$websrvstyle = '';
|
|
|
|
|
}
|
|
|
|
|
// apache
|
|
|
|
|
$formdata .= $this->_getSectionItemCheckbox('apache2', ($this->_data['webserver'] == 'apache2'), $websrvstyle);
|
|
|
|
|
@@ -783,13 +801,15 @@ class FroxlorInstall {
|
|
|
|
|
// webserver-user
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['httpuser'] == '') {
|
|
|
|
|
$style = 'color:red;';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('httpuser', true, $style);
|
|
|
|
|
// webserver-group
|
|
|
|
|
if (! empty($_POST['installstep']) && $this->_data['httpgroup'] == '') {
|
|
|
|
|
$style = 'color:red;';
|
|
|
|
|
} else { $style = '';
|
|
|
|
|
} else {
|
|
|
|
|
$style = '';
|
|
|
|
|
}
|
|
|
|
|
$formdata .= $this->_getSectionItemString('httpgroup', true, $style);
|
|
|
|
|
|
|
|
|
|
@@ -798,7 +818,10 @@ class FroxlorInstall {
|
|
|
|
|
eval("\$content .= \"" . $this->_getTemplate("dataform2") . "\";");
|
|
|
|
|
|
|
|
|
|
$navigation = '';
|
|
|
|
|
return array('pagecontent' => $content, 'pagenavigation' => $navigation);
|
|
|
|
|
return array(
|
|
|
|
|
'pagecontent' => $content,
|
|
|
|
|
'pagenavigation' => $navigation
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -806,12 +829,15 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @param string $fieldname
|
|
|
|
|
* @param boolean $required
|
|
|
|
|
* @param string $style optional css
|
|
|
|
|
* @param string $type optional type of input-box (default: text)
|
|
|
|
|
* @param string $style
|
|
|
|
|
* optional css
|
|
|
|
|
* @param string $type
|
|
|
|
|
* optional type of input-box (default: text)
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function _getSectionItemString($fieldname = null, $required = false, $style = "", $type = 'text') {
|
|
|
|
|
private function _getSectionItemString($fieldname = null, $required = false, $style = "", $type = 'text')
|
|
|
|
|
{
|
|
|
|
|
$fieldlabel = $this->_lng['install'][$fieldname];
|
|
|
|
|
$fieldvalue = htmlspecialchars($this->_data[$fieldname]);
|
|
|
|
|
if ($required) {
|
|
|
|
|
@@ -831,7 +857,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function _getSectionItemCheckbox($fieldname = null, $checked = false, $style = "") {
|
|
|
|
|
private function _getSectionItemCheckbox($fieldname = null, $checked = false, $style = "")
|
|
|
|
|
{
|
|
|
|
|
$fieldlabel = $this->_lng['install'][$fieldname];
|
|
|
|
|
if ($checked) {
|
|
|
|
|
$checked = 'checked="checked"';
|
|
|
|
|
@@ -850,7 +877,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function _getSectionItemYesNo($fieldname = null, $checked = false, $style = "") {
|
|
|
|
|
private function _getSectionItemYesNo($fieldname = null, $checked = false, $style = "")
|
|
|
|
|
{
|
|
|
|
|
$fieldlabel = $this->_lng['install'][$fieldname];
|
|
|
|
|
if ($checked) {
|
|
|
|
|
$checked = 'checked="checked"';
|
|
|
|
|
@@ -863,7 +891,8 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* check for requirements froxlor needs
|
|
|
|
|
*/
|
|
|
|
|
private function _requirementCheck() {
|
|
|
|
|
private function _requirementCheck()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// indicator whether we need to abort or not
|
|
|
|
|
$_die = false;
|
|
|
|
|
@@ -942,6 +971,16 @@ class FroxlorInstall {
|
|
|
|
|
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check for curl extension
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpcurl']);
|
|
|
|
|
|
|
|
|
|
if (! extension_loaded('curl')) {
|
|
|
|
|
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
|
|
|
|
|
$_die = true;
|
|
|
|
|
} else {
|
|
|
|
|
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check for bcmath extension
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpbcmath']);
|
|
|
|
|
|
|
|
|
|
@@ -951,15 +990,6 @@ class FroxlorInstall {
|
|
|
|
|
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check for curl extension
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpcurl']);
|
|
|
|
|
|
|
|
|
|
if (!extension_loaded('curl')) {
|
|
|
|
|
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['curldescription']);
|
|
|
|
|
} else {
|
|
|
|
|
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check for open_basedir
|
|
|
|
|
$content .= $this->_status_message('begin', $this->_lng['requirements']['openbasedir']);
|
|
|
|
|
$php_ob = @ini_get("open_basedir");
|
|
|
|
|
@@ -985,13 +1015,17 @@ class FroxlorInstall {
|
|
|
|
|
}
|
|
|
|
|
eval("\$navigation .= \"" . $this->_getTemplate("pagebottom") . "\";");
|
|
|
|
|
|
|
|
|
|
return array('pagecontent' => $content, 'pagenavigation' => $navigation);
|
|
|
|
|
return array(
|
|
|
|
|
'pagecontent' => $content,
|
|
|
|
|
'pagenavigation' => $navigation
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* send no-caching headers and set the default timezone
|
|
|
|
|
*/
|
|
|
|
|
private function _sendHeaders() {
|
|
|
|
|
private function _sendHeaders()
|
|
|
|
|
{
|
|
|
|
|
// no caching
|
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
|
|
|
|
header("Pragma: no-cache");
|
|
|
|
|
@@ -999,9 +1033,7 @@ class FroxlorInstall {
|
|
|
|
|
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
|
|
|
|
|
|
|
|
|
// ensure that default timezone is set
|
|
|
|
|
if (function_exists("date_default_timezone_set")
|
|
|
|
|
&& function_exists("date_default_timezone_get")
|
|
|
|
|
) {
|
|
|
|
|
if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
|
|
|
|
|
@date_default_timezone_set(@date_default_timezone_get());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1010,16 +1042,15 @@ class FroxlorInstall {
|
|
|
|
|
* check for the userdata - if it exists then froxlor is
|
|
|
|
|
* already installed and we show a nice note
|
|
|
|
|
*/
|
|
|
|
|
private function _checkUserDataFile() {
|
|
|
|
|
private function _checkUserDataFile()
|
|
|
|
|
{
|
|
|
|
|
$userdata = $this->_basepath . '/lib/userdata.inc.php';
|
|
|
|
|
if (file_exists($userdata)) {
|
|
|
|
|
// includes the usersettings (MySQL-Username/Passwort)
|
|
|
|
|
// to test if Froxlor is already installed
|
|
|
|
|
require $this->_basepath . '/lib/userdata.inc.php';
|
|
|
|
|
|
|
|
|
|
if (isset($sql)
|
|
|
|
|
&& is_array($sql)
|
|
|
|
|
) {
|
|
|
|
|
if (isset($sql) && is_array($sql)) {
|
|
|
|
|
// use sparkle theme for the notice
|
|
|
|
|
$installed_hint = file_get_contents($this->_basepath . '/templates/Sparkle/misc/alreadyinstalledhint.tpl');
|
|
|
|
|
$installed_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $installed_hint);
|
|
|
|
|
@@ -1031,18 +1062,15 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* include the chose language or else default (english)
|
|
|
|
|
*/
|
|
|
|
|
private function _includeLanguageFile() {
|
|
|
|
|
private function _includeLanguageFile()
|
|
|
|
|
{
|
|
|
|
|
// set default
|
|
|
|
|
$standardlanguage = 'english';
|
|
|
|
|
|
|
|
|
|
// check either _GET or _POST
|
|
|
|
|
if (isset($_GET['language'])
|
|
|
|
|
&& isset($this->_languages[$_GET['language']])
|
|
|
|
|
) {
|
|
|
|
|
if (isset($_GET['language']) && isset($this->_languages[$_GET['language']])) {
|
|
|
|
|
$this->_activelng = $_GET['language'];
|
|
|
|
|
} elseif (isset($_POST['language'])
|
|
|
|
|
&& isset($this->_languages[$_POST['language']])
|
|
|
|
|
) {
|
|
|
|
|
} elseif (isset($_POST['language']) && isset($this->_languages[$_POST['language']])) {
|
|
|
|
|
$this->_activelng = $_POST['language'];
|
|
|
|
|
} else {
|
|
|
|
|
// try to guess the right language
|
|
|
|
|
@@ -1071,17 +1099,17 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* Get template from filesystem
|
|
|
|
|
*
|
|
|
|
|
* @param string $template name of the template including subdirectory
|
|
|
|
|
* @param string $template
|
|
|
|
|
* name of the template including subdirectory
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function _getTemplate($template = null) {
|
|
|
|
|
private function _getTemplate($template = null)
|
|
|
|
|
{
|
|
|
|
|
// build filename
|
|
|
|
|
$filename = $this->_basepath . '/install/templates/' . $template . '.tpl';
|
|
|
|
|
// check existence
|
|
|
|
|
if(file_exists($filename)
|
|
|
|
|
&& is_readable($filename)
|
|
|
|
|
) {
|
|
|
|
|
if (file_exists($filename) && is_readable($filename)) {
|
|
|
|
|
$templatefile = addcslashes(file_get_contents($filename), '"\\');
|
|
|
|
|
// loop through template more than once in case we have an "if"-statement in another one
|
|
|
|
|
while (preg_match('/<if[ \t]*(.*)>(.*)(<\/if>|<else>(.*)<\/if>)/Uis', $templatefile)) {
|
|
|
|
|
@@ -1102,7 +1130,8 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function _status_message($case, $text) {
|
|
|
|
|
private function _status_message($case, $text)
|
|
|
|
|
{
|
|
|
|
|
if ($case == 'begin') {
|
|
|
|
|
return '<tr><td class="install-step">' . $text;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1113,13 +1142,15 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* get/guess servername
|
|
|
|
|
*/
|
|
|
|
|
private function _guessServerName() {
|
|
|
|
|
private function _guessServerName()
|
|
|
|
|
{
|
|
|
|
|
// from form?
|
|
|
|
|
if (! empty($_POST['servername'])) {
|
|
|
|
|
$this->_data['servername'] = $_POST['servername'];
|
|
|
|
|
return;
|
|
|
|
|
// from $_SERVER
|
|
|
|
|
} else if (!empty($_SERVER['SERVER_NAME'])) {
|
|
|
|
|
} else
|
|
|
|
|
if (! empty($_SERVER['SERVER_NAME'])) {
|
|
|
|
|
// no ips
|
|
|
|
|
if ($this->_validate_ip($_SERVER['SERVER_NAME']) == false) {
|
|
|
|
|
$this->_data['servername'] = $_SERVER['SERVER_NAME'];
|
|
|
|
|
@@ -1133,7 +1164,8 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* get/guess serverip
|
|
|
|
|
*/
|
|
|
|
|
private function _guessServerIP() {
|
|
|
|
|
private function _guessServerIP()
|
|
|
|
|
{
|
|
|
|
|
// from form
|
|
|
|
|
if (! empty($_POST['serverip'])) {
|
|
|
|
|
$this->_data['serverip'] = $_POST['serverip'];
|
|
|
|
|
@@ -1150,22 +1182,17 @@ class FroxlorInstall {
|
|
|
|
|
/**
|
|
|
|
|
* get/guess webserver-software
|
|
|
|
|
*/
|
|
|
|
|
private function _guessWebserver() {
|
|
|
|
|
private function _guessWebserver()
|
|
|
|
|
{
|
|
|
|
|
// post
|
|
|
|
|
if (! empty($_POST['webserver'])) {
|
|
|
|
|
$this->_data['webserver'] = $_POST['webserver'];
|
|
|
|
|
} else {
|
|
|
|
|
if (strtoupper(@php_sapi_name()) == "APACHE2HANDLER"
|
|
|
|
|
|| stristr($_SERVER['SERVER_SOFTWARE'], "apache/2")
|
|
|
|
|
) {
|
|
|
|
|
if (strtoupper(@php_sapi_name()) == "APACHE2HANDLER" || stristr($_SERVER['SERVER_SOFTWARE'], "apache/2")) {
|
|
|
|
|
$this->_data['webserver'] = 'apache2';
|
|
|
|
|
} elseif(substr(strtoupper(@php_sapi_name()), 0, 8) == "LIGHTTPD"
|
|
|
|
|
|| stristr($_SERVER['SERVER_SOFTWARE'], "lighttpd")
|
|
|
|
|
) {
|
|
|
|
|
} elseif (substr(strtoupper(@php_sapi_name()), 0, 8) == "LIGHTTPD" || stristr($_SERVER['SERVER_SOFTWARE'], "lighttpd")) {
|
|
|
|
|
$this->_data['webserver'] = 'lighttpd';
|
|
|
|
|
} elseif(substr(strtoupper(@php_sapi_name()), 0, 8) == "NGINX"
|
|
|
|
|
|| stristr($_SERVER['SERVER_SOFTWARE'], "nginx")
|
|
|
|
|
) {
|
|
|
|
|
} elseif (substr(strtoupper(@php_sapi_name()), 0, 8) == "NGINX" || stristr($_SERVER['SERVER_SOFTWARE'], "nginx")) {
|
|
|
|
|
$this->_data['webserver'] = 'nginx';
|
|
|
|
|
} else {
|
|
|
|
|
// we don't need to bail out, since unknown does not affect any critical installation routines
|
|
|
|
|
@@ -1182,7 +1209,8 @@ class FroxlorInstall {
|
|
|
|
|
* @param string $default
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
private function _getPostField($fieldname = null, $default = null) {
|
|
|
|
|
private function _getPostField($fieldname = null, $default = null)
|
|
|
|
|
{
|
|
|
|
|
// initialize
|
|
|
|
|
$this->_data[$fieldname] = '';
|
|
|
|
|
// set default
|
|
|
|
|
@@ -1202,11 +1230,9 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return boolean|string
|
|
|
|
|
*/
|
|
|
|
|
private function _validate_ip($ip = null) {
|
|
|
|
|
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false
|
|
|
|
|
&& filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false
|
|
|
|
|
&& filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) === false
|
|
|
|
|
) {
|
|
|
|
|
private function _validate_ip($ip = null)
|
|
|
|
|
{
|
|
|
|
|
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) === false) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return $ip;
|
|
|
|
|
@@ -1219,17 +1245,15 @@ class FroxlorInstall {
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function _remove_remarks($sql) {
|
|
|
|
|
|
|
|
|
|
private function _remove_remarks($sql)
|
|
|
|
|
{
|
|
|
|
|
$lines = explode("\n", $sql);
|
|
|
|
|
// try to keep mem. use down
|
|
|
|
|
$sql = "";
|
|
|
|
|
$linecount = count($lines);
|
|
|
|
|
$output = "";
|
|
|
|
|
for ($i = 0; $i < $linecount; $i ++) {
|
|
|
|
|
if ($i != ($linecount - 1)
|
|
|
|
|
|| strlen($lines[$i]) > 0
|
|
|
|
|
) {
|
|
|
|
|
if ($i != ($linecount - 1) || strlen($lines[$i]) > 0) {
|
|
|
|
|
if (substr($lines[$i], 0, 1) != "#") {
|
|
|
|
|
$output .= $lines[$i] . "\n";
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1249,7 +1273,8 @@ class FroxlorInstall {
|
|
|
|
|
* The whole function has been taken from the phpbb installer,
|
|
|
|
|
* copyright by the phpbb team, phpbb in summer 2004.
|
|
|
|
|
*/
|
|
|
|
|
private function _split_sql_file($sql, $delimiter) {
|
|
|
|
|
private function _split_sql_file($sql, $delimiter)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Split up our string into "possible" SQL statements.
|
|
|
|
|
$tokens = explode($delimiter, $sql);
|
|
|
|
|
@@ -1265,9 +1290,7 @@ class FroxlorInstall {
|
|
|
|
|
$token_count = count($tokens);
|
|
|
|
|
for ($i = 0; $i < $token_count; $i ++) {
|
|
|
|
|
// Don't want to add an empty string as the last thing in the array.
|
|
|
|
|
if (($i != ($token_count - 1))
|
|
|
|
|
|| (strlen($tokens[$i] > 0))
|
|
|
|
|
) {
|
|
|
|
|
if (($i != ($token_count - 1)) || (strlen($tokens[$i] > 0))) {
|
|
|
|
|
// This is the total number of single quotes in the token.
|
|
|
|
|
$total_quotes = preg_match_all("/'/", $tokens[$i], $matches);
|
|
|
|
|
|
|
|
|
|
@@ -1323,5 +1346,4 @@ class FroxlorInstall {
|
|
|
|
|
}
|
|
|
|
|
return $output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|