1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Install path fixes.

This commit is contained in:
CaMer0n
2012-06-23 10:08:17 +00:00
parent b1f4c980cc
commit bc72f5522e
3 changed files with 55 additions and 33 deletions

View File

@@ -412,7 +412,7 @@ City, State, Country
<field name="gen_user_id">1</field> <field name="gen_user_id">1</field>
<field name="gen_ip"></field> <field name="gen_ip"></field>
<field name="gen_intdata">0</field> <field name="gen_intdata">0</field>
<field name="gen_chardata"><![CDATA[[center]<img src=&#039;{e_IMAGE}splash.jpg&#039; style=&#039;width: 412px; height: 275px&#039; alt=&#039;&#039; />[/center]]]></field> <field name="gen_chardata">Welcome!</field>
</item> </item>
</dbTable> </dbTable>
<dbTable name="links"> <dbTable name="links">
@@ -642,17 +642,6 @@ City, State, Country
<field name="menu_layout"></field> <field name="menu_layout"></field>
<field name="menu_parms"></field> <field name="menu_parms"></field>
</item> </item>
<item>
<field name="menu_id">22</field>
<field name="menu_name">PCMag</field>
<field name="menu_location">2</field>
<field name="menu_order">1</field>
<field name="menu_class">0</field>
<field name="menu_pages"></field>
<field name="menu_path">1</field>
<field name="menu_layout"></field>
<field name="menu_parms"></field>
</item>
<item> <item>
<field name="menu_id">24</field> <field name="menu_id">24</field>
<field name="menu_name">counter_menu</field> <field name="menu_name">counter_menu</field>
@@ -715,19 +704,6 @@ City, State, Country
</item> </item>
</dbTable> </dbTable>
<dbTable name="page"> <dbTable name="page">
<item>
<field name="page_id">1</field>
<field name="page_title"></field>
<field name="page_text">[img]{e_IMAGE}pcmag.png[/img]</field>
<field name="page_author">0</field>
<field name="page_datestamp">1145843485</field>
<field name="page_rating_flag">0</field>
<field name="page_comment_flag">0</field>
<field name="page_password"></field>
<field name="page_class"></field>
<field name="page_ip_restrict"></field>
<field name="page_theme">PCMag</field>
</item>
</dbTable> </dbTable>
<dbTable name="userclass_classes"> <dbTable name="userclass_classes">
<item> <item>
@@ -743,8 +719,8 @@ City, State, Country
</item> </item>
<item> <item>
<field name="userclass_id">2</field> <field name="userclass_id">2</field>
<field name="userclass_name">PRIVATEFORUM1</field> <field name="userclass_name">CONTACT PEOPLE</field>
<field name="userclass_description">Example private forum class</field> <field name="userclass_description">Example contact person class</field>
<field name="userclass_editclass">254</field> <field name="userclass_editclass">254</field>
<field name="userclass_parent">0</field> <field name="userclass_parent">0</field>
<field name="userclass_accum"></field> <field name="userclass_accum"></field>

View File

@@ -278,11 +278,13 @@ class e107
{ {
// Do some security checks/cleanup, prepare the environment // Do some security checks/cleanup, prepare the environment
$this->prepare_request(); $this->prepare_request();
$this->site_path = "[hash]"; // placeholder
// folder info // folder info
//$this->e107_dirs = $e107_paths; //$this->e107_dirs = $e107_paths;
$this->setDirs($e107_paths, $e107_config_override); $this->setDirs($e107_paths, $e107_config_override);
// build all paths // build all paths
$this->set_paths(); $this->set_paths();
$this->file_path = $this->fix_windows_paths($e107_root_path)."/"; $this->file_path = $this->fix_windows_paths($e107_root_path)."/";
@@ -295,7 +297,7 @@ class e107
// set some core URLs (e_LOGIN/SIGNUP) // set some core URLs (e_LOGIN/SIGNUP)
$this->set_urls(); $this->set_urls();
return $this; return $this;
} }
@@ -316,7 +318,7 @@ class e107
$this->e107_config_mysql_info = $e107_config_mysql_info; $this->e107_config_mysql_info = $e107_config_mysql_info;
// unique folder for e_MEDIA - support for multiple websites from single-install. Must be set before setDirs() // unique folder for e_MEDIA - support for multiple websites from single-install. Must be set before setDirs()
$this->site_path = substr(md5($e107_config_mysql_info['mySQLdefaultdb'].".".$e107_config_mysql_info['mySQLprefix']),0,10); $this->site_path = $this->makeSiteHash($e107_config_mysql_info['mySQLdefaultdb'], $e107_config_mysql_info['mySQLprefix']);
// Set default folder (and override paths) if missing from e107_config.php // Set default folder (and override paths) if missing from e107_config.php
$this->setDirs($e107_paths, $e107_config_override); $this->setDirs($e107_paths, $e107_config_override);
@@ -338,9 +340,17 @@ class e107
$this->set_urls(); $this->set_urls();
} }
return $this; return $this;
} }
// Create a unique hash for each database configuration (multi-site support)
function makeSiteHash($db,$prefix) // also used by install.
{
return substr(md5($db.".".$prefix),0,10);
}
/** /**
* Set system folders and override paths * Set system folders and override paths
* $e107_paths is the 'compact' version of e107_config folder vars ($ADMIN_DIRECTORY, $IMAGES_DIRECTORY, etc) * $e107_paths is the 'compact' version of e107_config folder vars ($ADMIN_DIRECTORY, $IMAGES_DIRECTORY, etc)

View File

@@ -26,6 +26,8 @@ define('MIN_PHP_VERSION', '5.0');
define('MIN_MYSQL_VERSION', '4.1.2'); define('MIN_MYSQL_VERSION', '4.1.2');
define('MAKE_INSTALL_LOG', false); define('MAKE_INSTALL_LOG', false);
// ensure CHARSET is UTF-8 if used // ensure CHARSET is UTF-8 if used
//define('CHARSET', 'utf-8'); //define('CHARSET', 'utf-8');
@@ -233,6 +235,7 @@ class e_install
// public function __construct() // public function __construct()
function e_install() function e_install()
{ {
// notice removal, required from various core routines // notice removal, required from various core routines
define('USERID', 1); define('USERID', 1);
define('USER', true); define('USER', true);
@@ -272,6 +275,9 @@ class e_install
define("e_LANGUAGE", $this->previous_steps['language']); define("e_LANGUAGE", $this->previous_steps['language']);
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php"); include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
} }
} }
@@ -445,6 +451,23 @@ class e_install
$this->logLine('Stage 2 completed'); $this->logLine('Stage 2 completed');
} }
private function updatePaths() // replace hash paths and create folders if needed.
{
$hash = e107::makeSiteHash($this->previous_steps['mysql']['db'],$this->previous_steps['mysql']['prefix']);
$this->e107->site_path = $hash;
foreach($this->e107->e107_dirs as $dir => $p)
{
$this->e107->e107_dirs[$dir] = str_replace("[hash]", $hash, $this->e107->e107_dirs[$dir]);
if(!is_dir($this->e107->e107_dirs[$dir]))
{
@mkdir($this->e107->e107_dirs[$dir]);
}
}
}
private function stage_3() private function stage_3()
{ {
@@ -465,6 +488,8 @@ class e_install
$this->previous_steps['mysql']['db'] = trim($_POST['db']); $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']); $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) if ($success)
{ {
@@ -586,6 +611,8 @@ class e_install
private function stage_4() private function stage_4()
{ {
global $e_forms; global $e_forms;
$this->stage = 4; $this->stage = 4;
$this->logLine('Stage 4 started'); $this->logLine('Stage 4 started');
@@ -720,6 +747,9 @@ class e_install
private function stage_5() private function stage_5()
{ {
global $e_forms; global $e_forms;
$this->updatePaths(); // update dynamic paths and create media and system directories - requires mysql info.
$this->stage = 5; $this->stage = 5;
$this->logLine('Stage 5 started'); $this->logLine('Stage 5 started');
@@ -1049,7 +1079,7 @@ class e_install
\$HANDLERS_DIRECTORY = '{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}'; \$HANDLERS_DIRECTORY = '{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}';
\$LANGUAGES_DIRECTORY = '{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}'; \$LANGUAGES_DIRECTORY = '{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}';
\$HELP_DIRECTORY = '{$this->e107->e107_dirs['HELP_DIRECTORY']}'; \$HELP_DIRECTORY = '{$this->e107->e107_dirs['HELP_DIRECTORY']}';
\$CACHE_DIRECTORY = '{$this->e107->e107_dirs['CACHE_DIRECTORY']}'; \$SYSTEM_DIRECTORY = '{$this->e107->e107_dirs['SYSTEM_DIRECTORY']}';
\$DOWNLOADS_DIRECTORY = '{$this->e107->e107_dirs['DOWNLOADS_DIRECTORY']}'; \$DOWNLOADS_DIRECTORY = '{$this->e107->e107_dirs['DOWNLOADS_DIRECTORY']}';
\$UPLOADS_DIRECTORY = '{$this->e107->e107_dirs['UPLOADS_DIRECTORY']}'; \$UPLOADS_DIRECTORY = '{$this->e107->e107_dirs['UPLOADS_DIRECTORY']}';
\$MEDIA_DIRECTORY = '{$this->e107->e107_dirs['MEDIA_DIRECTORY']}'; \$MEDIA_DIRECTORY = '{$this->e107->e107_dirs['MEDIA_DIRECTORY']}';
@@ -1182,6 +1212,7 @@ class e_install
} }
// Media import // Media import
/*
e107::getMedia()->import('news',e_IMAGE.'newspost_images/') //TODO remove when news are pluginized e107::getMedia()->import('news',e_IMAGE.'newspost_images/') //TODO remove when news are pluginized
->import('page',e_IMAGE.'custom/') //TODO remove when pages are pluginized ->import('page',e_IMAGE.'custom/') //TODO remove when pages are pluginized
// ->importIcons(e_PLUGIN) - icons for plugins are imported on install // ->importIcons(e_PLUGIN) - icons for plugins are imported on install
@@ -1189,7 +1220,7 @@ class e_install
->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/images/") ->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/images/")
->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/icons/"); ->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/icons/");
$this->logLine('Media imported to media manager'); $this->logLine('Media imported to media manager');
*/
e107::getSingleton('e107plugin')->save_addon_prefs(); // save plugin addon pref-lists. eg. e_latest_list. e107::getSingleton('e107plugin')->save_addon_prefs(); // save plugin addon pref-lists. eg. e_latest_list.
$this->logLine('Addon prefs saved'); $this->logLine('Addon prefs saved');
@@ -1411,11 +1442,16 @@ class e_install
function check_writable_perms($list = 'must_write') function check_writable_perms($list = 'must_write')
{ {
$bad_files = array(); $bad_files = array();
$system_dirs = $this->e107->e107_dirs;
$system_dirs['MEDIA_DIRECTORY'] = str_replace("[hash]/","", $system_dirs['MEDIA_DIRECTORY']);
$system_dirs['SYSTEM_DIRECTORY'] = str_replace("[hash]/","", $system_dirs['SYSTEM_DIRECTORY']);
$data['must_write'] = 'e107_config.php|{$MEDIA_DIRECTORY}|{$SYSTEM_DIRECTORY}'; // all-sub folders are created on-the-fly $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}';
if (!isset($data[$list])) return $bad_files; if (!isset($data[$list])) return $bad_files;
foreach ($this->e107->e107_dirs as $dir_name => $value) foreach ($system_dirs as $dir_name => $value)
{ {
$find[] = "{\${$dir_name}}"; $find[] = "{\${$dir_name}}";
$replace[] = "./$value"; $replace[] = "./$value";