summaryrefslogtreecommitdiff
path: root/lib/blog
diff options
context:
space:
mode:
Diffstat (limited to 'lib/blog')
-rw-r--r--lib/blog/edit.php6
-rw-r--r--lib/blog/post.php2
-rw-r--r--lib/blog/view.php3
3 files changed, 4 insertions, 7 deletions
diff --git a/lib/blog/edit.php b/lib/blog/edit.php
index 854c94f..d76781c 100644
--- a/lib/blog/edit.php
+++ b/lib/blog/edit.php
@@ -39,11 +39,7 @@ if (isset($_POST['title']) && isset($_POST['tags']) && isset($_POST['text'])) {
}
sql("INSERT INTO blog_tags(post, tag) VALUES " . implode(',', $v));
}
- if ($post['draft']) {
- header("Location: drafts-blog");
- } else {
- header("Location: blog");
- }
+ header("Location: view-blog-$postid");
die();
}
}
diff --git a/lib/blog/post.php b/lib/blog/post.php
index 1f1525a..a17ba5b 100644
--- a/lib/blog/post.php
+++ b/lib/blog/post.php
@@ -28,7 +28,7 @@ if (isset($_POST['title']) && isset($_POST['text'])) {
}
sql("INSERT INTO blog_tags(post, tag) VALUES " . implode(',', $v));
}
- header("Location: drafts-blog");
+ header("Location: view-blog-$id");
die();
}
}
diff --git a/lib/blog/view.php b/lib/blog/view.php
index 15c4d6e..fa375d8 100644
--- a/lib/blog/view.php
+++ b/lib/blog/view.php
@@ -15,7 +15,7 @@ $post = mysql_fetch_assoc(sql(
"WHERE blog_posts.id = $postid"
));
-assert_error($post && $post['draft'] == 0,
+assert_error($post && ($post['draft'] == 0 || $post['owner_id'] == $user['id']),
"This post does not exist.");
$comments = array();
@@ -34,6 +34,7 @@ $can_post = ($user['priv'] >= $apps['blog']['drafts'] && $user['id'] != 0);
$can_edit = ($user['priv'] >= $apps['blog']['edit'] && $user['id'] != 0);
$can_delete = ($user['priv'] >= $apps['blog']['delete'] && $user['id'] != 0);
$can_comment = ($user['priv'] >= $apps['blog']['comment'] && $user['id'] != 0);
+$is_draft = ($post['draft'] != 0);
$can_delcom = ($user['priv'] >= $apps['blog']['delcom'] && $user['id'] != 0);
require("tpl/blog/view.php");