diff options
author | z0rglub <z0rglub@piwigo.org> | 2004-06-25 20:31:48 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2004-06-25 20:31:48 +0000 |
commit | 576c2cb2f89622330a17a73eb4df2feffbab278c (patch) | |
tree | 1d886e80dd3f5ec2e61f26ca554d53683f24b68d /include/functions_category.inc.php | |
parent | 634743c328e49073342d2d45534cdb83b6b0dc81 (diff) |
- 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
Diffstat (limited to 'include/functions_category.inc.php')
-rw-r--r-- | include/functions_category.inc.php | 39 |
1 files changed, 28 insertions, 11 deletions
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 ); |