aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--friends.php39
-rw-r--r--languages/en.php2
-rw-r--r--pages/edit.php (renamed from edit.php)5
-rw-r--r--pages/friends.php38
-rw-r--r--pages/newalbum.php (renamed from newalbum.php)4
-rw-r--r--pages/ownedalbums.php (renamed from index.php)15
-rw-r--r--pages/tagged.php (renamed from search.php)13
-rw-r--r--pages/upload.php (renamed from upload.php)5
-rw-r--r--pages/viewalbum.php (renamed from viewalbum.php)10
-rw-r--r--pages/viewimage.php (renamed from viewimage.php)12
-rw-r--r--pages/world.php (renamed from world.php)4
-rw-r--r--start.php28
-rw-r--r--views/default/object/image.php2
13 files changed, 93 insertions, 84 deletions
diff --git a/friends.php b/friends.php
deleted file mode 100644
index c9deb4772..000000000
--- a/friends.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
- /**
- * Tidypics Friends Albums Listing
- *
- */
-
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- //if no friends were requested, see world pictures instead, or redirect to user's friends
- if (is_null(get_input('username')) || get_input('username')=='') {
- if (!isloggedin()) {
- forward('pg/photos/world');
- } else {
- forward('pg/photos/friends/' . $_SESSION['user']->username);
- }
- }
-
- if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') {
- $friendname = get_input('username');
- } else {
- $friendname = page_owner_entity()->name;
- };
-
- if(isloggedin() && (page_owner() == $_SESSION['guid'])) {
- $area2 = elgg_view_title($title = elgg_echo('album:yours:friends'));
- } else {
- $area2 = elgg_view_title($title = sprintf(elgg_echo('album:friends'), $friendname));
- }
-
- set_context('search');
- set_input('search_viewtype', 'gallery');
- $area2 .= list_user_friends_objects(page_owner(), 'album', 10, true, false);
-
- set_context('photos');
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- // Finally draw the page
- page_draw(sprintf(elgg_echo("album:friends"),$_SESSION['user']->name), $body);
-?> \ No newline at end of file
diff --git a/languages/en.php b/languages/en.php
index 98cf9db53..82305d2aa 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -17,7 +17,7 @@
'albums' => "Photo Albums",
'album:slideshow' => "View Slideshow",
'album:yours' => "Your photo albums",
- 'album:yours:friends' => "Friends' photo albums",
+ 'album:yours:friends' => "Your friends' photo albums",
'album:user' => "%s's photo albums",
'album:friends' => "%s's friends' photo albums",
'album:all' => "All site photo albums",
diff --git a/edit.php b/pages/edit.php
index b61f6ba0f..3f13abae9 100644
--- a/edit.php
+++ b/pages/edit.php
@@ -4,9 +4,10 @@
*
*/
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
- gatekeeper(); // make sure the user is logged_in
+ // make sure the user is logged_in
+ gatekeeper();
set_context('photos');
$guid = (int) get_input('guid');
diff --git a/pages/friends.php b/pages/friends.php
new file mode 100644
index 000000000..8ac1e21d0
--- /dev/null
+++ b/pages/friends.php
@@ -0,0 +1,38 @@
+<?php
+ /**
+ * Tidypics Friends Albums Listing
+ *
+ * List all the albums of someone's friends
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ $username = get_input('username');
+
+ // if no username, redirect to world photo albums
+ if (!$username) {
+ forward('pg/photos/world');
+ }
+
+ // setup title
+ $user = get_user_by_username($username);
+ if (!$user) {
+ forward('pg/photos/world');
+ }
+ if ($user->guid == get_loggedin_userid())
+ $title = elgg_echo('album:yours:friends');
+ else
+ $title = sprintf(elgg_echo('album:friends'), $user->name);
+
+ $area2 = elgg_view_title($title);
+
+ // get html for viewing list of photo albums
+ set_context('search');
+ set_input('search_viewtype', 'gallery'); // need to force gallery view
+ $area2 .= list_user_friends_objects($user->guid, 'album', 10, true, false);
+
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/newalbum.php b/pages/newalbum.php
index 44e0e07a7..006c61b54 100644
--- a/newalbum.php
+++ b/pages/newalbum.php
@@ -6,7 +6,9 @@
*/
// Load Elgg engine
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // must be logged in to create a new album
gatekeeper();
// Get the current page's owner
diff --git a/index.php b/pages/ownedalbums.php
index 17aa70f3b..a28020216 100644
--- a/index.php
+++ b/pages/ownedalbums.php
@@ -1,11 +1,11 @@
<?php
/**
- * tidypics photo gallery main page
- *
+ * tidypics photo gallery album listing page for a person/group
*
+ * Shows all the albums that belong to that person or group
*/
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
// if this page belongs to a closed group, prevent anyone outside group from seeing
if (is_callable('group_gatekeeper')) group_gatekeeper();
@@ -14,14 +14,11 @@
$owner = page_owner_entity();
- //if page owner cannot be found, forward to user's pictures instead (or world if not logged in)
+ //if page owner cannot be found, forward to world album list
if (is_null($owner->username) || empty($owner->username)) {
- //if not logged in, see world pictures instead
- if (!isloggedin())
- forward('pg/photos/world');
-
- forward('pg/photos/owned/' . $_SESSION['user']->username);
+ forward('pg/photos/world');
}
+
// setup group menu for album index
if ($owner instanceof ElggGroup) {
diff --git a/search.php b/pages/tagged.php
index b7b67295d..0bc562f5b 100644
--- a/search.php
+++ b/pages/tagged.php
@@ -1,8 +1,12 @@
<?php
+ /**
+ * Tidypics Tagged Listing
+ *
+ * List all photos tagged with a user
+ */
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
- set_context('search');
// Get user guid
$guid = get_input('guid');
@@ -17,7 +21,10 @@
// create main column
- $body = elgg_view_title($title);
+ $body = elgg_view_title($title);
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery'); // need to force gallery view
$body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image');
// Set up submenus
diff --git a/upload.php b/pages/upload.php
index 71beb8752..3550d5620 100644
--- a/upload.php
+++ b/pages/upload.php
@@ -4,9 +4,10 @@
*
*/
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // must be logged in to upload images
gatekeeper();
- global $CONFIG;
$album_guid = (int) get_input('container_guid');
if (!$album_guid)
diff --git a/viewalbum.php b/pages/viewalbum.php
index 9342db1e6..b451b6993 100644
--- a/viewalbum.php
+++ b/pages/viewalbum.php
@@ -2,9 +2,14 @@
/**
* Tidypics Album View Page
+ *
+ * This displays a listing of all the photos that belong to an album
*/
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // if this page belongs to a closed group, prevent anyone outside group from seeing
+ if (is_callable('group_gatekeeper')) group_gatekeeper();
// get the album entity
$album_guid = (int) get_input('guid');
@@ -19,9 +24,6 @@
else
set_page_owner($album->owner_guid);
- // if this page belongs to a closed group, prevent anyone outside group from seeing
- if (is_callable('group_gatekeeper')) group_gatekeeper();
-
$owner = page_owner_entity();
// setup group menu
diff --git a/viewimage.php b/pages/viewimage.php
index 05efff6df..5caccdf06 100644
--- a/viewimage.php
+++ b/pages/viewimage.php
@@ -1,13 +1,16 @@
<?php
/**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
+ * Tidypics image view
*
+ * Display a view of a single image
*/
// Load Elgg engine
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // if this page belongs to a closed group, prevent anyone outside group from seeing
+ if (is_callable('group_gatekeeper')) group_gatekeeper();
// get the album entity
$photo_guid = (int) get_input('guid');
@@ -25,9 +28,6 @@
set_page_owner($owner_guid);
}
- // if this page belongs to a closed group, prevent anyone outside group from seeing
- if (is_callable('group_gatekeeper')) group_gatekeeper();
-
$page_owner = page_owner_entity();
if ($page_owner instanceof ElggGroup) {
diff --git a/world.php b/pages/world.php
index d5dbf1f2a..1ed712ac9 100644
--- a/world.php
+++ b/pages/world.php
@@ -4,7 +4,7 @@
*
*/
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
$limit = get_input("limit", 10);
$offset = get_input("offset", 0);
@@ -25,7 +25,7 @@
$area2 .= list_entities('object','album', 0, 28);
set_context('photos');
-
+
$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
// Finally draw the page
diff --git a/start.php b/start.php
index 0f73694d3..07dc9392f 100644
--- a/start.php
+++ b/start.php
@@ -227,32 +227,32 @@
{
case "owned": //view list of albums owned by container
if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/index.php");
+ include($CONFIG->pluginspath . "tidypics/pages/ownedalbums.php");
break;
case "view": //view an image individually
if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/viewimage.php");
+ include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
break;
case "album": //view an album individually
if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/viewalbum.php");
+ include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php");
break;
case "new": //create new album
if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/newalbum.php");
+ include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
break;
case "upload": //upload images to album
if (isset($page[1])) set_input('container_guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/upload.php");
+ include($CONFIG->pluginspath . "tidypics/pages/upload.php");
break;
case "edit": //edit image or album
if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/edit.php");
+ include($CONFIG->pluginspath . "tidypics/pages/edit.php");
break;
case "delete": //edit image or album
@@ -260,18 +260,18 @@
include($CONFIG->pluginspath . "tidypics/actions/delete.php");
break;
- case "friends":
+ case "friends": // albums of friends
if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/friends.php");
+ include($CONFIG->pluginspath . "tidypics/pages/friends.php");
break;
- case "world":
- include($CONFIG->pluginspath . "tidypics/world.php");
+ case "world": // all site albums
+ include($CONFIG->pluginspath . "tidypics/pages/world.php");
break;
- case "search": //view an image individually
+ case "tagged": // all photos tagged with user
if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/search.php");
+ include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
break;
case "rate": //rate image
@@ -327,8 +327,8 @@
}
else
{
- // going to the index because something is wrong with the page handler
- include($CONFIG->pluginspath . "tidypics/index.php");
+ // going to all site albums if something goes wrong with the page handler
+ include($CONFIG->pluginspath . "tidypics/pages/world.php");
}
}
diff --git a/views/default/object/image.php b/views/default/object/image.php
index 8ca20e75a..852fea8db 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -38,7 +38,7 @@ if ($photo_tags) {
else
$phototag_text = "unknown user";
- $phototag_link = $vars['url'] . "pg/photos/search/" . $photo_tag->value;
+ $phototag_link = $vars['url'] . "pg/photos/tagged/" . $photo_tag->value;
}
// hack to handle format of Pedro Prez's tags - ugh