From: dongsheng Date: Sat, 30 Aug 2008 16:48:11 +0000 (+0000) Subject: MDL-13766, trim api_key X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=70d91d90aba5b1cd34502d7800727d6bc12c59dd;p=moodle.git MDL-13766, trim api_key --- diff --git a/repository/boxnet/repository.class.php b/repository/boxnet/repository.class.php index ab38a52972..e898e6ca2f 100755 --- a/repository/boxnet/repository.class.php +++ b/repository/boxnet/repository.class.php @@ -15,7 +15,7 @@ class repository_boxnet extends repository{ public function set_option($options = array()){ if (!empty($options['api_key'])) { - set_config('api_key', $options['api_key'], 'boxnet'); + set_config('api_key', trim($options['api_key']), 'boxnet'); } unset($options['api_key']); $ret = parent::set_option($options); @@ -24,9 +24,9 @@ class repository_boxnet extends repository{ public function get_option($config = ''){ if($config==='api_key'){ - return get_config('boxnet', 'api_key'); + return trim(get_config('boxnet', 'api_key')); } else { - $options['api_key'] = get_config('boxnet', 'api_key'); + $options['api_key'] = trim(get_config('boxnet', 'api_key')); } $options = parent::get_option($config); return $options; diff --git a/repository/flickr/repository.class.php b/repository/flickr/repository.class.php index 58a1f0bfd7..948c662f32 100755 --- a/repository/flickr/repository.class.php +++ b/repository/flickr/repository.class.php @@ -16,7 +16,7 @@ class repository_flickr extends repository{ public function set_option($options = array()){ if (!empty($options['api_key'])) { - set_config('api_key', $options['api_key'], 'flickr'); + set_config('api_key', trim($options['api_key']), 'flickr'); } unset($options['api_key']); $ret = parent::set_option($options); @@ -25,9 +25,9 @@ class repository_flickr extends repository{ public function get_option($config = ''){ if($config==='api_key'){ - return get_config('flickr', 'api_key'); + return trim(get_config('flickr', 'api_key')); } else { - $options['api_key'] = get_config('flickr', 'api_key'); + $options['api_key'] = trim(get_config('flickr', 'api_key')); } $options = parent::get_option($config); return $options;