diff options
Diffstat (limited to 'pages')
-rw-r--r-- | pages/admin.php | 46 | ||||
-rw-r--r-- | pages/download.php | 102 | ||||
-rw-r--r-- | pages/edit.php | 100 | ||||
-rw-r--r-- | pages/edit_multiple.php | 94 | ||||
-rw-r--r-- | pages/friends.php | 74 | ||||
-rw-r--r-- | pages/newalbum.php | 62 | ||||
-rw-r--r-- | pages/ownedalbums.php | 100 | ||||
-rw-r--r-- | pages/tagged.php | 98 | ||||
-rw-r--r-- | pages/upload.php | 82 | ||||
-rw-r--r-- | pages/viewalbum.php | 134 | ||||
-rw-r--r-- | pages/viewimage.php | 114 | ||||
-rw-r--r-- | pages/world.php | 60 |
12 files changed, 533 insertions, 533 deletions
diff --git a/pages/admin.php b/pages/admin.php index 0668ac324..33d44b6c4 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -1,24 +1,24 @@ -<?php
- /******************************************************************
- *
- * Tidypics Admin Settings
- *
- *******************************************************************/
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- global $CONFIG;
-
- admin_gatekeeper();
- set_context('admin');
- set_page_owner($_SESSION['guid']);
-
- $tab = isset($_GET['tab']) ? $_GET['tab'] : 'settings';
-
- $body = elgg_view_title(elgg_echo('tidypics:administration'));
-
- $body .= elgg_view("tidypics/admin/tidypics", array('tab' => $tab));
-
- page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $body));
-
+<?php + /****************************************************************** + * + * Tidypics Admin Settings + * + *******************************************************************/ + + include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; + + global $CONFIG; + + admin_gatekeeper(); + set_context('admin'); + set_page_owner($_SESSION['guid']); + + $tab = isset($_GET['tab']) ? $_GET['tab'] : 'settings'; + + $body = elgg_view_title(elgg_echo('tidypics:administration')); + + $body .= elgg_view("tidypics/admin/tidypics", array('tab' => $tab)); + + page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $body)); + ?>
\ No newline at end of file diff --git a/pages/download.php b/pages/download.php index f5530cebc..e4ad2e855 100644 --- a/pages/download.php +++ b/pages/download.php @@ -1,52 +1,52 @@ -<?php
- /**
- * Tidypics Download Photos
- *
- * do not call this directly - call through page handler
- */
-
- global $CONFIG;
-
- $file_guid = (int) get_input("file_guid");
- $file = get_entity($file_guid);
-
- $type = get_input("type");
-
- if ($file) {
- $filename = $file->originalfilename;
- $mime = $file->mimetype;
-
- header("Content-Type: $mime");
- if ($type == "inline")
- header("Content-Disposition: inline; filename=\"$filename\"");
- else
- header("Content-Disposition: attachment; filename=\"$filename\"");
-
-
- $readfile = new ElggFile($file_guid);
- $readfile->owner_guid = $file->owner_guid;
-
- $contents = $readfile->grabFile();
-
- if (empty($contents)) {
- echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
- } else {
-
- // expires every 60 days
- $expires = 60 * 60*60*24;
-
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-
- echo $contents;
- }
-
- exit;
- }
- else
- register_error(elgg_echo("image:downloadfailed"));
-
+<?php + /** + * Tidypics Download Photos + * + * do not call this directly - call through page handler + */ + + global $CONFIG; + + $file_guid = (int) get_input("file_guid"); + $file = get_entity($file_guid); + + $type = get_input("type"); + + if ($file) { + $filename = $file->originalfilename; + $mime = $file->mimetype; + + header("Content-Type: $mime"); + if ($type == "inline") + header("Content-Disposition: inline; filename=\"$filename\""); + else + header("Content-Disposition: attachment; filename=\"$filename\""); + + + $readfile = new ElggFile($file_guid); + $readfile->owner_guid = $file->owner_guid; + + $contents = $readfile->grabFile(); + + if (empty($contents)) { + echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" ); + } else { + + // expires every 60 days + $expires = 60 * 60*60*24; + + header("Content-Length: " . strlen($contents)); + header("Cache-Control: public", true); + header("Pragma: public", true); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true); + + + echo $contents; + } + + exit; + } + else + register_error(elgg_echo("image:downloadfailed")); + ?>
\ No newline at end of file diff --git a/pages/edit.php b/pages/edit.php index 3f13abae9..abf1a0fdd 100644 --- a/pages/edit.php +++ b/pages/edit.php @@ -1,51 +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);
+<?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/edit_multiple.php b/pages/edit_multiple.php index 0c9295054..49b7dd6f3 100644 --- a/pages/edit_multiple.php +++ b/pages/edit_multiple.php @@ -1,47 +1,47 @@ -<?php
- /**
- * Tidypics: Edit the properties of multiple images
- *
- * Called after upload only
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- gatekeeper();
- set_context('photos');
-
- // parse out photo guids
- $file_string = get_input('files');
- $file_array_sent = explode('-', $file_string);
- $new_file_array = array();
-
- // set owner of page based on first photo guid
- $photo_guid = (int)$file_array_sent[0];
- $photo = get_entity($photo_guid);
-
- // 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);
- }
-
- foreach ($file_array_sent as $file_guid) {
- if ($entity = get_entity($file_guid)) {
- if ($entity->canEdit()){
- array_push($new_file_array, $file_guid);
- }
- if (!$album_guid)
- $album_guid = $entity->container_guid;
-
- }
- }
-
- $title = elgg_echo('tidypics:editprops');
- $area2 .= elgg_view_title($title);
- $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid));
- $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
- page_draw($title, $body);
-?>
+<?php + /** + * Tidypics: Edit the properties of multiple images + * + * Called after upload only + */ + + include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; + + gatekeeper(); + set_context('photos'); + + // parse out photo guids + $file_string = get_input('files'); + $file_array_sent = explode('-', $file_string); + $new_file_array = array(); + + // set owner of page based on first photo guid + $photo_guid = (int)$file_array_sent[0]; + $photo = get_entity($photo_guid); + + // 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); + } + + foreach ($file_array_sent as $file_guid) { + if ($entity = get_entity($file_guid)) { + if ($entity->canEdit()){ + array_push($new_file_array, $file_guid); + } + if (!$album_guid) + $album_guid = $entity->container_guid; + + } + } + + $title = elgg_echo('tidypics:editprops'); + $area2 .= elgg_view_title($title); + $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid)); + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + page_draw($title, $body); +?> diff --git a/pages/friends.php b/pages/friends.php index 8ac1e21d0..e35adce04 100644 --- a/pages/friends.php +++ b/pages/friends.php @@ -1,38 +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);
+<?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 index 006c61b54..fda886d52 100644 --- a/pages/newalbum.php +++ b/pages/newalbum.php @@ -1,32 +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 ));
-
+<?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 index c3dc54d24..f43c2c5eb 100644 --- a/pages/ownedalbums.php +++ b/pages/ownedalbums.php @@ -1,51 +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, false);
- else
- $area2 .= list_entities("object", "album", $owner->guid, 12, false);
-
- set_context('photos');
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- // Finally draw the page
- page_draw($title, $body);
+<?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, false); + else + $area2 .= list_entities("object", "album", $owner->guid, 12, false); + + 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 index fb07b392c..b5a879809 100644 --- a/pages/tagged.php +++ b/pages/tagged.php @@ -1,50 +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', 0, 10, false);
-
- // 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);
-
+<?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', 0, 10, false); + + // 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 index 3550d5620..84d237287 100644 --- a/pages/upload.php +++ b/pages/upload.php @@ -1,42 +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);
+<?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 index 402c2d7e6..9ebc31fae 100644 --- a/pages/viewalbum.php +++ b/pages/viewalbum.php @@ -1,68 +1,68 @@ -<?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);
- }
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
-
- 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');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('album:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
- 'photos',
- true);
- }
-
- // create body
- $area2 = elgg_view_entity($album, true);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($album->title, $body);
+<?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); + } + + // allow other plugins to override the slideshow + $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null); + if ($slideshow_link) { + add_submenu_item(elgg_echo('album:slideshow'), + $slideshow_link, + 'photos' ); + } + + 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'); + $ts = time(); + $token = generate_action_token($ts); + add_submenu_item( elgg_echo('album:delete'), + $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts, + '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 index 5f23fc685..025c1ad3b 100644 --- a/pages/viewimage.php +++ b/pages/viewimage.php @@ -1,58 +1,58 @@ -<?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');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('image:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
- '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);
+<?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'); + $ts = time(); + $token = generate_action_token($ts); + add_submenu_item( elgg_echo('image:delete'), + $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts, + '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 index 2683abc1d..9488f2620 100644 --- a/pages/world.php +++ b/pages/world.php @@ -1,31 +1,31 @@ -<?php
- /**
- * Tidypics View All Albums on Site
- *
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-
- $num_albums = 16;
-
- $title = elgg_echo('album:all');
-
- set_context('photos');
- $area2 = elgg_view_title($title);
-
- set_context('search');
- set_input('search_viewtype', 'gallery');
- $albums_html .= list_entities('object','album', 0, $num_albums, false);
-
-
- $area2 .= $albums_html;
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+<?php + /** + * Tidypics View All Albums on Site + * + */ + + include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; + + // set page owner to logged in user + if (isloggedin()) { + set_page_owner(get_loggedin_userid()); + } + + $num_albums = 16; + + $title = elgg_echo('album:all'); + + set_context('photos'); + $area2 = elgg_view_title($title); + + set_context('search'); + set_input('search_viewtype', 'gallery'); + $albums_html .= list_entities('object','album', 0, $num_albums, false); + + + $area2 .= $albums_html; + + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + + page_draw($title, $body); ?>
\ No newline at end of file |