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

Bugtracker #2230 - possible fix - manage database utf8 encoding

This commit is contained in:
marj
2009-07-17 14:20:26 +00:00
parent 9ab872b199
commit e4c1ecd33a
3 changed files with 618 additions and 464 deletions

View File

@@ -9,9 +9,9 @@
* mySQL Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
* $Revision: 1.38 $
* $Date: 2009-05-24 15:34:37 $
* $Author: e107steved $
* $Revision: 1.39 $
* $Date: 2009-07-17 14:20:26 $
* $Author: marj_nl_fr $
*/
if(defined('MYSQL_LIGHT'))
@@ -44,8 +44,8 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
* MySQL Abstraction class
*
* @package e107
* @version $Revision: 1.38 $
* @author $Author: e107steved $
* @version $Revision: 1.39 $
* @author $Author: marj_nl_fr $
*/
class db {
@@ -65,6 +65,11 @@ class db {
var $mySQLinfo;
var $tabset;
/**
* @public MySQL Charset
**/
var $mySQLcharset;
var $total_results; // Total number of results
/**
@@ -91,14 +96,10 @@ class db {
}
/**
* @return null or string error code
* @param string $mySQLserver IP Or hostname of the MySQL server
* @param string $mySQLuser MySQL username
* @param string $mySQLpassword MySQL Password
* @param string $mySQLdefaultdb The database schema to connect to
* @desc Connects to mySQL server and selects database - generally not required if your table is in the main DB.<br />
* @access public
* Connects to mySQL server and selects database - generally not required if your table is in the main DB.<br />
* <br />
* Example using e107 database with variables defined in config.php:<br />
* Example using e107 database with variables defined in e107_config.php:<br />
* <code>$sql = new db;
* $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);</code>
* <br />
@@ -106,7 +107,13 @@ class db {
* <code>$sql = new db;
* $sql->db_Connect('url_server_database', 'user_database', 'password_database', 'name_of_database');</code>
*
* @access public
* @param string $mySQLserver IP Or hostname of the MySQL server
* @param string $mySQLuser MySQL username
* @param string $mySQLpassword MySQL Password
* @param string $mySQLdefaultdb The database schema to connect to
* @param string $newLink force a new link connection if TRUE. Default FALSE
* @param string $mySQLPrefix Tables prefix. Default to $mySQLPrefix from e107_config.php
* @return null|string error code
*/
function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $newLink = FALSE, $mySQLPrefix = MPREFIX)
{
@@ -121,29 +128,36 @@ class db {
$temp = $this->mySQLerror;
$this->mySQLerror = FALSE;
if(defined("USE_PERSISTANT_DB") && USE_PERSISTANT_DB == true)
if(defined("USE_PERSISTANT_DB") && USE_PERSISTANT_DB == TRUE)
{
if (!$this->mySQLaccess = @mysql_pconnect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword)) // No persistent link parameter permitted
// No persistent link parameter permitted
if ( ! $this->mySQLaccess = @mysql_pconnect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword))
{
return 'e1';
}
}
else
{
if (!$this->mySQLaccess = @mysql_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword, $newLink))
if ( ! $this->mySQLaccess = @mysql_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword, $newLink))
{
return 'e1';
}
}
if (!@mysql_select_db($this->mySQLdefaultdb,$this->mySQLaccess))
// Set utf8 connection?
//@TODO: simplify when yet undiscovered side-effects will be fixed
$this->db_Set_Charset();
if ( ! @mysql_select_db($this->mySQLdefaultdb, $this->mySQLaccess))
{
return 'e2';
}
$this->dbError('dbConnect/SelectDB');
if ($db_ConnectionID == NULL) $db_ConnectionID = $this->mySQLaccess; // Save the connection resource
// Save the connection resource
if ($db_ConnectionID == NULL)
$db_ConnectionID = $this->mySQLaccess;
return TRUE;
}
@@ -1126,6 +1140,58 @@ class db {
{
return $this->mySQLlastErrText; // Text of last error (empty string if no error)
}
/**
* 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 occasion.
* UTF-8 encoding and decoding is left to the progammer
* @param bool TRUE enter debug mode. default FALSE
* @return string hardcoded error message
*/
function db_Set_Charset($charset = '', $debug = FALSE)
{
// Get the default user choice
global $mySQLcharset;
if (varset($mySQLcharset) != 'utf8')
{
// Only utf8 is accepted
$mySQLcharset = '';
}
$charset = ($charset ? $charset : $mySQLcharset);
$message = (( ! $charset && $debug) ? 'Empty charset!' : '');
if($charset)
{
if ( ! $debug)
{
@mysql_query("SET NAMES `$charset`");
}
else
{
// Check if MySQL version is utf8 compatible
preg_match('/^(.*?)($|-)/', mysql_get_server_info(), $mysql_version);
if (version_compare($mysql_version[1], '4.1.2', '<'))
{
// reset utf8
//@TODO reset globally? $mySQLcharset = '';
$charset = '';
$message = 'MySQL version is not utf8 compatible!';
}
else
{
// Use db_Query() debug handler
$this->db_Query("SET NAMES `$charset`", NULL, '', $debug);
}
}
}
// Save mySQLcharset for further uses within this connection
$this->mySQLcharset = $charset;
return $message;
}
}
?>

View File

@@ -21,7 +21,7 @@ define("LANINS_015", "PHP Version");
define("LANINS_016", "MySQL");
define("LANINS_017", "PASS");
define("LANINS_018", "Ensure all the listed files exist and are writable by the server. This normally involves CHMODing them 777, but environments vary - contact your host if you have any problems.");
define("LANINS_019", "The version of PHP installed on your server isn't capable of running e107. e107 requires a PHP version of at least 4.3.0 to run correctly. Either upgrade your PHP version, or contact your host for an upgrade.");
define("LANINS_019", "The version of PHP installed on your server isn't capable of running e107. e107 requires a PHP version of at least ".MIN_PHP_VERSION." to run correctly. Either upgrade your PHP version, or contact your host for an upgrade.");
define("LANINS_020", "Continue Installation");
define("LANINS_021", "2");
define("LANINS_022", "MySQL Server Details");

View File

@@ -9,14 +9,14 @@
* Installation file
*
* $Source: /cvs_backup/e107_0.8/install_.php,v $
* $Revision: 1.22 $
* $Date: 2009-07-16 10:12:26 $
* $Revision: 1.23 $
* $Date: 2009-07-17 14:20:26 $
* $Author: marj_nl_fr $
*
*/
define('MIN_PHP_VERSION','5.0');
define('MIN_MYSQL_VERSION','4.1');
define('MIN_MYSQL_VERSION','4.1.2');
/* Default Options and Paths for Installer */
@@ -132,7 +132,7 @@ if(!function_exists("print_a"))
header("Content-type: text/html; charset=utf-8");
$installer_folder_name = 'e107_install';
//obsolete $installer_folder_name = 'e107_install';
include_once("./{$HANDLERS_DIRECTORY}e107_class.php");
@@ -142,13 +142,13 @@ $e107 = e107::getInstance();
$e107->_init($e107_paths, realpath(dirname(__FILE__)));
unset($e107_paths);
$e107->e107_dirs['INSTALLER'] = "{$installer_folder_name}/";
//obsolete $e107->e107_dirs['INSTALLER'] = "{$installer_folder_name}/";
$e_install = new e_install();
$e_forms = new e_forms();
$e_install->template->SetTag("installer_css_http", $_SERVER['PHP_SELF']."?object=stylesheet");
$e_install->template->SetTag("installer_folder_http", e_HTTP.$installer_folder_name."/");
//obsolete $e_install->template->SetTag("installer_folder_http", e_HTTP.$installer_folder_name."/");
$e_install->template->SetTag("files_dir_http", e_FILE_ABS);
if(!isset($_POST['stage']))
@@ -236,7 +236,8 @@ class e_install
);
}
function stage_1(){
function stage_1()
{
global $e_forms;
$this->stage = 1;
$this->get_lan_file();
@@ -251,7 +252,8 @@ class e_install
$this->template->SetTag("stage_content", "<div style='text-align: center;'><label for='language'>".LANINS_005."</label>\n<br /><br /><br />\n".$e_forms->return_form()."</div>");
}
function stage_2(){
function stage_2()
{
global $e_forms;
$this->stage = 2;
$this->previous_steps['language'] = $_POST['language'];
@@ -284,7 +286,7 @@ class e_install
<tr>
<td class='row-border'><label for='db'>".LANINS_027."</label></td>
<td class='row-border'><input type='text' name='db' size='20' id='db' value='' maxlength='100' />
<label class='defaulttext'><input type='checkbox' name='createdb' value='1' />".LANINS_028."</label></td>
<br /><label class='defaulttext'><input type='checkbox' name='createdb' value='1' />".LANINS_028."</label></td>
<td class='row-border'>".LANINS_033."</td>
</tr>
<tr>
@@ -305,7 +307,7 @@ class e_install
function stage_3()
{
global $e_forms;
$success = true;
$success = TRUE;
$this->stage = 3;
$this->get_lan_file();
$this->template->SetTag("installation_heading", LANINS_001);
@@ -315,9 +317,9 @@ class e_install
$this->previous_steps['mysql']['user'] = trim($_POST['name']);
$this->previous_steps['mysql']['password'] = $_POST['password'];
$this->previous_steps['mysql']['db'] = trim($_POST['db']);
$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']);
$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 || $this->previous_steps['mysql']['server'] == "" || $this->previous_steps['mysql']['user'] == "")
{
$this->stage = 3;
@@ -346,7 +348,7 @@ class e_install
<tr>
<td class='row-border'><label for='db'>".LANINS_027."</label></td>
<td class='row-border'><input type='text' name='db' id='db' size='20' value='{$this->previous_steps['mysql']['db']}' maxlength='100' />
<label class='defaulttext'><input type='checkbox' name='createdb'".($this->previous_steps['mysql']['createdb'] == 1 ? " checked='checked'" : "")." value='1' />".LANINS_028."</label></td>
<br /><label class='defaulttext'><input type='checkbox' name='createdb'".($this->previous_steps['mysql']['createdb'] == 1 ? " checked='checked'" : "")." value='1' />".LANINS_028."</label></td>
<td class='row-border'>".LANINS_033."</td>
</tr>
<tr>
@@ -371,25 +373,42 @@ class e_install
$this->template->SetTag("stage_title", LANINS_037.($this->previous_steps['mysql']['createdb'] == 1 ? LANINS_038 : ""));
if (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']))
{
$success = false;
$success = FALSE;
$page_content = LANINS_041.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
}
else
{
$page_content = LANINS_042;
// @TODO Check database version here?
/*
$mysql_note = mysql_get_server_info();
if (version_compare($mysql_note, MIN_MYSQL_VERSION, '>='))
{
$success = FALSE;
}
*/
// Do brute force for now - Should be enough
if($this->previous_steps['mysql']['createdb'] == 1)
{
if (!$this->dbqry("CREATE DATABASE ".$this->previous_steps['mysql']['db']))
$query = 'CREATE DATABASE '.$this->previous_steps['mysql']['db'].' CHARACTER SET `utf8` ';
}
else
{
$success = false;
$query = 'ALTER DATABASE '.$this->previous_steps['mysql']['db'].' CHARACTER SET `utf8` ';
}
if ( ! $this->dbqry($query))
{
$success = FALSE;
$page_content .= "<br /><br />".LANINS_043.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
}
else
{
$this->dbqry('SET NAMES `utf8`');
$page_content .= "<br /><br />".LANINS_044;
}
}
}
if($success)
{
$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
@@ -398,7 +417,10 @@ class e_install
}
$head = $page_content;
}
if ($success) $this->finish_form(); else $this->finish_form(3);
if ($success)
$this->finish_form();
else
$this->finish_form(3);
$this->template->SetTag("stage_content", $head.$e_forms->return_form());
}
@@ -455,7 +477,7 @@ class e_install
else
{
$mysql_note = mysql_get_server_info();
if (version_compare($mysql_note,MIN_MYSQL_VERSION, '>='))
if (version_compare($mysql_note, MIN_MYSQL_VERSION, '>='))
{
$mysql_help = LANINS_017;
}
@@ -521,7 +543,8 @@ class e_install
function stage_5(){
function stage_5()
{
global $e_forms;
$this->stage = 5;
$this->get_lan_file();
@@ -567,7 +590,8 @@ class e_install
$this->template->SetTag("stage_content", $e_forms->return_form());
}
function stage_6(){
function stage_6()
{
global $e_forms;
$this->get_lan_file();
$this->stage = 6;
@@ -576,15 +600,19 @@ class e_install
$_POST['d_name'] = str_replace(array("'", '"'), "", $_POST['d_name']);
$this->previous_steps['admin']['user'] = $_POST['u_name'];
if ($_POST['d_name'] == "") {
if ($_POST['d_name'] == "")
{
$this->previous_steps['admin']['display'] = $_POST['u_name'];
} else {
}
else
{
$this->previous_steps['admin']['display'] = $_POST['d_name'];
}
$this->previous_steps['admin']['email'] = $_POST['email'];
$this->previous_steps['admin']['password'] = $_POST['pass1'];
if(trim($_POST['u_name']) == "" || trim($_POST['email']) == "" || trim($_POST['pass1']) == "") {
if(trim($_POST['u_name']) == "" || trim($_POST['email']) == "" || trim($_POST['pass1']) == "")
{
$this->template->SetTag("installation_heading", LANINS_001);
$this->template->SetTag("stage_num", LANINS_046);
$this->template->SetTag("stage_pre", LANINS_002);
@@ -594,7 +622,9 @@ class e_install
$this->finish_form(5);
$e_forms->add_button("submit", LANINS_048);
} elseif($_POST['pass1'] != $_POST['pass2']) {
}
elseif($_POST['pass1'] != $_POST['pass2'])
{
$this->template->SetTag("installation_heading", LANINS_001);
$this->template->SetTag("stage_num", LANINS_046);
$this->template->SetTag("stage_pre", LANINS_002);
@@ -604,7 +634,9 @@ class e_install
$this->finish_form(5);
$e_forms->add_button("submit", LANINS_048);
} else {
}
else
{
$this->template->SetTag("installation_heading", LANINS_001);
$this->template->SetTag("stage_pre", LANINS_002);
@@ -620,7 +652,8 @@ class e_install
$this->template->SetTag("stage_content", $page.$e_forms->return_form());
}
function stage_7(){
function stage_7()
{
global $e_forms;
$this->get_lan_file();
@@ -632,52 +665,58 @@ class e_install
$this->template->SetTag("stage_title", LANINS_071);
$config_file = "<?php
/*
+----------------------------------------------------+
| e107 website system
| e107_config.php
|
| Copyright (C) 2001-2009 e107 Inc
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+----------------------------------------------------+
This file has been generated by the installation script.
*/
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* e107 configuration file
*
* This file has been generated by the installation script.
*/
\$mySQLserver = '{$this->previous_steps['mysql']['server']}';
\$mySQLuser = '{$this->previous_steps['mysql']['user']}';
\$mySQLpassword = '{$this->previous_steps['mysql']['password']}';
\$mySQLdefaultdb = '{$this->previous_steps['mysql']['db']}';
\$mySQLprefix = '{$this->previous_steps['mysql']['prefix']}';
\$ADMIN_DIRECTORY = \"{$this->e107->e107_dirs['ADMIN_DIRECTORY']}\";
\$FILES_DIRECTORY = \"{$this->e107->e107_dirs['FILES_DIRECTORY']}\";
\$IMAGES_DIRECTORY = \"{$this->e107->e107_dirs['IMAGES_DIRECTORY']}\";
\$THEMES_DIRECTORY = \"{$this->e107->e107_dirs['THEMES_DIRECTORY']}\";
\$PLUGINS_DIRECTORY = \"{$this->e107->e107_dirs['PLUGINS_DIRECTORY']}\";
\$HANDLERS_DIRECTORY = \"{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}\";
\$LANGUAGES_DIRECTORY = \"{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}\";
\$HELP_DIRECTORY = \"{$this->e107->e107_dirs['HELP_DIRECTORY']}\";
\$CACHE_DIRECTORY = \"{$this->e107->e107_dirs['CACHE_DIRECTORY']}\";
\$DOWNLOADS_DIRECTORY = \"{$this->e107->e107_dirs['DOWNLOADS_DIRECTORY']}\";
\$UPLOADS_DIRECTORY = \"{$this->e107->e107_dirs['UPLOADS_DIRECTORY']}\";
// \$mySQLcharset can only contain 'utf8' or ''
//@TODO remove in the future
\$mySQLcharset = 'utf8';
?>";
\$ADMIN_DIRECTORY = '{$this->e107->e107_dirs['ADMIN_DIRECTORY']}';
\$FILES_DIRECTORY = '{$this->e107->e107_dirs['FILES_DIRECTORY']}';
\$IMAGES_DIRECTORY = '{$this->e107->e107_dirs['IMAGES_DIRECTORY']}';
\$THEMES_DIRECTORY = '{$this->e107->e107_dirs['THEMES_DIRECTORY']}';
\$PLUGINS_DIRECTORY = '{$this->e107->e107_dirs['PLUGINS_DIRECTORY']}';
\$HANDLERS_DIRECTORY = '{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}';
\$LANGUAGES_DIRECTORY = '{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}';
\$HELP_DIRECTORY = '{$this->e107->e107_dirs['HELP_DIRECTORY']}';
\$CACHE_DIRECTORY = '{$this->e107->e107_dirs['CACHE_DIRECTORY']}';
\$DOWNLOADS_DIRECTORY = '{$this->e107->e107_dirs['DOWNLOADS_DIRECTORY']}';
\$UPLOADS_DIRECTORY = '{$this->e107->e107_dirs['UPLOADS_DIRECTORY']}';
";
$config_result = $this->write_config($config_file);
$e_forms->start_form("confirmation", "index.php");
if ($config_result) {
if ($config_result)
{
$page = $config_result."<br />";
} else {
}
else
{
$errors = $this->create_tables();
if ($errors == true) {
if ($errors == true)
{
$page = $errors."<br />";
} else {
}
else
{
$page = nl2br(LANINS_069)."<br />";
$e_forms->add_button("submit", LANINS_035);
}
@@ -690,31 +729,42 @@ This file has been generated by the installation script.
// Check a DB name or table prefix - anything starting with a numeric followed by 'e' causes problems.
// Return TRUE if acceptable, FALSE if unacceptable
// Empty string returns the value of $blank_ok (caller should set TRUE for prefix, FALSE for DB name)
function check_name($str,$blank_ok = FALSE)
function check_name($str, $blank_ok = FALSE)
{
if ($str == '') return $blank_ok;
if (preg_match("#^\d+[e|E]#",$str)) return FALSE;
if ($str == '')
return $blank_ok;
if (preg_match("#^\d+[e|E]#", $str))
return FALSE;
return TRUE;
}
function get_lan_file(){
if(!isset($this->previous_steps['language'])) {
function get_lan_file()
{
if(!isset($this->previous_steps['language']))
{
$this->previous_steps['language'] = "English";
}
$this->lan_file = "{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$this->previous_steps['language']}/lan_installer.php";
if(is_readable($this->lan_file)){
if(is_readable($this->lan_file))
{
include($this->lan_file);
} elseif(is_readable("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php")) {
}
elseif(is_readable("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php"))
{
include("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php");
} else {
}
else
{
$this->raise_error("Fatal: Could not get valid language file for installation.");
}
}
function get_languages() {
function get_languages()
{
$handle = opendir("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}");
while ($file = readdir($handle)) {
while ($file = readdir($handle))
{
if ($file != "." && $file != ".." && $file != "/" && $file != "CVS") {
if(file_exists("./{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$file}/lan_installer.php")){
$lanlist[] = $file;
@@ -725,9 +775,11 @@ This file has been generated by the installation script.
return $lanlist;
}
function finish_form($force_stage = false) {
function finish_form($force_stage = false)
{
global $e_forms;
if($this->previous_steps) {
if($this->previous_steps)
{
$e_forms->add_hidden_data("previous_steps", base64_encode(serialize($this->previous_steps)));
}
$e_forms->add_hidden_data("stage", ($force_stage ? $force_stage : ($this->stage + 1)));
@@ -758,15 +810,18 @@ This file has been generated by the installation script.
}
function create_tables() {
function create_tables()
{
$link = mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']);
if(!$link) {
if(!$link)
{
return nl2br(LANINS_084."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
}
$db_selected = mysql_select_db($this->previous_steps['mysql']['db'], $link);
if(!$db_selected) {
if(!$db_selected)
{
return nl2br(LANINS_085." '{$this->previous_steps['mysql']['db']}'\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
}
@@ -782,10 +837,15 @@ This file has been generated by the installation script.
preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
// Force UTF-8 again
$this->dbqry('SET NAMES `utf8`');
foreach ($result[0] as $sql_table)
{
//@TODO is this still in use?
preg_match("/CREATE TABLE\s(.*?)\s\(/si", $sql_table, $match);
$tablename = $match[1];
preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
$sql_table = preg_replace("/create table\s/si", "CREATE TABLE {$this->previous_steps['mysql']['prefix']}", $sql_table);
if (!$this->dbqry($sql_table, $link))
@@ -810,9 +870,12 @@ This file has been generated by the installation script.
$pref_language = isset($this->previous_steps['language']) ? $this->previous_steps['language'] : "English";
if (file_exists($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php")) {
if (file_exists($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php"))
{
include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php");
} else {
}
else
{
include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY']."English/lan_prefs.php");
}
@@ -838,9 +901,9 @@ This file has been generated by the installation script.
'comment_characters' => '50',
'comment_postfix' => LANINS_097, // '[more ...]'
'comment_title' => 0,
'article_caption' => LANINS_098, // 'Articles'
'articles_display' => '10',
'articles_mainlink' => LANINS_099, // 'Articles Front Page ...'
//obsolete 'article_caption' => LANINS_098, // 'Articles'
//obsolete 'articles_display' => '10',
//obsolete 'articles_mainlink' => LANINS_099, // 'Articles Front Page ...'
'newforumposts_caption' => LANINS_100, // 'Latest Forum Posts'
'newforumposts_display' => '10',
'forum_no_characters' => '20',
@@ -850,22 +913,25 @@ This file has been generated by the installation script.
'newforumposts_characters' => '50',
'newforumposts_postfix' => LANINS_097, // '[more ...]'
'newforumposts_title' => 0,
'clock_caption' => LANINS_102, // 'Date / Time'
'reviews_caption' => LANINS_103, // 'Reviews'
'reviews_display' => '10',
'reviews_parents' => '1',
'reviews_mainlink' => LANINS_104, // 'Review Front Page ...'
'articles_parents' => '1'
'clock_caption' => LANINS_102 // 'Date / Time'
//obsolete 'reviews_caption' => LANINS_103, // 'Reviews'
//obsolete 'reviews_display' => '10',
//obsolete 'reviews_parents' => '1',
//obsolete 'reviews_mainlink' => LANINS_104, // 'Review Front Page ...'
//obsolete 'articles_parents' => '1'
);
$menu_conf = serialize($new_block);
// $menu_conf = 'a:23:{s:15:"comment_caption";s:15:"Latest Comments";s:15:"comment_display";s:2:"10";s:18:"comment_characters";s:2:"50";s:15:"comment_postfix";s:12:"[ more ... ]";s:13:"comment_title";i:0;s:15:"article_caption";s:8:"Articles";s:16:"articles_display";s:2:"10";s:17:"articles_mainlink";s:23:"Articles Front Page ...";s:21:"newforumposts_caption";s:18:"Latest Forum Posts";s:21:"newforumposts_display";s:2:"10";s:19:"forum_no_characters";s:2:"20";s:13:"forum_postfix";s:10:"[more ...]";s:11:"update_menu";s:20:"Update menu Settings";s:17:"forum_show_topics";s:1:"1";s:24:"newforumposts_characters";s:2:"50";s:21:"newforumposts_postfix";s:10:"[more ...]";s:19:"newforumposts_title";i:0;s:13:"clock_caption";s:11:"Date / Time";s:15:"reviews_caption";s:7:"Reviews";s:15:"reviews_display";s:2:"10";s:15:"reviews_parents";s:1:"1";s:16:"reviews_mainlink";s:21:"Review Front Page ...";s:16:"articles_parents";s:1:"1";}';
// $menu_conf = 'a:23:{s:15:"comment_caption";s:15:"Latest Comments";s:15:"comment_display";s:2:"10";s:18:"comment_characters";s:2:"50";s:15:"comment_postfix";s:12:"[ more ... ]";s:13:"comment_title";i:0;s:15:"article_caption";s:8:"Articles";s:16:"articles_display";s:2:"10";s:17:"articles_mainlink";s:23:"Articles Front Page ...";s:21:"newforumposts_caption";s:18:"Latest Forum Posts";s:21:"newforumposts_display";s:2:"10";s:19:"forum_no_characters";s:2:"20";s:13:"forum_postfix";s:10:"[more ...]";s:11:"update_menu";s:20:"Update menu Settings";s:17:"forum_show_topics";s:1:"1";s:24:"newforumposts_characters";s:2:"50";s:21:"newforumposts_postfix";s:10:"[more ...]";s:19:"newforumposts_title";i:0;s:13:"clock_caption";s:11:"Date / Time";s:15:"reviews_caption";s:7:"Reviews";s:15:"reviews_display";s:2:"10";s:15:"reviews_parents";s:1:"1";s:16:"reviews_mainlink";s:21:"Review Front Page ...";s:16:"articles_parents";s:1:"1";}';
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('menu_pref', '{$menu_conf}') ");
preg_match("/^(.*?)($|-)/", mysql_get_server_info(), $mysql_version);
if (version_compare($mysql_version[1], '4.0.1', '<')) {
if (version_compare($mysql_version[1], '4.0.1', '<'))
{
$search_prefs = 'a:12:{s:11:\"user_select\";s:1:\"1\";s:9:\"time_secs\";s:2:\"60\";s:13:\"time_restrict\";s:1:\"0\";s:8:\"selector\";s:1:\"2\";s:9:\"relevance\";s:1:\"0\";s:13:\"plug_handlers\";N;s:10:\"mysql_sort\";b:0;s:11:\"multisearch\";s:1:\"1\";s:6:\"google\";s:1:\"0\";s:13:\"core_handlers\";a:5:{s:4:\"news\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"1\";}s:8:\"comments\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"2\";}s:5:\"users\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"3\";}s:9:\"downloads\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"4\";}s:5:\"pages\";a:6:{s:5:\"class\";s:1:\"0\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"order\";s:1:\"5\";}}s:17:\"comments_handlers\";a:2:{s:4:\"news\";a:3:{s:2:\"id\";i:0;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}s:8:\"download\";a:3:{s:2:\"id\";i:2;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}}s:9:\"php_limit\";s:0:\"\";}';
} else {
}
else
{
$search_prefs = 'a:12:{s:11:\"user_select\";s:1:\"1\";s:9:\"time_secs\";s:2:\"60\";s:13:\"time_restrict\";s:1:\"0\";s:8:\"selector\";s:1:\"2\";s:9:\"relevance\";s:1:\"0\";s:13:\"plug_handlers\";N;s:10:\"mysql_sort\";b:1;s:11:\"multisearch\";s:1:\"1\";s:6:\"google\";s:1:\"0\";s:13:\"core_handlers\";a:5:{s:4:\"news\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"1\";}s:8:\"comments\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"2\";}s:5:\"users\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"3\";}s:9:\"downloads\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"4\";}s:5:\"pages\";a:6:{s:5:\"class\";s:1:\"0\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"order\";s:1:\"5\";}}s:17:\"comments_handlers\";a:2:{s:4:\"news\";a:3:{s:2:\"id\";i:0;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}s:8:\"download\";a:3:{s:2:\"id\";i:2;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}}s:9:\"php_limit\";s:0:\"\";}';
}
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('search_prefs', '{$search_prefs}') ");
@@ -913,7 +979,7 @@ This file has been generated by the installation script.
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}userclass_classes VALUES (1, 'PRIVATEMENU', '".LANINS_093."',".e_UC_ADMIN.", 0, '', 0, 0, '')");
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}userclass_classes VALUES (2, 'PRIVATEFORUM1', '".LANINS_094."',".e_UC_ADMIN.", 0, '', 0, 0, '')");
// $this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}plugin VALUES (0, '".LANINS_095."', '0.03', 'Integrity Check', 1, '') ");
// $this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}plugin VALUES (0, '".LANINS_095."', '0.03', 'Integrity Check', 1, '') ");
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}generic VALUES (0, 'wmessage', 1145848343, 1, '', 0, '[center]<img src=&#039;{e_IMAGE}splash.jpg&#039; style=&#039;width: 412px; height: 275px&#039; alt=&#039;&#039; />[/center]')");
@@ -929,9 +995,11 @@ This file has been generated by the installation script.
return false;
}
function write_config($data) {
function write_config($data)
{
$fp = @fopen("e107_config.php", "w");
if (!@fwrite($fp, $data)) {
if (!@fwrite($fp, $data))
{
@fclose ($fp);
return nl2br(LANINS_070);
}
@@ -959,34 +1027,42 @@ class e_forms {
var $form;
var $opened;
function start_form($id, $action, $method = "post" ) {
function start_form($id, $action, $method = "post" )
{
$this->form = "\n<form method='{$method}' id='{$id}' action='{$action}'>\n";
$this->opened = true;
}
function add_select_item($id, $labels, $selected) {
function add_select_item($id, $labels, $selected)
{
$this->form .= "
<select name='{$id}' id='{$id}'>\n";
foreach ($labels as $label) {
foreach ($labels as $label)
{
$this->form .= "<option".($label == $selected ? " selected='selected'" : "").">{$label}</option>\n";
}
$this->form .= "</select>\n";
}
function add_button($id, $title, $align = "right", $type = "submit") {
function add_button($id, $title, $align = "right", $type = "submit")
{
$this->form .= "<div style='text-align: {$align}; z-index: 10;'><input type='{$type}' id='{$id}' value='{$title}' /></div>\n";
}
function add_hidden_data($id, $data) {
function add_hidden_data($id, $data)
{
$this->form .= "<input type='hidden' name='{$id}' value='{$data}' />\n";
}
function add_plain_html($html_data) {
function add_plain_html($html_data)
{
$this->form .= $html_data;
}
function return_form() {
if($this->opened == true) {
function return_form()
{
if($this->opened == true)
{
$this->form .= "</form>\n";
}
$this->opened = false;
@@ -1041,45 +1117,56 @@ function create_tables_unattended()
}
class SimpleTemplate {
class SimpleTemplate
{
var $Tags = array();
var $open_tag = "{";
var $close_tag = "}";
function SimpleTemplate() {
function SimpleTemplate()
{
define("TEMPLATE_TYPE_FILE", 0);
define("TEMPLATE_TYPE_DATA", 1);
}
function SetTag($TagName, $Data) {
function SetTag($TagName, $Data)
{
$this->Tags[$TagName] = array( 'Tag' => $TagName,
'Data' => $Data
);
}
function RemoveTag($TagName) {
function RemoveTag($TagName)
{
unset($this->Tags[$TagName]);
}
function ClearTags() {
function ClearTags()
{
$this->Tags = array();
}
function ParseTemplate($Template, $template_type = TEMPLATE_TYPE_FILE) {
if($template_type == TEMPLATE_TYPE_DATA) {
function ParseTemplate($Template, $template_type = TEMPLATE_TYPE_FILE)
{
if($template_type == TEMPLATE_TYPE_DATA)
{
$TemplateData = $Template;
} else {
}
else
{
$TemplateData = file_get_contents($Template);
}
foreach ($this->Tags as $Tag) {
foreach ($this->Tags as $Tag)
{
$TemplateData = str_replace($this->open_tag.$Tag['Tag'].$this->close_tag, $Tag['Data'], $TemplateData);
}
return $TemplateData;
}
}
function template_data() {
function template_data()
{
$data = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
@@ -1091,10 +1178,10 @@ function template_data() {
<body>
<!-- Installer theme is a ripped version of 'Leaf' by Que, based on the nucleus cms theme by Ivan Fong aka Stanch. -->
<div id=\"header\">
<h1>{installation_heading}</h1>
<h1>{installation_heading}</h1>
</div>
<div id=\"wrapper\">
<div id=\"container\">
<div id=\"container\">
<div id=\"content\">
<div class=\"contentbody\">
<h3>{stage_pre}{stage_num} - {stage_title}</h3>
@@ -1103,8 +1190,8 @@ function template_data() {
{debug_info}
</div>
</div>
</div>
<div class=\"clearing\">&nbsp;</div>
</div>
<div class=\"clearing\">&nbsp;</div>
</div>
<div id=\"footer\">&nbsp;</div>
@@ -1113,9 +1200,11 @@ function template_data() {
return $data;
}
function get_object($name) {
switch ($name) {
case "stylesheet";
function get_object($name)
{
switch ($name)
{
case "stylesheet":
header("Content-type: text/css");
echo "#container{
float:left;
@@ -2161,4 +2250,3 @@ R0lGODlhAwABAJEAAAAAAP///1xcXP///yH5BAEAAAMALAAAAAADAAEAAAIC1FYAOw=="));
break;
}
}
?>