Merge branch 'MDL-42605-25' of git://github.com/FMCorz/moodle into MOODLE_25_STABLE
This commit is contained in:
+12
-1
@@ -1113,7 +1113,9 @@ class phpFlickr {
|
||||
$args['content_type'] = isset($meta['content_type']) ? $meta['content_type'] : 1; // photo by default
|
||||
$args['hidden'] = isset($meta['hidden']) ? $meta['hidden'] : 2; // hide from public searches by default
|
||||
|
||||
$args['async'] = 1;
|
||||
// Do not enable the asynchronous more because then the query does not return a photo ID,
|
||||
// and we need a photo ID to add the photo to a set later on.
|
||||
// $args['async'] = 1;
|
||||
$args['api_key'] = $this->api_key;
|
||||
|
||||
if (!empty($this->email)) {
|
||||
@@ -1144,8 +1146,17 @@ class phpFlickr {
|
||||
$args['photo'] = $photo; // $this->curl will process it correctly
|
||||
|
||||
if ($response = $this->curl->post($this->Upload, $args)) {
|
||||
$xml = simplexml_load_string($response);
|
||||
if ($xml['stat'] == 'fail') {
|
||||
$this->parsed_response = array('stat' => (string) $xml['stat'], 'code' => (int) $xml->err['code'],
|
||||
'message' => (string) $xml->err['msg']);
|
||||
} elseif ($xml['stat'] == 'ok') {
|
||||
$this->parsed_response = array('stat' => (string) $xml['stat'], 'photoid' => (int) $xml->photoid);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
$this->parsed_response = array('stat' => 'fail', 'code' => $this->curl->get_errno(),
|
||||
'message' => $this->curl->error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class portfolio_plugin_flickr extends portfolio_plugin_push_base {
|
||||
'hidden' => $this->get_export_config('hidden')));
|
||||
if ($return) {
|
||||
// Attach photo to a set if requested
|
||||
if ($this->get_export_config('set')) {
|
||||
if ($this->get_export_config('set') && !empty($this->flickr->parsed_response['photoid'])) {
|
||||
$this->flickr->photosets_addPhoto($this->get_export_config('set'),
|
||||
$this->flickr->parsed_response['photoid']);
|
||||
}
|
||||
@@ -188,10 +188,12 @@ class portfolio_plugin_flickr extends portfolio_plugin_push_base {
|
||||
|
||||
$mform->setDefaults(array('plugin_is_public' => true));
|
||||
|
||||
$sets = $this->get_sets();
|
||||
|
||||
if (!empty($sets)) {
|
||||
$sets[0] = '----';
|
||||
$rawsets = $this->get_sets();
|
||||
if (!empty($rawsets)) {
|
||||
$sets = array('0' => '----');
|
||||
foreach ($rawsets as $key => $value) {
|
||||
$sets[$key] = $value;
|
||||
}
|
||||
$mform->addElement('select', 'plugin_set', get_string('set', 'portfolio_flickr'), $sets);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user