2003-05-09 14:42:42 +02:00
|
|
|
<?php
|
2004-02-07 12:50:26 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2004-11-06 22:12:59 +01:00
|
|
|
// | PhpWebGallery - a PHP based picture gallery |
|
|
|
|
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
2007-01-11 06:10:16 +01:00
|
|
|
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
2004-02-07 12:50:26 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2007-01-11 06:10:16 +01:00
|
|
|
// | file : $Id$
|
2004-02-07 12:50:26 +01:00
|
|
|
// | last update : $Date$
|
|
|
|
// | last modifier : $Author$
|
|
|
|
// | revision : $Revision$
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | This program is free software; you can redistribute it and/or modify |
|
|
|
|
// | it under the terms of the GNU General Public License as published by |
|
2004-02-07 16:31:01 +01:00
|
|
|
// | the Free Software Foundation |
|
|
|
|
// | |
|
|
|
|
// | This program is distributed in the hope that it will be useful, but |
|
|
|
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
// | General Public License for more details. |
|
|
|
|
// | |
|
|
|
|
// | You should have received a copy of the GNU General Public License |
|
|
|
|
// | along with this program; if not, write to the Free Software |
|
|
|
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
|
|
|
// | USA. |
|
2004-02-07 12:50:26 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2004-02-07 16:31:01 +01:00
|
|
|
//--------------------------------------------------------------------- include
|
2004-02-19 01:31:09 +01:00
|
|
|
define('PHPWG_ROOT_PATH','./');
|
|
|
|
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
2006-03-16 23:34:45 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
|
2006-03-09 23:46:28 +01:00
|
|
|
|
2006-11-10 02:10:42 +01:00
|
|
|
trigger_action('loc_begin_index');
|
|
|
|
|
2006-03-09 23:46:28 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Check Access and exit when user status is not ok |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
check_status(ACCESS_GUEST);
|
|
|
|
|
2006-02-28 05:28:06 +01:00
|
|
|
//---------------------------------------------- change of image display order
|
2006-02-12 22:52:16 +01:00
|
|
|
if (isset($_GET['image_order']))
|
2004-11-23 23:31:24 +01:00
|
|
|
{
|
2006-12-01 02:46:32 +01:00
|
|
|
if ( (int)$_GET['image_order'] > 0)
|
|
|
|
{
|
|
|
|
pwg_set_session_var('image_order', (int)$_GET['image_order']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pwg_unset_session_var('image_order');
|
|
|
|
}
|
2006-02-12 22:52:16 +01:00
|
|
|
redirect(
|
2006-07-26 23:00:16 +02:00
|
|
|
duplicate_index_url(
|
2006-03-16 23:34:45 +01:00
|
|
|
array(), // nothing to redefine
|
|
|
|
array('start') // changing display order goes back to section first page
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
2006-02-12 22:52:16 +01:00
|
|
|
);
|
2006-02-01 23:56:17 +01:00
|
|
|
}
|
2003-05-09 14:42:42 +02:00
|
|
|
//-------------------------------------------------------------- initialization
|
2004-02-02 01:55:18 +01:00
|
|
|
// detection of the start picture to display
|
2006-03-15 23:44:35 +01:00
|
|
|
if (!isset($page['start']))
|
2004-09-04 10:07:33 +02:00
|
|
|
{
|
2004-02-02 01:55:18 +01:00
|
|
|
$page['start'] = 0;
|
2004-09-04 10:07:33 +02:00
|
|
|
}
|
2006-02-12 22:52:16 +01:00
|
|
|
|
|
|
|
// access authorization check
|
2006-03-15 23:44:35 +01:00
|
|
|
if (isset($page['category']))
|
2006-02-12 22:52:16 +01:00
|
|
|
{
|
2007-02-27 02:56:16 +01:00
|
|
|
check_restrictions($page['category']['id']);
|
2006-02-12 22:52:16 +01:00
|
|
|
}
|
|
|
|
|
2007-02-15 01:10:41 +01:00
|
|
|
if ( count($page['items']) > $user['nb_image_page'])
|
2006-02-12 22:52:16 +01:00
|
|
|
{
|
|
|
|
$page['navigation_bar'] = create_navigation_bar(
|
2006-07-26 23:00:16 +02:00
|
|
|
duplicate_index_url(array(), array('start')),
|
2007-02-15 01:10:41 +01:00
|
|
|
count($page['items']),
|
2006-02-12 22:52:16 +01:00
|
|
|
$page['start'],
|
|
|
|
$user['nb_image_page'],
|
2006-03-16 23:34:45 +01:00
|
|
|
true
|
2006-02-12 22:52:16 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page['navigation_bar'] = '';
|
|
|
|
}
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2005-03-25 23:10:55 +01:00
|
|
|
// caddie filling :-)
|
|
|
|
if (isset($_GET['caddie']))
|
|
|
|
{
|
2006-02-12 22:52:16 +01:00
|
|
|
fill_caddie($page['items']);
|
2006-03-15 23:44:35 +01:00
|
|
|
// redirect();
|
2005-03-25 23:10:55 +01:00
|
|
|
}
|
|
|
|
|
2003-05-09 14:42:42 +02:00
|
|
|
//----------------------------------------------------- template initialization
|
2004-02-02 01:55:18 +01:00
|
|
|
//
|
|
|
|
// Start output of page
|
|
|
|
//
|
|
|
|
$title = $page['title'];
|
- new : HTML BODY identifier to let CSS stylesheets manage specific
behaviour.
- deletion : admin/search useless
- improvement : in admin/user_list, special behaviour for true/false fields
(expand, show_comments)
- new : gallery_title and gallery_description are displayed at the top of
each page.
- improvement : simplification in HTML for categories menu.
- improvement : standardization of presentation in all public pages
(identification, registration, search, profile, notification, comments,
etc.)
(not in ChangeLog, below this line)
- add forgotten notification.php (should have been added in a previous
commit)
- [template cclear] deletion of useless class .bouton
- [template cclear] for test purpose, new presentation of register page
(using FORM.filter)
- [template cclear] adaptation of admin/group_list from template default
- [template cclear] deletion of obsolete admin/infos_images
- [template cclear] deletion of obsolete admin/search_username
- [template cclear] new icon register.png
git-svn-id: http://piwigo.org/svn/trunk@850 68402e56-0260-453c-a942-63ccdbb3a9ee
2005-08-26 00:43:47 +02:00
|
|
|
$page['body_id'] = 'theCategoryPage';
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2006-03-28 04:16:34 +02:00
|
|
|
$template->set_filenames( array('index'=>'index.tpl') );
|
2004-02-07 12:50:26 +01:00
|
|
|
//-------------------------------------------------------------- category title
|
2006-04-04 02:35:12 +02:00
|
|
|
$template_title = $page['title'];
|
2007-02-15 01:10:41 +01:00
|
|
|
if ( count($page['items']) > 0)
|
2004-06-15 22:00:40 +02:00
|
|
|
{
|
2007-02-15 01:10:41 +01:00
|
|
|
$template_title.= ' ['.count($page['items']).']';
|
2004-02-07 12:50:26 +01:00
|
|
|
}
|
|
|
|
|
2007-02-11 00:09:37 +01:00
|
|
|
if (isset($page['flat']) or isset($page['chronology_field']))
|
2006-12-13 01:05:16 +01:00
|
|
|
{
|
|
|
|
$template->assign_block_vars(
|
2006-12-21 22:38:20 +01:00
|
|
|
'mode_normal',
|
2006-12-13 01:05:16 +01:00
|
|
|
array(
|
2007-02-11 00:09:37 +01:00
|
|
|
'URL' => duplicate_index_url( array(), array('chronology_field', 'start', 'flat') )
|
2006-12-13 01:05:16 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-02-11 00:09:37 +01:00
|
|
|
if (!isset($page['flat']) and 'categories' == $page['section'])
|
2006-12-10 23:48:32 +01:00
|
|
|
{
|
|
|
|
$template->assign_block_vars(
|
2007-02-11 00:09:37 +01:00
|
|
|
'flat',
|
2006-12-10 23:48:32 +01:00
|
|
|
array(
|
2007-02-11 00:09:37 +01:00
|
|
|
'URL' => duplicate_index_url(array('flat' => ''), array('start', 'chronology_field'))
|
2006-12-10 23:48:32 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-21 02:27:21 +01:00
|
|
|
if (!isset($page['chronology_field']))
|
2006-02-20 05:39:37 +01:00
|
|
|
{
|
2006-03-21 02:27:21 +01:00
|
|
|
$chronology_params =
|
|
|
|
array(
|
|
|
|
'chronology_field' => 'created',
|
|
|
|
'chronology_style' => 'monthly',
|
|
|
|
'chronology_view' => 'list',
|
|
|
|
);
|
2006-02-22 02:00:39 +01:00
|
|
|
$template->assign_block_vars(
|
2006-02-28 05:28:06 +01:00
|
|
|
'mode_created',
|
2006-03-15 23:44:35 +01:00
|
|
|
array(
|
2007-02-11 00:09:37 +01:00
|
|
|
'URL' => duplicate_index_url( $chronology_params, array('start', 'flat') )
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
2006-02-22 02:00:39 +01:00
|
|
|
);
|
2006-03-16 03:22:58 +01:00
|
|
|
|
2006-03-21 02:27:21 +01:00
|
|
|
$chronology_params['chronology_field'] = 'posted';
|
2006-02-28 05:28:06 +01:00
|
|
|
$template->assign_block_vars(
|
|
|
|
'mode_posted',
|
2006-03-15 23:44:35 +01:00
|
|
|
array(
|
2007-02-11 00:09:37 +01:00
|
|
|
'URL' => duplicate_index_url( $chronology_params, array('start', 'flat') )
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
2006-02-28 05:28:06 +01:00
|
|
|
);
|
2006-02-22 02:00:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-21 02:27:21 +01:00
|
|
|
if ($page['chronology_field'] == 'created')
|
2006-02-28 05:28:06 +01:00
|
|
|
{
|
2006-03-21 02:27:21 +01:00
|
|
|
$chronology_field = 'posted';
|
2006-02-28 05:28:06 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-21 02:27:21 +01:00
|
|
|
$chronology_field = 'created';
|
2006-02-28 05:28:06 +01:00
|
|
|
}
|
2006-07-26 23:00:16 +02:00
|
|
|
$url = duplicate_index_url(
|
2006-03-21 02:27:21 +01:00
|
|
|
array('chronology_field'=>$chronology_field ),
|
2007-02-11 00:09:37 +01:00
|
|
|
array('chronology_date', 'start', 'flat')
|
2006-03-17 05:13:19 +01:00
|
|
|
);
|
|
|
|
$template->assign_block_vars(
|
2006-03-21 02:27:21 +01:00
|
|
|
'mode_'.$chronology_field,
|
2006-03-17 05:13:19 +01:00
|
|
|
array('URL' => $url )
|
|
|
|
);
|
2006-02-20 05:39:37 +01:00
|
|
|
}
|
2006-06-22 21:21:56 +02:00
|
|
|
// include menubar
|
|
|
|
include(PHPWG_ROOT_PATH.'include/menubar.inc.php');
|
2006-02-20 05:39:37 +01:00
|
|
|
|
- new : HTML BODY identifier to let CSS stylesheets manage specific
behaviour.
- deletion : admin/search useless
- improvement : in admin/user_list, special behaviour for true/false fields
(expand, show_comments)
- new : gallery_title and gallery_description are displayed at the top of
each page.
- improvement : simplification in HTML for categories menu.
- improvement : standardization of presentation in all public pages
(identification, registration, search, profile, notification, comments,
etc.)
(not in ChangeLog, below this line)
- add forgotten notification.php (should have been added in a previous
commit)
- [template cclear] deletion of useless class .bouton
- [template cclear] for test purpose, new presentation of register page
(using FORM.filter)
- [template cclear] adaptation of admin/group_list from template default
- [template cclear] deletion of obsolete admin/infos_images
- [template cclear] deletion of obsolete admin/search_username
- [template cclear] new icon register.png
git-svn-id: http://piwigo.org/svn/trunk@850 68402e56-0260-453c-a942-63ccdbb3a9ee
2005-08-26 00:43:47 +02:00
|
|
|
$template->assign_vars(
|
|
|
|
array(
|
2006-12-02 00:31:19 +01:00
|
|
|
'TITLE' => $template_title
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if ('search' == $page['section'])
|
2006-01-27 23:40:51 +01:00
|
|
|
{
|
|
|
|
$template->assign_block_vars(
|
|
|
|
'search_rules',
|
|
|
|
array(
|
2006-03-22 02:01:47 +01:00
|
|
|
'URL' => get_root_url().'search_rules.php?search_id='.$page['search'],
|
2006-01-27 23:40:51 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2005-07-16 16:29:35 +02:00
|
|
|
|
2006-03-15 23:44:35 +01:00
|
|
|
if (isset($page['category']) and is_admin())
|
2005-08-19 19:00:20 +02:00
|
|
|
{
|
|
|
|
$template->assign_block_vars(
|
|
|
|
'edit',
|
|
|
|
array(
|
|
|
|
'URL' =>
|
2006-03-21 02:27:21 +01:00
|
|
|
get_root_url().'admin.php?page=cat_modify'
|
2007-02-27 02:56:16 +01:00
|
|
|
.'&cat_id='.$page['category']['id']
|
2005-08-19 19:00:20 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-22 02:01:47 +01:00
|
|
|
if (is_admin() and !empty($page['items']) )
|
|
|
|
{
|
|
|
|
$template->assign_block_vars(
|
|
|
|
'caddie',
|
|
|
|
array(
|
|
|
|
'URL' =>
|
2006-03-23 02:49:04 +01:00
|
|
|
add_url_params(duplicate_index_url(), array('caddie'=>1) )
|
2006-03-22 02:01:47 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-08-15 04:06:06 +02:00
|
|
|
if ( $page['section']=='search' and $page['start']==0 )
|
|
|
|
{
|
|
|
|
$tags = get_common_tags($page['items'],
|
|
|
|
$conf['content_tag_cloud_items_number'], null);
|
|
|
|
if ( count($tags)>1 )
|
|
|
|
{
|
|
|
|
$template->assign_block_vars('related_tags', array() );
|
|
|
|
|
|
|
|
$tags = add_level_to_tags($tags);
|
|
|
|
foreach ($tags as $tag)
|
|
|
|
{
|
|
|
|
$template->assign_block_vars(
|
|
|
|
'related_tags.tag', array(
|
|
|
|
'URL' => make_index_url(
|
|
|
|
array(
|
2007-02-14 02:37:38 +01:00
|
|
|
'tags' => array($tag)
|
2006-08-15 04:06:06 +02:00
|
|
|
)
|
|
|
|
),
|
|
|
|
'NAME' => $tag['name'],
|
2007-03-29 21:04:54 +02:00
|
|
|
'TITLE' => l10n_dec(
|
|
|
|
'%d picture are also linked to current tags',
|
|
|
|
'%d pictures are also linked to current tags',
|
|
|
|
$tag['counter']),
|
2006-08-15 04:06:06 +02:00
|
|
|
'CLASS' => 'tagLevel'.$tag['level']
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-25 22:29:51 +02:00
|
|
|
//------------------------------------------------------ main part : thumbnails
|
2007-02-15 01:10:41 +01:00
|
|
|
if ( 0==$page['start']
|
|
|
|
and !isset($page['flat'])
|
|
|
|
and !isset($page['chronology_field'])
|
|
|
|
and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
|
|
|
|
)
|
2006-02-20 05:39:37 +01:00
|
|
|
{
|
2007-02-15 01:10:41 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
|
|
|
|
}
|
|
|
|
if ( !empty($page['items']) )
|
|
|
|
{
|
|
|
|
include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
|
2006-02-20 05:39:37 +01:00
|
|
|
}
|
2003-05-09 14:42:42 +02:00
|
|
|
//------------------------------------------------------- category informations
|
2006-11-10 02:10:42 +01:00
|
|
|
|
2006-02-20 05:39:37 +01:00
|
|
|
// navigation bar
|
2006-03-15 23:44:35 +01:00
|
|
|
if ($page['navigation_bar'] != '')
|
2006-02-28 05:28:06 +01:00
|
|
|
{
|
2006-02-20 05:39:37 +01:00
|
|
|
$template->assign_block_vars(
|
|
|
|
'cat_infos.navigation',
|
2006-03-15 23:44:35 +01:00
|
|
|
array(
|
|
|
|
'NAV_BAR' => $page['navigation_bar'],
|
|
|
|
)
|
2006-02-20 05:39:37 +01:00
|
|
|
);
|
|
|
|
}
|
2006-02-23 03:30:19 +01:00
|
|
|
|
2007-02-15 01:10:41 +01:00
|
|
|
if ( count($page['items']) > 0
|
2006-03-15 23:44:35 +01:00
|
|
|
and $page['section'] != 'most_visited'
|
|
|
|
and $page['section'] != 'best_rated')
|
2006-02-23 03:30:19 +01:00
|
|
|
{
|
|
|
|
// image order
|
|
|
|
$template->assign_block_vars( 'preferred_image_order', array() );
|
|
|
|
|
2006-12-01 02:46:32 +01:00
|
|
|
$order_idx = pwg_get_session_var( 'image_order', 0 );
|
2006-02-23 03:30:19 +01:00
|
|
|
|
|
|
|
$orders = get_category_preferred_image_orders();
|
2006-03-15 23:44:35 +01:00
|
|
|
for ($i = 0; $i < count($orders); $i++)
|
2006-02-23 03:30:19 +01:00
|
|
|
{
|
|
|
|
if ($orders[$i][2])
|
|
|
|
{
|
2006-03-15 23:44:35 +01:00
|
|
|
$template->assign_block_vars(
|
|
|
|
'preferred_image_order.order',
|
|
|
|
array(
|
|
|
|
'DISPLAY' => $orders[$i][0],
|
2006-07-26 23:00:16 +02:00
|
|
|
'URL' => add_url_params( duplicate_index_url(), array('image_order'=>$i) ),
|
2006-03-15 23:44:35 +01:00
|
|
|
'SELECTED_OPTION' => ($order_idx==$i ? 'SELECTED' : ''),
|
|
|
|
)
|
|
|
|
);
|
2006-02-23 03:30:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-10 02:10:42 +01:00
|
|
|
// category comment
|
|
|
|
if (isset($page['comment']) and $page['comment'] != '')
|
2003-05-09 14:42:42 +02:00
|
|
|
{
|
2006-11-10 02:10:42 +01:00
|
|
|
$template->assign_block_vars(
|
|
|
|
'cat_infos.comment',
|
|
|
|
array(
|
2007-08-26 01:10:12 +02:00
|
|
|
'COMMENTS' =>
|
|
|
|
trigger_event('render_category_description', $page['comment'])
|
2006-11-10 02:10:42 +01:00
|
|
|
)
|
|
|
|
);
|
2006-12-02 17:46:15 +01:00
|
|
|
$header_infos['COMMENT'] = strip_tags($page['comment']);
|
2003-05-09 14:42:42 +02:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------ log informations
|
2007-01-17 00:39:39 +01:00
|
|
|
pwg_log();
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2006-12-02 17:46:15 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
2006-12-14 01:58:57 +01:00
|
|
|
trigger_action('loc_end_index');
|
2006-03-28 04:16:34 +02:00
|
|
|
$template->parse('index');
|
2004-02-22 03:43:13 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
2004-02-12 00:20:38 +01:00
|
|
|
?>
|