if (!$session->is_logged_in()) { Redirect::redirectTo("/signup.php"); } if (!isset($_GET['msg'])) { Redirect::redirectTo("../messages"); } $msgid = sanitize_id($_GET['msg']); $message = Messages::getMsg($msgid); if (!$message) { Redirect::redirectTo(''); } $pageTitle = "Messages"; if (!$message) { $session->message("Message was not found", "../messages", "warning"); } Messages::msgSeen(USER_ID, $msgid); $self = USER_ID == $message->u_id ? true : false; $arch = $message->deleted == 1 ? true : false; $staff = $message->ual == 1 ? true : false; $img_path = $message->img_path; $date = $message->date; $sec = "messages"; include ROOT_PATH . "inc/head.php"; ?> <div class="ui container section messages"> <?php echo msgs(); ?> <?php if ($self) {
</h3> <?php } ?> <?php if (empty($messages)) { echo "There are no messages between you and " . $user->full_name . " yet.<br><br>"; echo "<a class=\"btn btn-success\" href=\"compose.php?to={$user_id}\">Compose a new message</a>"; } foreach ($messages as $message) { $sender = new User($message->sender_id); $sender = $sender->user; $sstaf = $sender->id == 1 ? true : false; $self = USER_ID == $sender->id ? true : false; if (!$self) { Messages::msgSeen($message->user_id, $message->id); } $img_path = $sender->img_path; $date = displayDate($message->date); $timeAgo = get_timeAgo($message->date); $subject = ctrim($message->subject, 120, true); ?> <div class="message message-row ui"> <div class="message-image"> <?php if ($sstaf) { ?> <img class="ui tiny image" src="<?php echo $img_path; ?> ">