예제 #1
0
파일: index.php 프로젝트: zhizunbaonie/blog
 if (isGET('comments')) {
     $out['title'] = $lang['comments'];
     $comments = listEntry('comments');
     rsort($comments);
     $pages = pages($comments);
     $page = page($pages);
     if ($comments) {
         $out['content'] .= '<div id="comments">';
         $first = true;
         foreach (pageItems($comments, $page) as $comment) {
             $out['content'] .= $first ? '' : '<div class="div">&middot; &middot; &middot; &middot; &middot;</div>';
             $first = false;
             $commentEntry = readEntry('comments', $comment);
             $postEntry = readEntry('posts', $commentEntry['post']);
             $title = $commentEntry['commenter'] . $lang['commented'] . $postEntry['title'];
             $pageOf = pageOf($comment, $postEntry['comments']);
             $link = './view.php?post=' . $commentEntry['post'] . '/pages/' . $pageOf . '#' . $comment;
             $out['content'] .= '<div class="comment">
   <div class="title"><a href="' . $link . '">' . $title . manageComment($comment) . '</a></div>
   <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 {
예제 #2
0
파일: feed.php 프로젝트: zhizunbaonie/blog
    ' . $cats . '
    <content type="html">' . str_replace('<', '&lt;', str_replace('&', '&amp;', str_replace('<br />', '<br>', $content))) . '</content>
  </entry>';
}
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']);
예제 #3
0
파일: edit.php 프로젝트: zhizunbaonie/blog
         $out['content'] .= '<form action="./edit.php?draft=' . $draft . '" method="post">
 <p>' . text('title', $draftEntry['title']) . '</p>
 <p>' . textarea('content', clean($draftEntry['content'])) . '</p>
 <p>' . submitAdmin($lang['confirm']) . '</p>
 </form>';
         $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : '';
     }
 } else {
     if (isGET('comment') && (isAdmin() || isAuthor(GET('comment'))) && isValidEntry('comments', GET('comment'))) {
         $comment = GET('comment');
         $commentEntry = readEntry('comments', $comment);
         if (checkBot() && check('content', $config['maxCommentLength'])) {
             $commentEntry['content'] = clean(cleanMagic($_POST['content']));
             saveEntry('comments', $comment, $commentEntry);
             $postEntry = readEntry('posts', $commentEntry['post']);
             redirect('view.php?post=' . $commentEntry['post'] . '/pages/' . pageOf($comment, $postEntry['comment']) . '#' . $comment);
         } else {
             $out['title'] = $lang['editComment'];
             $out['content'] .= '<form action="./edit.php?comment=' . $comment . '" method="post">
 <p>' . textarea('content', $commentEntry['content']) . '</p>
 <p>' . submitSafe($lang['confirm']) . '</p>
 </form>';
             $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : '';
         }
     } else {
         if (isGET('link') && isAdmin() && isValidEntry('links', GET('link'))) {
             $link = GET('link');
             $linkEntry = readEntry('links', $link);
             if (check('name') && check('url')) {
                 $linkEntry['name'] = clean(cleanMagic($_POST['name']));
                 $linkEntry['url'] = clean(cleanMagic($_POST['url']));