Temporary fixes for php encoding library bugs ending with segfault.
[fa-stable.git] / admin / inst_module.php
index 50d2e3e7184b8a6f37d5149f5d9938653355ed3e..2309292bef911ddfda922060b78dfa1900e74010 100644 (file)
@@ -94,7 +94,7 @@ function fmt_titles($defs)
 //
 // Display list of all extensions - installed and available from repository
 //
-function display_extensions()
+function display_extensions($mods)
 {
        global $installed_extensions;
        
@@ -106,7 +106,6 @@ function display_extensions()
        table_header($th);
 
        $k = 0;
-       $mods = get_extensions_list('extension');
 
        foreach($mods as $pkg_name => $ext)
        {
@@ -211,18 +210,16 @@ if (get_post('Refresh')) {
 
        $result = true;
        foreach($exts as $i => $ext) {
-               if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) {
+               if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) 
+               {
                        if (check_value('Active'.$i) && !check_src_ext_version($ext['version']))
                        {
                                display_warning(sprintf(_("Package '%s' is incompatible with current application version and cannot be activated.\n")
                                        . _("Check Install/Activate page for newer package version."), $ext['name']));
                                continue;
                        }
-                       if (!$ext['active'])
-                               $activated = activate_hooks($ext['package'], $comp);
-                       else
-                               $activated = hook_invoke($ext['package'], check_value('Active'.$i) ?
-                                'activate_extension':'deactivate_extension', $comp, false);
+                       $activated = activate_hooks($ext['package'], $comp, !$ext['active']);   // change active state
+
                        if ($activated !== null)
                                $result &= $activated;
                        if ($activated || ($activated === null))
@@ -264,8 +261,13 @@ echo extset_list('extset', null, true);
 echo "</center><br>";
 
 if ($set == -1) 
-       display_extensions();
-else 
+{
+       $mods = get_extensions_list('extension');
+       if (!$mods)
+               display_note(_("No optional extension module is currently available."));
+       else
+               display_extensions($mods);
+} else 
        company_extensions($set);
 
 //---------------------------------------------------------------------------------------------