diff --git a/tools/docker-dev/unity-web-portal b/tools/docker-dev/unity-web-portal new file mode 160000 index 0000000..7087b78 --- /dev/null +++ b/tools/docker-dev/unity-web-portal @@ -0,0 +1 @@ +Subproject commit 7087b78718a64185ea1ebaf615f4a8b395f39267 diff --git a/webroot/api/notices/index.php b/webroot/api/notices/index.php index 07b8a20..3ccdbb8 100644 --- a/webroot/api/notices/index.php +++ b/webroot/api/notices/index.php @@ -4,21 +4,16 @@ require_once "../../../resources/autoload.php"; -if (isset($_GET["line_wrap"])) { - $CHAR_WRAP = $_GET["line_wrap"]; -} else { - $CHAR_WRAP = 80; -} - $notices = $SQL->getNotices(); +$jsonArray = []; foreach ($notices as $notice) { - echo $notice["title"] . "\r\n"; - echo date('m-d-Y', strtotime($notice["date"])) . "\r\n"; - - $lineArr = explode("\r\n", wordwrap($notice["message"], $CHAR_WRAP)); - foreach ($lineArr as $line) { - echo $line; - } - - echo "\r\n\r\n"; + $formattedNotice = [ + "title" => $notice["title"], + "date" => date('m-d-Y', strtotime($notice["date"])), + "message" => $notice["message"] + ]; + $jsonArray[] = $formattedNotice; } + +$jsonOutput = json_encode($jsonArray, JSON_PRETTY_PRINT); +echo $jsonOutput;