diff options
author | nikrou <nikrou@piwigo.org> | 2010-02-03 09:26:32 +0000 |
---|---|---|
committer | nikrou <nikrou@piwigo.org> | 2010-02-03 09:26:32 +0000 |
commit | e1de0d6fafb4e22e90f9277b9f60baa8943e1228 (patch) | |
tree | 32806a8f2cadd8ab7c67c9d0c4118b6f0a0eddd4 /include/functions_calendar.inc.php | |
parent | 7fda6e5af949b66378055571377048af430df0fd (diff) |
Feature 511 : fix problems with calendar functions
add pwg_db_concat() function
git-svn-id: http://piwigo.org/svn/trunk@4833 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_calendar.inc.php')
-rw-r--r-- | include/functions_calendar.inc.php | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php index 73df86fbb..cc55578f6 100644 --- a/include/functions_calendar.inc.php +++ b/include/functions_calendar.inc.php @@ -290,23 +290,35 @@ WHERE id IN (' . implode(',',$page['items']) .')'; pwg_debug('end initialize_calendar'); } -/* - * callback to sort array with date comparaison - * - **/ -function date_compare(&$a, &$b) +function array_to_int($array) { - $parts = explode('-', $a); - foreach ($parts as &$p) { - $p = (int)$p; - } - $a = implode('-', $parts); - $parts = explode('-', $b); - foreach ($parts as &$p) { - $p = (int)$p; + foreach ($array as $k => $v) + { + if ((int)$k==$k) + { + $key = (int) $k; + } + else + { + $key = $k; + } + if (is_array($v)) + { + $result[$key] = array_to_int($v); + } + else + { + if (is_int($v)) + { + $value = (int) $v; + } + else + { + $value = $v; + } + $result[$key] = $value; + } } - $b = implode('-', $parts); - - return strcmp($a, $b); + return $result; } ?>
\ No newline at end of file |