mirror of
https://github.com/e107inc/e107.git
synced 2025-06-23 09:23:03 +02:00
Issue #1349 MySQL class fixes and install.php corrections.
This commit is contained in:
@ -1057,7 +1057,7 @@ class admin_shortcodes
|
||||
<br /><br />
|
||||
<b>".FOOTLAN_12."</b>
|
||||
<br />
|
||||
".e107::getDB()->mySqlServerInfo.
|
||||
".e107::getDB()->getServerInfo(). // mySqlServerInfo.
|
||||
"<br />
|
||||
".FOOTLAN_16.": ".$mySQLdefaultdb."
|
||||
<br /><br />
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<e107Export version="0.8.0 (cvs)" timestamp="1251856226">
|
||||
<e107Export version="2.0" timestamp="1251856226">
|
||||
<prefs>
|
||||
<core name="admin_alerts_ok">1</core>
|
||||
<core name="admin_alerts_uniquemenu">0</core>
|
||||
|
@ -68,10 +68,10 @@ class e_db_mysql
|
||||
// TODO switch to protected vars where needed
|
||||
public $mySQLserver;
|
||||
public $mySQLuser;
|
||||
public $mySQLpassword;
|
||||
public $mySQLdefaultdb;
|
||||
protected $mySQLpassword;
|
||||
protected $mySQLdefaultdb;
|
||||
public $mySQLPrefix;
|
||||
public $mySQLaccess;
|
||||
protected $mySQLaccess;
|
||||
public $mySQLresult;
|
||||
public $mySQLrows;
|
||||
public $mySQLerror = ''; // Error reporting mode - TRUE shows messages
|
||||
@ -135,8 +135,19 @@ class e_db_mysql
|
||||
if(defined('e_LANGUAGE')) $this->mySQLlanguage = e107::getLanguage()->e_language;
|
||||
}
|
||||
|
||||
function getPDO()
|
||||
{
|
||||
return $this->pdo;
|
||||
}
|
||||
|
||||
|
||||
function getMode()
|
||||
{
|
||||
$this->gen('SELECT @@sql_mode');
|
||||
$row = $this->fetch();
|
||||
return $row['@@sql_mode'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects to mySQL server and selects database - generally not required if your table is in the main DB.<br />
|
||||
* <br />
|
||||
@ -161,21 +172,19 @@ class e_db_mysql
|
||||
global $db_ConnectionID, $db_defaultPrefix;
|
||||
e107::getSingleton('e107_traffic')->BumpWho('db Connect', 1);
|
||||
|
||||
$this->mySQLserver = $mySQLserver;
|
||||
$this->mySQLuser = $mySQLuser;
|
||||
$this->mySQLpassword = $mySQLpassword;
|
||||
$this->mySQLdefaultdb = $mySQLdefaultdb;
|
||||
$this->mySQLPrefix = $mySQLPrefix;
|
||||
|
||||
$temp = $this->mySQLerror;
|
||||
$this->mySQLerror = FALSE;
|
||||
$this->mySQLserver = $mySQLserver;
|
||||
$this->mySQLuser = $mySQLuser;
|
||||
$this->mySQLpassword = $mySQLpassword;
|
||||
$this->mySQLdefaultdb = $mySQLdefaultdb;
|
||||
$this->mySQLPrefix = $mySQLPrefix;
|
||||
$this->mySQLerror = false;
|
||||
|
||||
|
||||
if($this->pdo)
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver, $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
$this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver."; port=3307", $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
}
|
||||
catch(PDOException $ex)
|
||||
{
|
||||
@ -203,7 +212,7 @@ class e_db_mysql
|
||||
}
|
||||
}
|
||||
|
||||
$this->mySqlServerInfo = ($this->pdo) ? $this->mySQLaccess->getAttribute(PDO::ATTR_SERVER_INFO) : mysql_get_server_info(); // We always need this for db_Set_Charset() - so make generally available
|
||||
$this->mySqlServerInfo = ($this->pdo) ? $this->mySQLaccess->query('select version()')->fetchColumn() : mysql_get_server_info(); // We always need this for db_Set_Charset() - so make generally available
|
||||
|
||||
// Set utf8 connection?
|
||||
//@TODO: simplify when yet undiscovered side-effects will be fixed
|
||||
@ -219,9 +228,12 @@ class e_db_mysql
|
||||
$this->dbError('dbConnect/SelectDB');
|
||||
|
||||
// Save the connection resource
|
||||
if ($db_ConnectionID == NULL)
|
||||
if ($db_ConnectionID == null)
|
||||
{
|
||||
$db_ConnectionID = $this->mySQLaccess;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -254,16 +266,17 @@ class e_db_mysql
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver, $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
$this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver."; port=3307", $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
}
|
||||
catch(PDOException $ex)
|
||||
{
|
||||
$this->mySQLlastErrText = $ex->getMessage();
|
||||
// echo "<pre>".print_r($ex,true)."</pre>"; // Useful for Debug.
|
||||
echo "<pre>".print_r($ex,true)."</pre>"; // Useful for Debug.
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->mySqlServerInfo = $this->mySQLaccess->getAttribute(PDO::ATTR_SERVER_INFO);
|
||||
// $this->mySqlServerInfo = $this->mySQLaccess->getAttribute(PDO::ATTR_SERVER_INFO);
|
||||
$this->mySqlServerInfo = $this->mySQLaccess->query('select version()')->fetchColumn();
|
||||
|
||||
}
|
||||
else // Legacy.
|
||||
@ -285,6 +298,16 @@ class e_db_mysql
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Server Info
|
||||
* @return mixed
|
||||
*/
|
||||
public function getServerInfo()
|
||||
{
|
||||
return $this->mySqlServerInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Select the database to use.
|
||||
@ -349,13 +372,15 @@ class e_db_mysql
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return void
|
||||
* @desc Enter description here...
|
||||
* @access private
|
||||
*/
|
||||
function db_Show_Performance()
|
||||
{
|
||||
return $db_debug->Show_Performance();
|
||||
// e107::getDebug()-Show_P
|
||||
// return $db_debug->Show_Performance();
|
||||
}
|
||||
|
||||
|
||||
@ -422,8 +447,16 @@ class e_db_mysql
|
||||
// print_a($query);
|
||||
// print_a($prep);
|
||||
// echo "<hr>";
|
||||
// $sQryRes = $prep->execute($query);
|
||||
$sQryRes = $this->mySQLaccess->query($query);
|
||||
// $sQryRes = $prep->execute($query);
|
||||
try
|
||||
{
|
||||
$sQryRes = is_null($rli) ? $this->mySQLaccess->query($query) : $rli->query($query);
|
||||
}
|
||||
catch(PDOException $ex)
|
||||
{
|
||||
// $sQryRes = null;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -437,6 +470,7 @@ class e_db_mysql
|
||||
$db_time += $mytime;
|
||||
$this->mySQLresult = $sQryRes;
|
||||
|
||||
|
||||
$this->total_results = false;
|
||||
|
||||
// Need to get the total record count as well. Return code is a resource identifier
|
||||
@ -449,7 +483,7 @@ class e_db_mysql
|
||||
$rc = $fr->fetchColumn();
|
||||
$this->total_results = (int) $rc;
|
||||
}
|
||||
else
|
||||
else /* @XXX Subject of Removal. */
|
||||
{
|
||||
$fr = mysql_query('SELECT FOUND_ROWS()', $this->mySQLaccess);
|
||||
$rc = mysql_fetch_array($fr);
|
||||
@ -461,6 +495,7 @@ class e_db_mysql
|
||||
|
||||
if (E107_DEBUG_LEVEL)
|
||||
{
|
||||
|
||||
global $db_debug;
|
||||
$aTrace = debug_backtrace();
|
||||
$pTable = $this->mySQLcurTable;
|
||||
@ -1102,9 +1137,8 @@ class e_db_mysql
|
||||
|
||||
/**
|
||||
* @return array MySQL row
|
||||
* @param string $mode
|
||||
* @desc Fetch an array containing row data (see PHP's mysql_fetch_array() docs)<br />
|
||||
* <br />
|
||||
* @example
|
||||
* Example :<br />
|
||||
* <code>while($row = $sql->fetch()){
|
||||
* $text .= $row['username'];
|
||||
@ -1123,15 +1157,15 @@ class e_db_mysql
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case MYSQL_BOTH:
|
||||
case MYSQL_BOTH: // 3
|
||||
$type = PDO::FETCH_BOTH;
|
||||
break;
|
||||
|
||||
case MYSQL_NUM:
|
||||
case MYSQL_NUM: // 2
|
||||
$type = PDO::FETCH_NUM;
|
||||
break;
|
||||
|
||||
case MYSQL_ASSOC:
|
||||
case MYSQL_ASSOC: // 1
|
||||
default:
|
||||
$type = PDO::FETCH_ASSOC;
|
||||
break;
|
||||
@ -2220,6 +2254,29 @@ class e_db_mysql
|
||||
*/
|
||||
function dbError($from)
|
||||
{
|
||||
|
||||
// $this->mySQLaccess->getMessage();
|
||||
|
||||
if($this->pdo)
|
||||
{
|
||||
// $this->mySQLlastErrNum =;
|
||||
$this->mySQLerror = true;
|
||||
if(is_object($this->mySQLaccess))
|
||||
{
|
||||
$errInfo= $this->mySQLaccess->errorInfo();
|
||||
$this->mySQLlastErrNum = $errInfo[1];
|
||||
$this->mySQLlastErrText = $errInfo[2]; // $ex->getMessage();
|
||||
}
|
||||
if($this->mySQLlastErrNum == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->mySQLlastErrText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->mySQLlastErrNum = mysql_errno();
|
||||
$this->mySQLlastErrText = '';
|
||||
if ($this->mySQLlastErrNum == 0)
|
||||
@ -2262,7 +2319,6 @@ class e_db_mysql
|
||||
* Check if MySQL version is utf8 compatible and may be used as it accordingly to the user choice
|
||||
*
|
||||
* @TODO Simplify when the conversion script will be available
|
||||
*
|
||||
* @access public
|
||||
* @param string MySQL charset may be forced in special circumstances
|
||||
* UTF-8 encoding and decoding is left to the progammer
|
||||
@ -2328,7 +2384,6 @@ class e_db_mysql
|
||||
* fields which are 'NOT NULL' but have no default are added to the '_NOTNULL' list
|
||||
*</code>
|
||||
* @param string $tableName - table name, without any prefixes (language or general)
|
||||
*
|
||||
* @return boolean|array - FALSE if not found/not to be used. Array of field names and processing types and null overrides if found
|
||||
*/
|
||||
public function getFieldDefs($tableName)
|
||||
@ -2375,15 +2430,12 @@ class e_db_mysql
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Search the specified file for a field type definition of the specified table.
|
||||
*
|
||||
* If found, generate and save a cache file in the e_CACHE_DB directory,
|
||||
* Always also update $this->dbFieldDefs[$tableName] - FALSE if not found, data if found
|
||||
*
|
||||
* @param string $defFile - file name, including path
|
||||
* @param string $tableName - name of table sought
|
||||
*
|
||||
* @return boolean TRUE on success, FALSE on not found (some errors intentionally ignored)
|
||||
*/
|
||||
protected function loadTableDef($defFile, $tableName)
|
||||
@ -2424,12 +2476,9 @@ class e_db_mysql
|
||||
|
||||
/**
|
||||
* Creates a field type definition from the structure of the table in the DB
|
||||
*
|
||||
* Generate and save a cache file in the e_CACHE_DB directory,
|
||||
* Also update $this->dbFieldDefs[$tableName] - FALSE if error, data if found
|
||||
*
|
||||
* @param string $tableName - name of table sought
|
||||
*
|
||||
* @return boolean TRUE on success, FALSE on not found (some errors intentionally ignored)
|
||||
*/
|
||||
protected function makeTableDef($tableName)
|
||||
|
@ -457,7 +457,7 @@ class e_session
|
||||
if (empty($this->_options['domain']))
|
||||
{
|
||||
// MULTILANG_SUBDOMAIN set during initial language detection in language handler
|
||||
$doma = ((!e_SUBDOMAIN || deftrue('MULTILANG_SUBDOMAIN')) && e_DOMAIN != FALSE) ? ".".e_DOMAIN : FALSE; // from v1.x
|
||||
$doma = ((deftrue('e_SUBDOMAIN') || deftrue('MULTILANG_SUBDOMAIN')) && e_DOMAIN != FALSE) ? ".".e_DOMAIN : FALSE; // from v1.x
|
||||
$this->_options['domain'] = $doma;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,11 @@ class themeHandler
|
||||
|
||||
|
||||
//enable inner tabindex counter
|
||||
$this->frm = new e_form();
|
||||
if(!deftrue("E107_INSTALL"))
|
||||
{
|
||||
$this->frm = new e_form();
|
||||
}
|
||||
|
||||
|
||||
$this->fl = e107::getFile();
|
||||
|
||||
|
139
install.php
139
install.php
@ -21,6 +21,7 @@ define('MAKE_INSTALL_LOG', false);
|
||||
/* Default Options and Paths for Installer */
|
||||
$MySQLprefix = 'e107_';
|
||||
$HANDLERS_DIRECTORY = "e107_handlers/"; // needed for e107 class init
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
define("e107_INIT", TRUE);
|
||||
require_once("e107_admin/ver.php");
|
||||
@ -35,7 +36,7 @@ define("e_UC_MEMBER", 253);
|
||||
define("e_UC_ADMIN", 254);
|
||||
define("e_UC_NOBODY", 255);*/
|
||||
|
||||
define("E107_INSTALL",TRUE);
|
||||
define("E107_INSTALL",true);
|
||||
|
||||
if($_SERVER['QUERY_STRING'] != "debug")
|
||||
{
|
||||
@ -46,6 +47,11 @@ else
|
||||
error_reporting(E_ALL);
|
||||
}
|
||||
|
||||
if($_SERVER['QUERY_STRING'] == 'clear')
|
||||
{
|
||||
unset($_SESSION);
|
||||
}
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
|
||||
function e107_ini_set($var, $value)
|
||||
@ -86,9 +92,9 @@ if($inc_path[0] != ".")
|
||||
}
|
||||
unset($inc_path);
|
||||
|
||||
if(!function_exists("mysql_connect")) //FIXME Adjust this once PDO is fully functional.
|
||||
if(!function_exists("mysql_connect") && !defined('PDO::ATTR_DRIVER_NAME'))
|
||||
{
|
||||
die_fatal_error("e107 requires PHP to be installed or compiled with the MySQL extension to work correctly, please see the MySQL manual for more information.");
|
||||
die_fatal_error("e107 requires PHP to be installed or compiled with PDO or the MySQL extension to work correctly, please see the MySQL manual for more information.");
|
||||
}
|
||||
|
||||
# Check for the realpath(). Some hosts (I'm looking at you, Awardspace) are totally dumb and
|
||||
@ -167,7 +173,7 @@ e107::getSession(); // starts session, creates default namespace
|
||||
|
||||
function include_lan($path, $force = false)
|
||||
{
|
||||
return e107::includeLan($path, $force);
|
||||
return include($path);
|
||||
}
|
||||
//obsolete $e107->e107_dirs['INSTALLER'] = "{$installer_folder_name}/";
|
||||
|
||||
@ -177,7 +183,7 @@ if(isset($_GET['create_tables']))
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
|
||||
$e_install = new e_install();
|
||||
$e_forms = new e_forms();
|
||||
@ -217,6 +223,7 @@ class e_install
|
||||
var $logFile; // Name of log file, empty string if logging disabled
|
||||
var $dbLink = NULL; // DB link - needed for PHP5.3 bug
|
||||
var $session = null;
|
||||
protected $pdo = false;
|
||||
|
||||
// public function __construct()
|
||||
function e_install()
|
||||
@ -225,6 +232,19 @@ class e_install
|
||||
define('USERID', 1);
|
||||
define('USER', true);
|
||||
define('ADMIN', true);
|
||||
define('e_UC_MAINADMIN', 250);
|
||||
define('E107_DEBUG_LEVEL',0);
|
||||
|
||||
if(defined('PDO::ATTR_DRIVER_NAME')) // TODO Uncomment when ready.
|
||||
{
|
||||
// $this->pdo = true;
|
||||
// define('e_PDO', true);
|
||||
}
|
||||
|
||||
if(!empty($this->previous_steps['mysql']['prefix']))
|
||||
{
|
||||
define('MPREFIX', $this->previous_steps['mysql']['prefix']);
|
||||
}
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
@ -247,7 +267,7 @@ class e_install
|
||||
if(isset($_POST['previous_steps']))
|
||||
{
|
||||
$this->previous_steps = unserialize(base64_decode($_POST['previous_steps']));
|
||||
$this->previous_steps = $tp->toDB($this->previous_steps);
|
||||
$this->previous_steps = $tp->filter($this->previous_steps);
|
||||
unset($_POST['previous_steps']);
|
||||
}
|
||||
else
|
||||
@ -255,7 +275,7 @@ class e_install
|
||||
$this->previous_steps = array();
|
||||
}
|
||||
$this->get_lan_file();
|
||||
$this->post_data = $tp->toDB($_POST);
|
||||
$this->post_data = $tp->filter($_POST);
|
||||
|
||||
|
||||
|
||||
@ -625,16 +645,19 @@ class e_install
|
||||
else
|
||||
{
|
||||
$this->template->SetTag("stage_title", LANINS_037.($this->previous_steps['mysql']['createdb'] == 1 ? LANINS_038 : ""));
|
||||
|
||||
if (!$res = @mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
|
||||
|
||||
$sql = e107::getDb();
|
||||
if (!$res = $sql->connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
|
||||
|
||||
// if (!$res = @mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
|
||||
{
|
||||
$success = FALSE;
|
||||
$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
|
||||
$page_content = LANINS_041.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
|
||||
$page_content = LANINS_041.nl2br("\n\n<b>".LANINS_083."\n</b><i>".$sql->getLastErrorText()."</i>");
|
||||
|
||||
$alertType = 'error';
|
||||
}
|
||||
elseif(($this->previous_steps['mysql']['createdb'] == 1) && empty($this->previous_steps['mysql']['overwritedb']) && mysql_select_db($this->previous_steps['mysql']['db'], $res))
|
||||
elseif(($this->previous_steps['mysql']['createdb'] == 1) && empty($this->previous_steps['mysql']['overwritedb']) && $sql->database($this->previous_steps['mysql']['db'], $this->previous_steps['mysql']['server']))
|
||||
{
|
||||
$success = false;
|
||||
$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
|
||||
@ -675,7 +698,7 @@ class e_install
|
||||
else
|
||||
{
|
||||
$success = false;
|
||||
$page_content .= "<br /><br />".LANINS_043.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
|
||||
$page_content .= "<br /><br />".LANINS_043.nl2br("\n\n<b>".LANINS_083."\n</b><i>".e107::getDb()->getLastErrorText()."</i>");
|
||||
}
|
||||
|
||||
}
|
||||
@ -700,7 +723,7 @@ class e_install
|
||||
$page_content .= (empty($this->previous_steps['mysql']['createdb'])) ? LANINS_129 : LANINS_043;
|
||||
|
||||
|
||||
$page_content .= nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
|
||||
$page_content .= nl2br("\n\n<b>".LANINS_083."\n</b><i>".e107::getDb()->getLastErrorText()."</i>");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -783,20 +806,28 @@ class e_install
|
||||
$perms_notes = "<span class='glyphicon glyphicon-ok'></span> ".LANINS_017;
|
||||
}
|
||||
|
||||
if(!function_exists("mysql_connect"))
|
||||
if(!function_exists("mysql_connect") && !defined('PDO::ATTR_DRIVER_NAME'))
|
||||
{
|
||||
$version_fail = true;
|
||||
$mysql_note = LAN_ERROR;
|
||||
$mysql_help = LANINS_012;
|
||||
}
|
||||
elseif (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
|
||||
elseif (!e107::getDb()->connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
|
||||
// elseif (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
|
||||
{
|
||||
$mysql_note = LAN_ERROR;
|
||||
$mysql_help = LANINS_013;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mysql_note = mysql_get_server_info();
|
||||
// $mysql_note = mysql_get_server_info();
|
||||
$mysql_note = e107::getDb()->getServerInfo();
|
||||
|
||||
if($this->pdo == true)
|
||||
{
|
||||
$mysql_note .= " (PDO)";
|
||||
}
|
||||
|
||||
if (version_compare($mysql_note, MIN_MYSQL_VERSION, '>='))
|
||||
{
|
||||
$mysql_help = "<span class='glyphicon glyphicon-ok'></span> ".LANINS_017;
|
||||
@ -807,26 +838,17 @@ class e_install
|
||||
$mysql_help = "<span class='glyphicon glyphicon-remove'></span> ".LANINS_105;
|
||||
}
|
||||
}
|
||||
if(!function_exists('utf8_encode'))
|
||||
{
|
||||
$xml_installed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml_installed = true;
|
||||
}
|
||||
|
||||
if(!function_exists('exif_imagetype'))
|
||||
{
|
||||
$exif_installed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$exif_installed = true;
|
||||
}
|
||||
|
||||
$xml_installed = (!function_exists('utf8_encode')) ? false : true;
|
||||
$exif_installed = (!function_exists('exif_imagetype')) ? false : true;
|
||||
$gdlib_installed = (extension_loaded('gd') && function_exists('gd_info')) ? true : false;
|
||||
|
||||
|
||||
|
||||
$exifExtensionLink = "<a href='http://php.net/manual/en/book.exif.php'>php.net</a>";
|
||||
|
||||
$php_version = phpversion();
|
||||
|
||||
if(version_compare($php_version, MIN_PHP_VERSION, ">="))
|
||||
{
|
||||
$php_help = "<span class='glyphicon glyphicon-ok'></span> ".LANINS_017;
|
||||
@ -835,7 +857,9 @@ class e_install
|
||||
{
|
||||
$php_help = "<span class='glyphicon glyphicon-remove'></span> ".LANINS_019;
|
||||
}
|
||||
|
||||
$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
|
||||
|
||||
if(!$perms_pass)
|
||||
{
|
||||
$this->add_button("retest_perms", LANINS_009);
|
||||
@ -852,6 +876,8 @@ class e_install
|
||||
$exifColor = ($exif_installed == true) ? "text-success" : "text-error";
|
||||
$mysqlColor = ($mysql_pass == true) ? "text-success" : "text-error";
|
||||
|
||||
$gdLibColor = ($gdlib_installed == true) ? "text-success" : "text-error";
|
||||
|
||||
$xmlExtensionLink = "<a href='http://php.net/manual/en/ref.xml.php'>php.net</a>";
|
||||
|
||||
$output = "
|
||||
@ -873,6 +899,12 @@ class e_install
|
||||
<td>{$mysql_note}</td>
|
||||
<td class='{$mysqlColor}'>{$mysql_help}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>GD Extension</td>
|
||||
<td>".($gdlib_installed ? LANINS_051 : LANINS_052)."</td>
|
||||
<td class='{$gdLibColor}'>".($gdlib_installed ? "<i class='glyphicon glyphicon-ok'></i> ".LANINS_017 : str_replace("[x]",$xmlExtensionLink, LANINS_053) )."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".LANINS_050."</td>
|
||||
@ -1197,7 +1229,7 @@ class e_install
|
||||
*
|
||||
* e107 configuration file
|
||||
*
|
||||
* This file has been generated by the installation script.
|
||||
* This file has been generated by the installation script on ".date('r').".
|
||||
*/
|
||||
|
||||
\$mySQLserver = '{$this->previous_steps['mysql']['server']}';
|
||||
@ -1220,6 +1252,13 @@ class e_install
|
||||
|
||||
";
|
||||
|
||||
if($this->pdo == true)
|
||||
{
|
||||
$config_file .= 'define("e_PDO", true);';
|
||||
$config_file .= "\n\n";
|
||||
}
|
||||
|
||||
|
||||
$config_result = $this->write_config($config_file);
|
||||
|
||||
if ($config_result)
|
||||
@ -1357,7 +1396,7 @@ class e_install
|
||||
}
|
||||
elseif(file_exists("e107.htaccess"))
|
||||
{
|
||||
$error = LANINS_144;
|
||||
$error = e107::getParser()->toHtml(LANINS_144,true);
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
@ -1523,7 +1562,8 @@ class e_install
|
||||
$extendedQuery = "REPLACE INTO `{$this->previous_steps['mysql']['prefix']}user_extended` (`user_extended_id` , `user_hidden_fields`) VALUES ('1', NULL );";
|
||||
$this->dbqry($extendedQuery);
|
||||
|
||||
mysql_close($this->dbLink);
|
||||
e107::getDb()->close();
|
||||
// mysql_close($this->dbLink);
|
||||
|
||||
e107::getMessage()->reset(false, false, true);
|
||||
|
||||
@ -1539,7 +1579,7 @@ class e_install
|
||||
public function install_plugin($plugpath) //FIXME - requires default plugin table entries, see above.
|
||||
{
|
||||
e107::getDb()->gen("SELECT * FROM #plugin WHERE plugin_path = '".$plugpath."' LIMIT 1");
|
||||
$row = e107::getDb()->fetch(MYSQL_ASSOC);
|
||||
$row = e107::getDb()->fetch();
|
||||
e107::getPlugin()->install_plugin($row['plugin_id']);
|
||||
|
||||
e107::getMessage()->reset(false, false, true);
|
||||
@ -1719,7 +1759,7 @@ class e_install
|
||||
|
||||
$data['must_write'] = 'e107_config.php|{$MEDIA_DIRECTORY}|{$SYSTEM_DIRECTORY}'; // all-sub folders are created on-the-fly
|
||||
|
||||
$data['can_write'] = '{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
|
||||
$data['can_write'] = '{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}|{$WEB_DIRECTORY}cache|{$WEB_DIRECTORY}lib';
|
||||
if (!isset($data[$list])) return $bad_files;
|
||||
foreach ($system_dirs as $dir_name => $value)
|
||||
{
|
||||
@ -1745,17 +1785,21 @@ class e_install
|
||||
*/
|
||||
public function create_tables()
|
||||
{
|
||||
$link = mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']);
|
||||
// $link = mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']);
|
||||
|
||||
$link = e107::getDb()->connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']);
|
||||
|
||||
if(!$link)
|
||||
{
|
||||
return nl2br(LANINS_084."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
|
||||
}
|
||||
|
||||
$this->dbLink = $link; // Needed for mysql_close() to work round bug in PHP 5.3
|
||||
$db_selected = mysql_select_db($this->previous_steps['mysql']['db'], $link);
|
||||
// $db_selected = mysql_select_db($this->previous_steps['mysql']['db'], $link);
|
||||
$db_selected = e107::getDb()->database($this->previous_steps['mysql']['db'],$this->previous_steps['mysql']['prefix']);
|
||||
if(!$db_selected)
|
||||
{
|
||||
return nl2br(LANINS_085." '{$this->previous_steps['mysql']['db']}'\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
|
||||
return nl2br(LANINS_085." '{$this->previous_steps['mysql']['db']}'\n\n<b>".LANINS_083."\n</b><i>".e107::getDb()->getLastErrorText()."</i>");
|
||||
}
|
||||
|
||||
$filename = "{$this->e107->e107_dirs['CORE_DIRECTORY']}sql/core_sql.php";
|
||||
@ -1788,7 +1832,7 @@ class e_install
|
||||
|
||||
if (!$this->dbqry($sql_table, $link))
|
||||
{
|
||||
return nl2br(LANINS_061."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
|
||||
return nl2br(LANINS_061."\n\n<b>".LANINS_083."\n</b><i>".e107::getDb()->getLastErrorText()."</i>");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1813,17 +1857,16 @@ class e_install
|
||||
function dbqry($qry)
|
||||
{
|
||||
mysql_query($qry);
|
||||
$sql = e107::getDb();
|
||||
$sql->db_Query($qry);
|
||||
|
||||
if(mysql_errno())
|
||||
if($error = $sql->getLastErrorNumber())
|
||||
{
|
||||
$errorInfo = 'Query Error [#'.mysql_errno().']: '.mysql_error()."\nQuery: {$qry}";
|
||||
// echo $errorInfo."<br />";
|
||||
//exit;
|
||||
$errorInfo = 'Query Error [#'.$error.']: '.$sql->getLastErrorText()."\nQuery: {$qry}";
|
||||
$this->debug_db_info['db_error_log'][] = $errorInfo;
|
||||
//$this->debug_db_info['db_log'][] = $qry;
|
||||
return false;
|
||||
}
|
||||
//$this->debug_db_info['db_log'][] = $qry;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user