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);
 }
Esempio n. 3
0
if ($dir = @dir(DIR_FS_CATALOG_ADDON_MODULES)) {
    while ($file = $dir->read()) {
        if (is_dir(DIR_FS_CATALOG_ADDON_MODULES . $file) && strtoupper($file) != 'CVS' && preg_match('/^[^\\.]/', $file)) {
            $directory_array[] = $file;
        }
    }
    sort($directory_array);
    $dir->close();
}
$installed_modules = array();
$cfgs = array();
$exists = false;
for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
    $file = $directory_array[$i];
    $class = $file;
    zen_addOnModules_load_module_files($class);
    if (zen_class_exists($class)) {
        $module = new $class();
        if ($module->check() > 0) {
            if ($module->sort_order > 0 && !isset($installed_modules[$module->sort_order])) {
                $installed_modules[$module->sort_order] = $file;
            } else {
                $installed_modules[] = $file;
            }
        }
        $module_keys = $module->keys();
        $keys = array();
        for ($j = 0, $k = sizeof($module_keys); $j < $k; $j++) {
            $keys[] = '\'' . zen_db_input($module_keys[$j]) . '\'';
        }
        $sql = 'SELECT configuration_title as cfg_title, configuration_key as cfg_key, configuration_value as cfg_value, configuration_description as cfg_desc, m17n_configuration_key as m17n_cfg_key FROM ' . TABLE_CONFIGURATION . ' AS c LEFT JOIN ' . TABLE_M17N_CONFIGURATION_KEYS . ' AS m ON c.configuration_key=m.m17n_configuration_key WHERE configuration_key IN (' . implode(',', $keys) . ') ORDER BY configuration_id';
 function dependModules()
 {
     global $messageStack;
     $module_directory = DIR_FS_CATALOG_ADDON_MODULES;
     $module_key = 'ADDON_MODULE_INSTALLED';
     eval('$module_installed = ' . $module_key . ';');
     if (defined($module_key) && zen_not_null($module_installed)) {
         $modules = explode(';', $module_installed);
         reset($modules);
         while (list(, $value) = each($modules)) {
             $module = null;
             $class = $value;
             if (!is_object($GLOBALS[$class])) {
                 zen_addOnModules_load_module_files($module_directory, $class);
                 $GLOBALS[$class] = new $class();
             }
             $require_modules = $GLOBALS[$class]->require_modules;
             for ($i = 0, $n = count($require_modules); $i < $n; $i++) {
                 if ($require_modules[$i] == $this->code) {
                     $error = true;
                     $messageStack->add_session(sprintf(WARNING_DEPEND_MODULE, $class), 'warning');
                 }
             }
         }
     }
     return $error;
 }