aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/admin.php24
-rw-r--r--pages/download.php96
-rw-r--r--pages/edit.php79
-rw-r--r--pages/edit_multiple.php72
-rw-r--r--pages/friends.php80
-rw-r--r--pages/lists/mostcommentedimages.php63
-rw-r--r--pages/lists/mostrecentimages.php102
-rw-r--r--pages/lists/mostviewedimages.php121
-rw-r--r--pages/lists/recentlycommented.php111
-rw-r--r--pages/lists/recentlyviewed.php105
-rw-r--r--pages/newalbum.php54
-rw-r--r--pages/ownedalbums.php102
-rw-r--r--pages/server_analysis.php62
-rw-r--r--pages/tagged.php96
-rw-r--r--pages/thumbnail.php146
-rw-r--r--pages/upload.php82
-rw-r--r--pages/viewalbum.php114
-rw-r--r--pages/viewimage.php104
-rw-r--r--pages/world.php55
19 files changed, 838 insertions, 830 deletions
diff --git a/pages/admin.php b/pages/admin.php
index d3e810351..4013e55ac 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -1,23 +1,21 @@
<?php
- /******************************************************************
+/******************************************************************
*
* Tidypics Admin Settings
*
*******************************************************************/
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
- global $CONFIG;
+global $CONFIG;
- admin_gatekeeper();
- set_context('admin');
-
- $tab = isset($_GET['tab']) ? $_GET['tab'] : 'settings';
+admin_gatekeeper();
+set_context('admin');
- $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));
+$tab = get_input('tab', 'settings');
-?> \ No newline at end of file
+$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));
diff --git a/pages/download.php b/pages/download.php
index e4ad2e855..23c3e39f4 100644
--- a/pages/download.php
+++ b/pages/download.php
@@ -1,52 +1,50 @@
<?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;
+/**
+ * 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;
}
- else
- register_error(elgg_echo("image:downloadfailed"));
-?> \ No newline at end of file
+ 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 abf1a0fdd..06d3dd9c4 100644
--- a/pages/edit.php
+++ b/pages/edit.php
@@ -1,51 +1,54 @@
<?php
- /**
- * Tidypics Edit for Albums and Single Photos
- *
- */
+/**
+ * Tidypics Edit for Albums and Single Photos
+ *
+ */
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+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');
+// make sure the user is logged_in
+gatekeeper();
- if (!$entity = get_entity($guid))
- forward();
+set_context('photos');
+$guid = (int) get_input('guid');
- if (!$entity->canEdit())
- forward();
+if (!$entity = get_entity($guid)) {
+ forward();
+}
- $subtype = $entity->getSubtype();
-
- if ($subtype == 'album') {
- $title = elgg_echo('album:edit');
+if (!$entity->canEdit()) {
+ forward();
+}
- if ($container = $entity->container_guid)
- set_page_owner($container);
+$subtype = $entity->getSubtype();
- } else if ($subtype == 'image') {
- $title = elgg_echo('image:edit');
+if ($subtype == 'album') {
+ $title = elgg_echo('album:edit');
- if ($container = get_entity($entity->container_guid)->container_guid)
- set_page_owner($container);
-
- } else {
- forward();
+ if ($container = $entity->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);
+
+} else if ($subtype == 'image') {
+ $title = elgg_echo('image:edit');
+
+ if ($container = get_entity($entity->container_guid)->container_guid) {
+ set_page_owner($container);
}
-
- $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);
+} 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
+page_draw($title, $body);
diff --git a/pages/edit_multiple.php b/pages/edit_multiple.php
index 49b7dd6f3..ec507ba4b 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
- */
+/**
+ * Tidypics: Edit the properties of multiple images
+ *
+ * Called after upload only
+ */
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
- gatekeeper();
- set_context('photos');
+gatekeeper();
+set_context('photos');
- // parse out photo guids
- $file_string = get_input('files');
- $file_array_sent = explode('-', $file_string);
- $new_file_array = array();
+// 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 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);
+// 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;
-
+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);
-?>
+$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 03ae1300a..d5dfdba5c 100644
--- a/pages/friends.php
+++ b/pages/friends.php
@@ -1,41 +1,41 @@
<?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);
-
- $albums = get_user_friends_objects($user->guid, 'album', 12);
-
- // get html for viewing list of photo albums
- set_context('search');
- set_input('search_viewtype', 'gallery'); // need to force gallery view
- $content = tp_view_entity_list($albums, count($albums), 0, 12, false, false, true);
-
- $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
-?> \ No newline at end of file
+/**
+ * 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);
+
+$albums = get_user_friends_objects($user->guid, 'album', 12);
+
+// get html for viewing list of photo albums
+set_context('search');
+set_input('search_viewtype', 'gallery'); // need to force gallery view
+$content = tp_view_entity_list($albums, count($albums), 0, 12, false, false, true);
+
+$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
+
+$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+page_draw($title, $body);
diff --git a/pages/lists/mostcommentedimages.php b/pages/lists/mostcommentedimages.php
index 801409fdc..0a4eb9622 100644
--- a/pages/lists/mostcommentedimages.php
+++ b/pages/lists/mostcommentedimages.php
@@ -1,22 +1,22 @@
<?php
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
+/**
+ * Tidypics full view of an image
+ * Given a GUID, this page will try and display any entity
+ *
+ */
+
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+
+global $CONFIG;
+$prefix = $CONFIG->dbprefix;
+$max = 24;
+
+//this works but is wildly inefficient
+//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
+
+$sql = "SELECT ent.guid, count( * ) AS views
FROM " . $prefix . "entities ent
INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
AND sub.subtype = 'image'
@@ -26,18 +26,17 @@
GROUP BY ent.guid
ORDER BY views DESC
LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostcommented");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
+
+$result = get_data($sql);
+
+$entities = array();
+foreach ($result as $entity) {
+ $entities[] = get_entity($entity->guid);
+}
+
+tidypics_mostviewed_submenus();
+$title = elgg_echo("tidypics:mostcommented");
+$area2 = elgg_view_title($title);
+$area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
+$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+page_draw($title, $body); \ No newline at end of file
diff --git a/pages/lists/mostrecentimages.php b/pages/lists/mostrecentimages.php
index 178e3c722..722f1fc32 100644
--- a/pages/lists/mostrecentimages.php
+++ b/pages/lists/mostrecentimages.php
@@ -1,56 +1,58 @@
<?php
- /**
- * Most recently uploaded images - individual or world
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- // start with assumption this is for all site photos
- $title = elgg_echo('tidypics:mostrecent');
- $user_id = 0;
-
- // is this all site or an individuals images
- $username = get_input('username');
- if ($username) {
- $user = get_user_by_username($username);
- if ($user) {
- $user_id = $user->guid;
-
- if ($user_id == get_loggedin_userid())
- $title = elgg_echo('tidypics:yourmostrecent');
- else
- $title = sprintf(elgg_echo("tidypics:friendmostrecent"), $user->name);
- }
- } else {
- // world view - set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
+/**
+ * Most recently uploaded images - individual or world
+ *
+ */
+
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+
+// start with assumption this is for all site photos
+$title = elgg_echo('tidypics:mostrecent');
+$user_id = 0;
+
+// is this all site or an individuals images
+$username = get_input('username');
+if ($username) {
+ $user = get_user_by_username($username);
+ if ($user) {
+ $user_id = $user->guid;
+
+ if ($user_id == get_loggedin_userid()) {
+ $title = elgg_echo('tidypics:yourmostrecent');
+ } else {
+ $title = sprintf(elgg_echo("tidypics:friendmostrecent"), $user->name);
}
}
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
+} else {
+ // world view - set page owner to logged in user
+ if (isloggedin()) {
+ set_page_owner(get_loggedin_userid());
}
+}
+
+// allow other plugins to override the slideshow
+$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
+if ($slideshow_link) {
+ add_submenu_item(elgg_echo('album:slideshow'),
+ $slideshow_link,
+ 'photos' );
+}
+
+// how many do we display
+$max = 12;
+
+// grab the html to display the images
+$images = tp_list_entities("object", "image", $user_id, null, $max, false, false, true);
+
+
+// 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);
- // how many do we display
- $max = 12;
-
- // grab the html to display the images
- $images = tp_list_entities("object", "image", $user_id, null, $max, false, false, true);
-
-
- // 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);
-?> \ No newline at end of file
+page_draw($title, $body);
diff --git a/pages/lists/mostviewedimages.php b/pages/lists/mostviewedimages.php
index d945680f1..eb87bc17c 100644
--- a/pages/lists/mostviewedimages.php
+++ b/pages/lists/mostviewedimages.php
@@ -1,33 +1,33 @@
<?php
- /**
- * Most viewed images - either for a user or all site
- *
- */
+/**
+ * Most viewed images - either for a user or all site
+ *
+ */
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
- $owner_guid = page_owner();
-
- //$start = microtime(true);
- $photos = tp_get_entities_from_annotations_calculate_x(
- 'count',
- 'object',
- 'image',
- 'tp_view',
- '',
- '',
- $owner_guid,
- $max);
- //error_log("elgg query is " . (float)(microtime(true) - $start));
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
+global $CONFIG;
+$prefix = $CONFIG->dbprefix;
+$max = 24;
+
+$owner_guid = page_owner();
+
+//$start = microtime(true);
+$photos = tp_get_entities_from_annotations_calculate_x(
+ 'count',
+ 'object',
+ 'image',
+ 'tp_view',
+ '',
+ '',
+ $owner_guid,
+ $max);
+//error_log("elgg query is " . (float)(microtime(true) - $start));
+
+//this works but is wildly inefficient
+//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
/*
$start = microtime(true);
$sql = "SELECT ent.guid, count( * ) AS views
@@ -48,39 +48,40 @@
$entities[] = get_entity($entity->guid);
}
*/
- //error_log("custom query is " . (float)(microtime(true) - $start));
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
-
- if ($owner_guid) {
- if ($owner_guid == get_loggedin_userid()) {
- $title = elgg_echo("tidypics:yourmostviewed");
- } else {
- $title = sprintf(elgg_echo("tidypics:friendmostviewed"), page_owner_entity()->name);
- }
+//error_log("custom query is " . (float)(microtime(true) - $start));
+
+// allow other plugins to override the slideshow
+$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
+if ($slideshow_link) {
+ add_submenu_item(elgg_echo('album:slideshow'),
+ $slideshow_link,
+ 'photos' );
+}
+
+if ($owner_guid) {
+ if ($owner_guid == get_loggedin_userid()) {
+ $title = elgg_echo("tidypics:yourmostviewed");
} else {
- // world view - set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-
- $title = elgg_echo("tidypics:mostviewed");
+ $title = sprintf(elgg_echo("tidypics:friendmostviewed"), page_owner_entity()->name);
}
- $area2 = elgg_view_title($title);
-
- // grab the html to display the images
- $content = tp_view_entity_list($photos, $max, 0, $max, false);
-
- // 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' => $content,));
- if( empty( $area2 )) $area2 = $content;
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
+} else {
+ // world view - set page owner to logged in user
+ if (isloggedin()) {
+ set_page_owner(get_loggedin_userid());
+ }
+
+ $title = elgg_echo("tidypics:mostviewed");
+}
+$area2 = elgg_view_title($title);
+
+// grab the html to display the images
+$content = tp_view_entity_list($photos, $max, 0, $max, false);
+
+// 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' => $content,));
+if (empty($area2)) {
+ $area2 = $content;
+}
+
+$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+page_draw($title, $body);
diff --git a/pages/lists/recentlycommented.php b/pages/lists/recentlycommented.php
index 1d5f7aea7..f070e8563 100644
--- a/pages/lists/recentlycommented.php
+++ b/pages/lists/recentlycommented.php
@@ -1,36 +1,36 @@
<?php
- /**
- * Images recently commented on - world view only
- *
- */
+/**
+ * Images recently commented on - world view only
+ *
+ */
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
- // world view - set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
-
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max_limit = 200; //get extra because you'll have multiple views per image in the result set
- $max = 16; //controls how many actually show on screen
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT distinct (ent.guid), ann1.time_created
+// world view - set page owner to logged in user
+if (isloggedin()) {
+ set_page_owner(get_loggedin_userid());
+}
+
+// allow other plugins to override the slideshow
+$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
+if ($slideshow_link) {
+ add_submenu_item(elgg_echo('album:slideshow'),
+ $slideshow_link,
+ 'photos' );
+}
+
+
+global $CONFIG;
+$prefix = $CONFIG->dbprefix;
+$max_limit = 200; //get extra because you'll have multiple views per image in the result set
+$max = 16; //controls how many actually show on screen
+
+//this works but is wildly inefficient
+//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
+
+$sql = "SELECT distinct (ent.guid), ann1.time_created
FROM " . $prefix . "entities ent
INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
AND sub.subtype = 'image'
@@ -39,34 +39,31 @@
AND ms.string = 'generic_comment'
ORDER BY ann1.time_created DESC
LIMIT $max_limit";
-
- $result = get_data($sql);
- $entities = array();
- foreach($result as $entity) {
- if(!$entities[$entity->guid]) {
- $entities[$entity->guid] = get_entity($entity->guid);
- }
- if(count($entities) >= $max) break;
+$result = get_data($sql);
+
+$entities = array();
+foreach ($result as $entity) {
+ if (!$entities[$entity->guid]) {
+ $entities[$entity->guid] = get_entity($entity->guid);
}
-
- $user = get_loggedin_user();
- if( $user->guid == 9 ) {
- echo "<pre>";
- var_dump( $sql);
-// var_dump( $result );
- echo "</pre>";
+ if (count($entities) >= $max) {
+ break;
}
- $title = elgg_echo("tidypics:recentlycommented");
- $area2 = elgg_view_title($title);
-
- // grab the html to display the images
- $images = tp_view_entity_list($entities, $max, 0, $max, false);
-
- // 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);
-?> \ No newline at end of file
+}
+
+$user = get_loggedin_user();
+$title = elgg_echo("tidypics:recentlycommented");
+$area2 = elgg_view_title($title);
+
+// grab the html to display the images
+$images = tp_view_entity_list($entities, $max, 0, $max, false);
+
+// 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);
diff --git a/pages/lists/recentlyviewed.php b/pages/lists/recentlyviewed.php
index 16ad474df..419576d8e 100644
--- a/pages/lists/recentlyviewed.php
+++ b/pages/lists/recentlyviewed.php
@@ -1,36 +1,36 @@
<?php
- /**
- * Most recently viewed images - world view only right now
- *
- */
+/**
+ * Most recently viewed images - world view only right now
+ *
+ */
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
- // world view - set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
-
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max_limit = 200; //get extra because you'll have multiple views per image in the result set
- $max = 16; //controls how many actually show on screen
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT distinct ent.guid, ann1.time_created
+// world view - set page owner to logged in user
+if (isloggedin()) {
+ set_page_owner(get_loggedin_userid());
+}
+
+// allow other plugins to override the slideshow
+$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
+if ($slideshow_link) {
+ add_submenu_item(elgg_echo('album:slideshow'),
+ $slideshow_link,
+ 'photos' );
+}
+
+
+global $CONFIG;
+$prefix = $CONFIG->dbprefix;
+$max_limit = 200; //get extra because you'll have multiple views per image in the result set
+$max = 16; //controls how many actually show on screen
+
+//this works but is wildly inefficient
+//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
+
+$sql = "SELECT distinct ent.guid, ann1.time_created
FROM " . $prefix . "entities ent
INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
AND sub.subtype = 'image'
@@ -39,27 +39,30 @@
AND ms.string = 'tp_view'
ORDER BY ann1.id DESC
LIMIT $max_limit";
-
- $result = get_data($sql);
- $entities = array();
- foreach($result as $entity) {
- if(!$entities[$entity->guid]) {
- $entities[$entity->guid] = get_entity($entity->guid);
- }
- if(count($entities) >= $max) break;
+$result = get_data($sql);
+
+$entities = array();
+foreach ($result as $entity) {
+ if (!$entities[$entity->guid]) {
+ $entities[$entity->guid] = get_entity($entity->guid);
+ }
+ if (count($entities) >= $max) {
+ break;
}
-
- $title = elgg_echo("tidypics:recentlyviewed");
- $area2 = elgg_view_title($title);
-
- // grab the html to display the images
- $images = tp_view_entity_list($entities, $max, 0, $max, false);
-
- // 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);
-?> \ No newline at end of file
+}
+
+$title = elgg_echo("tidypics:recentlyviewed");
+$area2 = elgg_view_title($title);
+
+// grab the html to display the images
+$images = tp_view_entity_list($entities, $max, 0, $max, false);
+
+// 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);
diff --git a/pages/newalbum.php b/pages/newalbum.php
index fda886d52..535116237 100644
--- a/pages/newalbum.php
+++ b/pages/newalbum.php
@@ -1,32 +1,30 @@
<?php
- /**
- * Tidypics Create New Album Page
- *
- */
+/**
+ * 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 ));
+// Load Elgg engine
+include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-?> \ No newline at end of file
+// 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 = get_loggedin_user();
+ set_page_owner($page_owner->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", '', $area2));
diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php
index d22c6d44a..67583c65c 100644
--- a/pages/ownedalbums.php
+++ b/pages/ownedalbums.php
@@ -1,53 +1,55 @@
<?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');
- }
+/**
+ * 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');
- }
+
+// 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)
- $content .= tp_list_entities("object", "album", 0, $owner->guid, 12, false);
- else
- $content .= tp_list_entities("object", "album", $owner->guid, $owner->guid, 12, false);
-
- $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
- 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
+}
+
+//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) {
+ $content .= tp_list_entities("object", "album", 0, $owner->guid, 12, false);
+} else {
+ $content .= tp_list_entities("object", "album", $owner->guid, $owner->guid, 12, false);
+}
+
+$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
+
+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/server_analysis.php b/pages/server_analysis.php
index ccffc1632..db3aed5f6 100644
--- a/pages/server_analysis.php
+++ b/pages/server_analysis.php
@@ -8,48 +8,49 @@
*
********************************************************************/
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
- global $CONFIG;
+global $CONFIG;
- admin_gatekeeper();
+admin_gatekeeper();
- set_context('admin');
+set_context('admin');
- $title = 'TidyPics Server Analysis';
+$title = 'TidyPics Server Analysis';
- function tp_readable_size($bytes)
- {
- if (strpos($bytes, 'M'))
- return $bytes . 'B';
-
- $size = $bytes / 1024;
+function tp_readable_size($bytes) {
+ if (strpos($bytes, 'M')) {
+ return $bytes . 'B';
+ }
+
+ $size = $bytes / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' KB';
+ } else {
+ $size = $size / 1024;
if ($size < 1024) {
$size = number_format($size, 2);
- $size .= ' KB';
+ $size .= ' MB';
} else {
$size = $size / 1024;
- if($size < 1024) {
- $size = number_format($size, 2);
- $size .= ' MB';
- } else {
- $size = $size / 1024;
- $size = number_format($size, 2);
- $size .= ' GB';
- }
+ $size = number_format($size, 2);
+ $size .= ' GB';
}
- return $size;
}
+ return $size;
+}
- $disablefunc = explode(',', ini_get('disable_functions'));
- $exec_avail = "Disabled";
- if (is_callable('exec') && !in_array('exec',$disablefunc))
- $exec_avail = "Enabled";
+$disablefunc = explode(',', ini_get('disable_functions'));
+$exec_avail = "Disabled";
+if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+ $exec_avail = "Enabled";
+}
- ob_start();
+ob_start();
- echo elgg_view_title($title);
+echo elgg_view_title($title);
?>
<div class="contentWrapper">
<table width="100%">
@@ -130,9 +131,8 @@
</div>
<?php
- $content = ob_get_clean();
+$content = ob_get_clean();
- $body = elgg_view_layout('two_column_left_sidebar', '', $content);
+$body = elgg_view_layout('two_column_left_sidebar', '', $content);
- echo page_draw($title, $body);
-?> \ No newline at end of file
+echo page_draw($title, $body); \ No newline at end of file
diff --git a/pages/tagged.php b/pages/tagged.php
index b5a879809..34ea8a709 100644
--- a/pages/tagged.php
+++ b/pages/tagged.php
@@ -1,50 +1,48 @@
<?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
+/**
+ * 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);
diff --git a/pages/thumbnail.php b/pages/thumbnail.php
index 3aad5969d..9daa2f9c0 100644
--- a/pages/thumbnail.php
+++ b/pages/thumbnail.php
@@ -1,76 +1,78 @@
<?php
- /**
- * Tidypics Thumbnail
- *
- */
-
- // Get file GUID
- $file_guid = (int) get_input('file_guid');
-
- // Get file thumbnail size
- $size = get_input('size');
- // only 3 possibilities
- if ($size != 'small' && $size != 'thumb') {
- $size = 'large';
- }
-
- $error_image = '';
- switch ($size) {
- case 'thumb':
- $error_image = "image_error_thumb.png";
- break;
- case 'small':
- $error_image = "image_error_small.png";
- break;
- case 'large':
- $error_image = "image_error_large.png";
- break;
- }
-
- // Get file entity
- $file = get_entity($file_guid);
- if (!$file)
- forward('mod/tidypics/graphics/' . $error_image);
-
- if ($file->getSubtype() != "image")
- forward('mod/tidypics/graphics/' . $error_image);
-
- // Get filename
- if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
- } else if ($size == "small") {
- $thumbfile = $file->smallthumb;
- } else {
- $thumbfile = $file->largethumb;
- }
-
- if (!$thumbfile)
- forward('mod/tidypics/graphics/' . $error_image);
-
- // create Elgg File object
- $readfile = new ElggFile();
- $readfile->owner_guid = $file->owner_guid;
- $readfile->setFilename($thumbfile);
- $contents = $readfile->grabFile();
+/**
+ * Tidypics Thumbnail
+ *
+ */
- // send error image if file could not be read
- if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
- }
-
- // expires every 14 days
- $expires = 14 * 60*60*24;
+// Get file GUID
+$file_guid = (int) get_input('file_guid');
- // overwrite header caused by php session code so images can be cached
- $mime = $file->getMimeType();
- header("Content-Type: $mime");
- 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);
-
- // Return the thumbnail and exit
- echo $contents;
- exit;
- \ No newline at end of file
+// Get file thumbnail size
+$size = get_input('size');
+// only 3 possibilities
+if ($size != 'small' && $size != 'thumb') {
+ $size = 'large';
+}
+
+$error_image = '';
+switch ($size) {
+ case 'thumb':
+ $error_image = "image_error_thumb.png";
+ break;
+ case 'small':
+ $error_image = "image_error_small.png";
+ break;
+ case 'large':
+ $error_image = "image_error_large.png";
+ break;
+}
+
+// Get file entity
+$file = get_entity($file_guid);
+if (!$file) {
+ forward('mod/tidypics/graphics/' . $error_image);
+}
+
+if ($file->getSubtype() != "image") {
+ forward('mod/tidypics/graphics/' . $error_image);
+}
+
+// Get filename
+if ($size == "thumb") {
+ $thumbfile = $file->thumbnail;
+} else if ($size == "small") {
+ $thumbfile = $file->smallthumb;
+} else {
+ $thumbfile = $file->largethumb;
+}
+
+if (!$thumbfile) {
+ forward('mod/tidypics/graphics/' . $error_image);
+}
+
+// create Elgg File object
+$readfile = new ElggFile();
+$readfile->owner_guid = $file->owner_guid;
+$readfile->setFilename($thumbfile);
+$contents = $readfile->grabFile();
+
+// send error image if file could not be read
+if (!$contents) {
+ forward('mod/tidypics/graphics/' . $error_image);
+}
+
+// expires every 14 days
+$expires = 14 * 60*60*24;
+
+// overwrite header caused by php session code so images can be cached
+$mime = $file->getMimeType();
+header("Content-Type: $mime");
+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);
+
+// Return the thumbnail and exit
+echo $contents;
+exit;
diff --git a/pages/upload.php b/pages/upload.php
index 5c123537e..6f8db288d 100644
--- a/pages/upload.php
+++ b/pages/upload.php
@@ -1,44 +1,44 @@
<?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 ) );
+/**
+ * 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 ) );
// $area2 .= elgg_view("tidypics/forms/flash_upload", array('album' => $album_guid ) );
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
-?> \ No newline at end of file
+$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+page_draw($title, $body);
diff --git a/pages/viewalbum.php b/pages/viewalbum.php
index 050b124cb..fe3c5bc62 100644
--- a/pages/viewalbum.php
+++ b/pages/viewalbum.php
@@ -1,68 +1,72 @@
<?php
- /**
- * Tidypics Album View Page
- *
- * This displays a listing of all the photos that belong to an album
- */
+/**
+ * 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";
+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();
+// 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);
+// 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();
+// 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);
+// 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();
+$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', array('album' => $album), null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
+// 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');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('album:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
- 'photos',
- true);
+// allow other plugins to override the slideshow
+$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array('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 . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
+ 'photos',
+ true);
+}
- // create body
- $area2 = elgg_view_entity($album, true);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+// 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
+page_draw($album->title, $body);
diff --git a/pages/viewimage.php b/pages/viewimage.php
index 025c1ad3b..890f7e8c4 100644
--- a/pages/viewimage.php
+++ b/pages/viewimage.php
@@ -1,58 +1,62 @@
<?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);
+/**
+ * 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 . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
- 'photos',
- true);
- }
+$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 . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
+ 'photos',
+ true);
+}
+
-
- $title = $photo->title;
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity($photo, true);
+$title = $photo->title;
+$area2 = elgg_view_title($title);
+$area2 .= elgg_view_entity($photo, true);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
+page_draw($title, $body);
diff --git a/pages/world.php b/pages/world.php
index 48a3345d4..fe97a882d 100644
--- a/pages/world.php
+++ b/pages/world.php
@@ -1,29 +1,28 @@
<?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');
- $area2 = elgg_view_title($title);
-
- set_context('search');
- set_input('search_viewtype', 'gallery');
- $content .= tp_list_entities('object','album', 0, null, $num_albums, false);
- set_context('photos');
-
- $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
-?> \ No newline at end of file
+/**
+ * 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');
+$area2 = elgg_view_title($title);
+
+set_context('search');
+set_input('search_viewtype', 'gallery');
+$content .= tp_list_entities('object','album', 0, null, $num_albums, false);
+set_context('photos');
+
+$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
+
+$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+page_draw($title, $body);