Browse Source

fix time in public form

rajven 3 năm trước cách đây
mục cha
commit
6e078fce07
3 tập tin đã thay đổi với 15 bổ sung14 xóa
  1. 6 6
      html/inc/common.php
  2. 2 2
      html/inc/datetimefilter.php
  3. 7 6
      html/public/blocked.php

+ 6 - 6
html/inc/common.php

@@ -1266,15 +1266,15 @@ return $date1;
 }
 
 function GetNowTimeString() {
-$date_now = DateTimeImmutable::createFromFormat('U', time());
-$now = $date_now->format('Y-m-d H:i:s');
-return $now;
+$now = new DateTimeImmutable('now');
+$result = $now->format('Y-m-d H:i:s');
+return $result;
 }
 
 function GetNowDayString() {
-$date_now = DateTimeImmutable::createFromFormat('U', time());
-$now = $date_now->format('Y-m-d');
-return $now;
+$now = new DateTimeImmutable('now');
+$result = $now->format('Y-m-d');
+return $result;
 }
 
 function get_ip_subnet($db,$ip)

+ 2 - 2
html/inc/datetimefilter.php

@@ -2,7 +2,7 @@
 
 if (!defined("CONFIG")) die("Not defined");
 
-$datetime_start = new DateTime(strftime('%Y-%m-%d 00:00:00',time()));
+$datetime_start = DateTime::createFromFormat("Y-m-d 00:00:00",date("Y-m-d"));
 
 if (empty($default_date_shift)) { $default_date_shift='h'; }
 
@@ -48,7 +48,7 @@ if (!isset($datetime_stop) or empty($datetime_stop)) {
         }
     if ($default_date_shift==='m') {
         $datetime_stop = new DateTime($date1);
-        $datetime_stop->modify('+1 day');
+        $datetime_stop->modify('+1 month');
         $time_stop = $datetime_stop->getTimestamp();
         $date2 = $datetime_start->format('Y-m-d H:i:s');
         $date1 = $datetime_start->format('Y-m-1 H:i:s');

+ 7 - 6
html/public/blocked.php

@@ -11,16 +11,17 @@ if (! isset($auth_ip)) { $auth_ip = get_user_ip(); }
 if (! isset($auth_ip)) { print "Error detecting user!!!"; }
 
 /* month */
-$pmdate_start = DateTimeImmutable::createFromFormat('U', mktime(0, 0, 0, date("m"), 1, date("Y")));
+$pmdate_start = DateTime::createFromFormat("Y-m-d",date("Y-m-d"));
+$pmdate_start->modify('+1 day');
 $date1m = $pmdate_start->format('Y-m-d');
-$pmdate_stop = DateTimeImmutable::createFromFormat('U', mktime(0, 0, 0, date("m")+1, 1, date("Y")));
+$pmdate_stop = DateTime::createFromFormat("Y-m-1",date("Y-m-d"));
 $date2m = $pmdate_stop->format('Y-m-d');
 
 /* day */
-$pdate_start = DateTimeImmutable::createFromFormat('U', mktime(0, 0, 0, date("m"), date("d"), date("Y")));
+$pdate_start = DateTime::createFromFormat("Y-m-d",date("Y-m-d"));
 $date1 = $pdate_start->format('Y-m-d');
-$pdate_stop = DateTimeImmutable::createFromFormat('U', mktime(0, 0, 0, date("m"), date("d")+1, date("Y")));
-$date2 = $pdate_stop->format('Y-m-d');
+$pdate_start->modify('+1 day');
+$date2 = $pdate_start->format('Y-m-d');
 
 ?>
 
@@ -66,7 +67,7 @@ $year = $date_now->format('Y');
 <tr>
 <td><b><?php echo WEB_cell_login; ?></b></td> <td><?php print $user['login']; ?></td>
 </tr><tr>
-<td><b>ФИО</b></td> <td><?php print $user['fio']; ?></td>
+<td><b><?php echo WEB_cell_fio; ?></b></td> <td><?php print $user['fio']; ?></td>
 </tr><tr>
 <td> <?php echo WEB_msg_access_login; ?> </td> <td><b><?php 
 if ($user['enabled'] and !$user['blocked']) { print WEB_msg_enabled; }