MDL-42605 portfolio_flickr: Photos can be added to a set on export

This commit is contained in:
Frederic Massart
2013-10-31 10:32:49 +08:00
parent 1cf4616825
commit e957693eab
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -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;
}
}