Changeset 873 for trunk/Modules/Chat/Chat.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Chat/Chat.php
r790 r873 14 14 { 15 15 $Num = dechex($Num); 16 return (substr($Num, 4, 2).substr($Num, 2, 2).substr($Num, 0, 2));16 return (substr($Num, 4, 2).substr($Num, 2, 2).substr($Num, 0, 2)); 17 17 } 18 18 … … 21 21 global $MonthNames; 22 22 23 if (!$this->System->User->CheckPermission('Chat', 'Display')) return('Nemáte oprávnění');23 if (!$this->System->User->CheckPermission('Chat', 'Display')) return ('Nemáte oprávnění'); 24 24 25 if (array_key_exists('date', $_GET)) $Date = $_GET['date'];25 if (array_key_exists('date', $_GET)) $Date = $_GET['date']; 26 26 else $Date = date('Y-m-d'); 27 27 $DateParts = explode('-', $Date); … … 35 35 $EndDateParts = explode('-', $EndDateTimeParts[0]); 36 36 37 if (!array_key_exists('year', $_SESSION)) $_SESSION['year'] = date('Y', time());38 if (array_key_exists('year', $_GET)) $_SESSION['year'] = addslashes($_GET['year']);37 if (!array_key_exists('year', $_SESSION)) $_SESSION['year'] = date('Y', time()); 38 if (array_key_exists('year', $_GET)) $_SESSION['year'] = addslashes($_GET['year']); 39 39 40 if (!array_key_exists('month', $_SESSION)) $_SESSION['month'] = date('n', time());41 if (array_key_exists('month', $_GET)) $_SESSION['month'] = addslashes($_GET['month']);40 if (!array_key_exists('month', $_SESSION)) $_SESSION['month'] = date('n', time()); 41 if (array_key_exists('month', $_GET)) $_SESSION['month'] = addslashes($_GET['month']); 42 42 43 43 $Output = '<div class="ChatHistory">'; 44 for ($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--)44 for ($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--) 45 45 { 46 if ($_SESSION['year'] == $Year)46 if ($_SESSION['year'] == $Year) 47 47 { 48 48 $Output .= '<div class="Year">'.$Year.'<div class="YearContent">'; 49 if ($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1] + 0); else $StartMonth = 1;50 if ($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1] + 0); else $EndMonth = 12;51 for ($Month = $EndMonth; $Month >= $StartMonth; $Month--)49 if ($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1] + 0); else $StartMonth = 1; 50 if ($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1] + 0); else $EndMonth = 12; 51 for ($Month = $EndMonth; $Month >= $StartMonth; $Month--) 52 52 { 53 if ($_SESSION['month'] == $Month)53 if ($_SESSION['month'] == $Month) 54 54 { 55 55 $Output .= '<div class="Months">'.$MonthNames[$Month].'<span>'; 56 if (($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1;57 if (($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year));58 for ($Day = $StartDay; $Day <= $EndDay; $Day++)56 if (($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1; 57 if (($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year)); 58 for ($Day = $StartDay; $Day <= $EndDay; $Day++) 59 59 { 60 60 $Text = '<a href="?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> '; 61 if (($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong>'.$Text.'</strong>';61 if (($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong>'.$Text.'</strong>'; 62 62 $Output .= $Text; 63 63 } … … 72 72 $DbResult = $this->Database->select('ChatHistory', 'Nick, Color, Text, UNIX_TIMESTAMP(Time)', "RoomType = 0 AND Time > '".$Date." 00:00:00' AND Time < '".$Date." 23:59:59' ORDER BY Time DESC"); 73 73 $Output .= '<div class="ChatHistoryText">'; 74 if ($DbResult->num_rows > 0)75 while ($Row = $DbResult->fetch_array())74 if ($DbResult->num_rows > 0) 75 while ($Row = $DbResult->fetch_array()) 76 76 { 77 77 $Text = $Row['Text'];; … … 81 81 else $Output .= 'V daném dni nebyly zaznamenány žádné zprávy.'; 82 82 $Output .= '</div>'; 83 return ($Output);83 return ($Output); 84 84 } 85 85 }
Note:
See TracChangeset
for help on using the changeset viewer.