diff options
Diffstat (limited to '')
-rw-r--r-- | picture.php | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/picture.php b/picture.php index 8daacb353..1e6e1c811 100644 --- a/picture.php +++ b/picture.php @@ -25,6 +25,7 @@ define('PHPWG_ROOT_PATH','./'); include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); include(PHPWG_ROOT_PATH.'include/section_init.inc.php'); include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); +include_once(PHPWG_ROOT_PATH.'include/functions_session.inc.php'); // Check Access and exit when user status is not ok check_status(ACCESS_GUEST); @@ -47,6 +48,19 @@ if ( !isset($page['rank_of'][$page['image_id']]) ) ); } +// There is cookie, so we must handle it at the beginning +if ( isset($_GET['metadata']) ) +{ + if ( pwg_get_session_var('show_metadata') == null ) + { + pwg_set_session_var('show_metadata', 1, 86400, cookie_path()); + } else { + pwg_unset_session_var('show_metadata'); + + } + +} + // add default event handler for rendering element content add_event_handler( 'render_element_content', @@ -477,6 +491,8 @@ $title_nb = ($page['current_rank'] + 1).'/'.count($page['items']); // metadata $url_metadata = duplicate_picture_url(); +$url_metadata = add_url_params( $url_metadata, array('metadata'=>null) ); + // do we have a plugin that can show metadata for something else than images? $metadata_showable = trigger_event( @@ -488,18 +504,13 @@ $metadata_showable = trigger_event( $picture['current']['path'] ); -if ($metadata_showable) +if ( $metadata_showable and pwg_get_session_var('show_metadata') ) { - if ( !isset($_GET['metadata']) ) - { - $url_metadata = add_url_params( $url_metadata, array('metadata'=>null) ); - } - else - { - $page['meta_robots']=array('noindex'=>1, 'nofollow'=>1); - } + $page['meta_robots']=array('noindex'=>1, 'nofollow'=>1); } + + $page['body_id'] = 'thePicturePage'; // allow plugins to change what we computed before passing data to template @@ -863,7 +874,7 @@ $template->assign( 'ELEMENT_CONTENT', $element_content ); include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php'); include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php'); -if ($metadata_showable and isset($_GET['metadata'])) +if ($metadata_showable and pwg_get_session_var('show_metadata') <> null ) { include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php'); } |