aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-10-09 03:23:52 +0000
committerGreg Froese <greg.froese@gmail.com>2009-10-09 03:23:52 +0000
commit71b4d8c3c3343455552a76756e5aaacd82034c4e (patch)
tree6fa9ed22a82a1815d63412bbab236283ed1bac62 /actions
parent9aa79bc38829f164bacc6b522278d0098b597933 (diff)
downloadelgg-71b4d8c3c3343455552a76756e5aaacd82034c4e.tar.gz
elgg-71b4d8c3c3343455552a76756e5aaacd82034c4e.tar.bz2
flickr integration updates
Diffstat (limited to 'actions')
-rw-r--r--actions/flickrImportPhotoset.php9
-rw-r--r--actions/flickrSetup.php6
2 files changed, 8 insertions, 7 deletions
diff --git a/actions/flickrImportPhotoset.php b/actions/flickrImportPhotoset.php
index 315d1009d..d28ea8564 100644
--- a/actions/flickrImportPhotoset.php
+++ b/actions/flickrImportPhotoset.php
@@ -11,6 +11,7 @@ require_once dirname(dirname(__FILE__)) . "/lib/phpFlickr/phpFlickr.php";
$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
$set_id = get_input( "set_id" );
+$album_id = get_input( "album_id" );
$page_pp = get_input( "page" );
$return_url = get_input( "return_url" );
$user = get_loggedin_user();
@@ -25,9 +26,6 @@ if( empty( $flickr_id )) {
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos( $flickr_id->value );
$photos = $f->photosets_getPhotos( $set_id, null, null, 10, $page_pp );
-/* TODO:
-* 1. create album if a matching one doesn't exist
-*/
$photos_to_upload = array();
foreach( $photos["photoset"]["photo"] as $photo ) {
@@ -76,10 +74,7 @@ gatekeeper();
// Get common variables
$access_id = (int) get_input("access_id");
$container_guid = (int) get_input('container_guid', 0);
-$container_guid = 990; //force it to my test album for now
-
-if (!$container_guid)
- $container_guid == $_SESSION['user']->getGUID();
+$container_guid = intval ($album_id);
$album = get_entity($container_guid);
diff --git a/actions/flickrSetup.php b/actions/flickrSetup.php
index e272ee141..2a1f82315 100644
--- a/actions/flickrSetup.php
+++ b/actions/flickrSetup.php
@@ -6,6 +6,7 @@ require_once dirname(dirname(__FILE__)) . "/lib/phpFlickr/phpFlickr.php";
$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
$flickr_username = get_input( "flickr_username" );
+$album_id = get_input( "album_id" );
$return_url = get_input( "return_url" );
$user = get_loggedin_user();
@@ -18,9 +19,14 @@ if( empty( $flickr_username )) {
if( !empty( $flickr_user["id"] )) {
create_metadata( $user->guid, "flickr_username", $flickr_username, "text", $user->guid, ACCESS_PUBLIC );
create_metadata( $user->guid, "flickr_id", $flickr_user["id"], "text", $user->guid, ACCESS_PUBLIC );
+ if( $album_id ) {
+ create_metadata( $user->guid, "flickr_album_id", $album_id, "text", $user->guid, ACCESS_PUBLIC );
+ $album = get_entity( $album_id );
+ }
system_message( "Successfully saved Flickr username of $flickr_username" );
system_message( "flickr user id: $flickr_user[id]" );
+ system_message( "Album saved - $album->title" );
} else {
register_error( "Username $flickr_username not found on Flickr" );
}