mirror of
https://github.com/e107inc/e107.git
synced 2025-04-16 02:26:25 +02:00
URL condig rebuild routine on various places,
Import prefs fix - arrays wasn't imported, Mislogic of some preference handler methods
This commit is contained in:
parent
b701180324
commit
34b40eddfb
@ -52,6 +52,7 @@ $pman->pluginObserver();
|
||||
require_once("footer.php");
|
||||
exit;
|
||||
|
||||
// FIXME switch to admin UI
|
||||
class pluginManager{
|
||||
|
||||
var $plugArray;
|
||||
@ -193,11 +194,15 @@ class pluginManager{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// FIXME - move it to plugin handler, similar to install_plugin() routine
|
||||
function pluginUninstall()
|
||||
{
|
||||
global $plugin,$admin_log,$pref,$tp,$sql;
|
||||
|
||||
$pref = e107::getPref();
|
||||
$admin_log = e107::getAdminLog();
|
||||
$plugin = e107::getPlugin();
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
|
||||
if(!isset($_POST['uninstall_confirm']))
|
||||
{ // $id is already an integer
|
||||
$this->pluginConfirmUninstall($this->id);
|
||||
@ -285,23 +290,18 @@ class pluginManager{
|
||||
$plugin->manage_search('remove', $eplug_folder);
|
||||
|
||||
$plugin->manage_notify('remove', $eplug_folder);
|
||||
|
||||
// it's done inside install_plugin_xml(), required only here
|
||||
if (isset($pref['plug_installed'][$plug['plugin_path']]))
|
||||
{
|
||||
unset($pref['plug_installed'][$plug['plugin_path']]);
|
||||
}
|
||||
e107::getConfig('core')->setPref($pref);
|
||||
$plugin->rebuildUrlConfig();
|
||||
e107::getConfig('core')->save();
|
||||
}
|
||||
|
||||
$admin_log->log_event('PLUGMAN_03', $plug['plugin_path'], E_LOG_INFORMATIVE, '');
|
||||
|
||||
if (isset($pref['plug_installed'][$plug['plugin_path']]))
|
||||
{
|
||||
|
||||
unset($pref['plug_installed'][$plug['plugin_path']]);
|
||||
if(save_prefs())
|
||||
{
|
||||
// echo "WORKED";
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "FAILED";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['delete_files'])
|
||||
@ -449,136 +449,93 @@ class pluginManager{
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
function pluginUpgrade()
|
||||
{
|
||||
global $plugin,$pref,$admin_log;
|
||||
function pluginUpgrade()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
$admin_log = e107::getAdminLog();
|
||||
$plugin = e107::getPlugin();
|
||||
|
||||
$sql = e107::getDb();
|
||||
$sql = e107::getDb();
|
||||
|
||||
$emessage = eMessage::getInstance();
|
||||
$emessage = eMessage::getInstance();
|
||||
|
||||
$plug = $plugin->getinfo($this->id);
|
||||
$plug = $plugin->getinfo($this->id);
|
||||
|
||||
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
||||
if(file_exists($_path.'plugin.xml'))
|
||||
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
||||
if(file_exists($_path.'plugin.xml'))
|
||||
{
|
||||
$plugin->install_plugin_xml($this->id, 'upgrade');
|
||||
}
|
||||
else
|
||||
{
|
||||
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
|
||||
|
||||
$func = $eplug_folder.'_upgrade';
|
||||
if (function_exists($func))
|
||||
{
|
||||
$plugin->install_plugin_xml($this->id, 'upgrade');
|
||||
}
|
||||
else
|
||||
{
|
||||
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
|
||||
|
||||
$func = $eplug_folder.'_upgrade';
|
||||
if (function_exists($func))
|
||||
{
|
||||
$text .= call_user_func($func);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_alter_tables))
|
||||
{
|
||||
$result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
|
||||
if (true !== $result)
|
||||
{
|
||||
//$text .= EPL_ADLAN_9.'<br />';
|
||||
$emessage->addWarning(EPL_ADLAN_9)
|
||||
->addDebug($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= EPL_ADLAN_7."<br />";
|
||||
}
|
||||
}
|
||||
|
||||
/* Not used in 0.8
|
||||
if ($eplug_module)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', 'modules', $eplug_folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
|
||||
}
|
||||
|
||||
if ($eplug_status)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', 'plug_status', $eplug_folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
|
||||
}
|
||||
|
||||
if ($eplug_latest)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', 'plug_latest', $eplug_folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_add_eplug_sc))
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', 'plug_sc', $eplug_folder, $eplug_sc);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_remove_eplug_sc))
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', 'plug_sc', $eplug_folder, $eplug_sc);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_add_eplug_bb))
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', 'plug_bb', $eplug_folder, $eplug_bb);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_remove_eplug_bb))
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb);
|
||||
}
|
||||
*/
|
||||
if (is_array($upgrade_add_prefs))
|
||||
{
|
||||
$plugin->manage_prefs('add', $upgrade_add_prefs);
|
||||
$text .= EPL_ADLAN_8.'<br />';
|
||||
}
|
||||
|
||||
if (is_array($upgrade_remove_prefs))
|
||||
{
|
||||
$plugin->manage_prefs('remove', $upgrade_remove_prefs);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_add_array_pref))
|
||||
{
|
||||
foreach($upgrade_add_array_pref as $key => $val)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($upgrade_remove_array_pref))
|
||||
{
|
||||
foreach($upgrade_remove_array_pref as $key => $val)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
|
||||
}
|
||||
}
|
||||
|
||||
$plugin->manage_search('upgrade', $eplug_folder);
|
||||
$plugin->manage_notify('upgrade', $eplug_folder);
|
||||
|
||||
$eplug_addons = $plugin -> getAddons($eplug_folder);
|
||||
|
||||
$admin_log->log_event('PLUGMAN_02', $eplug_folder, E_LOG_INFORMATIVE, '');
|
||||
$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL;
|
||||
$sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$this->id' ");
|
||||
$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version
|
||||
save_prefs();
|
||||
$text .= call_user_func($func);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_alter_tables))
|
||||
{
|
||||
$result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
|
||||
if (true !== $result)
|
||||
{
|
||||
//$text .= EPL_ADLAN_9.'<br />';
|
||||
$emessage->addWarning(EPL_ADLAN_9)
|
||||
->addDebug($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= EPL_ADLAN_7."<br />";
|
||||
}
|
||||
}
|
||||
|
||||
$emessage->add($text, E_MESSAGE_SUCCESS);
|
||||
$plugin->save_addon_prefs();
|
||||
if (is_array($upgrade_add_prefs))
|
||||
{
|
||||
$plugin->manage_prefs('add', $upgrade_add_prefs);
|
||||
$text .= EPL_ADLAN_8.'<br />';
|
||||
}
|
||||
|
||||
if (is_array($upgrade_remove_prefs))
|
||||
{
|
||||
$plugin->manage_prefs('remove', $upgrade_remove_prefs);
|
||||
}
|
||||
|
||||
if (is_array($upgrade_add_array_pref))
|
||||
{
|
||||
foreach($upgrade_add_array_pref as $key => $val)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($upgrade_remove_array_pref))
|
||||
{
|
||||
foreach($upgrade_remove_array_pref as $key => $val)
|
||||
{
|
||||
$plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
|
||||
}
|
||||
}
|
||||
|
||||
$plugin->manage_search('upgrade', $eplug_folder);
|
||||
$plugin->manage_notify('upgrade', $eplug_folder);
|
||||
|
||||
$eplug_addons = $plugin -> getAddons($eplug_folder);
|
||||
|
||||
$admin_log->log_event('PLUGMAN_02', $eplug_folder, E_LOG_INFORMATIVE, '');
|
||||
$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL;
|
||||
$sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$this->id' ");
|
||||
$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version
|
||||
|
||||
e107::getConfig('core')->setPref($pref);
|
||||
$plugin->rebuildUrlConfig();
|
||||
e107::getConfig('core')->save();
|
||||
}
|
||||
|
||||
|
||||
$emessage->add($text, E_MESSAGE_SUCCESS);
|
||||
$plugin->save_addon_prefs();
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,22 +29,22 @@
|
||||
<core name="contact_emailcopy">0</core>
|
||||
<core name="cookie_name">e107cookie</core>
|
||||
<core name="core-infopanel-default"><![CDATA[array (
|
||||
0 => "e-administrator",
|
||||
1 => "e-cpage",
|
||||
2 => "e-filemanager",
|
||||
3 => "e-frontpage",
|
||||
4 => "e-image",
|
||||
5 => "e-mailout",
|
||||
6 => "e-menus",
|
||||
7 => "e-meta",
|
||||
8 => "e-newspost",
|
||||
9 => "e-plugin",
|
||||
10 => "e-prefs",
|
||||
11 => "e-links",
|
||||
12 => "e-theme",
|
||||
13 => "e-userclass2",
|
||||
14 => "e-users",
|
||||
15 => "e-wmessage",
|
||||
0 => 'e-administrator',
|
||||
1 => 'e-cpage',
|
||||
2 => 'e-filemanager',
|
||||
3 => 'e-frontpage',
|
||||
4 => 'e-image',
|
||||
5 => 'e-mailout',
|
||||
6 => 'e-menus',
|
||||
7 => 'e-meta',
|
||||
8 => 'e-newspost',
|
||||
9 => 'e-plugin',
|
||||
10 => 'e-prefs',
|
||||
11 => 'e-links',
|
||||
12 => 'e-theme',
|
||||
13 => 'e-userclass2',
|
||||
14 => 'e-users',
|
||||
15 => 'e-wmessage',
|
||||
)]]></core>
|
||||
<core name="developer">0</core>
|
||||
<core name="disable_emailcheck">0</core>
|
||||
@ -58,10 +58,10 @@
|
||||
<core name="download_email">0</core>
|
||||
<core name="e_jslib_browser_cache">0</core>
|
||||
<core name="e_jslib_core"><![CDATA[array (
|
||||
"prototype/prototype.js" => "all",
|
||||
"scriptaculous/scriptaculous.js" => "all",
|
||||
"scriptaculous/effects.js" => "all",
|
||||
"e107.js.php" => "all",
|
||||
'prototype/prototype.js' => 'all',
|
||||
'scriptaculous/scriptaculous.js' => 'all',
|
||||
'scriptaculous/effects.js' => 'all',
|
||||
'e107.js.php' => 'all',
|
||||
)]]></core>
|
||||
<core name="e_jslib_plugin"><![CDATA[array ()]]></core>
|
||||
<core name="e_jslib_theme"><![CDATA[array ()]]></core>
|
||||
@ -77,10 +77,10 @@
|
||||
<core name="forumdate">%a %b %d %Y, %I:%M%p</core>
|
||||
<core name="fpwcode">0</core>
|
||||
<core name="frontpage"><![CDATA[array (
|
||||
0 => "news.php",
|
||||
0 => 'index.php',
|
||||
)]]></core>
|
||||
<core name="frontpage_force"><![CDATA[array (
|
||||
0 => "",
|
||||
0 => '',
|
||||
)]]></core>
|
||||
<core name="im_height">100</core>
|
||||
<core name="im_path">/usr/X11R6/bin/</core>
|
||||
@ -108,14 +108,14 @@
|
||||
<core name="memberlist_access">253</core>
|
||||
<core name="membersonly_enabled">0</core>
|
||||
<core name="membersonly_exceptions"><![CDATA[array (
|
||||
0 => "",
|
||||
0 => '',
|
||||
)]]></core>
|
||||
<core name="menu_wordwrap"></core>
|
||||
<core name="menuconfig_list"><![CDATA[array (
|
||||
"login_menu" =>
|
||||
'login_menu' =>
|
||||
array (
|
||||
"name" => "Login",
|
||||
"link" => "login_menu/config.php",
|
||||
'name' => 'Login',
|
||||
'link' => 'login_menu/config.php',
|
||||
),
|
||||
)]]></core>
|
||||
<core name="meta_tag"></core>
|
||||
@ -180,24 +180,24 @@ City, State, Country
|
||||
<core name="sitetheme_custompages"></core>
|
||||
<core name="sitetheme_deflayout">3_column</core>
|
||||
<core name="sitetheme_layouts"><![CDATA[array (
|
||||
"3_column" =>
|
||||
'3_column' =>
|
||||
array (
|
||||
"@attributes" =>
|
||||
'@attributes' =>
|
||||
array (
|
||||
"title" => "3 Columns",
|
||||
"preview" => "preview.jpg",
|
||||
"default" => "true",
|
||||
'title' => '3 Columns',
|
||||
'preview' => 'preview.jpg',
|
||||
'default' => 'true',
|
||||
),
|
||||
0 => "",
|
||||
0 => '',
|
||||
),
|
||||
"2_column" =>
|
||||
'2_column' =>
|
||||
array (
|
||||
"@attributes" =>
|
||||
'@attributes' =>
|
||||
array (
|
||||
"title" => "2 Columns",
|
||||
"preview" => "preview.jpg",
|
||||
'title' => '2 Columns',
|
||||
'preview' => 'preview.jpg',
|
||||
),
|
||||
0 => "",
|
||||
0 => '',
|
||||
),
|
||||
)]]></core>
|
||||
<core name="sitetheme_pref"></core>
|
||||
@ -216,6 +216,10 @@ City, State, Country
|
||||
<core name="upload_class">255</core>
|
||||
<core name="upload_enabled">0</core>
|
||||
<core name="upload_maxfilesize"></core>
|
||||
<core name="url_aliases"><![CDATA[array()]]></core>
|
||||
<core name="url_config"><![CDATA[array()]]></core>
|
||||
<core name="url_locations"><![CDATA[array()]]></core>
|
||||
<core name="url_modules"><![CDATA[array()]]></core>
|
||||
<core name="useGeshi">0</core>
|
||||
<core name="use_coppa">1</core>
|
||||
<core name="user_reg">1</core>
|
||||
@ -271,64 +275,64 @@ City, State, Country
|
||||
<menu name="newforumposts_title">0</menu>
|
||||
<menu name="update_menu">Update menu Settings</menu>
|
||||
<search name="comments_handlers"><![CDATA[array (
|
||||
"news" =>
|
||||
'news' =>
|
||||
array (
|
||||
"id" => 0,
|
||||
"dir" => "core",
|
||||
"class" => "0",
|
||||
'id' => 0,
|
||||
'dir' => 'core',
|
||||
'class' => '0',
|
||||
),
|
||||
"download" =>
|
||||
'download' =>
|
||||
array (
|
||||
"id" => 2,
|
||||
"dir" => "core",
|
||||
"class" => "0",
|
||||
'id' => 2,
|
||||
'dir' => 'core',
|
||||
'class' => '0',
|
||||
),
|
||||
)]]></search>
|
||||
<search name="core_handlers"><![CDATA[array (
|
||||
"news" =>
|
||||
'news' =>
|
||||
array (
|
||||
"class" => "0",
|
||||
"pre_title" => "0",
|
||||
"pre_title_alt" => "",
|
||||
"chars" => "150",
|
||||
"results" => "10",
|
||||
"order" => "1",
|
||||
'class' => '0',
|
||||
'pre_title' => '0',
|
||||
'pre_title_alt' => '',
|
||||
'chars' => '150',
|
||||
'results' => '10',
|
||||
'order' => '1',
|
||||
),
|
||||
"comments" =>
|
||||
'comments' =>
|
||||
array (
|
||||
"class" => "0",
|
||||
"pre_title" => "1",
|
||||
"pre_title_alt" => "",
|
||||
"chars" => "150",
|
||||
"results" => "10",
|
||||
"order" => "2",
|
||||
'class' => '0',
|
||||
'pre_title' => '1',
|
||||
'pre_title_alt' => '',
|
||||
'chars' => '150',
|
||||
'results' => '10',
|
||||
'order' => '2',
|
||||
),
|
||||
"users" =>
|
||||
'users' =>
|
||||
array (
|
||||
"class" => "0",
|
||||
"pre_title" => "1",
|
||||
"pre_title_alt" => "",
|
||||
"chars" => "150",
|
||||
"results" => "10",
|
||||
"order" => "3",
|
||||
'class' => '0',
|
||||
'pre_title' => '1',
|
||||
'pre_title_alt' => '',
|
||||
'chars' => '150',
|
||||
'results' => '10',
|
||||
'order' => '3',
|
||||
),
|
||||
"downloads" =>
|
||||
'downloads' =>
|
||||
array (
|
||||
"class" => "0",
|
||||
"pre_title" => "1",
|
||||
"pre_title_alt" => "",
|
||||
"chars" => "150",
|
||||
"results" => "10",
|
||||
"order" => "4",
|
||||
'class' => '0',
|
||||
'pre_title' => '1',
|
||||
'pre_title_alt' => '',
|
||||
'chars' => '150',
|
||||
'results' => '10',
|
||||
'order' => '4',
|
||||
),
|
||||
"pages" =>
|
||||
'pages' =>
|
||||
array (
|
||||
"class" => "0",
|
||||
"chars" => "150",
|
||||
"results" => "10",
|
||||
"pre_title" => "0",
|
||||
"pre_title_alt" => "",
|
||||
"order" => "5",
|
||||
'class' => '0',
|
||||
'chars' => '150',
|
||||
'results' => '10',
|
||||
'pre_title' => '0',
|
||||
'pre_title_alt' => '',
|
||||
'order' => '5',
|
||||
),
|
||||
)]]></search>
|
||||
<search name="google">0</search>
|
||||
@ -341,50 +345,50 @@ City, State, Country
|
||||
<search name="time_secs">60</search>
|
||||
<search name="user_select">1</search>
|
||||
<notify name="event"><![CDATA[array (
|
||||
"usersup" =>
|
||||
'usersup' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"userveri" =>
|
||||
'userveri' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"login" =>
|
||||
'login' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"logout" =>
|
||||
'logout' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"flood" =>
|
||||
'flood' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"subnews" =>
|
||||
'subnews' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"newspost" =>
|
||||
'newspost' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"newsupd" =>
|
||||
'newsupd' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
"newsdel" =>
|
||||
'newsdel' =>
|
||||
array (
|
||||
"class" => "254",
|
||||
"email" => "",
|
||||
'class' => '254',
|
||||
'email' => '',
|
||||
),
|
||||
)]]></notify>
|
||||
</prefs>
|
||||
|
@ -437,7 +437,6 @@ class eDispatcher
|
||||
{
|
||||
case 'plugin':
|
||||
if(!$plugin) return null;
|
||||
$location = $tmp[1];
|
||||
return $sc ? '{e_PLUGIN}'.$plugin.'/controllers/' : e_PLUGIN.$plugin.'/controllers/';
|
||||
break;
|
||||
|
||||
@ -1036,6 +1035,7 @@ class eRouter
|
||||
{
|
||||
$ret['plugin'][] = $plugin;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Register only those who don't need install and may be dispatchable
|
||||
@ -1066,6 +1066,19 @@ class eRouter
|
||||
}
|
||||
}
|
||||
sort($ret['override']);
|
||||
|
||||
// remove not installed plugin locations, possible only for 'all' type
|
||||
if($type == 'all')
|
||||
{
|
||||
foreach ($ret['override'] as $i => $l)
|
||||
{
|
||||
// it's a plugin override, but not listed in current plugin array - remove
|
||||
if(in_array($l, $plugins) && !in_array($l, $ret['plugin']))
|
||||
{
|
||||
unset($ret['override'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@ -277,9 +277,10 @@ class e107plugin
|
||||
// echo "Updated: ".$plug_path."<br />";
|
||||
}
|
||||
}
|
||||
if ($sp && vartrue($p_installed))
|
||||
if ($sp/* && vartrue($p_installed)*/)
|
||||
{
|
||||
e107::getConfig('core')->setPref('plug_installed', $p_installed);
|
||||
$this->rebuildUrlConfig();
|
||||
e107::getConfig('core')->save();
|
||||
}
|
||||
}
|
||||
@ -1074,6 +1075,30 @@ class e107plugin
|
||||
$notify_prefs->save(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild URL configuration values
|
||||
* Note - new core system pref values will be set, but not saved
|
||||
* e107::getConfig()->save() is required outside after execution of this method
|
||||
* @return void
|
||||
*/
|
||||
public function rebuildUrlConfig()
|
||||
{
|
||||
|
||||
$modules = eRouter::adminReadModules(); // get all available locations, non installed plugins will be ignored
|
||||
$config = eRouter::adminBuildConfig(e107::getPref('url_config'), $modules); // merge with current config
|
||||
$locations = eRouter::adminBuildLocations($modules); // rebuild locations pref
|
||||
$aliases = eRouter::adminSyncAliases(e107::getPref('url_aliases'), $config); // rebuild aliases
|
||||
|
||||
// set new values, changes should be saved outside this methods
|
||||
e107::getConfig()
|
||||
->set('url_aliases', $aliases)
|
||||
->set('url_config', $config)
|
||||
->set('url_modules', $modules)
|
||||
->set('url_locations', $locations);
|
||||
|
||||
eRouter::clearCache();
|
||||
}
|
||||
|
||||
function displayArray(&$array, $msg = '')
|
||||
{
|
||||
$txt = ($msg ? $msg.'<br />' : '');
|
||||
@ -1283,7 +1308,7 @@ class e107plugin
|
||||
$p_installed[$plug['plugin_path']] = $plug_vars['@attributes']['version'];
|
||||
|
||||
e107::getConfig('core')->setPref('plug_installed', $p_installed);
|
||||
e107::getConfig('core')->save();
|
||||
//e107::getConfig('core')->save(); - save triggered below
|
||||
}
|
||||
|
||||
if ($function == 'uninstall')
|
||||
@ -1293,6 +1318,8 @@ class e107plugin
|
||||
e107::getConfig('core')->setPref('plug_installed', $p_installed);
|
||||
|
||||
}
|
||||
|
||||
$this->rebuildUrlConfig();
|
||||
|
||||
e107::getConfig('core')->save();
|
||||
|
||||
@ -1870,7 +1897,11 @@ class e107plugin
|
||||
$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();
|
||||
e107::getConfig('core')->setPref('plug_installed', $p_installed);
|
||||
|
||||
$this->rebuildUrlConfig();
|
||||
|
||||
e107::getConfig('core')->save();
|
||||
|
||||
$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
|
||||
if ($eplug_conffile)
|
||||
|
@ -195,11 +195,11 @@ class e_pref extends e_front_model
|
||||
public function set($pref_name, $value)
|
||||
{
|
||||
global $pref;
|
||||
if(empty($pref_name))
|
||||
if(empty($pref_name) || !is_string($pref_name))
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
parent::set((string) $pref_name, $value, false);
|
||||
$this->_data[$pref_name] = $value;
|
||||
|
||||
//BC
|
||||
if($this->alias === 'core')
|
||||
@ -220,11 +220,11 @@ class e_pref extends e_front_model
|
||||
public function update($pref_name, $value)
|
||||
{
|
||||
global $pref;
|
||||
if(empty($pref_name))
|
||||
if(empty($pref_name) || !is_string($pref_name))
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
parent::set((string) $pref_name, $value, true);
|
||||
if(isset($this->_data[$pref_name])) $this->_data[$pref_name] = $value;
|
||||
|
||||
//BC
|
||||
if($this->alias === 'core')
|
||||
@ -249,8 +249,13 @@ class e_pref extends e_front_model
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->addData($pref_name, $value);
|
||||
if(!isset($this->_data[$pref_name])) $this->_data[$pref_name] = $value;
|
||||
|
||||
//BC
|
||||
if($this->alias === 'core')
|
||||
{
|
||||
$pref = $this->getData();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -633,7 +638,7 @@ class e_pref extends e_front_model
|
||||
* @param boolean $runtime clear runtime cache as well ($this->pref_cache)
|
||||
* @return e_pref
|
||||
*/
|
||||
protected function clearPrefCache($cache_name = '', $runtime = true)
|
||||
public function clearPrefCache($cache_name = '', $runtime = true)
|
||||
{
|
||||
if($runtime)
|
||||
{
|
||||
|
@ -807,13 +807,20 @@ class xmlClass
|
||||
return array();
|
||||
}
|
||||
|
||||
$mes = eMessage::getInstance();
|
||||
//$mes = eMessage::getInstance();
|
||||
|
||||
$pref = array();
|
||||
foreach($XMLData['prefs'][$prefType] as $val)
|
||||
{
|
||||
$name = $val['@attributes']['name'];
|
||||
$value = (substr($val['@value'],0,7) == "array (") ? e107::getArrayStorage()->ReadArray($val['@value']) : $val['@value'];
|
||||
// if(strpos($val['@value'], 'array (') === 0)
|
||||
// {
|
||||
// echo '<pre>'.$val['@value'];
|
||||
// echo "\n";
|
||||
// var_dump(e107::getArrayStorage()->ReadArray($val['@value']));
|
||||
// echo $val['@value'].'</pre>';
|
||||
// }
|
||||
$value = strpos($val['@value'], 'array (') === 0 ? e107::getArrayStorage()->ReadArray($val['@value']) : $val['@value'];
|
||||
$pref[$name] = $value;
|
||||
|
||||
// $mes->add("Setting up ".$prefType." Pref [".$name."] => ".$value, E_MESSAGE_DEBUG);
|
||||
@ -839,30 +846,30 @@ class xmlClass
|
||||
|
||||
if($debug)
|
||||
{
|
||||
// $message = print_r($xmlArray);
|
||||
// echo "<pre>".print_r($xmlArray,TRUE)."</pre>";
|
||||
//$message = print_r($xmlArray);
|
||||
echo "<pre>".var_export($xmlArray,TRUE)."</pre>";
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
//FIXME - doesn't work from install_.php.
|
||||
|
||||
if(vartrue($xmlArray['prefs'])) // Save Core Prefs
|
||||
{
|
||||
foreach($xmlArray['prefs'] as $type=>$array)
|
||||
{
|
||||
|
||||
$pArray = $this->e107ImportPrefs($xmlArray,$type);
|
||||
|
||||
if($mode == 'replace')
|
||||
|
||||
if($mode == 'replace') // merge with existing, add new
|
||||
{
|
||||
e107::getConfig($type)->setPref($pArray);
|
||||
}
|
||||
else // 'add'
|
||||
else // 'add' only new prefs
|
||||
{
|
||||
foreach ($pArray as $pname => $pval)
|
||||
{
|
||||
e107::getConfig($type)->add($pname, $pval); // don't parse x/y/z
|
||||
}
|
||||
// e107::getConfig($type)->addPref($pArray);
|
||||
}
|
||||
|
||||
if($debug == FALSE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user