X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fhooks.inc;h=6f15d0b0b7138c7a8f3542b89d4e55144fab7bec;hb=61fb69cf679671e44d7aaa10fab553c059e6f62e;hp=ab2d2bdc6af5b1cb00f193e5fb1158c603f6c6b8;hpb=cb7da60bef5f27507540f827e4a03ede8d08f684;p=fa-stable.git diff --git a/includes/hooks.inc b/includes/hooks.inc index ab2d2bdc..6f15d0b0 100644 --- a/includes/hooks.inc +++ b/includes/hooks.inc @@ -225,9 +225,10 @@ function install_hooks() $Hooks = array(); // include current language related $Hooks object if locale file exists - if (file_exists($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc")) + $lang_code = clean_file_name($_SESSION['language']->code); + if (file_exists($path_to_root . "/lang/" . $lang_code . "/locale.inc")) { - include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc"); + include_once($path_to_root . "/lang/" . $lang_code . "/locale.inc"); $code = $_SESSION['language']->code; $hook_class = 'hooks_'.$code; $Hooks[$code] = new $hook_class; @@ -245,7 +246,7 @@ function install_hooks() Non active hooks are not included in $Hooks array, so we can use special function to activate. */ -function activate_hooks($ext, $comp) +function activate_hooks($ext, $comp, $on=true) { global $Hooks; @@ -259,8 +260,10 @@ function activate_hooks($ext, $comp) } if (!$hooks) return false; - else + elseif ($on) return $hooks->activate_extension($comp, false); + else + return $hooks->deactivate_extension($comp, false); } /* Calls hook $method defined in extension $ext (if any)