mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Updated admin events handling. Now ensures each 'action' function is only called once, to prevent infinite recurssion.
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/event_class.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/event_class.php,v $
|
||||||
| $Revision: 1.3 $
|
| $Revision: 1.4 $
|
||||||
| $Date: 2008-12-03 00:48:19 $
|
| $Date: 2008-12-03 17:21:15 $
|
||||||
| $Author: mcfly_e107 $
|
| $Author: mcfly_e107 $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -70,6 +70,8 @@ class e107_event
|
|||||||
}
|
}
|
||||||
if(isset($pref['e_admin_events_list']) && is_array($pref['e_admin_events_list']))
|
if(isset($pref['e_admin_events_list']) && is_array($pref['e_admin_events_list']))
|
||||||
{
|
{
|
||||||
|
$called = getcachedvars('admin_events_called');
|
||||||
|
if(!is_array($called)) { $called = array(); }
|
||||||
foreach($pref['e_admin_events_list'] as $plugin)
|
foreach($pref['e_admin_events_list'] as $plugin)
|
||||||
{
|
{
|
||||||
if(plugInstalled($plugin))
|
if(plugInstalled($plugin))
|
||||||
@@ -78,14 +80,17 @@ class e107_event
|
|||||||
if(!function_exists($func))
|
if(!function_exists($func))
|
||||||
{
|
{
|
||||||
$fname = e_PLUGIN.$plugin.'/e_admin_events.php';
|
$fname = e_PLUGIN.$plugin.'/e_admin_events.php';
|
||||||
if(is_readable($fname))
|
if(is_readable($fname)) { include_once($fname); }
|
||||||
{
|
|
||||||
include_once($fname);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(function_exists($func))
|
if(function_exists($func))
|
||||||
{
|
{
|
||||||
call_user_func($func, $type, $parms);
|
$event_func = call_user_func($func, $type, $parms);
|
||||||
|
if ($event_func && function_exists($event_func) && !in_array($event_func, $called))
|
||||||
|
{
|
||||||
|
$called[] = $event_func;
|
||||||
|
cachevars('admin_events_called', $called);
|
||||||
|
call_user_func($event_func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
*
|
||||||
|
* Check for admin events being triggered
|
||||||
|
*
|
||||||
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/e_admin_events.php,v $
|
||||||
|
* $Revision: 1.2 $
|
||||||
|
* $Date: 2008-12-03 17:21:15 $
|
||||||
|
* $Author: mcfly_e107 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
function plugin_forum_admin_events($type, $parms)
|
function plugin_forum_admin_events($type, $parms)
|
||||||
{
|
{
|
||||||
echo "type = $type <br />";
|
//We currently only care about system cache, so just return if it's not
|
||||||
var_dump($parms);
|
if(!isset($parms['syscache']) || !$parms['syscache']) { return ''; }
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'cache_clear':
|
||||||
|
$which = varset($parms['cachetag']);
|
||||||
|
if('nomd5_classtree' == $which)
|
||||||
|
{
|
||||||
|
return 'plugin_forum_admin_events_clear_moderators';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Called if classtree cache is cleared. Meaning we'll need to rebuild moderator cache
|
||||||
|
function plugin_forum_admin_events_clear_moderators()
|
||||||
|
{
|
||||||
|
$e107 = e107::getInstance();
|
||||||
|
$e107->ecache->clear_sys('nomd5_forum_moderators');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user