aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/edit.php51
-rw-r--r--pages/friends.php38
-rw-r--r--pages/newalbum.php32
-rw-r--r--pages/ownedalbums.php51
-rw-r--r--pages/tagged.php50
-rw-r--r--pages/upload.php42
-rw-r--r--pages/viewalbum.php58
-rw-r--r--pages/viewimage.php56
-rw-r--r--pages/world.php33
9 files changed, 411 insertions, 0 deletions
diff --git a/pages/edit.php b/pages/edit.php
new file mode 100644
index 000000000..3f13abae9
--- /dev/null
+++ b/pages/edit.php
@@ -0,0 +1,51 @@
+<?php
+ /**
+ * Tidypics Edit for Albums and Single Photos
+ *
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // make sure the user is logged_in
+ gatekeeper();
+
+ set_context('photos');
+ $guid = (int) get_input('guid');
+
+ if (!$entity = get_entity($guid))
+ forward();
+
+ if (!$entity->canEdit())
+ forward();
+
+ $subtype = $entity->getSubtype();
+
+ if ($subtype == 'album') {
+ $title = elgg_echo('album:edit');
+
+ if ($container = $entity->container_guid)
+ set_page_owner($container);
+
+ } else if ($subtype == 'image') {
+ $title = elgg_echo('image:edit');
+
+ if ($container = get_entity($entity->container_guid)->container_guid)
+ set_page_owner($container);
+
+ } else {
+ forward();
+ }
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+
+ $area2 .= elgg_view_title($title);
+ $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
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/pages/newalbum.php b/pages/newalbum.php
new file mode 100644
index 000000000..006c61b54
--- /dev/null
+++ b/pages/newalbum.php
@@ -0,0 +1,32 @@
+<?php
+
+ /**
+ * Tidypics Create New Album Page
+ *
+ */
+
+ // Load Elgg engine
+ 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
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ $area2 = elgg_view_title(elgg_echo('album:add'));
+ $area2 .= elgg_view("tidypics/forms/edit");
+
+ // Display page
+ page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 ));
+
+?> \ No newline at end of file
diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php
new file mode 100644
index 000000000..a28020216
--- /dev/null
+++ b/pages/ownedalbums.php
@@ -0,0 +1,51 @@
+<?php
+ /**
+ * 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(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 owner of the current page
+ $owner = page_owner_entity();
+
+
+ //if page owner cannot be found, forward to world album list
+ if (is_null($owner->username) || empty($owner->username)) {
+ forward('pg/photos/world');
+ }
+
+
+ // setup group menu for album index
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
+ if (can_write_to_container(0, $owner->guid)) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'tidypics');
+ }
+ }
+
+ //set the title
+ $title = sprintf(elgg_echo('album:user'), $owner->name);
+ $area2 = elgg_view_title($title);
+
+ // Get objects
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ if ($owner instanceof ElggGroup)
+ $area2 .= list_entities("object", "album", $owner->guid, 12);
+ else
+ $area2 .= list_entities("object", "album", $owner->guid, 12);
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/pages/tagged.php b/pages/tagged.php
new file mode 100644
index 000000000..0bc562f5b
--- /dev/null
+++ b/pages/tagged.php
@@ -0,0 +1,50 @@
+<?php
+ /**
+ * Tidypics Tagged Listing
+ *
+ * List all photos tagged with a user
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+
+ // Get user guid
+ $guid = get_input('guid');
+
+ $user = get_entity($guid);
+
+ if ($user)
+ $title = sprintf(elgg_echo('tidypics:usertag'), $user->name);
+ else
+ $title = "User does not exist";
+
+
+
+ // create main column
+ $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
+ if (isloggedin()) {
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
+ 'tidypics-b' );
+ }
+ add_submenu_item( elgg_echo('album:all'),
+ $CONFIG->wwwroot . "pg/photos/world/",
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:mostrecent'),
+ $CONFIG->wwwroot . 'pg/photos/mostrecent',
+ 'tidypics-z');
+
+
+
+ $body = elgg_view_layout('two_column_left_sidebar','',$body);
+
+
+ page_draw($title,$body);
+
+?> \ No newline at end of file
diff --git a/pages/upload.php b/pages/upload.php
new file mode 100644
index 000000000..3550d5620
--- /dev/null
+++ b/pages/upload.php
@@ -0,0 +1,42 @@
+<?php
+ /**
+ * Tidypics Upload Images Page
+ *
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // must be logged in to upload images
+ gatekeeper();
+
+ $album_guid = (int) get_input('container_guid');
+ if (!$album_guid)
+ forward();
+
+ $album = get_entity($album_guid);
+
+ //if album does not exist or user does not have access
+ if (!$album || !$album->canEdit()) {
+ // throw warning and forward to previous page
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ // set page owner based on container (user or group)
+ $container = $album->container_guid;
+ set_page_owner($container);
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ set_context('photos');
+ $title = elgg_echo('album:addpix') . ': ' . $album->title;
+ $area2 .= elgg_view_title($title);
+
+ $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album_guid ) );
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/pages/viewalbum.php b/pages/viewalbum.php
new file mode 100644
index 000000000..b451b6993
--- /dev/null
+++ b/pages/viewalbum.php
@@ -0,0 +1,58 @@
+<?php
+
+ /**
+ * Tidypics Album View Page
+ *
+ * This displays a listing of all the photos that belong to an album
+ */
+
+ 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');
+ $album = get_entity($album_guid);
+
+ // panic if we can't get it
+ if (!$album) forward();
+
+ // container should always be set, but just in case
+ if ($album->container_guid)
+ set_page_owner($album->container_guid);
+ else
+ set_page_owner($album->owner_guid);
+
+ $owner = page_owner_entity();
+
+ // setup group menu
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
+ }
+
+ if (can_write_to_container(0, $album->container_guid)) {
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'photos');
+ }
+ add_submenu_item( elgg_echo('album:addpix'),
+ $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
+ 'photos');
+ add_submenu_item( elgg_echo('album:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
+ 'photos');
+ add_submenu_item( elgg_echo('album:delete'),
+ $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid,
+ 'photos',
+ true);
+ }
+
+ // create body
+ $area2 = elgg_view_entity($album, true);
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($album->title, $body);
+?> \ No newline at end of file
diff --git a/pages/viewimage.php b/pages/viewimage.php
new file mode 100644
index 000000000..5caccdf06
--- /dev/null
+++ b/pages/viewimage.php
@@ -0,0 +1,56 @@
+<?php
+
+ /**
+ * Tidypics image view
+ *
+ * Display a view of a single image
+ */
+
+ // Load Elgg engine
+ 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');
+ $photo = get_entity($photo_guid);
+
+ // panic if we can't get it
+ if (!$photo) forward();
+
+ // set page owner based on owner of photo album
+ set_page_owner($photo->owner_guid);
+ $album = get_entity($photo->container_guid);
+ if ($album) {
+ $owner_guid = $album->container_guid;
+ if ($owner_guid)
+ set_page_owner($owner_guid);
+ }
+
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ if (can_write_to_container(0, $album->container_guid)) {
+ add_submenu_item( elgg_echo('image:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
+ 'photos');
+ add_submenu_item( elgg_echo('image:delete'),
+ $CONFIG->wwwroot . 'pg/photos/delete/' . $photo_guid,
+ 'photos',
+ true);
+ }
+
+
+ $title = $photo->title;
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view_entity($photo, true);
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/pages/world.php b/pages/world.php
new file mode 100644
index 000000000..1ed712ac9
--- /dev/null
+++ b/pages/world.php
@@ -0,0 +1,33 @@
+<?php
+ /**
+ * Tidypics View All Albums on Site
+ *
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ $limit = get_input("limit", 10);
+ $offset = get_input("offset", 0);
+ $tag = get_input("tag");
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ // Get objects
+ $area2 = elgg_view_title($title = elgg_echo('album:all'));
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities('object','album', 0, 28);
+
+ set_context('photos');
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("album:all"),$_SESSION['user']->name), $body);
+?> \ No newline at end of file