Changeset 18729
- Timestamp:
- Oct 23, 2012, 10:19:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r18629 r18729 510 510 $formated_date.= ' '.$lang['month'][(int)$ymdhms[1]]; 511 511 } 512 512 513 513 $formated_date.= ' '.$ymdhms[0]; 514 514 if ($show_time and count($ymdhms)>=5 ) … … 533 533 $tok = strtok('- :'); 534 534 } 535 535 536 536 if ($ymdhms[0] < 1970) return false; 537 537 if (!isset($ymdhms[3])) $ymdhms[3] = 12; … … 540 540 $original = mktime($ymdhms[3],$ymdhms[4],$ymdhms[5],$ymdhms[1],$ymdhms[2],$ymdhms[0]); 541 541 } 542 542 543 543 // array of time period chunks 544 544 $chunks = array( … … 551 551 'second' => 1, 552 552 ); 553 553 554 554 $today = time(); /* Current unix time */ 555 555 $since = abs($today - $original); 556 556 557 557 $print = null; 558 558 foreach ($chunks as $name => $seconds) … … 569 569 } 570 570 571 if ($today > $original) 571 if ($today > $original) 572 572 { 573 573 $print = sprintf(l10n('%s ago'), $print); … … 577 577 $print = sprintf(l10n('%s in the future'), $print); 578 578 } 579 579 580 580 return $print; 581 581 } … … 1422 1422 if ($nb_element > $nb_element_page) 1423 1423 { 1424 $cur_page = ceil($start / $nb_element_page) + 1; 1424 $url_start = $url.$start_str; 1425 1426 $cur_page = $navbar['CURRENT_PAGE'] = $start / $nb_element_page + 1; 1425 1427 $maximum = ceil($nb_element / $nb_element_page); 1428 1429 $start = $nb_element_page * round( $start / $nb_element_page ); 1426 1430 $previous = $start - $nb_element_page; 1427 1431 $next = $start + $nb_element_page; 1428 1432 $last = ($maximum - 1) * $nb_element_page; 1429 1433 1430 $navbar['CURRENT_PAGE'] = $cur_page;1431 1432 1434 // link to first page and previous page? 1433 1435 if ($cur_page != 1) 1434 1436 { 1435 1437 $navbar['URL_FIRST'] = $url; 1436 $navbar['URL_PREV'] = $ url.($previous > 0 ? $start_str.$previous : '');1438 $navbar['URL_PREV'] = $previous > 0 ? $url_start.$previous : $url; 1437 1439 } 1438 1440 // link on next page and last page? 1439 1441 if ($cur_page != $maximum) 1440 1442 { 1441 $navbar['URL_NEXT'] = $url .$start_str.$next;1442 $navbar['URL_LAST'] = $url .$start_str.$last;1443 $navbar['URL_NEXT'] = $url_start.($next < $last ? $next : $last); 1444 $navbar['URL_LAST'] = $url_start.$last; 1443 1445 } 1444 1446 … … 1446 1448 $navbar['pages'] = array(); 1447 1449 $navbar['pages'][1] = $url; 1448 $navbar['pages'][$maximum] = $url.$start_str.$last; 1449 1450 for ($i = max($cur_page - $pages_around , 2), $stop = min($cur_page + $pages_around + 1, $maximum); 1450 for ($i = max( floor($cur_page) - $pages_around , 2), $stop = min( ceil($cur_page) + $pages_around + 1, $maximum); 1451 1451 $i < $stop; $i++) 1452 1452 { 1453 1453 $navbar['pages'][$i] = $url.$start_str.(($i - 1) * $nb_element_page); 1454 1454 } 1455 ksort($navbar['pages']);1455 $navbar['pages'][$maximum] = $url_start.$last; 1456 1456 } 1457 1457 return $navbar;
Note: See TracChangeset
for help on using the changeset viewer.