aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_category.inc.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-06-15 20:02:03 +0000
committerz0rglub <z0rglub@piwigo.org>2004-06-15 20:02:03 +0000
commitdd1354aed2511c6c7c5e2abee524ff94088f608b (patch)
treead630a942750d643a2dab0c0c877ae7552792983 /include/functions_category.inc.php
parent880d2761592cbf9b553b426fe729cebba926fbdd (diff)
- adds calendar category
git-svn-id: http://piwigo.org/svn/trunk@429 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_category.inc.php')
-rw-r--r--include/functions_category.inc.php56
1 files changed, 48 insertions, 8 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index fbeff41e9..809753726 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -59,11 +59,12 @@ function check_restrictions( $category_id )
* The argument is a right parameter if corresponds to one of these :
*
* - is numeric and corresponds to a category in the database
- * - is equals 'fav' (for favorites)
- * - is equals 'search' (when the result of a search is displayed)
- * - is equals 'most_visited'
- * - is equals 'best_rated'
- * - is equals 'recent'
+ * - equals 'fav' (for favorites)
+ * - equals 'search' (when the result of a search is displayed)
+ * - equals 'most_visited'
+ * - equals 'best_rated'
+ * - equals 'recent'
+ * _ equals 'calendar'
*
* The function fills the global var $page['cat'] and returns nothing
*
@@ -95,7 +96,8 @@ function check_cat_id( $cat )
or $cat == 'search'
or $cat == 'most_visited'
or $cat == 'best_rated'
- or $cat == 'recent' )
+ or $cat == 'recent'
+ or $cat == 'calendar' )
{
$page['cat'] = $cat;
}
@@ -427,8 +429,11 @@ function initialize_category( $calling_page = 'category' )
}
else
{
- if ( $page['cat'] == 'search' or $page['cat'] == 'most_visited'
- or $page['cat'] == 'recent' or $page['cat'] == 'best_rated' )
+ if ( $page['cat'] == 'search'
+ or $page['cat'] == 'most_visited'
+ or $page['cat'] == 'recent'
+ or $page['cat'] == 'best_rated'
+ or $page['cat'] == 'calendar' )
{
// we must not show pictures of a forbidden category
if ( $user['forbidden_categories'] != '' )
@@ -537,6 +542,41 @@ function initialize_category( $calling_page = 'category' )
$page['nb_image_page'] = $conf['top_number'] - $page['start'];
}
}
+ else if ( $page['cat'] == 'calendar' )
+ {
+ $page['cat_nb_images'] = 0;
+ $page['title'] = $lang['calendar'];
+ if ( isset( $_GET['year'] )
+ and preg_match( '/^\d+$/', $_GET['year'] ) )
+ {
+ $page['calendar_year'] = (int)$_GET['year'];
+ }
+ if ( isset( $_GET['month'] )
+ and preg_match( '/^(\d+)\.(\d{2})$/', $_GET['month'], $matches ) )
+ {
+ $page['calendar_year'] = (int)$matches[1];
+ $page['calendar_month'] = (int)$matches[2];
+ }
+ if ( isset( $page['calendar_year'] )
+ or isset( $page['calendar_month'] ) )
+ {
+ $page['title'] .= ' (';
+ if ( isset( $page['calendar_month'] ) )
+ {
+ $page['title'] .= $lang['month'][$page['calendar_month']].' ';
+ }
+ $page['title'] .= $page['calendar_year'];
+ $page['title'] .= ')';
+ }
+ if ( isset( $forbidden ) )
+ {
+ $page['where'] = ' WHERE '.$forbidden;
+ }
+ else
+ {
+ $page['where'] = ' WHERE 1=1';
+ }
+ }
if ( isset($query))
{