From 65ba89198f1392341ba55b3e2b6fe12b799a3c1d Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 5 Dec 2019 15:59:52 +0900 Subject: [PATCH] Update config.php --- system/config.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/system/config.php b/system/config.php index 101804b..202dbe5 100644 --- a/system/config.php +++ b/system/config.php @@ -89,7 +89,27 @@ if(!check_function_exists("get_current_timestamp")) { // adjust time if(!array_key_empty("adjust", $options)) { - $timestamp = strtotime($options['adjust'], $timestamp); + $units = array( + "s" => array( 1, "second", "seconds"), + "m" => array( 60, "minute", "minutes"), + "h" => array( 120, "hour", "hours" ), + "d" => array(86400, "day", "days" ) + ); + $adjust = trim($options['adjust']); + $_adjust = ""; + if(strlen($adjust) > 0) { + $_L = intval(substr($adjust, 0, -1)); + $_R = substr($adjust, -1); + if(array_key_exists($_R, $units)) { + if(abs($_L) > 1) { + $_adjust = sprintf("%s %s", $_L, $units[$_R][2]); + } else { + $_adjust = sprintf("%s %s", $_L, $units[$_R][1]); + } + } + } + + $timestamp = strtotime($_adjust, $timestamp); } return $timestamp;