aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-10-08 04:38:19 +0000
committerGreg Froese <greg.froese@gmail.com>2009-10-08 04:38:19 +0000
commit24f3f2f0d304254451c46a3b28a8e1f4678bc02f (patch)
treec95dc02130267e6c2d7053faf7546089c1c744b1 /pages
parent6b00bdba17af611726eb950fb51758556694e80f (diff)
downloadelgg-24f3f2f0d304254451c46a3b28a8e1f4678bc02f.tar.gz
elgg-24f3f2f0d304254451c46a3b28a8e1f4678bc02f.tar.bz2
flickr integration
Diffstat (limited to 'pages')
-rw-r--r--pages/flickr/error_log23
-rw-r--r--pages/flickr/importPhotosets.php44
-rw-r--r--pages/flickr/setup.php17
-rw-r--r--pages/lists/flickr.php60
-rw-r--r--pages/lists/mostrecentimages.php4
5 files changed, 147 insertions, 1 deletions
diff --git a/pages/flickr/error_log b/pages/flickr/error_log
new file mode 100644
index 000000000..716344052
--- /dev/null
+++ b/pages/flickr/error_log
@@ -0,0 +1,23 @@
+[06-Oct-2009 10:32:06] PHP Warning: include_once(/home/gfroese/public_html/mod/engine/start.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/gfroese/public_html/mod/tidypics/pages/flickr/setup.php on line 9
+[06-Oct-2009 10:32:06] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '/home/gfroese/public_html/mod/engine/start.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gfroese/public_html/mod/tidypics/pages/flickr/setup.php on line 9
+[06-Oct-2009 10:32:06] PHP Fatal error: Call to undefined function get_loggedin_user() in /home/gfroese/public_html/mod/tidypics/pages/flickr/setup.php on line 11
+[06-Oct-2009 10:40:16] PHP Warning: require_once(/home/gfroese/public_html/mod/lib/phpFlickr/phpFlickr.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php on line 7
+[06-Oct-2009 10:40:16] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/home/gfroese/public_html/mod/lib/phpFlickr/phpFlickr.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php on line 7
+[06-Oct-2009 10:43:29] WARNING: 2009-10-06 10:43:29 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 18)
+[06-Oct-2009 10:44:07] WARNING: 2009-10-06 10:44:07 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 18)
+[06-Oct-2009 10:44:15] WARNING: 2009-10-06 10:44:15 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 18)
+[06-Oct-2009 11:08:35] WARNING: 2009-10-06 11:08:35 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 20)
+[06-Oct-2009 11:08:35] WARNING: 2009-10-06 11:08:35 (PDT): "Cannot modify header information - headers already sent by (output started at /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php:17)" in file /home/gfroese/public_html/mod/theme_simpleneutral/views/default/pageshells/pageshell.php (line 21)
+[06-Oct-2009 23:05:07] WARNING: 2009-10-06 23:05:07 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 20)
+[06-Oct-2009 23:05:08] WARNING: 2009-10-06 23:05:08 (PDT): "Cannot modify header information - headers already sent by (output started at /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php:17)" in file /home/gfroese/public_html/mod/theme_simpleneutral/views/default/pageshells/pageshell.php (line 21)
+[06-Oct-2009 23:05:16] WARNING: 2009-10-06 23:05:16 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 20)
+[06-Oct-2009 23:05:16] WARNING: 2009-10-06 23:05:16 (PDT): "Cannot modify header information - headers already sent by (output started at /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php:17)" in file /home/gfroese/public_html/mod/theme_simpleneutral/views/default/pageshells/pageshell.php (line 21)
+[06-Oct-2009 23:16:00] WARNING: 2009-10-06 23:16:00 (PDT): "Cannot modify header information - headers already sent by (output started at /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php:21)" in file /home/gfroese/public_html/mod/theme_simpleneutral/views/default/pageshells/pageshell.php (line 21)
+[06-Oct-2009 23:16:56] WARNING: 2009-10-06 23:16:56 (PDT): "Invalid argument supplied for foreach()" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 18)
+[06-Oct-2009 23:29:07] WARNING: 2009-10-06 23:29:07 (PDT): "require_once(/home/gfroese/public_html/mod/lib/flickr.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory" in file /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php (line 14)
+[06-Oct-2009 23:29:07] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/home/gfroese/public_html/mod/lib/flickr.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/gfroese/public_html/mod/tidypics/lib/phpFlickr/PEAR') in /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php on line 14
+[06-Oct-2009 23:29:22] PHP Warning: include_once(/home/gfroese/public_html/mod/engine/start.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php on line 8
+[06-Oct-2009 23:29:22] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '/home/gfroese/public_html/mod/engine/start.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php on line 8
+[06-Oct-2009 23:29:22] PHP Fatal error: Call to undefined function elgg_view_title() in /home/gfroese/public_html/mod/tidypics/pages/flickr/importPhotosets.php on line 9
+[06-Oct-2009 23:30:08] WARNING: 2009-10-06 23:30:08 (PDT): "require_once(/home/gfroese/public_html/mod/tidypics/views/lib/flickr.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory" in file /home/gfroese/public_html/mod/tidypics/views/default/tidypics/forms/setupFlickr.php (line 2)
+[06-Oct-2009 23:30:08] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/home/gfroese/public_html/mod/tidypics/views/lib/flickr.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gfroese/public_html/mod/tidypics/views/default/tidypics/forms/setupFlickr.php on line 2
diff --git a/pages/flickr/importPhotosets.php b/pages/flickr/importPhotosets.php
new file mode 100644
index 000000000..c9b4416e4
--- /dev/null
+++ b/pages/flickr/importPhotosets.php
@@ -0,0 +1,44 @@
+<?php
+
+ /**
+ * Import a set of photos from Flickr
+ */
+
+ // Load Elgg engine
+ include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+ $body = elgg_view_title( "Photoset Import Manager" );
+ $body .= "<h2>Click on the set you wish to import into this site. Copies of the photos will be made and stored on this site where they can be viewed and commented on.</h2>";
+
+ $viewer = get_loggedin_user();
+
+ require_once dirname(dirname(dirname(__FILE__))) . "/lib/phpFlickr/phpFlickr.php";
+ require_once( dirname(dirname(dirname(__FILE__)))) . "/lib/flickr.php";
+ $f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
+
+ $viewer = get_loggedin_user();
+ $flickr_username = get_metadata_byname( $viewer->guid, "flickr_username" );
+ $flickr_id = get_metadata_byname( $viewer->guid, "flickr_id" );
+
+ $photosets = $f->photosets_getList( $flickr_id->value );
+ foreach( $photosets["photoset"] as $photoset ) {
+ $body .= "<div class='tidypics_album_images'>";
+ $body .= "$photoset[title]<br />";
+
+ $count = 0;
+ $looper = 0;
+ //create links to import photos 10 at a time
+ while( $photoset["photos"] > $count ) {
+ $looper++;
+ $body .= " <a href='/mod/tidypics/actions/flickrImportPhotoset.php?set_id=$photoset[id]&page=$looper'>$looper</a>";
+ $count = $count + 10;
+ }
+ $body .= "<br />$photoset[photos] images";
+ $body .= "</div>";
+// echo "<pre>"; var_dump( $photoset ); echo "</pre>"; die;
+ }
+
+// $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true );
+ flickr_menu();
+ page_draw( "Photoset Import", elgg_view_layout("two_column_left_sidebar", '', $body));
+
+?> \ No newline at end of file
diff --git a/pages/flickr/setup.php b/pages/flickr/setup.php
new file mode 100644
index 000000000..a2aa20db6
--- /dev/null
+++ b/pages/flickr/setup.php
@@ -0,0 +1,17 @@
+<?php
+
+ /**
+ * Setup a users Flickr username
+ *
+ */
+
+ // Load Elgg engine
+ include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+
+ $viewer = get_loggedin_user();
+
+ $body = elgg_view_title( "Setup Flickr" );
+ $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true );
+// echo "<pre>"; var_dump($body); echo "</pre>";
+ page_draw( "Setup Flickr", elgg_view_layout("two_column_left_sidebar", '', $body));
+?> \ No newline at end of file
diff --git a/pages/lists/flickr.php b/pages/lists/flickr.php
new file mode 100644
index 000000000..b9886042b
--- /dev/null
+++ b/pages/lists/flickr.php
@@ -0,0 +1,60 @@
+<?php
+require_once dirname(dirname(dirname(__FILE__))) . "/lib/phpFlickr/phpFlickr.php";
+$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
+
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+$username = get_input('username');
+if( !empty( $username )) {
+ $temp_user = get_user_by_username( $username );
+} else {
+ $temp_user = get_loggedin_user();
+}
+$flickr_username = get_metadata_byname( $temp_user->guid, "flickr_username" );
+if( empty( $flickr_username )) {
+ register_error( "No Flickr username set");
+ echo "<pre>No flickr username set: $temp_user->guid"; die;
+ forward( "/" );
+ die;
+}
+$flickr_user = $f->people_findByUsername( $flickr_username->value );
+
+// Get the friendly URL of the user's photos
+$photos_url = $f->urls_getUserPhotos( $flickr_user["id"] );
+
+if( !empty( $flickr_user )) {
+ $recent = $f->people_getPublicPhotos( $flickr_user['id'], NULL, NULL, 5 );
+} else {
+ echo "user not found"; die;
+}
+//echo "<pre>"; var_dump( $recent ); echo "</pre>";
+
+//echo "<pre>"; var_dump( $user ); echo "</pre>";
+$body = elgg_view_title( "Flickr photos for $flickr_user[username]" );
+
+$count = 0;
+foreach ($recent['photos']['photo'] as $photo) {
+
+ $photo_info = $f->photos_getInfo( $photo["id"], $photo["secret"] );
+ $body .= "<div class='tidypics_album_images'>";
+ $body .= "$photo_info[title]<br />Views: $photo_info[views]<br />";
+ $body .= "<a href=$photos_url$photo[id]>";
+ $body .= "<img border='0' alt='$photo[title]' ".
+ "src=" . $f->buildPhotoURL($photo, "Square") . ">";
+ $body .= "</a>";
+
+ $tag_count = 0;
+ $body .= "<br /><div style='font-size: 8px;'>Tags:<br />";
+ foreach( $photo_info["tags"]["tag"] as $tag ) {
+ if( $tag_count ) $body .= ", ";
+ $body .= "$tag[_content]";
+ $tag_count++;
+ }
+
+ $body .= "</div></div>";
+ $count++;
+}
+page_draw( "Flickr photos for $flickr_user[username]", elgg_view_layout("two_column_left_sidebar", '', $body));
+
+?> \ No newline at end of file
diff --git a/pages/lists/mostrecentimages.php b/pages/lists/mostrecentimages.php
index 32320a5d2..615b05340 100644
--- a/pages/lists/mostrecentimages.php
+++ b/pages/lists/mostrecentimages.php
@@ -31,12 +31,14 @@
// grab the html to display the images
$images = tp_list_entities("object", "image", $user_id, $max, false, false, true);
+// echo "<pre>"; var_dump( $images ); echo "</pre>";
$images .= '<div class="clearfloat"/>'; // hack until elgg fixes problem with css/list entities html
// this view takes care of the title on the main column and the content wrapper
$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,));
-
+ if( empty( $area2 )) $area2 = $images;
+
$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
page_draw($title, $body);