1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Update required versions of PHP and MySQL for 0.8

This commit is contained in:
e107steved
2008-05-26 13:19:06 +00:00
parent 46444e3879
commit cda3863c84

View File

@@ -11,12 +11,16 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/install_.php,v $ | $Source: /cvs_backup/e107_0.8/install_.php,v $
| $Revision: 1.8 $ | $Revision: 1.9 $
| $Date: 2008-05-25 10:23:12 $ | $Date: 2008-05-26 13:19:06 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define('MIN_PHP_VERSION','4.4');
define('MIN_MYSQL_VERSION','4.1');
/* Default Options and Paths for Installer */ /* Default Options and Paths for Installer */
$MySQLPrefix = 'e107_'; $MySQLPrefix = 'e107_';
@@ -34,7 +38,8 @@ $UPLOADS_DIRECTORY = "e107_files/public/";
/* End configurable variables */ /* End configurable variables */
if(isset($_GET['object'])) { if(isset($_GET['object']))
{
get_object($_GET['object']); get_object($_GET['object']);
die(); die();
} }
@@ -44,8 +49,10 @@ define("e_UC_ADMIN", 254);
error_reporting(E_ALL); error_reporting(E_ALL);
function e107_ini_set($var, $value){ function e107_ini_set($var, $value)
if (function_exists('ini_set')){ {
if (function_exists('ini_set'))
{
ini_set($var, $value); ini_set($var, $value);
} }
} }
@@ -58,20 +65,25 @@ e107_ini_set('session.use_only_cookies', 1);
e107_ini_set('session.use_trans_sid', 0); e107_ini_set('session.use_trans_sid', 0);
if(!function_exists("file_get_contents")) { $php_version = phpversion();
die("e107 requires PHP 4.3 or greater to work correctly."); if(version_compare($php_version, MIN_PHP_VERSION, "<"))
{
die('A newer version of PHP is required');
} }
// Ensure that '.' is the first part of the include path // Ensure that '.' is the first part of the include path
$inc_path = explode(PATH_SEPARATOR, ini_get('include_path')); $inc_path = explode(PATH_SEPARATOR, ini_get('include_path'));
if($inc_path[0] != ".") { if($inc_path[0] != ".")
{
array_unshift($inc_path, "."); array_unshift($inc_path, ".");
$inc_path = implode(PATH_SEPARATOR, $inc_path); $inc_path = implode(PATH_SEPARATOR, $inc_path);
e107_ini_set("include_path", $inc_path); e107_ini_set("include_path", $inc_path);
} }
unset($inc_path); unset($inc_path);
if(!function_exists("mysql_connect")) { if(!function_exists("mysql_connect"))
{
die("e107 requires PHP to be installed or compiled with the MySQL extension to work correctly, please see the MySQL manual for more information."); die("e107 requires PHP to be installed or compiled with the MySQL extension to work correctly, please see the MySQL manual for more information.");
} }
@@ -81,23 +93,30 @@ if(!function_exists("mysql_connect")) {
# checks. So, we refuse to work with these people. # checks. So, we refuse to work with these people.
$functions_ok = true; $functions_ok = true;
$disabled_functions = ini_get('disable_functions'); $disabled_functions = ini_get('disable_functions');
if (trim($disabled_functions) != '') { if (trim($disabled_functions) != '')
{
$disabled_functions = explode( ',', $disabled_functions ); $disabled_functions = explode( ',', $disabled_functions );
foreach ($disabled_functions as $function) { foreach ($disabled_functions as $function)
if(trim($function) == "realpath") { {
if(trim($function) == "realpath")
{
$functions_ok = false; $functions_ok = false;
} }
} }
} }
if($functions_ok == true && function_exists("realpath") == false) { if($functions_ok == true && function_exists("realpath") == false)
{
$functions_ok = false; $functions_ok = false;
} }
if($functions_ok == false) { if($functions_ok == false)
{
die("e107 requires the realpath() function to be enabled and your host appears to have disabled it. This function is required for some <b>important</b> security checks and <b>There is NO workaround</b>. Please contact your host for more information."); die("e107 requires the realpath() function to be enabled and your host appears to have disabled it. This function is required for some <b>important</b> security checks and <b>There is NO workaround</b>. Please contact your host for more information.");
} }
if(!function_exists("print_a")) { if(!function_exists("print_a"))
function print_a($var) { {
function print_a($var)
{
return '<pre>'.htmlentities(print_r($var, true), null, "UTF-8").'</pre>'; return '<pre>'.htmlentities(print_r($var, true), null, "UTF-8").'</pre>';
} }
} }
@@ -121,12 +140,14 @@ $e_install->template->SetTag("installer_css_http", $_SERVER['PHP_SELF']."?object
$e_install->template->SetTag("installer_folder_http", e_HTTP.$installer_folder_name."/"); $e_install->template->SetTag("installer_folder_http", e_HTTP.$installer_folder_name."/");
$e_install->template->SetTag("files_dir_http", e_FILE_ABS); $e_install->template->SetTag("files_dir_http", e_FILE_ABS);
if(!isset($_POST['stage'])) { if(!isset($_POST['stage']))
{
$_POST['stage'] = 1; $_POST['stage'] = 1;
} }
$_POST['stage'] = intval($_POST['stage']); $_POST['stage'] = intval($_POST['stage']);
switch ($_POST['stage']) { switch ($_POST['stage'])
{
case 1: case 1:
$e_install->stage_1(); $e_install->stage_1();
break; break;
@@ -152,9 +173,12 @@ switch ($_POST['stage']) {
$e_install->raise_error("Install stage information from client makes no sense to me."); $e_install->raise_error("Install stage information from client makes no sense to me.");
} }
if($_SERVER['QUERY_STRING'] == "debug"){ if($_SERVER['QUERY_STRING'] == "debug")
{
$e_install->template->SetTag("debug_info", print_a($e_install)); $e_install->template->SetTag("debug_info", print_a($e_install));
} else { }
else
{
$e_install->template->SetTag("debug_info", (count($e_install->debug_info) ? print_a($e_install->debug_info)."Backtrace:<br />".print_a($e_install) : "")); $e_install->template->SetTag("debug_info", (count($e_install->debug_info) ? print_a($e_install->debug_info)."Backtrace:<br />".print_a($e_install) : ""));
} }
@@ -162,10 +186,8 @@ echo $e_install->template->ParseTemplate(template_data(), TEMPLATE_TYPE_DATA);
class e_install { class e_install
{
var $required_php = "4.3";
var $paths; var $paths;
var $template; var $template;
var $debug_info; var $debug_info;
@@ -174,21 +196,26 @@ class e_install {
var $stage; var $stage;
var $post_data; var $post_data;
function e_install() { function e_install()
{
$this->template = new SimpleTemplate(); $this->template = new SimpleTemplate();
while (@ob_end_clean()); while (@ob_end_clean());
global $e107; global $e107;
$this->e107 = $e107; $this->e107 = $e107;
if(isset($_POST['previous_steps'])) { if(isset($_POST['previous_steps']))
{
$this->previous_steps = unserialize(base64_decode($_POST['previous_steps'])); $this->previous_steps = unserialize(base64_decode($_POST['previous_steps']));
unset($_POST['previous_steps']); unset($_POST['previous_steps']);
} else { }
else
{
$this->previous_steps = array(); $this->previous_steps = array();
} }
$this->post_data = $_POST; $this->post_data = $_POST;
} }
function raise_error($details){ function raise_error($details)
{
$this->debug_info[] = array ( $this->debug_info[] = array (
'info' => array ( 'info' => array (
'details' => $details, 'details' => $details,
@@ -363,7 +390,8 @@ class e_install {
$this->template->SetTag("stage_content", $head.$e_forms->return_form()); $this->template->SetTag("stage_content", $head.$e_forms->return_form());
} }
function stage_4(){ function stage_4()
{
global $e_forms; global $e_forms;
$this->stage = 4; $this->stage = 4;
$this->get_lan_file(); $this->get_lan_file();
@@ -374,45 +402,71 @@ class e_install {
$not_writable = $this->check_writable_perms(); $not_writable = $this->check_writable_perms();
$version_fail = false; $version_fail = false;
$perms_errors = ""; $perms_errors = "";
if(count($not_writable)) { if(count($not_writable))
{
$perms_pass = false; $perms_pass = false;
foreach ($not_writable as $file) { foreach ($not_writable as $file)
{
$perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n"; $perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n";
} }
$perms_notes = LANINS_018; $perms_notes = LANINS_018;
} else { }
else
{
$perms_pass = true; $perms_pass = true;
$perms_errors = "&nbsp;"; $perms_errors = "&nbsp;";
$perms_notes = LANINS_017; $perms_notes = LANINS_017;
} }
if(!function_exists("mysql_connect")) {
if(!function_exists("mysql_connect"))
{
$version_fail = true; $version_fail = true;
$mysql_note = LANINS_011; $mysql_note = LANINS_011;
$mysql_help = LANINS_012; $mysql_help = LANINS_012;
} elseif (!@mysql_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 = LANINS_011; $mysql_note = LANINS_011;
$mysql_help = LANINS_013; $mysql_help = LANINS_013;
} else { }
else
{
$mysql_note = mysql_get_server_info(); $mysql_note = mysql_get_server_info();
if (version_compare($mysql_note,MIN_MYSQL_VERSION, '>='))
{
$mysql_help = LANINS_017; $mysql_help = LANINS_017;
} }
if(!function_exists("utf8_encode")) { else
{
$mysql_help = LANINS_105;
}
}
if(!function_exists("utf8_encode"))
{
$xml_installed = false; $xml_installed = false;
} else { }
else
{
$xml_installed = true; $xml_installed = true;
} }
$php_version = phpversion(); $php_version = phpversion();
if(version_compare($php_version, $this->required_php, ">=")) { if(version_compare($php_version, MIN_PHP_VERSION, ">="))
{
$php_help = LANINS_017; $php_help = LANINS_017;
} else { }
else
{
$php_help = LANINS_019; $php_help = LANINS_019;
} }
$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
if(!$perms_pass) { if(!$perms_pass)
{
$e_forms->add_button("retest_perms", LANINS_009); $e_forms->add_button("retest_perms", LANINS_009);
$this->stage = 3; // make the installer jump back a step $this->stage = 3; // make the installer jump back a step
} elseif ($perms_pass && !$version_fail && $xml_installed) { }
elseif ($perms_pass && !$version_fail && $xml_installed)
{
$e_forms->add_button("continue_install", LANINS_020); $e_forms->add_button("continue_install", LANINS_020);
} }
$output = " $output = "