From ab8916a0daf5147638d01d35745ef444f862424a Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Fri, 22 May 2020 09:39:10 +0200 Subject: [PATCH] Fixed error functions date default type --- pandora_console/include/functions.php | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index eaea211d2a..284b8c83b7 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -477,7 +477,8 @@ function set_user_language() /** - * INTERNAL (use ui_print_timestamp for output): Transform an amount of time in seconds into a human readable + * INTERNAL (use ui_print_timestamp for output): + * Transform an amount of time in seconds into a human readable * strings of minutes, hours or days. * * @param integer $seconds Seconds elapsed time @@ -488,17 +489,11 @@ function set_user_language() */ function human_time_description_raw($seconds, $exactly=false, $units='large') { - switch ($units) { - case 'large': - $secondsString = __('seconds'); - $daysString = __('days'); - $monthsString = __('months'); - $yearsString = __('years'); - $minutesString = __('minutes'); - $hoursString = __('hours'); - $nowString = __('Now'); - break; + if (isset($units) === false || empty($units) === true) { + $units = 'large'; + } + switch ($units) { case 'tiny': $secondsString = __('s'); $daysString = __('d'); @@ -508,6 +503,17 @@ function human_time_description_raw($seconds, $exactly=false, $units='large') $hoursString = __('h'); $nowString = __('N'); break; + + default: + case 'large': + $secondsString = __('seconds'); + $daysString = __('days'); + $monthsString = __('months'); + $yearsString = __('years'); + $minutesString = __('minutes'); + $hoursString = __('hours'); + $nowString = __('Now'); + break; } if (empty($seconds)) {