Obvestila - popravljeno, da belezijo tudi cas posiljanja in ne samo datuma

This commit is contained in:
pero1203 2022-03-31 09:02:23 +02:00
parent e659c85446
commit 7fd584192c
2 changed files with 18 additions and 14 deletions

View File

@ -85,10 +85,10 @@ class Notifications {
// Napolnimo array prejetih sporocil
$recievedMessages = array();
$sql = sisplet_query("SELECT n.id AS id, n.recipient AS recipient, n.viewed AS viewed, m.id AS message_id, m.date AS date, m.title AS title, m.text AS text
$sql = sisplet_query("SELECT n.id AS id, n.recipient AS recipient, n.viewed AS viewed, m.id AS message_id, m.send_time AS send_time, m.title AS title, m.text AS text
FROM srv_notifications n, srv_notifications_messages m
WHERE n.recipient='".$global_user_id."' AND n.message_id=m.id
ORDER BY m.date DESC");
ORDER BY m.send_time DESC");
while($row = mysqli_fetch_array($sql)){
$recievedMessages[$row['id']] = $row;
}
@ -107,7 +107,7 @@ class Notifications {
echo $message['title'];
echo '</div>';
echo '<div class="date">';
echo $message['date'];
echo date('Y-m-d H:i:s', strtotime($message['send_time']));
echo '</div>';
echo '</div>';
@ -129,7 +129,7 @@ class Notifications {
// Napolnimo array poslanih sporocil
$sentMessages = array();
$sql = sisplet_query("SELECT * FROM srv_notifications_messages WHERE author='".$global_user_id."' ORDER BY date DESC");
$sql = sisplet_query("SELECT * FROM srv_notifications_messages WHERE author='".$global_user_id."' ORDER BY send_time DESC");
while($row = mysqli_fetch_array($sql)){
$sentMessages[$row['id']] = $row;
}
@ -147,7 +147,7 @@ class Notifications {
echo $message['title'];
echo '</div>';
echo '<div class="date">';
echo $message['date'];
echo date('Y-m-d H:i:s', strtotime($message['send_time']));
echo '</div>';
echo '</div>';
@ -327,7 +327,7 @@ class Notifications {
if($recipient_all_slo == 1 || $recipient_all_ang == 1){
// Dodamo novo sporocilo v bazo
$sql = sisplet_query("INSERT INTO srv_notifications_messages (author, date, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')");
$sql = sisplet_query("INSERT INTO srv_notifications_messages (author, send_time, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')");
$message_id = mysqli_insert_id($GLOBALS['connect_db']);
$note = '';
@ -354,7 +354,7 @@ class Notifications {
$rowU = mysqli_fetch_array($sqlU);
// Dodamo novo sporocilo v bazo
$sql = sisplet_query("INSERT INTO srv_notifications_messages (author, date, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')");
$sql = sisplet_query("INSERT INTO srv_notifications_messages (author, send_time, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')");
$message_id = mysqli_insert_id($GLOBALS['connect_db']);
// Dodamo novo sporocilo v bazo
@ -418,7 +418,7 @@ class Notifications {
$sql = sisplet_query("UPDATE srv_notifications SET viewed='1' WHERE id='$id'");
// Dobimo sporocilo
$sql = sisplet_query("SELECT n.id AS id, m.title AS title, m.text AS text, m.date AS date
$sql = sisplet_query("SELECT n.id AS id, m.title AS title, m.text AS text, m.send_time AS send_time
FROM srv_notifications n, srv_notifications_messages m
WHERE n.id='$id' AND m.id=n.message_id");
$row = mysqli_fetch_array($sql);
@ -446,11 +446,11 @@ class Notifications {
echo '</div>';
echo '<div class="date">';
echo '('.$row['date'].')';
echo '('.date('Y-m-d H:i:s', strtotime($row['send_time'])).')';
echo '</div>';
// Stara sporocila so brez editorja
$text = (strtotime($row['date']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text'];
$text = (strtotime($row['send_time']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text'];
echo '<div class="content">';
echo $text;
echo '</div>';
@ -470,17 +470,17 @@ class Notifications {
echo '<ul>';
// Loop cez vsa neprebrana sporocila
$sql = sisplet_query("SELECT n.id AS id, m.title AS title, m.text AS text, m.date AS date, n.viewed AS viewed
$sql = sisplet_query("SELECT n.id AS id, m.title AS title, m.text AS text, m.send_time AS send_time, n.viewed AS viewed
FROM srv_notifications n, srv_notifications_messages m
WHERE n.recipient='".$global_user_id."' AND n.viewed='0' AND m.id=n.message_id
ORDER BY m.date DESC");
ORDER BY m.send_time DESC");
while($row = mysqli_fetch_array($sql)){
echo '<li class="'.($row['viewed'] == 0 ? ' unread':'').' '.($active > 0 && $row['id'] == $active ? ' active':'').'">';
echo '<span class="bold">'.$row['title'].' <span class="italic">('.$row['date'].')</span></span>';
echo '<span class="bold">'.$row['title'].' <span class="italic">('.date('Y-m-d H:i:s', strtotime($row['send_time'])).')</span></span>';
// Stara sporocila so brez editorja
$text = (strtotime($row['date']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text'];
$text = (strtotime($row['send_time']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text'];
echo '<br />'.$text;
echo '</li>';

View File

@ -9584,3 +9584,7 @@ INSERT INTO srv_help (what, help) VALUES ('srv_glasovanje_archive', 'Dodaj anket
UPDATE misc SET value='21.11.16' WHERE what="version";
## !!!!! Uvozi sql/srv_help_new.sql datoteko za nove help vprasajcke
ALTER TABLE srv_notifications_messages CHANGE date send_time DATETIME(3) NOT NULL AFTER author;
UPDATE misc SET value='22.03.31' WHERE what="version";