diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/blog/edit.php | 3 | ||||
-rw-r--r-- | lib/blog/index.php | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/blog/edit.php b/lib/blog/edit.php index d76781c..2c87bde 100644 --- a/lib/blog/edit.php +++ b/lib/blog/edit.php @@ -30,11 +30,12 @@ if (isset($_POST['title']) && isset($_POST['tags']) && isset($_POST['text'])) { " WHERE id = $postid"); sql("DELETE FROM blog_tags WHERE post = $postid"); $tags = explode(' ', $post_tags); - if (count($tags) == 1 && $tags[0] == "") { + if ($post_tags == "") { //do nothing lol } else if (count($tags) >= 1) { $v = array(); foreach ($tags as $tag) { + if ($tag == "") continue; $v[] = "($postid, '" . escs($tag) . "')"; } sql("INSERT INTO blog_tags(post, tag) VALUES " . implode(',', $v)); diff --git a/lib/blog/index.php b/lib/blog/index.php index dd353d3..08aa630 100644 --- a/lib/blog/index.php +++ b/lib/blog/index.php @@ -51,7 +51,7 @@ $q = (isset($fvalues['tag']) ? "LEFT JOIN blog_tags bb ON bb.post = blog_posts.id AND bb.tag = '" . escs($fvalues['tag'])."' " : ""). "WHERE blog_posts.draft = 0 ". (isset($fvalues['author']) ? 'AND blog_posts.owner = ' . intval($fvalues['author']) .' ' : ''). - (isset($fvalues['date']) ? "AND blog_posts.date >= '" . escs(str_replace('.', '-', $fvalues['date'])) ."-01 00:00:00' " . + (isset($fvalues['date']) ? "AND blog_posts.date >= '" . escs(str_replace('_', '-', $fvalues['date'])) ."-01 00:00:00' " . "AND blog_posts.date <= '" . escs(str_replace('.', '-', $fvalues['date'])) . "-31 23:59:59'" : ''). (isset($fvalues['tag']) ? " AND bb.post != 0 " : ""). "GROUP BY blog_posts.id ". @@ -64,9 +64,10 @@ while ($pp = mysql_fetch_assoc($n)) { count_in('author', $pp['owner_id'], $pp['owner']); $tags = explode(', ', $pp['tags']); foreach ($tags as $tag) { + if ($tag == "") continue; count_in('tag', $tag, $tag); } - count_in('date', str_replace('-', '.', $pp['month']), $pp['month']); + count_in('date', str_replace('-', '_', $pp['month']), $pp['month']); } $can_post = ($user['priv'] >= $apps['blog']['drafts'] && $user['id'] != 0); |