Bug 817 (metadata display persistency) fixed for Butterfly

git-svn-id: http://piwigo.org/svn/trunk@2407 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mathiasm 2008-06-28 13:59:26 +00:00
parent a39ef87e7e
commit 8d64d10732

View file

@ -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');
}