1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 10:50:25 +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,9 +38,10 @@ $UPLOADS_DIRECTORY = "e107_files/public/";
/* End configurable variables */ /* End configurable variables */
if(isset($_GET['object'])) { if(isset($_GET['object']))
get_object($_GET['object']); {
die(); get_object($_GET['object']);
die();
} }
define("e107_INIT", TRUE); define("e107_INIT", TRUE);
@@ -44,10 +49,12 @@ 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')){ {
ini_set($var, $value); if (function_exists('ini_set'))
} {
ini_set($var, $value);
}
} }
// setup some php options // setup some php options
@@ -58,21 +65,26 @@ 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, "."); {
$inc_path = implode(PATH_SEPARATOR, $inc_path); array_unshift($inc_path, ".");
e107_ini_set("include_path", $inc_path); $inc_path = implode(PATH_SEPARATOR, $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.");
} }
# Check for the realpath(). Some hosts (I'm looking at you, Awardspace) are totally dumb and # Check for the realpath(). Some hosts (I'm looking at you, Awardspace) are totally dumb and
@@ -81,25 +93,32 @@ 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 ); {
foreach ($disabled_functions as $function) { $disabled_functions = explode( ',', $disabled_functions );
if(trim($function) == "realpath") { foreach ($disabled_functions as $function)
$functions_ok = false; {
} if(trim($function) == "realpath")
{
$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) { {
return '<pre>'.htmlentities(print_r($var, true), null, "UTF-8").'</pre>'; function print_a($var)
} {
return '<pre>'.htmlentities(print_r($var, true), null, "UTF-8").'</pre>';
}
} }
header("Content-type: text/html; charset=utf-8"); header("Content-type: text/html; charset=utf-8");
@@ -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,20 +173,21 @@ 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)); {
} else { $e_install->template->SetTag("debug_info", 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) : "")); }
else
{
$e_install->template->SetTag("debug_info", (count($e_install->debug_info) ? print_a($e_install->debug_info)."Backtrace:<br />".print_a($e_install) : ""));
} }
echo $e_install->template->ParseTemplate(template_data(), TEMPLATE_TYPE_DATA); 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(); {
while (@ob_end_clean()); $this->template = new SimpleTemplate();
global $e107; while (@ob_end_clean());
$this->e107 = $e107; global $e107;
if(isset($_POST['previous_steps'])) { $this->e107 = $e107;
$this->previous_steps = unserialize(base64_decode($_POST['previous_steps'])); if(isset($_POST['previous_steps']))
unset($_POST['previous_steps']); {
} else { $this->previous_steps = unserialize(base64_decode($_POST['previous_steps']));
$this->previous_steps = array(); unset($_POST['previous_steps']);
} }
$this->post_data = $_POST; else
{
$this->previous_steps = array();
}
$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,46 +402,72 @@ 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; {
foreach ($not_writable as $file) { $perms_pass = false;
$perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n"; foreach ($not_writable as $file)
} {
$perms_notes = LANINS_018; $perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n";
} else { }
$perms_pass = true; $perms_notes = LANINS_018;
$perms_errors = "&nbsp;"; }
$perms_notes = LANINS_017; else
{
$perms_pass = true;
$perms_errors = "&nbsp;";
$perms_notes = LANINS_017;
} }
if(!function_exists("mysql_connect")) {
$version_fail = true; if(!function_exists("mysql_connect"))
$mysql_note = LANINS_011; {
$mysql_help = LANINS_012; $version_fail = true;
} 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_012;
$mysql_help = LANINS_013; }
} else { elseif (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
$mysql_note = mysql_get_server_info(); {
$mysql_note = LANINS_011;
$mysql_help = LANINS_013;
}
else
{
$mysql_note = mysql_get_server_info();
if (version_compare($mysql_note,MIN_MYSQL_VERSION, '>='))
{
$mysql_help = LANINS_017; $mysql_help = LANINS_017;
}
else
{
$mysql_help = LANINS_105;
}
} }
if(!function_exists("utf8_encode")) { if(!function_exists("utf8_encode"))
$xml_installed = false; {
} else { $xml_installed = false;
$xml_installed = true; }
else
{
$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; {
} else { $php_help = LANINS_017;
$php_help = LANINS_019; }
else
{
$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); {
$this->stage = 3; // make the installer jump back a step $e_forms->add_button("retest_perms", LANINS_009);
} elseif ($perms_pass && !$version_fail && $xml_installed) { $this->stage = 3; // make the installer jump back a step
$e_forms->add_button("continue_install", LANINS_020); }
elseif ($perms_pass && !$version_fail && $xml_installed)
{
$e_forms->add_button("continue_install", LANINS_020);
} }
$output = " $output = "
<table style='width: 100%; margin-left: auto; margin-right: auto;'> <table style='width: 100%; margin-left: auto; margin-right: auto;'>