From 386864cd2612ac743e182253541bddfebed80606 Mon Sep 17 00:00:00 2001 From: nikrou Date: Thu, 28 Jan 2010 11:30:36 +0000 Subject: Feature 511 : add support for sqlite database engine Using session_write_close function when session handler use database because write is called after object destruction. git-svn-id: http://piwigo.org/svn/trunk@4781 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/calendar_base.class.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'include/calendar_base.class.php') diff --git a/include/calendar_base.class.php b/include/calendar_base.class.php index 41a15d918..4424c62f9 100644 --- a/include/calendar_base.class.php +++ b/include/calendar_base.class.php @@ -271,24 +271,20 @@ $this->get_date_where($level).' if ( empty($page['chronology_date']) ) return; - $sub_query = ''; + $sub_queries = array(); $nb_elements = count($page['chronology_date']); for ($i=0; $i<$nb_elements; $i++) { if ( 'any' === $page['chronology_date'][$i] ) { - $sub_query .= '\'any\''; + $sub_queries[] = '\'any\''; } else { - $sub_query .= pwg_db_cast_to_text($this->calendar_levels[$i]['sql']); - } - if ($i<($nb_elements-1)) - { - $sub_query .= ','; + $sub_queries[] = pwg_db_cast_to_text($this->calendar_levels[$i]['sql']); } } - $query = 'SELECT '.pwg_db_concat_ws($sub_query, '-').' AS period'; + $query = 'SELECT '.pwg_db_concat_ws($sub_queries, '-').' AS period'; $query .= $this->inner_sql .' AND ' . $this->date_field . ' IS NOT NULL GROUP BY period'; @@ -296,12 +292,12 @@ GROUP BY period'; $current = implode('-', $page['chronology_date'] ); $upper_items = array_from_query( $query, 'period'); - usort($upper_items, 'version_compare'); + usort($upper_items, 'date_compare'); $upper_items_rank = array_flip($upper_items); if ( !isset($upper_items_rank[$current]) ) { array_push($upper_items, $current);// just in case (external link) - usort($upper_items, 'version_compare'); + usort($upper_items, 'date_compare'); $upper_items_rank = array_flip($upper_items); } $current_rank = $upper_items_rank[$current]; -- cgit v1.2.3