Ejemplo n.º 1
0
         $count = get_number_of_comments($postdata['ID']);
         if ($count == 0) {
             $echostring .= '<a href="' . $myurl . '?view=comment&num=' . $num . '&p=' . $p . $ses_param . '">コメントする</a><br />';
         } else {
             $echostring .= '<a href="' . $myurl . '?view=comprev&num=' . $num . '&p=' . $p . '&page=0' . $ses_param . '">コメント(' . $count . ')</a><br />';
         }
     } else {
         $echostring .= '<font color="red">[パスワードで保護された記事は携帯ではご覧になれません。]</font>';
     }
     $echostring .= '<hr />';
     $nextnum = $num + 1;
     if ($next_p = find_post($nextnum)) {
         $echostring .= $ackeychar[9] . '<a href="' . $myurl . '?view=content&num=' . $nextnum . '&p=' . $next_p . '&page=0' . $ses_param . '" accesskey="9">次の記事へ &gt;</a><br />';
     }
     $prevnum = $num - 1;
     if ($prev_p = find_post($prevnum)) {
         $echostring .= $ackeychar[7] . '<a href="' . $myurl . '?view=content&num=' . $prevnum . '&p=' . $prev_p . '&page=0' . $ses_param . '" accesskey="7">&lt; 前の記事へ</a><br />';
     }
     $echostring .= $ackeychar[0] . '<a href="' . $myurl . '?view=list&start=0' . $ses_param . '" accesskey="0">一覧へ戻る</a><br/>';
     break;
 case "comprev":
     $num = intval($_REQUEST["num"]);
     $p = intval($_REQUEST["p"]);
     $start = intval(isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0);
     if ($CommentPerPage > 10) {
         $CommentPerPage = 10;
     }
     //コメント表示
     $postdata = get_postdata($p);
     $tmp = substr($postdata['Date'], 5, 2) . '/' . substr($postdata['Date'], 8, 2) . substr($postdata['Date'], 10, 6);
     $echostring .= '<b>' . $postdata['Title'] . '(' . $tmp . ')へのコメント</b>';
Ejemplo n.º 2
0
                            config('views.root', 'system/admin/views');
                            render('edit-content', array('title' => $type . ' - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'error' => '<ul>' . $message['error'] . '</ul>', 'oldfile' => $oldfile, 'postTitle' => $title, 'postImage' => $image, 'postVideo' => $video, 'postLink' => $link, 'postQuote' => $quote, 'postAudio' => $audio, 'postTag' => $tag, 'postUrl' => $url, 'type' => $type, 'postContent' => $content, 'bodyclass' => 'editcontent', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Edit content'));
                        }
                    }
                }
            }
        }
    }
});
// Delete blog post
get('/:year/:month/:name/delete', function ($year, $month, $name) {
    if (login()) {
        $user = $_SESSION[config("site.url")]['user'];
        $role = user('role', $user);
        config('views.root', 'system/admin/views');
        $post = find_post($year, $month, $name);
        if (!$post) {
            $post = find_draft($year, $month, $name);
            if (!$post) {
                not_found();
            }
        }
        $current = $post['current'];
        if ($user === $current->author || $role === 'admin') {
            render('delete-post', array('title' => 'Delete post - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'p' => $current, 'bodyclass' => 'deletepost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title));
        } else {
            render('denied', array('title' => 'Delete post - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'p' => $current, 'bodyclass' => 'deletepost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title));
        }
    } else {
        $login = site_url() . 'login';
        header("location: {$login}");
Ejemplo n.º 3
0
<?php

if (filter_input_array(INPUT_GET)) {
    $id = filter_input(INPUT_GET, "id");
    $post = find_post($id);
} else {
    //post not found
    //redirect to index with error message
}
error_reporting(0);
include "includes/header.inc";
?>
<div id="content">
  <ul id="subnav">
    <li><a href="post_index.php">Post Index</a></li>
    <li><a href="post_new.php">New Post</a></li>
  </ul>
  <?php 
print_post($post['title'], $post['body']);
?>
</div>
<?php 
include "includes/footer.inc";
?>

<?php 
function print_post($title, $body)
{
    ?>
<div class="blog">
  <h2><?php 
Ejemplo n.º 4
0
     			$comment_author = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "" : trim($HTTP_COOKIE_VARS["comment_author"]);
     			$comment_author_email = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "" : trim($HTTP_COOKIE_VARS["comment_author_email"]);
     			$comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "" : trim($HTTP_COOKIE_VARS["comment_author_url"]);
     */
     $count = get_number_of_comments($post['ID']);
     if ($count == 0) {
         $echostring .= '<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=comment&num=' . $_REQUEST["num"] . '">コメントする</a><br />';
     } else {
         $echostring .= '<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=comprev&num=' . $_REQUEST["num"] . '&page=0">コメント(' . $count . ')</a><br />';
     }
     /*
     		} //post_password is empty or match cookie password
     */
     $echostring .= '<hr />';
     $nextnum = $_REQUEST["num"] + 1;
     if (find_post($nextnum)) {
         $echostring .= $ackeychar[9] . '<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=content&num=' . $nextnum . '&page=0" accesskey="9">次の記事へ &gt;</a><br />';
     }
     $prevnum = $_REQUEST["num"] - 1;
     if ($prevnum >= 0) {
         $echostring .= $ackeychar[7] . '<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=content&num=' . $prevnum . '&page=0" accesskey="7">&lt; 前の記事へ</a><br />';
     }
     $echostring .= $ackeychar[0] . '<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=list&start=0" accesskey="0">一覧へ戻る</a><br/>';
     break;
 case "comprev":
     //コメント表示
     $post = get_postdata_num($_REQUEST["num"]);
     $tmp = substr($post['Date'], 5, 2) . '/' . substr($post['Date'], 8, 2) . substr($post['Date'], 10, 6);
     $echostring .= '<b>' . $post['Title'] . '(' . $tmp . ')へのコメント</b>';
     $echostring .= '<hr />';
     $comments = get_comments($post['ID']);
Ejemplo n.º 5
0
    render('profile', array('exists' => $exists, 'page' => $page, 'posts' => $posts, 'total' => $author['count'], 'author' => $author, 'name' => $name, 'tags' => $tags, 'category' => $category, 'likes' => $likes, 'has_pagination' => has_pagination($page, $total)));
});
get('/cat/:name', function ($name) {
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $categoryposts = get_posts_category($name);
    $tags = get_tags();
    $category = get_category();
    $likes = get_likes();
    foreach ($categoryposts as $p) {
        $total = $p->count;
    }
    render('category', array('page' => $page, 'author' => $categoryposts, 'tags' => $tags, 'category' => $category, 'likes' => $likes, 'has_pagination' => has_pagination($page, $total)));
});
get('/post/:title', function ($title) {
    $post = find_post($title);
    if (!$post) {
        not_found();
    }
    foreach ($post as $ps) {
        $id = $ps['id'];
    }
    $tags = get_tags();
    $comments = get_comments($id);
    $category = get_category();
    $likes = get_likes();
    render('post', array('title' => $post->title . ' ⋅ ' . config('blog.title'), 'p' => $post, 'tags' => $tags, 'comments' => $comments, 'category' => $category, 'likes' => $likes));
});
// The JSON API
get('/api/json', function () {
    header('Content-type: application/json');