From 576c2cb2f89622330a17a73eb4df2feffbab278c Mon Sep 17 00:00:00 2001 From: z0rglub Date: Fri, 25 Jun 2004 20:31:48 +0000 Subject: - code refactoring - for calendar category, adds the support of the day request (displays the list of category for this day) git-svn-id: http://piwigo.org/svn/trunk@442 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_category.inc.php | 39 +++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'include/functions_category.inc.php') diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 50dfe348e..500070f80 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -555,39 +555,56 @@ function initialize_category( $calling_page = 'category' ) { $page['cat_nb_images'] = 0; $page['title'] = $lang['calendar']; - if ( isset( $_GET['year'] ) - and preg_match( '/^\d+$/', $_GET['year'] ) ) + 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 ) ) + 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'] ) ) + if (isset($_GET['day']) + and preg_match('/^(\d+)\.(\d{2})\.(\d{2})$/', + $_GET['day'], + $matches)) + { + $page['calendar_year'] = (int)$matches[1]; + $page['calendar_month'] = (int)$matches[2]; + $page['calendar_day'] = (int)$matches[3]; + } + if (isset($page['calendar_year'])) { $page['title'] .= ' ('; - if ( isset( $page['calendar_month'] ) ) + if (isset($page['calendar_day'])) + { + $unixdate = mktime(0,0,0, + $page['calendar_month'], + $page['calendar_day'], + $page['calendar_year']); + $page['title'].= $lang['day'][date("w", $unixdate)]; + $page['title'].= ' '.$page['calendar_day'].', '; + } + if (isset($page['calendar_month'])) { $page['title'] .= $lang['month'][$page['calendar_month']].' '; } $page['title'] .= $page['calendar_year']; $page['title'] .= ')'; } - if ( isset( $forbidden ) ) + if (isset($forbidden)) { - $page['where'] = ' WHERE '.$forbidden; + $page['where'] = 'WHERE '.$forbidden; } else { - $page['where'] = ' WHERE 1=1'; + $page['where'] = 'WHERE 1=1'; } } - if ( isset($query)) + if (isset($query)) { $result = mysql_query( $query ); $row = mysql_fetch_array( $result ); -- cgit v1.2.3