- fix use $page['nb_image_page'] instead of $user... when creating the nav bar (same as category_default)
- rewrote function format_date without regular expressions (faster); parameter date type is not used anymore (but I left it there for now) git-svn-id: http://piwigo.org/svn/trunk@3117 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
341e35196f
commit
5c001820a1
2 changed files with 19 additions and 39 deletions
|
@ -578,54 +578,34 @@ function format_date($date, $type = 'us', $show_time = false)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
list($year,$month,$day,$hour,$minute,$second) = array(0,0,0,0,0,0);
|
$ymdhms = array();
|
||||||
|
$tok = strtok( $date, '- :');
|
||||||
|
while ($tok !== false)
|
||||||
|
{
|
||||||
|
$ymdhms[] = $tok;
|
||||||
|
$tok = strtok('- :');
|
||||||
|
}
|
||||||
|
|
||||||
switch ( $type )
|
if ( count($ymdhms)<3 )
|
||||||
{
|
{
|
||||||
case 'us' :
|
return false;
|
||||||
{
|
|
||||||
list($year,$month,$day) = explode('-', $date);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'unix' :
|
|
||||||
{
|
|
||||||
list($year,$month,$day,$hour,$minute) =
|
|
||||||
explode('.', date('Y.n.j.G.i', $date));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'mysql_datetime' :
|
|
||||||
{
|
|
||||||
preg_match('/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/',
|
|
||||||
$date, $out);
|
|
||||||
list($year,$month,$day,$hour,$minute,$second) =
|
|
||||||
array($out[1],$out[2],$out[3],$out[4],$out[5],$out[6]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'mysql_date' :
|
|
||||||
{
|
|
||||||
preg_match('/^(\d{4})-(\d{2})-(\d{2})$/',
|
|
||||||
$date, $out);
|
|
||||||
list($year,$month,$day) =
|
|
||||||
array($out[1],$out[2],$out[3]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$formated_date = '';
|
$formated_date = '';
|
||||||
// before 1970, Microsoft Windows can't mktime
|
// before 1970, Microsoft Windows can't mktime
|
||||||
if ($year >= 1970)
|
if ($ymdhms[0] >= 1970)
|
||||||
{
|
{
|
||||||
// we ask midday because Windows think it's prior to midnight with a
|
// we ask midday because Windows think it's prior to midnight with a
|
||||||
// zero and refuse to work
|
// zero and refuse to work
|
||||||
$formated_date.= $lang['day'][date('w', mktime(12,0,0,$month,$day,$year))];
|
$formated_date.= $lang['day'][date('w', mktime(12,0,0,$ymdhms[1],$ymdhms[2],$ymdhms[0]))];
|
||||||
}
|
}
|
||||||
$formated_date.= ' '.$day;
|
$formated_date.= ' '.$ymdhms[2];
|
||||||
$formated_date.= ' '.$lang['month'][(int)$month];
|
$formated_date.= ' '.$lang['month'][(int)$ymdhms[1]];
|
||||||
$formated_date.= ' '.$year;
|
$formated_date.= ' '.$ymdhms[0];
|
||||||
if ($show_time)
|
if ($show_time and count($ymdhms)>=5 )
|
||||||
{
|
{
|
||||||
$formated_date.= ' '.$hour.':'.$minute;
|
$formated_date.= ' '.$ymdhms[3].':'.$ymdhms[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $formated_date;
|
return $formated_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ if (count($page['items']) > $user['nb_image_page'])
|
||||||
duplicate_index_url(array(), array('start')),
|
duplicate_index_url(array(), array('start')),
|
||||||
count($page['items']),
|
count($page['items']),
|
||||||
$page['start'],
|
$page['start'],
|
||||||
$user['nb_image_page'],
|
$page['nb_image_page'],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue