Example #1
0
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="Категория&nbsp;"><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>';
    }
}
Example #2
0
function getFeedEntry($title, $url, $date, $content, $tags = array())
{
    $cats = '';
    foreach ($tags as $tag) {
        $tagEntry = readEntry('tags', $tag);
        $tagName = $tagEntry['name'];
        $cats .= "<category term=\"{$tagName}\"/>";
    }
    return '
  <entry>
    <title>' . $title . '</title>
    <link href="' . $url . '"/>
    <id>' . $url . '</id>
    <updated>' . $date . '</updated>
    ' . $cats . '
    <content type="html">' . str_replace('<', '&lt;', str_replace('&', '&amp;', str_replace('<br />', '<br>', $content))) . '</content>
  </entry>';
}
Example #3
0
} else {
    print_header($day, $month, $year, $area);
    echo _('Error: No entry spesified.');
    exit;
}
$entry = getEntry($entry_id);
if (!count($entry)) {
    echo _('Can\'t find entry');
    exit;
}
$day = date('d', $entry['time_start']);
$month = date('m', $entry['time_start']);
$year = date('Y', $entry['time_start']);
$area = $entry['area_id'];
print_header($day, $month, $year, $area);
readEntry($entry['entry_id'], $entry['rev_num']);
echo '<span class="hiddenprint">';
echo '<h1>' . _('Viewing entry') . '</h1>' . chr(10) . chr(10);
echo '- <a href="edit_entry2.php?entry_id=' . $entry['entry_id'] . '">' . iconHTML('page_white_edit') . ' ' . _('Edit this entry') . '</a><br><br></span>';
echo '<span class="print"><h2>' . date('Y-m-d', $entry['time_start']) . ': ' . $entry['entry_name'] . '</h2></span>' . chr(10);
echo '<table>';
echo '<tr>
	<td align="right"><b>' . _('Entry name') . ': </td>
	<td>' . $entry['entry_name'] . '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right">' . iconHTML('page_white_star') . ' ' . '<b>' . _('Entry ID') . ':</b> </td>
	<td>' . $entry['entry_id'] . '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right"><b>' . _('Entry title') . ':</b> </td>
Example #4
0
// Links
$out['addLink'] .= isAdmin() ? '<a href="./add.php?link" class="add"></a>' : '';
$out['linkListItems'] .= '';
$links = listEntry('links');
if ($links) {
    foreach ($links as $link) {
        $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) {
Example #5
0
<?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) . ' &mdash; ' . toDate($post) . '</li>';
        }
    }
    $out['content'] .= '</ul>';
} else {
    home();
}
require 'templates/page.php';
Example #6
0
<?php

header('Content-Type: text/html; charset=utf-8');
session_start();
$ar_rang = array();
$ar_rand = range(1, 12);
shuffle($ar_rand);
$ar_rand = array_slice($ar_rand, 0, 5);
if (empty($_SESSION['number']) or empty($_SESSION['i'])) {
    $_SESSION['i'] = 0;
    $_SESSION['number'] = $ar_rand;
}
require 'include/flatfile.inc.php';
require 'include/manage.inc.php';
require 'include/functions.php';
$listNote = readEntry('questions', $_SESSION['number'][$_SESSION['i']]);
$l = $listNote['name'];
$img = $listNote['img'];
include 'header.php';
?>

<script>
var count
var options = {
	bg: 'rgb(255, 170, 170)',
	id: 'mynano'
};

var nanobar = new Nanobar( options );

// move bar
Example #7
0
             if (check('name') && check('url')) {
                 $linkEntry['name'] = clean(cleanMagic($_POST['name']));
                 $linkEntry['url'] = clean(cleanMagic($_POST['url']));
                 saveEntry('links', $link, $linkEntry);
                 home();
             } else {
                 $out['title'] = $lang['editLink'] . ': ' . $linkEntry['name'];
                 $out['content'] .= '<form action="./edit.php?link=' . $link . '" method="post">
 <p>' . text('name', $linkEntry['name']) . '</p>
 <p>' . text('url', $linkEntry['url']) . '</p>
 <p>' . submitAdmin($lang['confirm']) . '</p>
 </form>';
             }
         } else {
             if (isGET('tag') && isAdmin() && isValidEntry('tags', GET('tag'))) {
                 $tagEntry = readEntry('tags', GET('tag'));
                 if (check('name')) {
                     $tagEntry['name'] = clean(cleanMagic($_POST['name']));
                     saveEntry('tags', GET('tag'), $tagEntry);
                     home();
                 } else {
                     $out['title'] = $lang['editTag'] . ': ' . $tagEntry['name'];
                     $out['content'] .= '<form action="./edit.php?tag=' . GET('tag') . '" method="post">
 <p>' . text('name', $tagEntry['name']) . '</p>
 <p>' . submitAdmin($lang['confirm']) . '</p>
 </form>';
                 }
             } else {
                 home();
             }
         }
Example #8
0
        $post = newEntry(cleanMagic($_POST['id']));
        saveEntry('drafts', $post, $postEntry);
        redirect('view.php?draft=' . $post);
    } else {
        $out['title'] = $lang['newPost'];
        $out['content'] .= '<form action="./add.php?draft" method="post">
    <p>' . text('title') . '</p>
    <p>' . text('id') . '</p>
    <p>' . textarea('content') . '</p>
    <p>' . submitAdmin($lang['confirm']) . '</p>
    </form>';
        $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : '';
    }
} else {
    if (isGET('comment') && isValidEntry('posts', GET('comment'))) {
        $postEntry = readEntry('posts', GET('comment'));
        if ($postEntry['locked']) {
            home();
        } else {
            if (checkBot() && check('name', $config['maxNameLength']) && check('content', $config['maxCommentLength'])) {
                $commentEntry['content'] = clean(cleanMagic($_POST['content']));
                $commentEntry['post'] = GET('comment');
                $comment = newEntry();
                $commentEntry['commenter'] = clean(cleanMagic($_POST['name']));
                saveEntry('comments', $comment, $commentEntry);
                $postEntry['comments'][$comment] = $comment;
                saveEntry('posts', GET('comment'), $postEntry);
                $_SESSION[$comment] = $comment;
                redirect('view.php?post=' . GET('comment') . '/pages/' . pageOf($comment, $postEntry['comment']) . '#' . $comment);
            } else {
                $out['title'] = $lang['addComment'] . ': ' . $postEntry['title'];