diff --git a/acptemplate/messageLog.tpl b/acptemplate/messageLog.tpl index d286e9d..0c893b2 100644 --- a/acptemplate/messageLog.tpl +++ b/acptemplate/messageLog.tpl @@ -57,33 +57,63 @@ {section name=contentLoop loop=24 step=3} -
- - - {section name=subTabLoop loop=6} - {assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop} - - {/section} -
+ + {/if} + {/section} + + {/if} {/section} {/if} diff --git a/file/lib/acp/page/MessageLogPage.class.php b/file/lib/acp/page/MessageLogPage.class.php index ccfc254..4f60406 100644 --- a/file/lib/acp/page/MessageLogPage.class.php +++ b/file/lib/acp/page/MessageLogPage.class.php @@ -78,26 +78,39 @@ public function readData() { parent::readData(); try { - if($this->date > TIME_NOW) { + if ($this->date > TIME_NOW) { throw new \wcf\system\exception\UserInputException('date', 'inFuture'); } - } catch(\wcf\system\exception\UserInputException $e) { + } catch (\wcf\system\exception\UserInputException $e) { $this->errorField = $e->getField(); $this->errorType = $e->getType(); + return; } try { - if($this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) { + if ($this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) { throw new \wcf\system\exception\UserInputException('date', 'tooLongAgo'); } - } catch(\wcf\system\exception\UserInputException $e) { + } catch (\wcf\system\exception\UserInputException $e) { $this->errorField = $e->getField(); $this->errorType = $e->getType(); + return; } - $this->messages = \chat\data\message\ViewableMessageList::getMessagesBetween($this->room, $this->date, $this->date + 86399); + $messages = \chat\data\message\ViewableMessageList::getMessagesBetween($this->room, $this->date, $this->date + 86399); + + foreach ($messages as $message) { + $hour = ((int) date('H', $message->time)) * 2; + $minutes = (int) date('i', $message->time); + + if ($minutes >= 30) { + $hour += 1; + } + + $this->messages[$hour][] = $message; + } } /** @@ -108,7 +121,7 @@ public function readParameters() { $this->rooms = \chat\data\room\RoomCache::getInstance()->getRooms(); - foreach($this->rooms as $id => $room) { + foreach ($this->rooms as $id => $room) { if (!$room->permanent) unset($this->rooms[$key]); }