function zen_addOnModules_load_boxes_dhtml(&$za_contents, $boxes_dhtml)
{
    $enabled_addon_modules = zen_addOnModules_get_installed_modules();
    for ($i = 0, $n = count($enabled_addon_modules); $i < $n; $i++) {
        $class = $enabled_addon_modules[$i];
        $module_directory = DIR_FS_CATALOG_ADDON_MODULES . $class . '/';
        if (file_exists($module_directory . $boxes_dhtml)) {
            require $module_directory . $boxes_dhtml;
        }
    }
}
function zen_addOnModules_get_enabled_modules()
{
    $enabled_addon_modules = array();
    $installed_addon_modules = zen_addOnModules_get_installed_modules();
    for ($i = 0, $n = count($installed_addon_modules); $i < $n; $i++) {
        $class = $installed_addon_modules[$i];
        if (!is_object($GLOBALS[$class])) {
            zen_addOnModules_load_module_files($class);
            if (class_exists($class)) {
                $GLOBALS[$class] = new $class();
            }
        }
        if ($GLOBALS[$class]->enabled) {
            $enabled_addon_modules[] = $installed_addon_modules[$i];
        }
    }
    return $enabled_addon_modules;
}
 function addOnModulesObserver()
 {
     global $zco_notifier;
     $notify_event_id = array();
     $this->modules = zen_addOnModules_get_installed_modules();
     for ($i = 0, $n = count($this->modules); $i < $n; $i++) {
         $class = $this->modules[$i];
         if (!is_object($GLOBALS[$class])) {
             zen_addOnModules_load_module_files($class);
             if (class_exists($class)) {
                 $GLOBALS[$class] = new $class();
             }
         }
         if ($GLOBALS[$class]->enabled) {
             $notify_event_id = array_merge($notify_event_id, $GLOBALS[$class]->attachEvent());
         }
     }
     $notify_event_id = array_unique($notify_event_id);
     $notify_event_id = array_merge($notify_event_id);
     $zco_notifier->attach($this, $notify_event_id);
 }
 function remove()
 {
     global $db, $messageStack;
     if ($this->_dependModules()) {
         $messageStack->add_session(sprintf(ERROE_MODULE_REMOVE_FAILED, $this->code), 'error');
         zen_redirect(zen_href_link(FILENAME_ADDON_MODULES, 'module=' . $this->code, 'NONSSL'));
         exit;
     }
     if ($this->code == 'addon_modules') {
         $installed_modules = zen_addOnModules_get_installed_modules();
         if (($index = array_search('addon_modules', $installed_modules)) !== false) {
             unset($installed_modules[$index]);
         }
         if (count($installed_modules) > 0) {
             $messageStack->add_session(sprintf(WARNING_CANNOT_REMOVE_CORE_MODULE), 'warning');
             $messageStack->add_session(sprintf(ERROE_MODULE_REMOVE_FAILED, $this->code), 'error');
             zen_redirect(zen_href_link(FILENAME_ADDON_MODULES, 'module=' . $this->code, 'NONSSL'));
             exit;
         }
     }
     // delete configurations
     $db->Execute("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key IN ('" . implode("', '", $this->keys()) . "');");
     // delete layout data
     $db->Execute("DELETE FROM " . TABLE_BLOCKS . " WHERE module = '" . $this->code . "';");
     $this->_remove();
 }
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//  $Id: addon_modules_admin.php $
//
require 'includes/application_top.php';
$perse_admin_module = zen_addOnModules_perseAdminModule($_GET['module']);
$admin_class = $perse_admin_module['class'];
$admin_page = $perse_admin_module['page'];
// check module admin page enable
$enable_admin_page = false;
$enabled_modules = zen_addOnModules_get_installed_modules();
if (in_array($admin_class, $enabled_modules)) {
    $admin_module = $GLOBALS[$admin_class];
    $admin_page_file = DIR_FS_CATALOG . $admin_module->dir . $admin_page . '.php';
    $admin_page_language_file = DIR_FS_CATALOG . $admin_module->dir . 'languages/' . $_SESSION['language'] . '/' . $admin_page . '.php';
    if (file_exists($admin_page_file)) {
        $enable_admin_page = true;
    }
}
if ($enable_admin_page) {
    if (file_exists($admin_page_language_file)) {
        require $admin_page_language_file;
    }
    require $admin_page_file;
}
require DIR_WS_INCLUDES . 'application_bottom.php';