diff --git a/classes/api.php b/classes/api.php index 88e964b7c..18743d56d 100755 --- a/classes/api.php +++ b/classes/api.php @@ -74,7 +74,12 @@ class API extends Handler { if ($uid = UserHelper::find_user_by_login($login)) { if (get_pref(Prefs::ENABLE_API_ACCESS, $uid)) { if (UserHelper::authenticate($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { + + // needed for _get_config() + UserHelper::load_user_plugins($_SESSION['uid']); + $this->_wrap(self::STATUS_OK, array("session_id" => session_id(), + "config" => $this->_get_config(), "api_level" => self::API_LEVEL)); } else { $this->_wrap(self::STATUS_ERR, array("error" => self::E_LOGIN_ERROR)); @@ -370,7 +375,7 @@ class API extends Handler { } } - function getConfig() { + private function _get_config() { $config = [ "icons_dir" => Config::get(Config::ICONS_DIR), "icons_url" => Config::get(Config::ICONS_URL) @@ -383,6 +388,12 @@ class API extends Handler { ->where('owner_uid', $_SESSION['uid']) ->count(); + return $config; + } + + function getConfig() { + $config = $this->_get_config(); + $this->_wrap(self::STATUS_OK, $config); }