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>'; } }
<?php $out = array(); require 'header.php'; if (check('text')) { $text = clean($_POST['text']); $foundPosts = array(); foreach (listEntry('posts') as $post) { $postEntry = readEntry('posts', $post); if (stripos($postEntry['title'], $text) !== false || stripos($postEntry['content'], $text) !== false) { $foundPosts[$post] = $postEntry['title']; } } $out['title'] = $lang['search']; $out['content'] .= '<ul>'; if ($foundPosts) { foreach ($foundPosts as $post => $title) { $out['content'] .= '<li><a href="./view.php?post=' . $post . '">' . $title . '</a>' . managePost($post) . ' — ' . toDate($post) . '</li>'; } } $out['content'] .= '</ul>'; } else { home(); } require 'templates/page.php';
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; $out['content'] .= '<div class="post"> <h2><a href="./view.php?post=' . $post . '">' . $postEntry['title'] . managePost($post) . '</a></h2> <div class="date">' . toDate($post) . '</div>'; $out['content'] .= '<div class="info">'; foreach ($postEntry['tags'] as $tag) { $tagEntry = readEntry('tags', $tag); $tagName = $tagEntry['name']; $out['content'] .= '<a href="./view.php?tag=' . $tag . '">' . $tagName . '</a>'; } $out['content'] .= '</div>'; if (!$is_posts) { $out['content'] .= '<div class="content">' . $postEntry['content'] . '</div>'; } $commentCount = $postEntry['comments'] ? count($postEntry['comments']) : 0; $out['content'] .= '<div class="ccount"><a href="./view.php?post=' . $post . '#comments">' . $commentCount . ($commentCount != 1 ? $lang['ncomments'] : $lang['ncomment']) . '</a></div>'; $out['content'] .= '</div>'; }
<?php require 'common.php'; switch ($_SERVER['REQUEST_METHOD']) { case "POST": managePost(); break; case "PUT": break; case "GET": break; case "DELETE": break; default: break; } function nextAgentCall($data) { $callduration = $_POST["callduration"]; $status = $_POST["status"]; $recordurl = $_POST["recordurl"]; $message = $_POST["message"]; $stage = $_POST["stage"]; $agent = $_POST["agent"]; nextCall($agent); } function managePost() { error_log(print_R($_POST, TRUE)); $type = $_POST["type"]; if ($type == "nextcall") {