2003-05-09 14:42:42 +02:00
|
|
|
<?php
|
2004-02-07 12:50:26 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2008-05-15 20:43:33 +02:00
|
|
|
// | Piwigo - a PHP based picture gallery |
|
2004-02-07 12:50:26 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2009-01-05 00:28:36 +01:00
|
|
|
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
|
2008-05-15 20:43:33 +02:00
|
|
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
|
|
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
2004-02-07 12:50:26 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | 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
|
|
|
}
|
|
|
|
|
2008-02-27 21:25:18 +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']);
|
2007-10-01 17:56:42 +02:00
|
|
|
redirect(duplicate_index_url());
|
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'];
|
2008-02-27 21:25:18 +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
|
|
|
}
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign('TITLE', $template_title);
|
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
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_MODE_NORMAL',
|
|
|
|
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
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_MODE_FLAT',
|
|
|
|
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',
|
|
|
|
);
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_MODE_CREATED',
|
|
|
|
duplicate_index_url( $chronology_params, array('start', 'flat') )
|
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';
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_MODE_POSTED',
|
|
|
|
duplicate_index_url( $chronology_params, array('start', 'flat') )
|
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
|
|
|
);
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_MODE_'.strtoupper($chronology_field),
|
|
|
|
$url
|
2006-03-17 05:13:19 +01:00
|
|
|
);
|
2006-02-20 05:39:37 +01:00
|
|
|
}
|
|
|
|
|
2006-03-15 23:44:35 +01:00
|
|
|
if ('search' == $page['section'])
|
2006-01-27 23:40:51 +01:00
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_SEARCH_RULES',
|
|
|
|
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
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_EDIT',
|
|
|
|
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
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-02-27 21:25:18 +01:00
|
|
|
if (is_admin() and !empty($page['items']))
|
2006-03-22 02:01:47 +01:00
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign(
|
|
|
|
'U_CADDIE',
|
|
|
|
add_url_params(duplicate_index_url(), array('caddie'=>1) )
|
2007-10-12 05:27:34 +02:00
|
|
|
);
|
|
|
|
}
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2007-10-12 05:27:34 +02:00
|
|
|
if ( $page['section']=='search' and $page['start']==0 and
|
|
|
|
!isset($page['chronology_field']) and isset($page['qsearch_details']) )
|
2006-08-15 04:06:06 +02:00
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign('QUERY_SEARCH',
|
2007-10-12 05:27:34 +02:00
|
|
|
htmlspecialchars($page['qsearch_details']['q']) );
|
2006-08-15 04:06:06 +02:00
|
|
|
|
2007-10-16 03:46:09 +02:00
|
|
|
$cats = array_merge(
|
2007-10-12 05:27:34 +02:00
|
|
|
(array)@$page['qsearch_details']['matching_cats_no_images'],
|
|
|
|
(array)@$page['qsearch_details']['matching_cats'] );
|
2007-10-16 03:46:09 +02:00
|
|
|
if (count($cats))
|
2007-10-12 05:27:34 +02:00
|
|
|
{
|
2007-10-16 03:46:09 +02:00
|
|
|
usort($cats, 'name_compare');
|
2007-10-12 05:27:34 +02:00
|
|
|
$hints = array();
|
2007-10-16 03:46:09 +02:00
|
|
|
foreach ( $cats as $cat )
|
2006-08-15 04:06:06 +02:00
|
|
|
{
|
2008-10-18 02:45:45 +02:00
|
|
|
$hints[] = get_cat_display_name( array($cat), '', false );
|
2007-10-12 05:27:34 +02:00
|
|
|
}
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign( 'category_search_results', $hints);
|
2007-10-12 05:27:34 +02:00
|
|
|
}
|
|
|
|
|
2007-10-16 03:46:09 +02:00
|
|
|
$tags = (array)@$page['qsearch_details']['matching_tags'];
|
2007-10-12 05:27:34 +02:00
|
|
|
if (count($tags))
|
|
|
|
{
|
|
|
|
usort($tags, 'name_compare');
|
|
|
|
$hints = array();
|
|
|
|
foreach ( $tags as $tag )
|
|
|
|
{
|
|
|
|
$hints[] =
|
|
|
|
'<a href="' . make_index_url(array('tags'=>array($tag))) . '">'
|
|
|
|
.$tag['name']
|
|
|
|
.'</a>';
|
2006-08-15 04:06:06 +02:00
|
|
|
}
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign( 'tag_search_results', $hints);
|
2006-08-15 04:06:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-20 05:39:37 +01:00
|
|
|
// navigation bar
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign( 'NAV_BAR', $page['navigation_bar'] );
|
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
|
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();
|
2008-09-11 23:40:00 +02:00
|
|
|
foreach ($orders as $order_id => $order)
|
2006-02-23 03:30:19 +01:00
|
|
|
{
|
2008-09-11 23:40:00 +02:00
|
|
|
if ($order[2])
|
2006-02-23 03:30:19 +01:00
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->append(
|
|
|
|
'image_orders',
|
2006-03-15 23:44:35 +01:00
|
|
|
array(
|
2008-09-11 23:40:00 +02:00
|
|
|
'DISPLAY' => $order[0],
|
|
|
|
'URL' => add_url_params(
|
|
|
|
duplicate_index_url(),
|
|
|
|
array('image_order' => $order_id)
|
|
|
|
),
|
|
|
|
'SELECTED' => ($order_idx == $order_id ? true:false),
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
|
|
|
);
|
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
|
|
|
{
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->assign('CONTENT_DESCRIPTION', $page['comment'] );
|
2003-05-09 14:42:42 +02:00
|
|
|
}
|
2008-09-25 02:39:12 +02:00
|
|
|
|
|
|
|
// include menubar
|
|
|
|
include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
|
|
|
|
|
|
|
|
//------------------------------------------------------ main part : thumbnails
|
|
|
|
if ( 0==$page['start']
|
|
|
|
and !isset($page['flat'])
|
|
|
|
and !isset($page['chronology_field'])
|
|
|
|
and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
|
|
|
|
and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
|
|
|
|
}
|
|
|
|
if ( !empty($page['items']) )
|
|
|
|
{
|
|
|
|
include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
|
|
|
|
}
|
|
|
|
//------------------------------------------------------- category informations
|
|
|
|
|
|
|
|
// slideshow
|
|
|
|
// execute after init thumbs in order to have all picture informations
|
|
|
|
if (!empty($page['cat_slideshow_url']))
|
|
|
|
{
|
|
|
|
if (isset($_GET['slideshow']))
|
|
|
|
{
|
|
|
|
redirect($page['cat_slideshow_url']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$template->assign('U_SLIDESHOW', $page['cat_slideshow_url']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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');
|
2008-03-01 14:12:07 +01:00
|
|
|
$template->pparse('index');
|
2008-10-10 01:14:43 +02:00
|
|
|
//------------------------------------------------------------ log informations
|
|
|
|
pwg_log();
|
2004-02-22 03:43:13 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
2004-02-12 00:20:38 +01:00
|
|
|
?>
|