function getSubpageTitle($p, $subp, $subp2) { $games = getGameList($subp); if ($p == "games") { if ($subp == -1) { return "Создание игры"; } $game = $games[0]; return $game['name']; } if ($p == "news") { if ($subp == -1) { return "Новая новость"; } $news = getNewsData($subp); return $news['header']; } if ($p == "checkers") { $game = $games[0]; if ($subp == -1) { return "Новый чекер для '" . $game['name'] . "'"; } if ($subp == 0) { return "Чекеры для '" . $game['name'] . "'"; } $checkers = getCheckerList($subp); $checker = $checkers[0]; return $checker['name'] . " для '" . $game['name'] . "'"; } return ""; }
echo "</div></td>"; echo "</tr>"; } ?> </tbody> </table> <a role="button" href="?page=<?php echo $page; ?> &subpage=-1" style="float: right" class="btn btn-primary"> Создать новость </a> <?php } else { $currentNews = getNewsData($subpage); $date = ''; if ($subpage == -1) { $date[0] = date("Y"); $date[1] = date("m"); $date[2] = date("d"); } else { $date = explode("-", $currentNews["date"]); } ?> <script type="text/javascript"> function loadFormData() { var currentNews = <?php echo $subpage; ?>
<?php include "top.php"; $newsId = -1; if (isset($_GET['news'])) { $newsId = intval($_GET['news']); } $commentId = -1; if (isset($_GET['comment'])) { $commentId = intval($_GET['comment']); } $currentNews = getNewsData($newsId); if (isset($_POST['submit'])) { $postNewsId = intval($_POST['newsId']); $postCommentId = intval($_POST['commentId']); if ($postCommentId == -1) { sendComments($postNewsId, $_POST['userComment']); } else { updateComment($postCommentId, $_POST['userComment']); } header("Location: comments.php?news={$postNewsId}"); exit; } if (isset($_POST['delete'])) { $postCommentId = intval($_POST['commentId']); deleteComment($postCommentId); } ?> <script>
<?php include_once 'procedures.php'; include "top.php"; ?> <?php $news = getNewsData(); ?> <div class = "container content" id = "dataContainer"> <?php foreach ($news as $data) { ?> <div class = "boardedHeader"> <h2><?php echo $data['header']; ?> </h2> </div> <div class = "newsDiv"> <?php echo $data['text']; ?> </div> <div class = "commentsDate"> <?php echo reverseDate($data['date'], "-"); ?> </div> <div>