mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
More Install fixes. Prefs seem to be saving correctly now.
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<core name='adminstyle'>infopanel</core>
|
<core name='adminstyle'>infopanel</core>
|
||||||
<core name='admintheme'>jayya</core>
|
<core name='admintheme'>jayya</core>
|
||||||
<core name='allowCommentEdit'>0</core>
|
<core name='allowCommentEdit'>0</core>
|
||||||
<core name='allowEmailLogin'>1</core>
|
<core name='allowEmailLogin'>0</core>
|
||||||
<core name='anon_post'>0</core>
|
<core name='anon_post'>0</core>
|
||||||
<core name='antiflood1'>1</core>
|
<core name='antiflood1'>1</core>
|
||||||
<core name='antiflood_timeout'>10</core>
|
<core name='antiflood_timeout'>10</core>
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* e107 Base Model
|
* e107 Base Model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
* $Date: 2009-09-03 14:15:36 $
|
* $Date: 2009-09-03 22:27:32 $
|
||||||
* $Author: secretr $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -791,11 +791,14 @@ class e_model
|
|||||||
if($override || !$this->_isData($key, $data_src))
|
if($override || !$this->_isData($key, $data_src))
|
||||||
{
|
{
|
||||||
if(is_array($value))
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
if(is_array($key))
|
||||||
{
|
{
|
||||||
foreach($key as $k => $v)
|
foreach($key as $k => $v)
|
||||||
{
|
{
|
||||||
$this->_addData($key.'/'.$k, $v, $override, $data_src);
|
$this->_addData($key.'/'.$k, $v, $override, $data_src);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
$this->_setData($key, $value, false, $data_src);
|
$this->_setData($key, $value, false, $data_src);
|
||||||
|
@@ -11,14 +11,16 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||||
| $Revision: 1.77 $
|
| $Revision: 1.78 $
|
||||||
| $Date: 2009-09-03 01:27:27 $
|
| $Date: 2009-09-03 22:27:32 $
|
||||||
| $Author: e107coders $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_plugin.php");
|
||||||
|
|
||||||
class e107plugin
|
class e107plugin
|
||||||
{
|
{
|
||||||
var $plugin_addons = array(
|
var $plugin_addons = array(
|
||||||
@@ -102,8 +104,8 @@ class e107plugin
|
|||||||
*/
|
*/
|
||||||
function getall($flag)
|
function getall($flag)
|
||||||
{
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
global $sql;
|
|
||||||
if ($sql->db_Select("plugin","*","plugin_installflag = ".(int)$flag." ORDER BY plugin_path ASC"))
|
if ($sql->db_Select("plugin","*","plugin_installflag = ".(int)$flag." ORDER BY plugin_path ASC"))
|
||||||
{
|
{
|
||||||
$ret = $sql->db_getList();
|
$ret = $sql->db_getList();
|
||||||
@@ -118,10 +120,12 @@ class e107plugin
|
|||||||
*/
|
*/
|
||||||
function update_plugins_table()
|
function update_plugins_table()
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$sql2 = e107::getDb('sql2');
|
$sql2 = e107::getDb('sql2');
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
global $mySQLprefix, $menu_pref, $tp, $pref;
|
global $mySQLprefix, $menu_pref, $pref;
|
||||||
|
|
||||||
require_once(e_HANDLER.'file_class.php');
|
require_once(e_HANDLER.'file_class.php');
|
||||||
|
|
||||||
@@ -162,21 +166,31 @@ class e107plugin
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$p_installed = e107::getPref('plug_installed',array()); // load preference;
|
||||||
|
|
||||||
|
|
||||||
foreach($pluginList as $p)
|
foreach($pluginList as $p)
|
||||||
{
|
{
|
||||||
|
|
||||||
$plug['plug_action'] = 'scan'; // Make sure plugin.php knows what we're up to
|
$plug['plug_action'] = 'scan'; // Make sure plugin.php knows what we're up to
|
||||||
|
|
||||||
|
$p['path'] = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
|
||||||
|
$plugin_path = $p['path'];
|
||||||
|
|
||||||
if(!$this->parse_plugin($p['path']))
|
if(!$this->parse_plugin($p['path']))
|
||||||
{
|
{
|
||||||
//parsing of plugin.php/plugin.xml failed.
|
//parsing of plugin.php/plugin.xml failed.
|
||||||
|
|
||||||
require_once(e_HANDLER."message_handler.php");
|
require_once(e_HANDLER."message_handler.php");
|
||||||
$emessage = &eMessage::getInstance();
|
$emessage = &eMessage::getInstance();
|
||||||
$emessage->add("Parsing failed - file format error: {$p['path']}", E_MESSAGE_ERROR);
|
$emessage->add("Parsing failed - file format error: {$p['path']}", E_MESSAGE_ERROR);
|
||||||
// echo <br />";
|
|
||||||
continue; // Carry on and do any others that are OK
|
continue; // Carry on and do any others that are OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$plug_info = $this->plug_vars;
|
$plug_info = $this->plug_vars;
|
||||||
$plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
|
// $plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
|
||||||
|
|
||||||
// scan for addons.
|
// scan for addons.
|
||||||
$eplug_addons = $this->getAddons($plugin_path); // Returns comma-separated list
|
$eplug_addons = $this->getAddons($plugin_path); // Returns comma-separated list
|
||||||
@@ -212,20 +226,19 @@ class e107plugin
|
|||||||
$pluginDBList[$plugin_path]['status'] = 'update';
|
$pluginDBList[$plugin_path]['status'] = 'update';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pluginDBList[$plugin_path]['plugin_installflag'] == 0)
|
if ($pluginDBList[$plugin_path]['plugin_installflag'] == 0 ) // Plugin not installed - make sure $pref not set
|
||||||
{ // Plugin not installed - make sure $pref not set
|
|
||||||
if (isset($pref['plug_installed'][$plugin_path]))
|
|
||||||
{
|
{
|
||||||
unset($pref['plug_installed'][$plugin_path]);
|
if(isset($p_installed[$plugin_path]))
|
||||||
// echo "Remove: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
|
{
|
||||||
|
unset($p_installed[$plugin_path]);
|
||||||
$sp = TRUE;
|
$sp = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Plugin installed - make sure $pref is set
|
{ // Plugin installed - make sure $pref is set
|
||||||
if (!isset($pref['plug_installed'][$plugin_path]) || ($pref['plug_installed'][$plugin_path] != $pluginDBList[$plugin_path]['plugin_version']))
|
if (!isset($p_installed[$plugin_path]) || ($p_installed[$plugin_path] != $pluginDBList[$plugin_path]['plugin_version']))
|
||||||
{ // Update prefs array of installed plugins
|
{ // Update prefs array of installed plugins
|
||||||
$pref['plug_installed'][$plugin_path] = $pluginDBList[$plugin_path]['plugin_version'];
|
$p_installed[$plugin_path] = $pluginDBList[$plugin_path]['plugin_version'];
|
||||||
// echo "Add: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
|
// echo "Add: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
|
||||||
$sp = TRUE;
|
$sp = TRUE;
|
||||||
}
|
}
|
||||||
@@ -240,7 +253,8 @@ class e107plugin
|
|||||||
// Can just add to DB - shouldn't matter that its not in our current table
|
// Can just add to DB - shouldn't matter that its not in our current table
|
||||||
// echo "Trying to insert: ".$eplug_folder."<br />";
|
// echo "Trying to insert: ".$eplug_folder."<br />";
|
||||||
$_installed = ($plug_info['@attributes']['installRequired'] == 'true' || $plug_info['@attributes']['installRequired'] == 1 ? 0 : 1 );
|
$_installed = ($plug_info['@attributes']['installRequired'] == 'true' || $plug_info['@attributes']['installRequired'] == 1 ? 0 : 1 );
|
||||||
$sql->db_Insert("plugin", "0, '".$tp -> toDB($plug_info['@attributes']['name'], true)."', '".$tp -> toDB($plug_info['@attributes']['version'], true)."', '".$tp -> toDB($plugin_path, true)."', {$_installed}, '{$eplug_addons}', '".$plug_info['category']."', '".varset($plug_info['@attributes']['releaseUrl'])."' ");
|
e107::getDb()->db_Insert("plugin", "0, '".$tp -> toDB($plug_info['@attributes']['name'], true)."', '".$tp -> toDB($plug_info['@attributes']['version'], true)."', '".$tp -> toDB($plugin_path, true)."', {$_installed}, '{$eplug_addons}', '".vartrue($plug_info['category'],'misc')."', '".varset($plug_info['@attributes']['releaseUrl'])."' ");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,7 +263,7 @@ class e107plugin
|
|||||||
// echo "Plugin copied to wrong directory. Is in: {$plugin_path} Should be: {$plug_info['folder']}<br /><br />";
|
// echo "Plugin copied to wrong directory. Is in: {$plugin_path} Should be: {$plug_info['folder']}<br /><br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// print_a($plug_info);
|
// print_a($plug_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now scan the table, updating the DB where needed
|
// Now scan the table, updating the DB where needed
|
||||||
@@ -271,12 +285,19 @@ class e107plugin
|
|||||||
// echo "Updated: ".$plug_path."<br />";
|
// echo "Updated: ".$plug_path."<br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($sp) { save_prefs(); }
|
if ($sp && vartrue($p_installed))
|
||||||
|
{
|
||||||
|
e107::getConfig('core')->setPref('plug_installed',$p_installed);
|
||||||
|
e107::getConfig('core')->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function manage_icons($plugin='')
|
function manage_icons($plugin='')
|
||||||
{
|
{
|
||||||
global $sql,$tp, $iconpool,$pref;
|
global $iconpool,$pref;
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$query = "SELECT * FROM #plugin WHERE plugin_installflag =0 ORDER BY plugin_path ASC";
|
$query = "SELECT * FROM #plugin WHERE plugin_installflag =0 ORDER BY plugin_path ASC";
|
||||||
$sql->db_Select_gen($query);
|
$sql->db_Select_gen($query);
|
||||||
@@ -342,9 +363,13 @@ class e107plugin
|
|||||||
$iconpool[$key][] = $tp->createConstants($file['path'],1).$file['fname'];
|
$iconpool[$key][] = $tp->createConstants($file['path'],1).$file['fname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Review pref-class method used below (a new function?), to simply add or update existing prefs. (without a global $pref)
|
||||||
|
foreach($iconpool as $key=>$val)
|
||||||
|
{
|
||||||
|
e107::getConfig('ipool')->set($key,$val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (e107::getConfig('ipool')->save(FALSE)) ? TRUE : FALSE;
|
||||||
return (save_prefs("iconpool")) ? TRUE : FALSE;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +423,10 @@ class e107plugin
|
|||||||
|
|
||||||
function manage_userclass($action, $class_name, $class_description)
|
function manage_userclass($action, $class_name, $class_description)
|
||||||
{
|
{
|
||||||
global $sql, $tp, $e107;
|
global $e107;
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
if (!$e107->user_class->isAdmin)
|
if (!$e107->user_class->isAdmin)
|
||||||
{
|
{
|
||||||
$e107->user_class = new user_class_admin; // We need the extra methods of the admin extension
|
$e107->user_class = new user_class_admin; // We need the extra methods of the admin extension
|
||||||
@@ -451,7 +479,9 @@ class e107plugin
|
|||||||
|
|
||||||
function manage_link($action, $link_url, $link_name, $link_class = 0)
|
function manage_link($action, $link_url, $link_name, $link_class = 0)
|
||||||
{
|
{
|
||||||
global $sql, $tp;
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if( ! is_numeric($link_class))
|
if( ! is_numeric($link_class))
|
||||||
{
|
{
|
||||||
@@ -569,7 +599,11 @@ class e107plugin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
save_prefs();
|
|
||||||
|
|
||||||
|
// e107::getConfig('core')->save(FALSE);
|
||||||
|
// save_prefs(); //FIXME doesn't work from install.php
|
||||||
|
e107::getConfig()->loadData($pref, false)->save(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -577,7 +611,9 @@ class e107plugin
|
|||||||
|
|
||||||
function manage_comments($action, $comment_id)
|
function manage_comments($action, $comment_id)
|
||||||
{
|
{
|
||||||
global $sql, $tp;
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
if($action == 'remove')
|
if($action == 'remove')
|
||||||
{
|
{
|
||||||
@@ -601,7 +637,7 @@ class e107plugin
|
|||||||
// 'upgrade' and 'remove' operate on all language variants of the same table
|
// 'upgrade' and 'remove' operate on all language variants of the same table
|
||||||
function manage_tables($action, $var)
|
function manage_tables($action, $var)
|
||||||
{
|
{
|
||||||
global $sql;
|
$sql = e107::getDB();
|
||||||
if (!is_array($var)) return FALSE; // Return if nothing to do
|
if (!is_array($var)) return FALSE; // Return if nothing to do
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
@@ -685,7 +721,8 @@ class e107plugin
|
|||||||
{
|
{
|
||||||
$pref[$prefname] = substr($pref[$prefname], 1);
|
$pref[$prefname] = substr($pref[$prefname], 1);
|
||||||
}
|
}
|
||||||
save_prefs();
|
// save_prefs(); //FIXME - should be a better way to do this.
|
||||||
|
e107::getConfig()->loadData($pref, false)->save(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -693,8 +730,12 @@ class e107plugin
|
|||||||
|
|
||||||
function manage_search($action, $eplug_folder)
|
function manage_search($action, $eplug_folder)
|
||||||
{
|
{
|
||||||
global $sql, $sysprefs;
|
global $sysprefs;
|
||||||
$search_prefs = $sysprefs -> getArray('search_prefs');
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
|
||||||
|
$search_prefs = e107::getConfig('search');
|
||||||
|
// $search_prefs = $sysprefs -> getArray('search_prefs');
|
||||||
$default = file_exists(e_PLUGIN.$eplug_folder.'/e_search.php') ? TRUE : FALSE;
|
$default = file_exists(e_PLUGIN.$eplug_folder.'/e_search.php') ? TRUE : FALSE;
|
||||||
$comments = file_exists(e_PLUGIN.$eplug_folder.'/search/search_comments.php') ? TRUE : FALSE;
|
$comments = file_exists(e_PLUGIN.$eplug_folder.'/search/search_comments.php') ? TRUE : FALSE;
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
@@ -726,20 +767,20 @@ class e107plugin
|
|||||||
$install_comments = $comments ? TRUE : FALSE;
|
$install_comments = $comments ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($install_default)
|
if (vartrue($install_default))
|
||||||
{
|
{
|
||||||
$search_prefs['plug_handlers'][$eplug_folder] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10);
|
$search_prefs['plug_handlers'][$eplug_folder] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10);
|
||||||
}
|
}
|
||||||
else if ($uninstall_default)
|
else if (vartrue($uninstall_default))
|
||||||
{
|
{
|
||||||
unset($search_prefs['plug_handlers'][$eplug_folder]);
|
unset($search_prefs['plug_handlers'][$eplug_folder]);
|
||||||
}
|
}
|
||||||
if ($install_comments)
|
if (vartrue($install_comments))
|
||||||
{
|
{
|
||||||
require_once(e_PLUGIN.$eplug_folder.'/search/search_comments.php');
|
require_once(e_PLUGIN.$eplug_folder.'/search/search_comments.php');
|
||||||
$search_prefs['comments_handlers'][$eplug_folder] = array('id' => $comments_type_id, 'class' => 0, 'dir' => $eplug_folder);
|
$search_prefs['comments_handlers'][$eplug_folder] = array('id' => $comments_type_id, 'class' => 0, 'dir' => $eplug_folder);
|
||||||
}
|
}
|
||||||
else if ($uninstall_comments)
|
else if (vartrue($uninstall_comments))
|
||||||
{
|
{
|
||||||
unset($search_prefs['comments_handlers'][$eplug_folder]);
|
unset($search_prefs['comments_handlers'][$eplug_folder]);
|
||||||
}
|
}
|
||||||
@@ -751,9 +792,14 @@ class e107plugin
|
|||||||
|
|
||||||
function manage_notify($action, $eplug_folder)
|
function manage_notify($action, $eplug_folder)
|
||||||
{
|
{
|
||||||
global $sql, $sysprefs, $eArrayStorage, $tp;
|
global $sysprefs, $eArrayStorage;
|
||||||
$notify_prefs = $sysprefs -> get('notify_prefs');
|
|
||||||
$notify_prefs = $eArrayStorage -> ReadArray($notify_prefs);
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
// $notify_prefs = $sysprefs -> get('notify_prefs');
|
||||||
|
// $notify_prefs = $eArrayStorage -> ReadArray($notify_prefs);
|
||||||
|
|
||||||
|
$notify_prefs = e107::getConfig('notify');
|
||||||
$e_notify = file_exists(e_PLUGIN.$eplug_folder.'/e_notify.php') ? TRUE : FALSE;
|
$e_notify = file_exists(e_PLUGIN.$eplug_folder.'/e_notify.php') ? TRUE : FALSE;
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
@@ -774,7 +820,7 @@ class e107plugin
|
|||||||
$install_notify = $e_notify ? TRUE : FALSE;
|
$install_notify = $e_notify ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($install_notify)
|
if (vartrue($install_notify))
|
||||||
{
|
{
|
||||||
$notify_prefs['plugins'][$eplug_folder] = TRUE;
|
$notify_prefs['plugins'][$eplug_folder] = TRUE;
|
||||||
require_once(e_PLUGIN.$eplug_folder.'/e_notify.php');
|
require_once(e_PLUGIN.$eplug_folder.'/e_notify.php');
|
||||||
@@ -783,7 +829,7 @@ class e107plugin
|
|||||||
$notify_prefs['event'][$event_id] = array('class' => e_UC_NOBODY, 'email' => '');
|
$notify_prefs['event'][$event_id] = array('class' => e_UC_NOBODY, 'email' => '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($uninstall_notify)
|
else if (vartrue($uninstall_notify))
|
||||||
{
|
{
|
||||||
unset($notify_prefs['plugins'][$eplug_folder]);
|
unset($notify_prefs['plugins'][$eplug_folder]);
|
||||||
require_once(e_PLUGIN.$eplug_folder.'/e_notify.php');
|
require_once(e_PLUGIN.$eplug_folder.'/e_notify.php');
|
||||||
@@ -793,8 +839,8 @@ class e107plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$s_prefs = $tp -> toDB($notify_prefs);
|
$s_prefs = $tp -> toDB($notify_prefs);
|
||||||
$s_prefs = $eArrayStorage->WriteArray($s_prefs); //TODO use preference class function instead.
|
$s_prefs = e107::getArrayStorage()->WriteArray($s_prefs); //TODO use preference class function instead.
|
||||||
$sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
|
e107::getDb() -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayArray(&$array, $msg='')
|
function displayArray(&$array, $msg='')
|
||||||
@@ -824,8 +870,9 @@ class e107plugin
|
|||||||
// 'del_extended' - to delete extended fields
|
// 'del_extended' - to delete extended fields
|
||||||
function manage_plugin_xml($id, $function='', $options = FALSE)
|
function manage_plugin_xml($id, $function='', $options = FALSE)
|
||||||
{
|
{
|
||||||
global $sql, $pref;
|
global $pref;
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
$error = array(); // Array of error messages
|
$error = array(); // Array of error messages
|
||||||
$canContinue = TRUE; // Clear flag if must abort part way through
|
$canContinue = TRUE; // Clear flag if must abort part way through
|
||||||
|
|
||||||
@@ -1050,7 +1097,7 @@ class e107plugin
|
|||||||
switch($function)
|
switch($function)
|
||||||
{
|
{
|
||||||
case 'install':
|
case 'install':
|
||||||
if(is_array($list['active']))
|
if(varset($list['active']) && is_array($list['active']))
|
||||||
{
|
{
|
||||||
$txt .= $this->displayArray($list['active'], "Adding '{$prefType}' prefs:");
|
$txt .= $this->displayArray($list['active'], "Adding '{$prefType}' prefs:");
|
||||||
$this->manage_prefs('add', $list['active'], $prefType, $plug['plugin_path'], TRUE);
|
$this->manage_prefs('add', $list['active'], $prefType, $plug['plugin_path'], TRUE);
|
||||||
@@ -1058,14 +1105,14 @@ class e107plugin
|
|||||||
break;
|
break;
|
||||||
case 'upgrade' :
|
case 'upgrade' :
|
||||||
case 'refresh' : // Add any defined prefs which don't already exist
|
case 'refresh' : // Add any defined prefs which don't already exist
|
||||||
if(is_array($list['active']))
|
if(varset($list['active']) && is_array($list['active']))
|
||||||
{
|
{
|
||||||
$txt .= $this->displayArray($list['active'], "Updating '{$prefType}' prefs:");
|
$txt .= $this->displayArray($list['active'], "Updating '{$prefType}' prefs:");
|
||||||
$this->manage_prefs('update', $list['active'], $prefType, $plug['plugin_path'], TRUE); // This only adds prefs which aren't already defined
|
$this->manage_prefs('update', $list['active'], $prefType, $plug['plugin_path'], TRUE); // This only adds prefs which aren't already defined
|
||||||
}
|
}
|
||||||
|
|
||||||
//If upgrading, removing any inactive pref
|
//If upgrading, removing any inactive pref
|
||||||
if(is_array($list['inactive']))
|
if(varset($list['inactive']) && is_array($list['inactive']))
|
||||||
{
|
{
|
||||||
$txt .= $this->displayArray($list['inactive'], "Removing '{$prefType}' prefs:");
|
$txt .= $this->displayArray($list['inactive'], "Removing '{$prefType}' prefs:");
|
||||||
$this->manage_prefs('remove', $list['inactive'], $prefType, $plug['plugin_path'], TRUE);
|
$this->manage_prefs('remove', $list['inactive'], $prefType, $plug['plugin_path'], TRUE);
|
||||||
@@ -1074,7 +1121,7 @@ class e107plugin
|
|||||||
|
|
||||||
//If uninstalling, remove all prefs (active or inactive)
|
//If uninstalling, remove all prefs (active or inactive)
|
||||||
case 'uninstall':
|
case 'uninstall':
|
||||||
if(is_array($list['all']))
|
if(varset($list['all']) && is_array($list['all']))
|
||||||
{
|
{
|
||||||
$txt .= $this->displayArray($list['all'], "Removing '{$prefType}' prefs:");
|
$txt .= $this->displayArray($list['all'], "Removing '{$prefType}' prefs:");
|
||||||
$this->manage_prefs('remove', $list['all'], $prefType, $plug['plugin_path'], TRUE);
|
$this->manage_prefs('remove', $list['all'], $prefType, $plug['plugin_path'], TRUE);
|
||||||
@@ -1224,7 +1271,11 @@ class e107plugin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
save_prefs();
|
|
||||||
|
|
||||||
|
|
||||||
|
// save_prefs(); //FIXME replace with pref-class equivalent
|
||||||
|
e107::getConfig()->loadData($pref, false)->save(false, true);
|
||||||
|
|
||||||
|
|
||||||
if ($canContinue)
|
if ($canContinue)
|
||||||
@@ -1236,20 +1287,25 @@ class e107plugin
|
|||||||
|
|
||||||
$eplug_addons = $this->getAddons($plug['plugin_path']);
|
$eplug_addons = $this->getAddons($plug['plugin_path']);
|
||||||
|
|
||||||
|
$p_installed = e107::getPref('plug_installed',array()); // load preference;
|
||||||
|
|
||||||
if($function == 'install' || $function == 'upgrade')
|
if($function == 'install' || $function == 'upgrade')
|
||||||
{
|
{
|
||||||
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['@attributes']['version']}' WHERE plugin_id = ".$id);
|
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['@attributes']['version']}' WHERE plugin_id = ".$id);
|
||||||
$pref['plug_installed'][$plug['plugin_path']] = $plug_vars['@attributes']['version'];
|
$p_installed[$plug['plugin_path']] = $plug_vars['@attributes']['version'];
|
||||||
save_prefs();
|
|
||||||
|
e107::getConfig('core')->setPref('plug_installed',$p_installed)->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($function == 'uninstall')
|
if($function == 'uninstall')
|
||||||
{
|
{
|
||||||
$sql->db_Update('plugin', "plugin_installflag = 0, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['@attributes']['version']}' WHERE plugin_id = ".$id);
|
$sql->db_Update('plugin', "plugin_installflag = 0, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['@attributes']['version']}' WHERE plugin_id = ".$id);
|
||||||
unset($pref['plug_installed'][$plug['plugin_path']]);
|
unset($p_installed[$plug['plugin_path']]);
|
||||||
save_prefs();
|
e107::getConfig('core')->setPref('plug_installed',$p_installed)->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($function == 'install')
|
if($function == 'install')
|
||||||
{
|
{
|
||||||
$txt .= LAN_INSTALL_SUCCESSFUL."<br />";
|
$txt .= LAN_INSTALL_SUCCESSFUL."<br />";
|
||||||
@@ -1330,7 +1386,8 @@ class e107plugin
|
|||||||
|
|
||||||
function install_plugin_php($id)
|
function install_plugin_php($id)
|
||||||
{
|
{
|
||||||
global $sql;
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
$plug = $this->getinfo($id);
|
$plug = $this->getinfo($id);
|
||||||
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
||||||
@@ -1404,8 +1461,11 @@ class e107plugin
|
|||||||
$eplug_addons = $this->getAddons($eplug_folder);
|
$eplug_addons = $this->getAddons($eplug_folder);
|
||||||
|
|
||||||
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}' WHERE plugin_id = ".(int)$id);
|
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}' WHERE plugin_id = ".(int)$id);
|
||||||
$pref['plug_installed'][$plugin_path] = $plug['plugin_version'];
|
|
||||||
save_prefs();
|
$p_installed = e107::getPref('plug_installed',array()); // load preference;
|
||||||
|
$p_installed[$plug['plugin_path']] = $plug['plugin_version'];
|
||||||
|
|
||||||
|
e107::getConfig('core')->setPref('plug_installed',$p_installed)->save();
|
||||||
|
|
||||||
$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
|
$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
|
||||||
|
|
||||||
@@ -1420,7 +1480,10 @@ class e107plugin
|
|||||||
*/
|
*/
|
||||||
function install_plugin($id)
|
function install_plugin($id)
|
||||||
{
|
{
|
||||||
global $sql, $ns, $sysprefs, $mySQLprefix, $tp;
|
global $ns, $sysprefs, $mySQLprefix;
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
// install plugin ...
|
// install plugin ...
|
||||||
$id = (int)$id;
|
$id = (int)$id;
|
||||||
@@ -1448,19 +1511,15 @@ class e107plugin
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_addon_prefs()
|
function save_addon_prefs() // scan the plugin table and create path-array-prefs for each addon.
|
||||||
{ // scan the plugin table and create path-array-prefs for each addon.
|
{
|
||||||
global $sql,$pref;
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
$addpref = array();
|
||||||
|
|
||||||
// $query = "SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_addons !='' ORDER BY plugin_path ASC";
|
// $query = "SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_addons !='' ORDER BY plugin_path ASC";
|
||||||
$query = "SELECT * FROM #plugin WHERE plugin_addons !='' ORDER BY plugin_path ASC";
|
$query = "SELECT * FROM #plugin WHERE plugin_addons !='' ORDER BY plugin_path ASC";
|
||||||
|
|
||||||
// clear all addon prefs before re-creation.
|
|
||||||
unset($pref['shortcode_list'],$pref['bbcode_list'],$pref['e_sql_list']);
|
|
||||||
foreach($this->plugin_addons as $plg)
|
|
||||||
{
|
|
||||||
unset($pref[$plg."_list"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($sql -> db_Select_gen($query))
|
if ($sql -> db_Select_gen($query))
|
||||||
{
|
{
|
||||||
while($row = $sql-> db_Fetch())
|
while($row = $sql-> db_Fetch())
|
||||||
@@ -1475,7 +1534,7 @@ class e107plugin
|
|||||||
{
|
{
|
||||||
if(strpos($val, 'e_') === 0)
|
if(strpos($val, 'e_') === 0)
|
||||||
{
|
{
|
||||||
$pref[$val."_list"][$path] = $path;
|
$addpref[$val."_list"][$path] = $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1507,7 +1566,7 @@ class e107plugin
|
|||||||
|
|
||||||
if($is_installed && (substr($adds,-4) == "_sql"))
|
if($is_installed && (substr($adds,-4) == "_sql"))
|
||||||
{
|
{
|
||||||
$pref['e_sql_list'][$path] = $adds;
|
$addpref['e_sql_list'][$path] = $adds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1515,29 +1574,27 @@ class e107plugin
|
|||||||
if(count($bb_array) > 0)
|
if(count($bb_array) > 0)
|
||||||
{
|
{
|
||||||
ksort($bb_array);
|
ksort($bb_array);
|
||||||
$pref['bbcode_list'][$path] = $bb_array;
|
$addpref['bbcode_list'][$path] = $bb_array;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isset($pref['bbcode_list'][$path])) unset($pref['bbcode_list'][$path]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build shortcode list - do if uninstalled as well
|
// Build shortcode list - do if uninstalled as well
|
||||||
if(count($sc_array) > 0)
|
if(count($sc_array) > 0)
|
||||||
{
|
{
|
||||||
ksort($sc_array);
|
ksort($sc_array);
|
||||||
$pref['shortcode_list'][$path] = $sc_array;
|
$addpref['shortcode_list'][$path] = $sc_array;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Review pref-class method used below (a new function?), to simply add or update existing prefs. (without a global $pref)
|
||||||
|
|
||||||
|
foreach($addpref as $key=>$val)
|
||||||
{
|
{
|
||||||
if(isset($pref['shortcode_list'][$path])) unset($pref['shortcode_list'][$path]);
|
e107::getConfig('core')->set($key,$val);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
e107::getConfig('core')->save(FALSE);
|
||||||
}
|
|
||||||
|
|
||||||
save_prefs();
|
|
||||||
|
|
||||||
if($this->manage_icons())
|
if($this->manage_icons())
|
||||||
{
|
{
|
||||||
@@ -1646,6 +1703,7 @@ class e107plugin
|
|||||||
function parse_plugin($plugName, $force=false)
|
function parse_plugin($plugName, $force=false)
|
||||||
{
|
{
|
||||||
$ret = "";
|
$ret = "";
|
||||||
|
|
||||||
if(isset($this->parsed_plugin[$plugName]) && $force != true)
|
if(isset($this->parsed_plugin[$plugName]) && $force != true)
|
||||||
{
|
{
|
||||||
$this->plug_vars = $this->parsed_plugin[$plugName];
|
$this->plug_vars = $this->parsed_plugin[$plugName];
|
||||||
@@ -1707,8 +1765,8 @@ class e107plugin
|
|||||||
// Called to parse the plugin.xml file if it exists
|
// Called to parse the plugin.xml file if it exists
|
||||||
function parse_plugin_xml($plugName)
|
function parse_plugin_xml($plugName)
|
||||||
{
|
{
|
||||||
global $tp;
|
$tp = e107::getParser();
|
||||||
loadLanFiles($plugName, 'admin'); // Look for LAN files on default paths
|
// loadLanFiles($plugName, 'admin'); // Look for LAN files on default paths
|
||||||
require_once(e_HANDLER.'xml_class.php');
|
require_once(e_HANDLER.'xml_class.php');
|
||||||
$xml = new xmlClass;
|
$xml = new xmlClass;
|
||||||
$this->plug_vars = $xml->loadXMLfile(e_PLUGIN.$plugName.'/plugin.xml', true, true);
|
$this->plug_vars = $xml->loadXMLfile(e_PLUGIN.$plugName.'/plugin.xml', true, true);
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Simple XML Parser
|
* Simple XML Parser
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
|
||||||
* $Revision: 1.20 $
|
* $Revision: 1.21 $
|
||||||
* $Date: 2009-09-01 02:00:56 $
|
* $Date: 2009-09-03 22:27:32 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ class xmlClass
|
|||||||
{
|
{
|
||||||
$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
|
$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
|
||||||
$data = file_get_contents(urlencode($address));
|
$data = file_get_contents(urlencode($address));
|
||||||
echo "data=".$data;
|
|
||||||
// $data = file_get_contents(htmlspecialchars($address)); // buggy - sometimes fails.
|
// $data = file_get_contents(htmlspecialchars($address)); // buggy - sometimes fails.
|
||||||
if ($old_timeout !== FALSE)
|
if ($old_timeout !== FALSE)
|
||||||
{
|
{
|
||||||
@@ -648,11 +648,11 @@ class xmlClass
|
|||||||
/**
|
/**
|
||||||
* Import an e107 XML file into site preferences and DB tables
|
* Import an e107 XML file into site preferences and DB tables
|
||||||
* @param path $file - e107 XML file path
|
* @param path $file - e107 XML file path
|
||||||
* @param string $only [optional] - prefs|database
|
* @param string $mode[optional] - add|replace
|
||||||
* @param boolean $debug [optional]
|
* @param boolean $debug [optional]
|
||||||
* @return array with keys 'success' and 'failed' - DB table entry status.
|
* @return array with keys 'success' and 'failed' - DB table entry status.
|
||||||
*/
|
*/
|
||||||
public function e107Import($file,$only='',$debug=FALSE)
|
public function e107Import($file,$mode='replace',$debug=FALSE)
|
||||||
{
|
{
|
||||||
|
|
||||||
$xmlArray = $this->loadXMLfile($file,'advanced');
|
$xmlArray = $this->loadXMLfile($file,'advanced');
|
||||||
@@ -666,12 +666,19 @@ class xmlClass
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
//FIXME - doesn't work from install_.php.
|
//FIXME - doesn't work from install_.php.
|
||||||
if(vartrue($xmlArray['prefs']) && $only !='database') // Save Core Prefs
|
if(vartrue($xmlArray['prefs'])) // Save Core Prefs
|
||||||
{
|
{
|
||||||
foreach($xmlArray['prefs'] as $type=>$array)
|
foreach($xmlArray['prefs'] as $type=>$array)
|
||||||
{
|
{
|
||||||
$pArray = $this->e107ImportPrefs($xmlArray,$type);
|
$pArray = $this->e107ImportPrefs($xmlArray,$type);
|
||||||
|
if($mode == 'replace')
|
||||||
|
{
|
||||||
e107::getConfig($type)->setPref($pArray);
|
e107::getConfig($type)->setPref($pArray);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e107::getConfig($type)->addPref($pArray);
|
||||||
|
}
|
||||||
|
|
||||||
if($debug == FALSE)
|
if($debug == FALSE)
|
||||||
{
|
{
|
||||||
@@ -680,7 +687,7 @@ class xmlClass
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vartrue($xmlArray['database']) && $only !='prefs')
|
if(vartrue($xmlArray['database']))
|
||||||
{
|
{
|
||||||
foreach($xmlArray['database']['dbTable'] as $val)
|
foreach($xmlArray['database']['dbTable'] as $val)
|
||||||
{
|
{
|
||||||
@@ -696,7 +703,11 @@ class xmlClass
|
|||||||
|
|
||||||
$insert_array[$fieldkey] = $fieldval;
|
$insert_array[$fieldkey] = $fieldval;
|
||||||
}
|
}
|
||||||
if(e107::getDB()->db_Replace($table, $insert_array)!==FALSE)
|
if(($mode == "replace") && e107::getDB()->db_Replace($table, $insert_array)!==FALSE)
|
||||||
|
{
|
||||||
|
$ret['success'][] = $table;
|
||||||
|
}
|
||||||
|
elseif(($mode == "add") && e107::getDB()->db_Insert($table, $insert_array)!==FALSE)
|
||||||
{
|
{
|
||||||
$ret['success'][] = $table;
|
$ret['success'][] = $table;
|
||||||
}
|
}
|
||||||
|
72
install_.php
72
install_.php
@@ -2,15 +2,15 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
* Copyright (C) 2001-2009 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* Installation file
|
* Installation file
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/install_.php,v $
|
* $Source: /cvs_backup/e107_0.8/install_.php,v $
|
||||||
* $Revision: 1.33 $
|
* $Revision: 1.34 $
|
||||||
* $Date: 2009-09-03 14:39:20 $
|
* $Date: 2009-09-03 22:27:32 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -69,6 +69,8 @@ function e107_ini_set($var, $value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// setup some php options
|
// setup some php options
|
||||||
e107_ini_set('magic_quotes_runtime', 0);
|
e107_ini_set('magic_quotes_runtime', 0);
|
||||||
e107_ini_set('magic_quotes_sybase', 0);
|
e107_ini_set('magic_quotes_sybase', 0);
|
||||||
@@ -132,6 +134,16 @@ header("Content-type: text/html; charset=utf-8");
|
|||||||
include_once("./{$HANDLERS_DIRECTORY}core_functions.php");
|
include_once("./{$HANDLERS_DIRECTORY}core_functions.php");
|
||||||
include_once("./{$HANDLERS_DIRECTORY}e107_class.php");
|
include_once("./{$HANDLERS_DIRECTORY}e107_class.php");
|
||||||
|
|
||||||
|
function include_lan($path, $force = false)
|
||||||
|
{
|
||||||
|
return e107::getLan($path, $force);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_class($whatever)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'CACHE_DIRECTORY', 'DOWNLOADS_DIRECTORY', 'UPLOADS_DIRECTORY');
|
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'CACHE_DIRECTORY', 'DOWNLOADS_DIRECTORY', 'UPLOADS_DIRECTORY');
|
||||||
|
|
||||||
@@ -892,13 +904,26 @@ class e_install
|
|||||||
$this->template->SetTag("stage_content", $page.$e_forms->return_form());
|
$this->template->SetTag("stage_content", $page.$e_forms->return_form());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import and Generate Preferences and default content.
|
* Import and Generate Preferences and default content.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private function import_configuration()
|
private function import_configuration()
|
||||||
{
|
{
|
||||||
|
// Basic stuff to get the handlers/classes to work.
|
||||||
|
|
||||||
define("E107_INSTALL",TRUE); //FIXME - remove the need for this - ie. make the MySQL class work without it.
|
define("E107_INSTALL",TRUE); //FIXME - remove the need for this - ie. make the MySQL class work without it.
|
||||||
|
$udirs = "admin/|plugins/|temp";
|
||||||
|
$e_SELF = $_SERVER['PHP_SELF'];
|
||||||
|
$e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/");
|
||||||
|
|
||||||
|
define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? true : false));
|
||||||
|
define("CHARSET",'utf-8');
|
||||||
|
define("e_LANGUAGE", $this->previous_steps['language']);
|
||||||
|
define('e_SELF', 'http://'.$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']);
|
||||||
|
|
||||||
|
|
||||||
$themeImportFile = $this->e107->e107_dirs['THEMES_DIRECTORY'].$this->previous_steps['prefs']['sitetheme']."/install.xml";
|
$themeImportFile = $this->e107->e107_dirs['THEMES_DIRECTORY'].$this->previous_steps['prefs']['sitetheme']."/install.xml";
|
||||||
if($this->previous_steps['generate_content']==1 && is_readable($themeImportFile))
|
if($this->previous_steps['generate_content']==1 && is_readable($themeImportFile))
|
||||||
@@ -910,39 +935,20 @@ class e_install
|
|||||||
$XMLImportfile = $this->e107->e107_dirs['FILES_DIRECTORY']. "default_install.xml";
|
$XMLImportfile = $this->e107->e107_dirs['FILES_DIRECTORY']. "default_install.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert Defaults.
|
|
||||||
$udirs = "admin/|plugins/|temp";
|
|
||||||
$e_SELF = $_SERVER['PHP_SELF'];
|
|
||||||
$e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/");
|
|
||||||
|
|
||||||
$pref_language = isset($this->previous_steps['language']) ? $this->previous_steps['language'] : "English";
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if (is_readable($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php"))
|
include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$this->previous_steps['language']."/lan_prefs.php");
|
||||||
{
|
|
||||||
include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY']."English/lan_prefs.php");
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once("{$this->e107->e107_dirs['FILES_DIRECTORY']}def_e107_prefs.php"); // could be deprecated if need be
|
|
||||||
include_once("{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}arraystorage_class.php");
|
|
||||||
|
|
||||||
$tmp = ArrayData::WriteArray($pref);
|
|
||||||
|
|
||||||
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('SitePrefs', '{$tmp}')");
|
|
||||||
$this->dbqry("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('SitePrefs_Backup', '{$tmp}')");
|
|
||||||
|
|
||||||
//Create default plugin-table entries.
|
//Create default plugin-table entries.
|
||||||
e107::getSingleton('e107plugin')->update_plugins_table(); //FIXME - also relies on pref class.
|
e107::getSingleton('e107plugin')->update_plugins_table();
|
||||||
|
|
||||||
// Install Theme-required plugins
|
// Install Theme-required plugins
|
||||||
if($this->previous_steps['install_plugins']==1)
|
if($this->previous_steps['install_plugins']==1)
|
||||||
{
|
{
|
||||||
if($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme']))
|
if($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme']))
|
||||||
{
|
{
|
||||||
if(varset($themeInfo['plugins']['plugin']))
|
if(isset($themeInfo['plugins']['plugin']))
|
||||||
{
|
{
|
||||||
foreach($themeInfo['plugins']['plugin'] as $k=>$plug)
|
foreach($themeInfo['plugins']['plugin'] as $k=>$plug)
|
||||||
{
|
{
|
||||||
@@ -952,9 +958,10 @@ class e_install
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import Site-Data from XML.
|
|
||||||
//FIXME remove 'database' from the function below, once the pref handler is working.
|
|
||||||
e107::getSingleton('xmlClass')->e107Import($XMLImportfile); // includes non-core preferences
|
e107::getSingleton('xmlClass')->e107Import($XMLImportfile,'add'); // Add missing core pref values
|
||||||
|
e107::getSingleton('e107plugin')->save_addon_prefs(); // save plugin addon pref-lists. eg. e_latest_list.
|
||||||
|
|
||||||
// Set Preferences defined during install - overwriting those that may exist in the XML.
|
// Set Preferences defined during install - overwriting those that may exist in the XML.
|
||||||
|
|
||||||
@@ -977,9 +984,10 @@ class e_install
|
|||||||
|
|
||||||
foreach($this->previous_steps['prefs'] as $key=>$val)
|
foreach($this->previous_steps['prefs'] as $key=>$val)
|
||||||
{
|
{
|
||||||
e107::getConfig('core')->set($key, $val); //FIXME - pref class issues.
|
e107::getConfig('core')->set($key,$val);
|
||||||
}
|
}
|
||||||
e107::getConfig('core')->save(FALSE); //FIXME - pref class issues.
|
|
||||||
|
e107::getConfig('core')->save(FALSE); // save preferences made during install.
|
||||||
|
|
||||||
// Create the admin user - replacing any that may be been included in the XML.
|
// Create the admin user - replacing any that may be been included in the XML.
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
@@ -998,7 +1006,7 @@ class e_install
|
|||||||
*/
|
*/
|
||||||
private function install_plugin($plugpath) //FIXME - requires default plugin table entries, see above.
|
private function install_plugin($plugpath) //FIXME - requires default plugin table entries, see above.
|
||||||
{
|
{
|
||||||
e107::getDb()->db_Select('plugin','plugin_id',"plugin_path='".$plugpath." LIMIT 1");
|
e107::getDb()->db_Select_gen("SELECT * FROM #plugin WHERE plugin_path = '".$plugpath."' LIMIT 1");
|
||||||
$row = e107::getDb()->db_Fetch(MYSQL_ASSOC);
|
$row = e107::getDb()->db_Fetch(MYSQL_ASSOC);
|
||||||
e107::getSingleton('e107plugin')->install_plugin($row['plugin_id']);
|
e107::getSingleton('e107plugin')->install_plugin($row['plugin_id']);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user