mirror of
https://github.com/e107inc/e107.git
synced 2025-07-27 01:40:22 +02:00
Prevent core pref corruption by old plugins that are using save_prefs();
This commit is contained in:
21
class2.php
21
class2.php
@@ -1717,10 +1717,31 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
|||||||
e107::getMessage()->addDebug('Deprecated save_prefs() backtrace:<pre>'."\n".print_r($backtrace, true).'</pre>');
|
e107::getMessage()->addDebug('Deprecated save_prefs() backtrace:<pre>'."\n".print_r($backtrace, true).'</pre>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch($table)
|
switch($table)
|
||||||
{
|
{
|
||||||
case 'core':
|
case 'core':
|
||||||
//brute load, force update
|
//brute load, force update
|
||||||
|
|
||||||
|
if(count($pref) < 100) // precaution for old plugins
|
||||||
|
{
|
||||||
|
$backtrace = debug_backtrace(false);
|
||||||
|
|
||||||
|
e107::getAdminLog()->add(
|
||||||
|
'Core pref corruption avoided',
|
||||||
|
"Call to deprecated function save_prefs() (class2.php) with too few prefs. Backtrace:\n".print_r($backtrace, true),
|
||||||
|
E_LOG_INFORMATIVE,
|
||||||
|
'DEPRECATED'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
e107::getMessage()->addDebug('Core-pref corruption avoided. Too few prefs sent to save_prefs(). Backtrace:<pre>'."\n".print_r($backtrace, true).'</pre>');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return e107::getConfig()->loadData($pref, false)->save(false, true);
|
return e107::getConfig()->loadData($pref, false)->save(false, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -451,6 +451,8 @@ class e_menu
|
|||||||
public function renderMenu($mpath, $mname='', $parm = '', $return = false)
|
public function renderMenu($mpath, $mname='', $parm = '', $return = false)
|
||||||
{
|
{
|
||||||
// global $sql; // required at the moment.
|
// global $sql; // required at the moment.
|
||||||
|
|
||||||
|
|
||||||
global $sc_style, $e107_debug;
|
global $sc_style, $e107_debug;
|
||||||
|
|
||||||
|
|
||||||
@@ -540,7 +542,8 @@ class e_menu
|
|||||||
$id = e107::getForm()->name2id($mpath . $mname);
|
$id = e107::getForm()->name2id($mpath . $mname);
|
||||||
$ns->setUniqueId($id);
|
$ns->setUniqueId($id);
|
||||||
|
|
||||||
global $pref; // possibly used by plugin menu.
|
|
||||||
|
$pref = e107::getPref(); // possibly used by plugin menu.
|
||||||
|
|
||||||
|
|
||||||
$e107_debug ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
|
$e107_debug ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
|
||||||
|
Reference in New Issue
Block a user