aboutsummaryrefslogtreecommitdiffstats
path: root/include/calendar_base.class.php
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2010-01-28 11:30:36 +0000
committernikrou <nikrou@piwigo.org>2010-01-28 11:30:36 +0000
commit386864cd2612ac743e182253541bddfebed80606 (patch)
treef2c8a0d0f72bb919e28f751c8fc20544a919ba8e /include/calendar_base.class.php
parent22191d91a223c4e71399f32ff42cf61a53e9d19d (diff)
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
Diffstat (limited to '')
-rw-r--r--include/calendar_base.class.php16
1 files changed, 6 insertions, 10 deletions
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];