mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 16:32:45 +00:00
Remove deprecated functions (https://php.watch/versions/8.1/strftime-gmstrftime-deprecated)
This commit is contained in:
parent
1e1fc2a9b1
commit
1ca2d09137
@ -394,7 +394,8 @@ class Page {
|
||||
*/
|
||||
function millis_to_date($millis) {
|
||||
$ts = $millis / 1000;
|
||||
$result = strftime($this->settings->date_format, $ts);
|
||||
$formatter = new IntlDateFormatter($this->settings->lang, IntlDateFormatter::LONG, IntlDateFormatter::NONE, $this->settings->timezone, IntlDateFormatter::GREGORIAN, $this->settings->date_format);
|
||||
$result = $formatter->format($ts);
|
||||
$translations = $this->settings->date_month_translations;
|
||||
if ($translations !== null) {
|
||||
foreach ($translations as $key => $val) {
|
||||
|
@ -52,9 +52,9 @@ class Settings {
|
||||
$this->timezone = "UTC";
|
||||
|
||||
// The date format can be changed here.
|
||||
// https://secure.php.net/manual/en/function.strftime.php
|
||||
// Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
|
||||
$this->date_format = '%B %d, %Y, %H:%M';
|
||||
// https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table
|
||||
// Example output of default format: July 2, 2015, 09:19
|
||||
$this->date_format = 'MMMM d, yyyy, HH:mm';
|
||||
|
||||
// Amount of bans/mutes/warnings to show on each page
|
||||
$this->limit_per_page = 10;
|
||||
@ -161,8 +161,6 @@ class Settings {
|
||||
}
|
||||
$this->verify = false;
|
||||
|
||||
$this->test_strftime();
|
||||
|
||||
$this->init_tables();
|
||||
|
||||
if ($connect) {
|
||||
@ -256,25 +254,6 @@ class Settings {
|
||||
die("Database error");
|
||||
}
|
||||
|
||||
private function test_strftime() {
|
||||
$test = gmstrftime($this->date_format, 0);
|
||||
if ($test == false) {
|
||||
ob_start();
|
||||
var_dump($test);
|
||||
$testdump = ob_get_clean();
|
||||
die("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
|
||||
}
|
||||
|
||||
$test = gmstrftime("%Y-%m-%d %H:%M", 0);
|
||||
if ($test !== "1970-01-01 00:00") {
|
||||
ob_start();
|
||||
var_dump($test);
|
||||
$testdump = ob_get_clean();
|
||||
die("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>Actual result: $testdump");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function init_tables() {
|
||||
$this->table = array();
|
||||
foreach (array('bans', 'mutes', 'warnings', 'kicks', 'history', 'servers', 'config') as $t) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user