Kaynağa Gözat

Added notice for empty unpublished blogs. Added check in recent for only published posts.

pull/24/head
Teknikode 5 yıl önce
ebeveyn
işleme
37942d9e64
2 değiştirilmiş dosya ile 52 ekleme ve 49 silme
  1. 12
    0
      blog/get_post.php
  2. 40
    49
      home/main.php

+ 12
- 0
blog/get_post.php Dosyayı Görüntüle

@@ -28,6 +28,7 @@ if(isset($_POST))
if ($posts)
{
$viewablePosts = 0;
foreach ($posts as $post)
{
$post_id = $post['id'];
@@ -97,7 +98,18 @@ if(isset($_POST))
</div>
</div>
<?php
$viewablePosts++;
}
}
if ($viewablePosts == 0)
{
?>
<div class="row">
<div class="col-sm-12 text-center">
<h2>There are currently no articles.</h2>
</div>
</div>
<?php
}
}
}

+ 40
- 49
home/main.php Dosyayı Görüntüle

@@ -124,7 +124,7 @@
<p>
<ul class="list-group">
<?php
$new_posts = $db->select('blog', "user_id=? ORDER BY date_posted DESC LIMIT 5", array(0));
$new_posts = $db->select('blog', "user_id=? AND published=? ORDER BY date_posted DESC LIMIT 5", array(0,1));
$posts = array();
foreach ($new_posts as $post)
{
@@ -141,35 +141,30 @@
$author_id = $post['author_id'];
$author = $userTools->get($author_id);
$date = $post['date_posted'];
$published = $post['published'];
$title = $post['title'];
$tags = $post['tags'];
$post = $post['post'];

if ($published)
{
?>
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_<?php echo $post_id; ?>").text();
var new_post = converter.makeHtml(old_post);
$("#title_<?php echo $post_id; ?>").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a>
</p>
</div>
?>
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_<?php echo $post_id; ?>").text();
var new_post = converter.makeHtml(old_post);
$("#title_<?php echo $post_id; ?>").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a>
</p>
</div>
</div>
</li>
<?php
}
</div>
</li>
<?php
}
?>
</ul>
@@ -239,7 +234,7 @@
<p>
<ul class="list-group">
<?php
$new_posts = $db->select('blog', "user_id!=? ORDER BY date_posted DESC LIMIT 5", array(0));
$new_posts = $db->select('blog', "user_id!=? AND published=? ORDER BY date_posted DESC LIMIT 5", array(0,1));
$posts = array();
foreach ($new_posts as $post)
{
@@ -260,31 +255,27 @@
$title = $post['title'];
$tags = $post['tags'];
$post = $post['post'];

if ($published)
{
?>
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_<?php echo $post_id; ?>").text();
var new_post = converter.makeHtml(old_post);
$("#title_<?php echo $post_id; ?>").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a>
</p>
</div>
?>
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_<?php echo $post_id; ?>").text();
var new_post = converter.makeHtml(old_post);
$("#title_<?php echo $post_id; ?>").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a>
</p>
</div>
</div>
</li>
<?php
}
</div>
</li>
<?php
}
?>
</ul>

Loading…
İptal
Kaydet