diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-07-25 02:01:36 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-07-25 02:01:36 +0000 |
commit | 73403645808a81425381f43c25e0ea2c92705312 (patch) | |
tree | 83fb73e9a122054f6f4c2e1c44e399572ee13e28 /pages/viewimage.php | |
parent | 791ec4925346cb38ecca9a2f2574b012ab64a88a (diff) | |
download | elgg-73403645808a81425381f43c25e0ea2c92705312.tar.gz elgg-73403645808a81425381f43c25e0ea2c92705312.tar.bz2 |
first go at brining tidypics up to code standards
Diffstat (limited to 'pages/viewimage.php')
-rw-r--r-- | pages/viewimage.php | 104 |
1 files changed, 54 insertions, 50 deletions
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 . '&__elgg_token=' . $token . '&__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 . '&__elgg_token=' . $token . '&__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); |