Changeset 13086 for trunk/include


Ignore:
Timestamp:
Feb 10, 2012, 6:02:54 PM (12 years ago)
Author:
mistic100
Message:

feature 2564: small changes in infos list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r13085 r13086  
    547547      $tok = strtok('- :');
    548548    }
     549   
     550    if ($ymdhms[0] < 1970) return false;
     551    if (!isset($ymdhms[3])) $ymdhms[3] = 12;
     552    if (!isset($ymdhms[4])) $ymdhms[4] = 0;
     553    if (!isset($ymdhms[5])) $ymdhms[5] = 0;
    549554    $original = mktime($ymdhms[3],$ymdhms[4],$ymdhms[5],$ymdhms[1],$ymdhms[2],$ymdhms[0]);
    550555  }
     
    552557  // array of time period chunks
    553558  $chunks = array(
    554       array(60 * 60 * 24 * 365 , 'year'),
    555       array(60 * 60 * 24 * 30 , 'month'),
    556       array(60 * 60 * 24 * 7, 'week'),
    557       array(60 * 60 * 24 , 'day'),
    558       array(60 * 60 , 'hour'),
    559       array(60 , 'minute'),
    560       array(1 , 'second'),
     559    'year' => 60 * 60 * 24 * 365,
     560    'month' => 60 * 60 * 24 * 30,
     561    'week' => 60 * 60 * 24 * 7,
     562    'day' => 60 * 60 * 24,
     563    'hour' => 60 * 60,
     564    'minute' => 60,
     565    'second' => 1,
    561566  );
    562567 
     
    565570 
    566571  $print = null;
    567   for ($i = 0, $j = count($chunks); $i < $j; $i++)
    568   {
    569     $seconds = $chunks[$i][0];
    570     $name = $chunks[$i][1];
     572  foreach ($chunks as $name => $seconds)
     573  {
    571574    if (($count = floor($since / $seconds)) != 0)
    572575    {
    573       $print.= ($count == 1) ? '1 '.l10n($name).' ' : $count.' '.l10n($name.'s').' ';
     576      $print.= l10n_dec('%d '.$name, '%d '.$name.'s', $count);
    574577      $since-= $count*$seconds;
    575578    }
    576     if ($name == $stop)
     579    if (!empty($print) and $chunks[$name] <= $chunks[$stop])
    577580    {
    578581      break;
Note: See TracChangeset for help on using the changeset viewer.