Merge branch 'MDL-69006-master' of git://github.com/bmbrands/moodle

This commit is contained in:
Andrew Nicols 2020-06-11 12:59:26 +08:00
commit 01f6be2cff
2 changed files with 9 additions and 1 deletions

View File

@ -60,12 +60,16 @@ class flickr_client extends oauth_helper {
* @param moodle_url|string $callbackurl
*/
public function __construct($consumerkey, $consumersecret, $callbackurl = '') {
global $CFG;
$version = moodle_major_version();
$useragent = "MoodleSite/$version (+{$CFG->wwwroot})";
parent::__construct([
'api_root' => self::OAUTH_ROOT,
'oauth_consumer_key' => $consumerkey,
'oauth_consumer_secret' => $consumersecret,
'oauth_callback' => $callbackurl,
'http_options' => ['CURLOPT_USERAGENT' => $useragent]
]);
}

View File

@ -108,7 +108,11 @@ class oauth_helper {
$this->access_token_secret = $args['access_token_secret'];
}
$this->http = new curl(array('debug'=>false));
$this->http_options = array();
if (!empty($args['http_options'])) {
$this->http_options = $args['http_options'];
} else {
$this->http_options = array();
}
}
/**