diff --git a/aes.install b/aes.install index 9506413..2eaa2cb 100755 --- a/aes.install +++ b/aes.install @@ -32,8 +32,12 @@ function aes_requirements($phase) { } function aes_get_available_aes_implementations() { - - $phpsec_include_path = dirname(__FILE__)."/phpseclib"; + if (module_exists('libraries')) { + $phpsec_include_path = libraries_get_path('phpseclib'); + } + else { + $phpsec_include_path = dirname(__FILE__)."/phpseclib"; + } set_include_path(get_include_path() . PATH_SEPARATOR . $phpsec_include_path); $phpsec_available = true; if (file_exists($phpsec_include_path.'/Crypt/AES.php') === false) { diff --git a/aes.module b/aes.module index 49bdd1e..179ebb1 100755 --- a/aes.module +++ b/aes.module @@ -50,7 +50,12 @@ function aes_permission() { function aes_load_phpsec() { //find out where this module is located and set up an include path for the phpsec library - $phpsec_include_path = dirname(__FILE__)."/phpseclib"; + if (module_exists('libraries')) { + $phpsec_include_path = libraries_get_path('phpseclib'); + } + else { + $phpsec_include_path = dirname(__FILE__)."/phpseclib"; + } //include phpsec AES lib if (file_exists($phpsec_include_path.'/Crypt/AES.php') === false) {