X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Finst_module.php;h=6c974ddb4bda02234902550237a7e75365b122e1;hb=da7df35c61205d0b1af47d286be591b8a3194b0c;hp=eda65097e50426d5cfb4337ffc908d2772792a1d;hpb=5e63c6ace55729bbb5ee3b060035a25a4426eb0a;p=fa-stable.git diff --git a/admin/inst_module.php b/admin/inst_module.php index eda65097..6c974ddb 100644 --- a/admin/inst_module.php +++ b/admin/inst_module.php @@ -17,7 +17,7 @@ include_once($path_to_root."/includes/packages.inc"); if ($SysPrefs->use_popup_windows) { $js = get_js_open_window(900, 500); } -page(_($help_context = "Install/Activate extensions")); +page(_($help_context = "Install/Activate extensions"), false, false, "", $js); include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/admin/db/company_db.inc"); @@ -42,8 +42,18 @@ function local_extension($id) 'active' => false ); - if (file_exists($path_to_root.'/modules/'.clean_file_name($id).'/hooks.php')) { - include_once($path_to_root.'/modules/'.clean_file_name($id).'/hooks.php'); + $local_module_path = $path_to_root.'/modules/'.clean_file_name($id); + $local_config_file = $local_module_path.'/_init/config'; + $local_hook_file = $local_module_path.'/hooks.php'; + + if (file_exists($local_config_file)) { + $ctrl = get_control_file($local_config_file); + if (key_exists('Name', $ctrl)) $exts[$next_extension_id-1]['name'] = $ctrl['Name']; + if (key_exists('Version', $ctrl)) $exts[$next_extension_id-1]['version'] = $ctrl['Version']; + } + if (file_exists($local_hook_file)) { + include_once($local_hook_file); + } $hooks_class = 'hooks_'.$id; if (class_exists($hooks_class, false)) { @@ -94,7 +104,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 +116,6 @@ function display_extensions() table_header($th); $k = 0; - $mods = get_extensions_list('extension'); foreach($mods as $pkg_name => $ext) { @@ -124,7 +133,7 @@ function display_extensions() label_cell($entries); label_cell($id === null ? _("None") : - ($available && $installed ? $installed : _("Unknown"))); + (($installed && ($installed != '-' || $installed != '')) ? $installed : _("Unknown"))); label_cell($available ? $available : _("Unknown")); if (!$available && $ext['type'] == 'extension') {// third-party plugin @@ -211,12 +220,16 @@ if (get_post('Refresh')) { $result = true; foreach($exts as $i => $ext) { - if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) { - 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); + 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; + } + $activated = activate_hooks($ext['package'], $comp, !$ext['active']); // change active state + if ($activated !== null) $result &= $activated; if ($activated || ($activated === null)) @@ -258,8 +271,13 @@ echo extset_list('extset', null, true); echo "
"; 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); //---------------------------------------------------------------------------------------------