(GPLv2) or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA. ********************************************************************************/ if (stristr(htmlentities($_SERVER['PHP_SELF']), "inc_hooks.php")) { die("
Error: This file cannot be opened directly!
"); } //=========================================== //HOOK SYSTEM //=========================================== if (!isset($memHooks)) { $memHooks = array(); function memReadHooks() { global $memHooks; $proceed = true; if (@file_exists("hooks/")) { $path = "hooks/"; } else if (@file_exists("../hooks/")) { $path = "../hooks/"; } else if (@file_exists("../../hooks/")) { $path = "../../hooks/"; } else if (@file_exists("../../../hooks/")) { $path = "../../../hooks/"; } else if (@file_exists("../../../../hooks/")) { $path = "../../../../hooks/"; } else { $proceed = false; } if ($proceed) { $handle = opendir($path); while (false !== ($file = readdir($handle))) { if (eregi(".hook.php",$file)) { include($path.$file); } } closedir($handle); } } function memRunHooks($event,$arguments=array()) { global $memHooks; if (isset($memHooks[$event])) { foreach ($memHooks[$event] as $hook) { if (function_exists($hook)) { if ($hook($arguments)===false) { return false; } } } } return true; } memReadHooks(); } ?>