function view() { if (isset($_GET['post'])) { $data['subtitle'] = $lang['post']; $data['content'] .= '<h1>' . (isset($_SESSION['admin']) ? '<a href = "add.php?post">[+]</a>' : '') . $data['subtitle'] . '</h1>'; $page = array_chunk(array_reverse(listEntry('post/')), 4); if (!isset($page[$_GET['post'] - 1])) { $_GET['post'] = 1; } if ($page) { foreach ($page[$_GET['post'] - 1] as &$post) { $postEntry = readEntry('post', $post); $data['content'] .= '<div class = "well" style="margin-top: 20px;"> <div class = "entryHeader"><h3>' . managePost($post) . $postEntry['title'] . '<h3></div> <div class = "entryMain"> <p>' . summary($postEntry['content']) . '</p> <p><a class = "btn btn-primary" href = "view.php?post=' . $post . '"><span class="btn-label">' . $lang['readMore'] . '</span></a></p> </div> <div class = "entryFooter"><ul>'; if (isset($postEntry['category'])) { $categoryEntry = readEntry('category', $postEntry['category']); $data['content'] .= '<label><strong rel="tooltip" data-placement="top" title="Категория "><i class="icon-folder-open"></i></strong></label> - <a href = "view.php?category=' . $postEntry['category'] . '">' . $categoryEntry['name'] . '</a> <br> '; } $data['content'] .= '<label><strong rel="tooltip" data-placement="top" title="Комментарии"><i class="icon-comment"></i></strong></label> - <small>' . count($postEntry['comment']) . '</small> <br> <label><strong rel="tooltip" data-placement="left" title="Просмотры"><i class="icon-eye-open"></i></strong></label> - <small>' . $postEntry['view'] . '</small> <br> <label><strong rel="tooltip" data-placement="left" title="Дата"><i class="icon-calendar"></i></strong></label> - <small>' . date('Y-m-d H:i', strtotime($dateoutput)) . '</small> </ul></div> </div>'; } } else { $data['content'] .= '<p>' . $lang['none'] . '</p>'; } $data['content'] .= '<div id = "page"><ul>' . (isset($page[$_GET['post'] - 2]) ? '<li><a href = "index.php?post=' . ($_GET['post'] - 1) . '">< ' . $lang['prev'] . '</a></li>' : '') . '<li>' . $lang['page'] . ':' . $_GET['post'] . ' / ' . count($page) . '</li>' . (isset($page[$_GET['post']]) ? '<li><a href = "index.php?post=' . ($_GET['post'] + 1) . '">' . $lang['next'] . ' ></a></li>' : '') . '</ul></div>'; } }
$linkEntry = readEntry('links', $link); $out['linkListItems'] .= '<li><a href="' . $linkEntry['url'] . '">' . $linkEntry['name'] . '</a>' . manageLink($link) . '</li>'; } } // Tags $out['addTag'] .= isAdmin() ? '<a href="./add.php?tag" class="add"></a>' : ''; $out['tagLinks'] .= ''; $tags = listEntry('tags'); foreach ($tags as $tag) { $tagEntry = readEntry('tags', $tag); $out['tagLinks'] .= ' <a href="./view.php?tag=' . $tag . '">' . $tagEntry['name'] . ' (' . count($tagEntry['posts']) . ')</a>'; } // Archive $out['archiveListItems'] .= ''; $archives = array(); foreach (listEntry('posts') as $post) { $year = substr($post, 0, 4); $month = substr($post, 5, 2); if (isset($archives[$year][$month])) { $archives[$year][$month]++; } else { $archives[$year][$month] = 1; } } if ($archives) { foreach ($archives as $year => $months) { $out['archiveListItems'] .= '<li>' . $year . ' '; foreach ($months as $month => $count) { $yearMonth = $year . '-' . $month; $out['archiveListItems'] .= ' <a href="./view.php?archive=' . $yearMonth . '">' . date('M', strtotime($yearMonth)) . ' (' . $count . ')</a>'; }
if (isGET('comments')) { $out['title'] = $lang['comments']; $out['type'] = 'comments'; $items = listEntry('comments'); rsort($items); $items = array_slice($items, 0, 100); if ($items) { foreach ($items as $item) { $itemData = readEntry('comments', $item); $parentData = readEntry('posts', $itemData['post']); $title = clean($itemData['commenter'] . $lang['commented'] . $parentData['title']); $url = $out['baseURL'] . 'view.php?post=' . $itemData['post'] . '/pages/' . pageOf($item, $parentData['comments']) . '#' . $item; $out['content'] .= getFeedEntry($title, $url, toDate($item, 'c'), content($itemData['content'])); } } } else { $out['title'] = $lang['posts']; $out['type'] = 'posts'; $items = listEntry('posts'); rsort($items); $items = array_slice($items, 0, 100); if ($items) { foreach ($items as $item) { $itemData = readEntry('posts', $item); $title = clean($itemData['title']); $url = $out['baseURL'] . 'view.php?post=' . $item; $out['content'] .= getFeedEntry($title, $url, toDate($item, 'c'), $itemData['content'], $itemData['tags']); } } } require 'templates/feed.php';
$postEntry['content'] = cleanMagic($_POST['content']); $postEntry['locked'] = $_POST['locked'] === 'yes'; $addedTags = $_POST['tags'] ? $_POST['tags'] : array(); $postEntry['tags'] = $addedTags; saveEntry('posts', $post, $postEntry); foreach ($addedTags as $tag) { $tagEntry = readEntry('tags', $tag); $tagEntry['posts'][$post] = $post; saveEntry('tags', $tag, $tagEntry); } deleteEntry('drafts', $draft); redirect('view.php?post=' . $post); } else { $draftEntry = readEntry('drafts', $draft); $tagOptions = array(); foreach (listEntry('tags') as $tag) { $tagEntry = readEntry('tags', $tag); $tagOptions[$tag] = $tagEntry['name']; } $out['title'] = $lang['publishPost'] . ': ' . $draftEntry['title']; $out['content'] .= '<form action="./publish.php?draft=' . $draft . '" method="post"> <p>' . text('title', $draftEntry['title']) . '</p> <p>' . text('id', substr($draft, 20)) . '</p> <p>' . textarea('content', clean($draftEntry['content'])) . '</p> <p>' . select('locked', array('yes' => $lang['yes'], 'no' => $lang['no']), $postEntry['locked'] ? 'yes' : 'no') . '</p> <p>' . multiselect('tags', $tagOptions, $postEntry['tags']) . '</p> <p>' . submitAdmin($lang['confirm']) . '</p> </form>'; $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : ''; } } else {
<div class="date">' . toDate($comment) . '</div> <div class="content">' . content($commentEntry['content']) . '</div> </div>'; } $out['content'] .= '</div>'; } $out['content'] .= paging($page, $pages, './index.php?comments=all'); } else { if (isGET('404')) { $out['title'] = 'HTTP 404'; $out['content'] .= '<p>' . $lang['notFound'] . '</p>'; } else { $is_posts = isGET('posts'); $out['title'] = $lang['posts']; $out['titleHtml'] = ''; $posts = listEntry('posts'); if ($is_posts) { sort($posts); } else { rsort($posts); } $pages = pages($posts); $page = page($pages); if ($posts) { $first = true; foreach (pageItems($posts, $page) as $post) { $postEntry = readEntry('posts', $post); if (!$is_posts && !$first) { $out['content'] .= '<div class="div">· · · · ·</div>'; } $first = false;
<div style="<?if($img==false){ ?> width:100%; <? } ?>" class="mdl-card mdl-cell mdl-cell--9-col-desktop mdl-cell--5-col-tablet mdl-cell--4-col-phone"> <div class="mdl-card__supporting-text"> <h4><? echo '<h3>'.$l.'</h3>'; ?> </h4> </div> </div> </section> <br> <center> <section class="animated fadeIn section--center mdl-cell--9-col-desktop mdl-cell--6-col-tablet mdl-cell--4-col-phone mdl-shadow--2dp"> <? $answers = listEntry('answers/'.$_SESSION['number'][$_SESSION['i']].'/'); shuffle($answers); foreach($answers as &$answer) { $oneAns = readNote($_SESSION['number'][$_SESSION['i']], $answer); ?> <section style="margin-bottom: 0;" class="section--center mdl-grid mdl-grid--no-spacing border_line"> <div style="<?if($oneAns['img']==false){ ?> width:100%; min-height: 80px; <? } else { ?> min-height: 200px; <? } ?>" arr="<?php echo $oneAns['name']; ?> " id="place" class="place mdl-card mdl-cell mdl-cell--9-col-desktop mdl-cell--4-col-tablet mdl-cell--4-col-phone"> <div class="mdl-card__supporting-text"> <h4><?php echo $oneAns['pass']; ?> </h4> </div>