From f6b86b8c2a62fe776cb3c969a69dc8e69d9e464c Mon Sep 17 00:00:00 2001 From: ruan Date: Fri, 9 Sep 2016 20:04:03 +0200 Subject: [PATCH] Add month translation option --- inc/page.php | 6 ++++++ inc/settings.php | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/inc/page.php b/inc/page.php index c505c21..e086ab7 100644 --- a/inc/page.php +++ b/inc/page.php @@ -302,6 +302,12 @@ class Page { function millis_to_date($millis) { $ts = $millis / 1000; $result = strftime($this->settings->date_format, $ts); + $translations = $this->settings->date_month_translations; + if ($translations !== null) { + foreach ($translations as $key => $val) { + $result = str_replace($key, $val, $result); + } + } return $result; } diff --git a/inc/settings.php b/inc/settings.php index 6efad5c..5569923 100644 --- a/inc/settings.php +++ b/inc/settings.php @@ -71,6 +71,25 @@ final class Settings { // Enable error pages. $this->error_pages = true; + $this->date_month_translations = null; + + /* + $this->date_month_translations = array( + "January" => "Month 1", + "February" => "Month 2", + "March" => "Month 3", + "April" => "Month 4", + "May" => "Month 5", + "June" => "Month 6", + "July" => "Month 7", + "August" => "Month 8", + "September" => "Month 9", + "October" => "Month 10", + "November" => "Month 11", + "December" => "Month 12", + ); + */ + /*** End of configuration ***/ @@ -81,15 +100,6 @@ final class Settings { ini_set("display_errors", 1); } - $this->table = array( - 'bans' => "${table_prefix}bans", - 'mutes' => "${table_prefix}mutes", - 'warnings' => "${table_prefix}warnings", - 'kicks' => "${table_prefix}kicks", - 'history' => "${table_prefix}history", - 'servers' => "${table_prefix}servers", - ); - $this->active_query = ""; if ($driver === "pgsql") { @@ -101,6 +111,16 @@ final class Settings { $this->active_query = "WHERE active=" . Settings::$TRUE; } + // Internal table names, do not translate. + $this->table = array( + 'bans' => "${table_prefix}bans", + 'mutes' => "${table_prefix}mutes", + 'warnings' => "${table_prefix}warnings", + 'kicks' => "${table_prefix}kicks", + 'history' => "${table_prefix}history", + 'servers' => "${table_prefix}servers", + ); + $this->driver = $driver; if ($connect) { if ($username === "" && $password === "") {