diff --git a/system/admin/admin.php b/system/admin/admin.php
index 2dee18e..409a5bc 100644
--- a/system/admin/admin.php
+++ b/system/admin/admin.php
@@ -58,7 +58,7 @@ function session($user, $pass)
$_SESSION[config("site.url")]['user'] = $user;
header('location: admin');
} else {
- return $str = '
-
+
+
+
+
URL
@@ -47,10 +51,6 @@
-
diff --git a/system/admin/views/add-post.html.php b/system/admin/views/add-post.html.php
deleted file mode 100644
index b75abbb..0000000
--- a/system/admin/views/add-post.html.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/add-quote.html.php b/system/admin/views/add-quote.html.php
deleted file mode 100644
index 787b35d..0000000
--- a/system/admin/views/add-quote.html.php
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/add-video.html.php b/system/admin/views/add-video.html.php
deleted file mode 100644
index b24afdb..0000000
--- a/system/admin/views/add-video.html.php
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/content-type.html.php b/system/admin/views/content-type.html.php
index 238232f..9594531 100644
--- a/system/admin/views/content-type.html.php
+++ b/system/admin/views/content-type.html.php
@@ -1,9 +1,9 @@
Add content
-
Regular post
Creating regular blog post.
-
Image post
Creating blog post with featured image.
-
Video post
Creating blog post with featured video.
-
Audio post
Creating blog post with featured audio.
-
Link post
Creating blog post with featured link.
-
Quote post
Creating blog post with featured quote.
+
Regular post
Creating regular blog post.
+
Image post
Creating blog post with featured image.
+
Video post
Creating blog post with featured video.
+
Audio post
Creating blog post with featured audio.
+
Link post
Creating blog post with featured link.
+
Quote post
Creating blog post with featured quote.
Static page
Creating static page.
\ No newline at end of file
diff --git a/system/admin/views/edit-audio.html.php b/system/admin/views/edit-audio.html.php
deleted file mode 100644
index 44919cd..0000000
--- a/system/admin/views/edit-audio.html.php
+++ /dev/null
@@ -1,130 +0,0 @@
-file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-
-$desc = get_category_info(null);
-
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldtag = get_content_tag('tag', $content);
-$oldaudio = get_content_tag('audio', $content);
-$oldcontent = remove_html_comments($content);
-
-$dir = substr($url, 0, strrpos($url, '/'));
-$isdraft = explode('/', $dir);
-$oldurl = explode('_', $url);
-
-if (empty($oldtag)) {
- $oldtag = $oldurl[1];
-}
-
-$oldmd = str_replace('.md', '', $oldurl[2]);
-
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
-} else {
- $destination = 'admin';
-}
-$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
-
-// Category string
-$cat = explode('/', $replaced);
-$category = $cat[count($cat) - 3];
-
-$dt = str_replace($replaced, '', $oldurl[0]);
-$t = str_replace('-', '', $dt);
-$time = new DateTime($t);
-$timestamp = $time->format("Y-m-d H:i:s");
-// The post date
-$postdate = strtotime($timestamp);
-
-if (config('permalink.type') == 'post') {
- $delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
-} else {
- // The post URL
- $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
-}
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-category.html.php b/system/admin/views/edit-category.html.php
deleted file mode 100644
index f1730f1..0000000
--- a/system/admin/views/edit-category.html.php
+++ /dev/null
@@ -1,87 +0,0 @@
-file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldcontent = remove_html_comments($content);
-
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
-} else {
- $destination = 'admin';
-}
-$dir = substr($url, 0, strrpos($url, '/'));
-$oldurl = str_replace($dir . '/', '', $url);
-$oldmd = str_replace('.md', '', $oldurl);
-
-if (isset($p->url)) {
- $delete = $p->url . '/delete?destination=' . $destination;
-}
-else {
- if(empty($sub)) {
- $delete = site_url() . $oldmd . '/delete?destination=' . $destination;
- }
- else {
- $delete = site_url() . $static .'/'. $sub . '/delete?destination=' . $destination;
- }
-}
-
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-video.html.php b/system/admin/views/edit-content.html.php
similarity index 51%
rename from system/admin/views/edit-video.html.php
rename to system/admin/views/edit-content.html.php
index 06e93ff..818cd37 100644
--- a/system/admin/views/edit-video.html.php
+++ b/system/admin/views/edit-content.html.php
@@ -11,9 +11,14 @@ $content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldtag = get_content_tag('tag', $content);
-$oldvideo = get_content_tag('video', $content);
$oldcontent = remove_html_comments($content);
+$oldimage = get_content_tag('image', $content);
+$oldaudio = get_content_tag('audio', $content);
+$oldvideo = get_content_tag('video', $content);
+$oldlink = get_content_tag('link', $content);
+$oldquote = get_content_tag('quote', $content);
+
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
@@ -22,7 +27,6 @@ if (empty($oldtag)) {
$oldtag = $oldurl[1];
}
-
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
@@ -60,51 +64,85 @@ if (config('permalink.type') == 'post') {
+
+
+
+
+
URL
@@ -121,11 +165,8 @@ if (config('permalink.type') == 'post') {
-
+
diff --git a/system/admin/views/edit-frontpage.html.php b/system/admin/views/edit-frontpage.html.php
deleted file mode 100644
index 11cae7c..0000000
--- a/system/admin/views/edit-frontpage.html.php
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-image.html.php b/system/admin/views/edit-image.html.php
deleted file mode 100644
index 72d7ffe..0000000
--- a/system/admin/views/edit-image.html.php
+++ /dev/null
@@ -1,130 +0,0 @@
-file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-
-$desc = get_category_info(null);
-
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldtag = get_content_tag('tag', $content);
-$oldimage = get_content_tag('image', $content);
-$oldcontent = remove_html_comments($content);
-
-$dir = substr($url, 0, strrpos($url, '/'));
-$isdraft = explode('/', $dir);
-$oldurl = explode('_', $url);
-
-if (empty($oldtag)) {
- $oldtag = $oldurl[1];
-}
-
-$oldmd = str_replace('.md', '', $oldurl[2]);
-
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
-} else {
- $destination = 'admin';
-}
-$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
-
-// Category string
-$cat = explode('/', $replaced);
-$category = $cat[count($cat) - 3];
-
-$dt = str_replace($replaced, '', $oldurl[0]);
-$t = str_replace('-', '', $dt);
-$time = new DateTime($t);
-$timestamp = $time->format("Y-m-d H:i:s");
-// The post date
-$postdate = strtotime($timestamp);
-// The post URL
-if (config('permalink.type') == 'post') {
- $delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
-} else {
- // The post URL
- $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
-}
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-link.html.php b/system/admin/views/edit-link.html.php
deleted file mode 100644
index 67042d5..0000000
--- a/system/admin/views/edit-link.html.php
+++ /dev/null
@@ -1,131 +0,0 @@
-file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-
-$desc = get_category_info(null);
-
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldtag = get_content_tag('tag', $content);
-$oldlink = get_content_tag('link', $content);
-$oldcontent = remove_html_comments($content);
-
-$dir = substr($url, 0, strrpos($url, '/'));
-$isdraft = explode('/', $dir);
-$oldurl = explode('_', $url);
-
-if (empty($oldtag)) {
- $oldtag = $oldurl[1];
-}
-
-$oldmd = str_replace('.md', '', $oldurl[2]);
-
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
-} else {
- $destination = 'admin';
-}
-$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
-
-// Category string
-$cat = explode('/', $replaced);
-$category = $cat[count($cat) - 3];
-
-$dt = str_replace($replaced, '', $oldurl[0]);
-$t = str_replace('-', '', $dt);
-$time = new DateTime($t);
-$timestamp = $time->format("Y-m-d H:i:s");
-// The post date
-$postdate = strtotime($timestamp);
-// The post URL
-if (config('permalink.type') == 'post') {
- $delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
-} else {
- // The post URL
- $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
-}
-
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-page.html.php b/system/admin/views/edit-page.html.php
index dde61ce..6ce4e84 100644
--- a/system/admin/views/edit-page.html.php
+++ b/system/admin/views/edit-page.html.php
@@ -1,34 +1,65 @@
file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldcontent = remove_html_comments($content);
+if ($type == 'is_frontpage') {
+ $filename = 'content/data/frontpage/frontpage.md';
+
+ if (file_exists($filename)) {
+ $content = file_get_contents($filename);
+ $oldtitle = get_content_tag('t', $content, 'Welcome');
+ $oldcontent = remove_html_comments($content);
+ } else {
+ $oldtitle = 'Welcome';
+ $oldcontent = 'Welcome to our website.';
+ }
+} elseif ($type == 'is_profile') {
+
+ if (isset($_SESSION[config("site.url")]['user'])) {
+ $user = $_SESSION[config("site.url")]['user'];
+ }
+
+ $filename = 'content/' . $user . '/author.md';
+
+ if (file_exists($filename)) {
+ $content = file_get_contents($filename);
+ $oldtitle = get_content_tag('t', $content, 'user');
+ $oldcontent = remove_html_comments($content);
+ } else {
+ $oldtitle = $user;
+ $oldcontent = 'Just another HTMLy user.';
+ }
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
} else {
- $destination = 'admin';
-}
-$dir = substr($url, 0, strrpos($url, '/'));
-$oldurl = str_replace($dir . '/', '', $url);
-$oldmd = str_replace('.md', '', $oldurl);
-if (isset($p->url)) {
- $delete = $p->url . '/delete?destination=' . $destination;
-}
-else {
- if(empty($sub)) {
- $delete = site_url() . $oldmd . '/delete?destination=' . $destination;
- }
- else {
- $delete = site_url() . $static .'/'. $sub . '/delete?destination=' . $destination;
- }
+ if (isset($p->file)) {
+ $url = $p->file;
+ } else {
+ $url = $oldfile;
+ }
+ $content = file_get_contents($url);
+ $oldtitle = get_content_tag('t', $content, 'Untitled');
+ $olddescription = get_content_tag('d', $content);
+ $oldcontent = remove_html_comments($content);
+
+ if (isset($_GET['destination'])) {
+ $destination = $_GET['destination'];
+ } else {
+ $destination = 'admin';
+ }
+ $dir = substr($url, 0, strrpos($url, '/'));
+ $oldurl = str_replace($dir . '/', '', $url);
+ $oldmd = str_replace('.md', '', $oldurl);
+
+ if (isset($p->url)) {
+ $delete = $p->url . '/delete?destination=' . $destination;
+ }
+ else {
+ if(empty($sub)) {
+ $delete = site_url() . $oldmd . '/delete?destination=' . $destination;
+ }
+ else {
+ $delete = site_url() . $static .'/'. $sub . '/delete?destination=' . $destination;
+ }
+ }
}
?>
@@ -41,34 +72,45 @@ else {
+
+
+
+
+
URL
@@ -76,10 +118,6 @@ else {
-
diff --git a/system/admin/views/edit-post.html.php b/system/admin/views/edit-post.html.php
deleted file mode 100644
index 384c868..0000000
--- a/system/admin/views/edit-post.html.php
+++ /dev/null
@@ -1,125 +0,0 @@
-file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-
-$desc = get_category_info(null);
-
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldtag = get_content_tag('tag', $content);
-$oldcontent = remove_html_comments($content);
-
-$dir = substr($url, 0, strrpos($url, '/'));
-$isdraft = explode('/', $dir);
-$oldurl = explode('_', $url);
-
-if (empty($oldtag)) {
- $oldtag = $oldurl[1];
-}
-
-$oldmd = str_replace('.md', '', $oldurl[2]);
-
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
-} else {
- $destination = 'admin';
-}
-$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
-
-// Category string
-$cat = explode('/', $replaced);
-$category = $cat[count($cat) - 3];
-
-$dt = str_replace($replaced, '', $oldurl[0]);
-$t = str_replace('-', '', $dt);
-$time = new DateTime($t);
-$timestamp = $time->format("Y-m-d H:i:s");
-// The post date
-$postdate = strtotime($timestamp);
-// The post URL
-if (config('permalink.type') == 'post') {
- $delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
-} else {
- // The post URL
- $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
-}
-
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-profile.html.php b/system/admin/views/edit-profile.html.php
deleted file mode 100644
index 0ab68f3..0000000
--- a/system/admin/views/edit-profile.html.php
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/edit-quote.html.php b/system/admin/views/edit-quote.html.php
deleted file mode 100644
index f8f748f..0000000
--- a/system/admin/views/edit-quote.html.php
+++ /dev/null
@@ -1,131 +0,0 @@
-file)) {
- $url = $p->file;
-} else {
- $url = $oldfile;
-}
-
-$desc = get_category_info(null);
-
-$content = file_get_contents($url);
-$oldtitle = get_content_tag('t', $content, 'Untitled');
-$olddescription = get_content_tag('d', $content);
-$oldtag = get_content_tag('tag', $content);
-$oldquote = get_content_tag('quote', $content);
-$oldcontent = remove_html_comments($content);
-
-$dir = substr($url, 0, strrpos($url, '/'));
-$isdraft = explode('/', $dir);
-$oldurl = explode('_', $url);
-
-if (empty($oldtag)) {
- $oldtag = $oldurl[1];
-}
-
-$oldmd = str_replace('.md', '', $oldurl[2]);
-
-if (isset($_GET['destination'])) {
- $destination = $_GET['destination'];
-} else {
- $destination = 'admin';
-}
-$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
-
-// Category string
-$cat = explode('/', $replaced);
-$category = $cat[count($cat) - 3];
-
-$dt = str_replace($replaced, '', $oldurl[0]);
-$t = str_replace('-', '', $dt);
-$time = new DateTime($t);
-$timestamp = $time->format("Y-m-d H:i:s");
-// The post date
-$postdate = strtotime($timestamp);
-// The post URL
-if (config('permalink.type') == 'post') {
- $delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
-} else {
- // The post URL
- $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
-}
-
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
URL
-
- Upload
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/admin/views/layout.html.php b/system/admin/views/layout.html.php
index 04892a4..92ffc77 100644
--- a/system/admin/views/layout.html.php
+++ b/system/admin/views/layout.html.php
@@ -7,7 +7,7 @@
-
+
diff --git a/system/htmly.php b/system/htmly.php
index 04d8051..76ad099 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -205,10 +205,11 @@ get('/edit/profile', function () {
if (login()) {
config('views.root', 'system/admin/views');
- render('edit-profile', array(
+ render('edit-page', array(
'title' => 'Edit profile - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
+ 'type' => 'is_profile',
'bodyclass' => 'editprofile',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit profile',
));
@@ -241,13 +242,14 @@ post('/edit/profile', function () {
}
config('views.root', 'system/admin/views');
- render('edit-profile', array(
+ render('edit-page', array(
'title' => 'Edit profile - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '
' . $message['error'] . '
',
'postTitle' => $title,
'postContent' => $content,
+ 'type' => 'is_profile',
'bodyclass' => 'editprofile',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit profile'
));
@@ -260,10 +262,11 @@ get('/edit/frontpage', function () {
if (login()) {
config('views.root', 'system/admin/views');
- render('edit-frontpage', array(
+ render('edit-page', array(
'title' => 'Edit frontpage - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
+ 'type' => 'is_frontpage',
'bodyclass' => 'editfrontpage',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit frontpage',
));
@@ -296,13 +299,14 @@ post('/edit/frontpage', function () {
}
config('views.root', 'system/admin/views');
- render('edit-frontpage', array(
+ render('edit-page', array(
'title' => 'Edit frontpage - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '
' . $message['error'] . '
',
'postTitle' => $title,
'postContent' => $content,
+ 'type' => 'is_frontpage',
'bodyclass' => 'editfrontpage',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit frontpage'
));
@@ -322,17 +326,22 @@ get('/front/edit', function () {
});
// Show the "Add post" page
-get('/add/post', function () {
+get('/add/content', function () {
+
+ $req = $_GET['type'];
+
+ $type = 'is_' . $req;
if (login()) {
config('views.root', 'system/admin/views');
- render('add-post', array(
- 'title' => 'Add post - ' . blog_title(),
+ render('add-content', array(
+ 'title' => 'Add content - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
- 'bodyclass' => 'addpost',
+ 'type' => $type,
+ 'bodyclass' => 'addcontent',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add post'
));
} else {
@@ -342,7 +351,20 @@ get('/add/post', function () {
});
// Submitted add post data
-post('/add/post', function () {
+post('/add/content', function () {
+
+ $is_image = from($_REQUEST, 'is_image');
+ $is_audio = from($_REQUEST, 'is_audio');
+ $is_video = from($_REQUEST, 'is_video');
+ $is_quote = from($_REQUEST, 'is_quote');
+ $is_link = from($_REQUEST, 'is_link');
+ $is_post = from($_REQUEST, 'is_post');
+
+ $link = from($_REQUEST, 'link');
+ $image = from($_REQUEST, 'image');
+ $audio = from($_REQUEST, 'audio');
+ $video = from($_REQUEST, 'video');
+ $quote = from($_REQUEST, 'quote');
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
@@ -354,416 +376,266 @@ post('/add/post', function () {
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
$category = from($_REQUEST, 'category');
- if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
- if (!empty($url)) {
- add_post($title, $tag, $url, $content, $user, $description, $draft, $category);
+
+ if (empty($is_post) && empty($is_image) && empty($is_video) && empty($is_audio) && empty($is_link) && empty($is_quote)) {
+ $add = site_url() . 'admin/content';
+ header("location: $add");
+ }
+
+ if (!empty($is_post)) {
+ if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
+ }
} else {
- $url = $title;
- add_post($title, $tag, $url, $content, $user, $description, $draft, $category);
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= '
Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= '
Content field is required.';
- }
- if (!$proper) {
- $message['error'] .= '
CSRF Token not correct.';
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= '
Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= '
Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= '
Content field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= '
CSRF Token not correct.';
+ }
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add post- ' . blog_title(),
+ 'description' => blog_description(),
+ 'canonical' => site_url(),
+ 'error' => '
' . $message['error'] . '
',
+ 'postTitle' => $title,
+ 'postTag' => $tag,
+ 'postUrl' => $url,
+ 'postContent' => $content,
+ 'type' => 'is_post',
+ 'bodyclass' => 'addpost',
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add post'
+ ));
}
- config('views.root', 'system/admin/views');
- render('add-post', array(
- 'title' => 'Add post- ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'error' => '
' . $message['error'] . '
',
- 'postTitle' => $title,
- 'postTag' => $tag,
- 'postUrl' => $url,
- 'postContent' => $content,
- 'bodyclass' => 'addpost',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add post'
- ));
- }
-});
-
-// Show the "Add image" page
-get('/add/image', function () {
-
- if (login()) {
-
- config('views.root', 'system/admin/views');
-
- render('add-image', array(
- 'title' => 'Add image - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'bodyclass' => 'addimage',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add image'
- ));
- } else {
- $login = site_url() . 'login';
- header("location: $login");
}
-});
-
-// Submitted add image data
-post('/add/image', function () {
-
- $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
-
- $title = from($_REQUEST, 'title');
- $image = from($_REQUEST, 'image');
- $tag = from($_REQUEST, 'tag');
- $url = from($_REQUEST, 'url');
- $content = from($_REQUEST, 'content');
- $description = from($_REQUEST, 'description');
- $user = $_SESSION[config("site.url")]['user'];
- $draft = from($_REQUEST, 'draft');
- $category = from($_REQUEST, 'category');
- if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
- if (!empty($url)) {
- add_image($title, $tag, $url, $content, $user, $description, $image, $draft, $category);
+
+ if (!empty($is_image)) {
+ if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
+ }
} else {
- $url = $title;
- add_image($title, $tag, $url, $content, $user, $description, $image, $draft, $category);
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= '
Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= '
Content field is required.';
- }
- if (empty($image)) {
- $message['error'] .= '
Image field is required.';
- }
- if (!$proper) {
- $message['error'] .= '
CSRF Token not correct.';
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= '
Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= '
Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= '
Content field is required.';
+ }
+ if (empty($image)) {
+ $message['error'] .= '
Image field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= '
CSRF Token not correct.';
+ }
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add image - ' . blog_title(),
+ 'description' => blog_description(),
+ 'canonical' => site_url(),
+ 'error' => '
' . $message['error'] . '
',
+ 'postTitle' => $title,
+ 'postImage' => $image,
+ 'postTag' => $tag,
+ 'postUrl' => $url,
+ 'postContent' => $content,
+ 'type' => 'is_image',
+ 'bodyclass' => 'addpost',
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add image'
+ ));
}
- config('views.root', 'system/admin/views');
- render('add-image', array(
- 'title' => 'Add image - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'error' => '
' . $message['error'] . '
',
- 'postTitle' => $title,
- 'postImage' => $image,
- 'postTag' => $tag,
- 'postUrl' => $url,
- 'postContent' => $content,
- 'bodyclass' => 'addpost',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add image'
- ));
}
-});
-
-// Show the "Add video" page
-get('/add/video', function () {
-
- if (login()) {
-
- config('views.root', 'system/admin/views');
-
- render('add-video', array(
- 'title' => 'Add video - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'bodyclass' => 'addvideo',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add video'
- ));
- } else {
- $login = site_url() . 'login';
- header("location: $login");
- }
-});
-
-// Submitted add video data
-post('/add/video', function () {
-
- $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
-
- $title = from($_REQUEST, 'title');
- $video = from($_REQUEST, 'video');
- $tag = from($_REQUEST, 'tag');
- $url = from($_REQUEST, 'url');
- $content = from($_REQUEST, 'content');
- $description = from($_REQUEST, 'description');
- $user = $_SESSION[config("site.url")]['user'];
- $draft = from($_REQUEST, 'draft');
- $category = from($_REQUEST, 'category');
- if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
- if (!empty($url)) {
- add_video($title, $tag, $url, $content, $user, $description, $video, $draft, $category);
+
+ if (!empty($is_video)) {
+ if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
+ }
} else {
- $url = $title;
- add_video($title, $tag, $url, $content, $user, $description, $video, $draft, $category);
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= '
Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= '
Content field is required.';
- }
- if (empty($video)) {
- $message['error'] .= '
Video field is required.';
- }
- if (!$proper) {
- $message['error'] .= '
CSRF Token not correct.';
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= '
Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= '
Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= '
Content field is required.';
+ }
+ if (empty($video)) {
+ $message['error'] .= '
Video field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= '
CSRF Token not correct.';
+ }
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add video - ' . blog_title(),
+ 'description' => blog_description(),
+ 'canonical' => site_url(),
+ 'error' => '
' . $message['error'] . '
',
+ 'postTitle' => $title,
+ 'postVideo' => $video,
+ 'postTag' => $tag,
+ 'postUrl' => $url,
+ 'postContent' => $content,
+ 'type' => 'is_video',
+ 'bodyclass' => 'addvideo',
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add video'
+ ));
}
- config('views.root', 'system/admin/views');
- render('add-video', array(
- 'title' => 'Add video - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'error' => '
' . $message['error'] . '
',
- 'postTitle' => $title,
- 'postVideo' => $video,
- 'postTag' => $tag,
- 'postUrl' => $url,
- 'postContent' => $content,
- 'bodyclass' => 'addvideo',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add video'
- ));
- }
-});
-
-// Show the "Add link" page
-get('/add/link', function () {
-
- if (login()) {
-
- config('views.root', 'system/admin/views');
-
- render('add-link', array(
- 'title' => 'Add link - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'bodyclass' => 'addlink',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add link'
- ));
- } else {
- $login = site_url() . 'login';
- header("location: $login");
}
-});
-
-// Submitted add link data
-post('/add/link', function () {
-
- $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
-
- $title = from($_REQUEST, 'title');
- $link = from($_REQUEST, 'link');
- $tag = from($_REQUEST, 'tag');
- $url = from($_REQUEST, 'url');
- $content = from($_REQUEST, 'content');
- $description = from($_REQUEST, 'description');
- $user = $_SESSION[config("site.url")]['user'];
- $draft = from($_REQUEST, 'draft');
- $category = from($_REQUEST, 'category');
- if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
- if (!empty($url)) {
- add_link($title, $tag, $url, $content, $user, $description, $link, $draft, $category);
+
+ if (!empty($is_audio)) {
+ if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
+ }
} else {
- $url = $title;
- add_link($title, $tag, $url, $content, $user, $description, $link, $draft, $category);
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= '
Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= '
Content field is required.';
- }
- if (empty($link)) {
- $message['error'] .= '
Link field is required.';
- }
- if (!$proper) {
- $message['error'] .= '
CSRF Token not correct.';
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= '
Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= '
Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= '
Content field is required.';
+ }
+ if (empty($audio)) {
+ $message['error'] .= '
Audio field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= '
CSRF Token not correct.';
+ }
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add audio - ' . blog_title(),
+ 'description' => blog_description(),
+ 'canonical' => site_url(),
+ 'error' => '
' . $message['error'] . '
',
+ 'postTitle' => $title,
+ 'postAudio' => $audio,
+ 'postTag' => $tag,
+ 'postUrl' => $url,
+ 'postContent' => $content,
+ 'type' => 'is_audio',
+ 'bodyclass' => 'addaudio',
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add audio'
+ ));
}
- config('views.root', 'system/admin/views');
- render('add-link', array(
- 'title' => 'Add link - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'error' => '
' . $message['error'] . '
',
- 'postTitle' => $title,
- 'postLink' => $link,
- 'postTag' => $tag,
- 'postUrl' => $url,
- 'postContent' => $content,
- 'bodyclass' => 'addlink',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add link'
- ));
- }
-});
-
-// Show the "Add quote" page
-get('/add/quote', function () {
-
- if (login()) {
-
- config('views.root', 'system/admin/views');
-
- render('add-quote', array(
- 'title' => 'Add quote - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'bodyclass' => 'addquote',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add quote'
- ));
- } else {
- $login = site_url() . 'login';
- header("location: $login");
}
-});
-
-// Submitted add quote data
-post('/add/quote', function () {
-
- $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
-
- $title = from($_REQUEST, 'title');
- $quote = from($_REQUEST, 'quote');
- $tag = from($_REQUEST, 'tag');
- $url = from($_REQUEST, 'url');
- $content = from($_REQUEST, 'content');
- $description = from($_REQUEST, 'description');
- $user = $_SESSION[config("site.url")]['user'];
- $draft = from($_REQUEST, 'draft');
- $category = from($_REQUEST, 'category');
- if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
- if (!empty($url)) {
- add_quote($title, $tag, $url, $content, $user, $description, $quote, $draft, $category);
+
+ if (!empty($is_quote)) {
+ if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
+ }
} else {
- $url = $title;
- add_quote($title, $tag, $url, $content, $user, $description, $quote, $draft, $category);
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= '
Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= '
Content field is required.';
- }
- if (empty($quote)) {
- $message['error'] .= '
Quote field is required.';
- }
- if (!$proper) {
- $message['error'] .= '
CSRF Token not correct.';
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= '
Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= '
Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= '
Content field is required.';
+ }
+ if (empty($quote)) {
+ $message['error'] .= '
Quote field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= '
CSRF Token not correct.';
+ }
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add quote - ' . blog_title(),
+ 'description' => blog_description(),
+ 'canonical' => site_url(),
+ 'error' => '
' . $message['error'] . '
',
+ 'postTitle' => $title,
+ 'postQuote' => $quote,
+ 'postTag' => $tag,
+ 'postUrl' => $url,
+ 'postContent' => $content,
+ 'type' => 'is_quote',
+ 'bodyclass' => 'addquote',
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add Quote'
+ ));
}
- config('views.root', 'system/admin/views');
- render('add-quote', array(
- 'title' => 'Add quote - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'error' => '
' . $message['error'] . '
',
- 'postTitle' => $title,
- 'postQuote' => $quote,
- 'postTag' => $tag,
- 'postUrl' => $url,
- 'postContent' => $content,
- 'bodyclass' => 'addquote',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add Quote'
- ));
- }
-});
-
-// Show the "Add audio" page
-get('/add/audio', function () {
-
- if (login()) {
-
- config('views.root', 'system/admin/views');
-
- render('add-audio', array(
- 'title' => 'Add audio - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'bodyclass' => 'addaudio',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add audio'
- ));
- } else {
- $login = site_url() . 'login';
- header("location: $login");
}
-});
-
-// Submitted add quote data
-post('/add/audio', function () {
-
- $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
-
- $title = from($_REQUEST, 'title');
- $audio = from($_REQUEST, 'audio');
- $tag = from($_REQUEST, 'tag');
- $url = from($_REQUEST, 'url');
- $content = from($_REQUEST, 'content');
- $description = from($_REQUEST, 'description');
- $user = $_SESSION[config("site.url")]['user'];
- $draft = from($_REQUEST, 'draft');
- $category = from($_REQUEST, 'category');
- if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
- if (!empty($url)) {
- add_audio($title, $tag, $url, $content, $user, $description, $audio, $draft, $category);
+
+ if (!empty($is_link)) {
+ if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
+ }
} else {
- $url = $title;
- add_audio($title, $tag, $url, $content, $user, $description, $audio, $draft, $category);
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= '
Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= '
Content field is required.';
- }
- if (empty($audio)) {
- $message['error'] .= '
Audio field is required.';
- }
- if (!$proper) {
- $message['error'] .= '
CSRF Token not correct.';
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= '
Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= '
Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= '
Content field is required.';
+ }
+ if (empty($link)) {
+ $message['error'] .= '
Link field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= '
CSRF Token not correct.';
+ }
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add link - ' . blog_title(),
+ 'description' => blog_description(),
+ 'canonical' => site_url(),
+ 'error' => '
' . $message['error'] . '
',
+ 'postTitle' => $title,
+ 'postLink' => $link,
+ 'postTag' => $tag,
+ 'postUrl' => $url,
+ 'postContent' => $content,
+ 'type' => 'is_link',
+ 'bodyclass' => 'addlink',
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add link'
+ ));
}
- config('views.root', 'system/admin/views');
- render('add-audio', array(
- 'title' => 'Add audio - ' . blog_title(),
- 'description' => blog_description(),
- 'canonical' => site_url(),
- 'error' => '
' . $message['error'] . '
',
- 'postTitle' => $title,
- 'postAudio' => $audio,
- 'postTag' => $tag,
- 'postUrl' => $url,
- 'postContent' => $content,
- 'bodyclass' => 'addaudio',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add audio'
- ));
}
+
});
// Show the static add page
@@ -777,6 +649,7 @@ get('/add/page', function () {
'title' => 'Add page - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
+ 'type' => 'is_page',
'bodyclass' => 'addpage',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add page'
));
@@ -822,6 +695,7 @@ post('/add/page', function () {
'postTitle' => $title,
'postUrl' => $url,
'postContent' => $content,
+ 'type' => 'is_page',
'bodyclass' => 'addpage',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add page'
));
@@ -835,11 +709,12 @@ get('/add/category', function () {
config('views.root', 'system/admin/views');
- render('add-category', array(
+ render('add-page', array(
'title' => 'Add page - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
- 'bodyclass' => 'addpage',
+ 'type' => 'is_category',
+ 'bodyclass' => 'addcategory',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add page'
));
} else {
@@ -876,7 +751,7 @@ post('/add/category', function () {
$message['error'] .= '
CSRF Token not correct.';
}
config('views.root', 'system/admin/views');
- render('add-category', array(
+ render('add-page', array(
'title' => 'Add page - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
@@ -884,7 +759,8 @@ post('/add/category', function () {
'postTitle' => $title,
'postUrl' => $url,
'postContent' => $content,
- 'bodyclass' => 'addpage',
+ 'type' => 'is_category',
+ 'bodyclass' => 'addcategory',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Add page'
));
}
@@ -1445,14 +1321,14 @@ get('/category/:category/edit', function ($category) {
$post = $post[0];
- render('edit-category', array(
+ render('edit-page', array(
'title' => 'Edit category - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
+ 'type' => 'is_category',
'bodyclass' => 'editpage',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » ' . $post->title,
- 'p' => $post,
- 'type' => 'categoryPage',
+ 'p' => $post
));
} else {
$login = site_url() . 'login';
@@ -1496,7 +1372,7 @@ post('/category/:category/edit', function () {
}
config('views.root', 'system/admin/views');
- render('edit-category', array(
+ render('edit-page', array(
'title' => 'Edit category - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
@@ -1505,6 +1381,7 @@ post('/category/:category/edit', function () {
'postTitle' => $title,
'postUrl' => $url,
'postContent' => $content,
+ 'type' => 'is_category',
'bodyclass' => 'editcategory',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit category'
));
@@ -1824,31 +1701,32 @@ get('/post/:name/edit', function ($name) {
$current = $post['current'];
if (isset($current->image)) {
- $var = 'edit-image';
+ $type= 'is_image';
} elseif (isset($current->link)) {
- $var = 'edit-link';
+ $type = 'is_link';
} elseif (isset($current->quote)) {
- $var = 'edit-quote';
+ $type = 'is_quote';
} elseif (isset($current->audio)) {
- $var = 'edit-audio';
+ $type = 'is_audio';
} elseif (isset($current->video)) {
- $var = 'edit-video';
+ $type = 'is_video';
} else {
- $var = 'edit-post';
+ $type = 'is_post';
}
if ($user === $current->author || $role === 'admin') {
- render($var, array(
- 'title' => $var .' '. blog_title(),
+ render('edit-content', array(
+ 'title' => $type .' - '. blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'p' => $current,
+ 'type' => $type,
'bodyclass' => 'editcontent',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » ' . $current->tagb . ' » ' . $current->title
));
} else {
render('denied', array(
- 'title' => $var .' '. blog_title(),
+ 'title' => $type .' - '. blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'p' => $current,
@@ -1896,54 +1774,54 @@ post('/post/:name/edit', function () {
}
if (!empty($is_image)) {
- $var = 'edit-image';
+ $type = 'is_image';
} elseif (!empty($is_video)) {
- $var = 'edit-video';
+ $type = 'is_video';
} elseif (!empty($is_link)) {
- $var = 'edit-link';
+ $type = 'is_link';
} elseif (!empty($is_quote)) {
- $var = 'edit-quote';
+ $type = 'is_quote';
} elseif (!empty($is_audio)) {
- $var = 'edit-audio';
+ $type = 'is_audio';
} elseif (!empty($is_post)) {
- $var = 'edit-post';
+ $type = 'is_post';
}
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
if (empty($url)) {
$url = $title;
}
- edit_image($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category, 'image');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
if (empty($url)) {
$url = $title;
}
- edit_video($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category, 'video');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
if (empty($url)) {
$url = $title;
}
- edit_link($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category, 'link');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
if (empty($url)) {
$url = $title;
}
- edit_quote($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft, $category);
+ edit_contente($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft, $category, 'quote');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
if (empty($url)) {
$url = $title;
}
- edit_audio($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft, $category, 'audio');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
if (empty($url)) {
$url = $title;
}
- edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, null, $revertPost, $publishDraft, $category, 'post');
} else {
$message['error'] = '';
@@ -1984,8 +1862,8 @@ post('/post/:name/edit', function () {
config('views.root', 'system/admin/views');
- render($var, array(
- 'title' => 'Edit content - ' . blog_title(),
+ render('edit-content', array(
+ 'title' => $type . ' - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '
' . $message['error'] . '
',
@@ -1998,6 +1876,7 @@ post('/post/:name/edit', function () {
'postAudio' => $audio,
'postTag' => $tag,
'postUrl' => $url,
+ 'type' => $type,
'postContent' => $content,
'bodyclass' => 'editcontent',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit content'
@@ -2236,6 +2115,7 @@ get('/:static/add', function ($static) {
'title' => 'Add page - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
+ 'type' => 'is_page',
'bodyclass' => 'addpage',
'breadcrumb' => '
' . config('breadcrumb.home') . ' »
' . $post->title . ' Add page'
));
@@ -2281,8 +2161,9 @@ post('/:static/add', function ($static) {
'postTitle' => $title,
'postUrl' => $url,
'postContent' => $content,
+ 'type' => 'is_page',
'bodyclass' => 'addpage',
- 'breadcrumb' => '
' . config('breadcrumb.home') . ' »
' . $post->title . ' Add page'
+ 'breadcrumb' => '
' . config('breadcrumb.home') . ' »
' . $title . ' Add page'
));
}
});
@@ -2686,31 +2567,32 @@ get('/:year/:month/:name/edit', function ($year, $month, $name) {
$current = $post['current'];
if (isset($current->image)) {
- $var = 'edit-image';
+ $type= 'is_image';
} elseif (isset($current->link)) {
- $var = 'edit-link';
+ $type = 'is_link';
} elseif (isset($current->quote)) {
- $var = 'edit-quote';
+ $type = 'is_quote';
} elseif (isset($current->audio)) {
- $var = 'edit-audio';
+ $type = 'is_audio';
} elseif (isset($current->video)) {
- $var = 'edit-video';
+ $type = 'is_video';
} else {
- $var = 'edit-post';
+ $type = 'is_post';
}
if ($user === $current->author || $role === 'admin') {
- render($var, array(
- 'title' => $var .' '. blog_title(),
+ render('edit-content', array(
+ 'title' => $type .' - '. blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'p' => $current,
+ 'type' => $type,
'bodyclass' => 'editcontent',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » ' . $current->tagb . ' » ' . $current->title
));
} else {
render('denied', array(
- 'title' => $var .' '. blog_title(),
+ 'title' => $type .' - '. blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'p' => $current,
@@ -2758,54 +2640,54 @@ post('/:year/:month/:name/edit', function () {
}
if (!empty($is_image)) {
- $var = 'edit-image';
+ $type = 'is_image';
} elseif (!empty($is_video)) {
- $var = 'edit-video';
+ $type = 'is_video';
} elseif (!empty($is_link)) {
- $var = 'edit-link';
+ $type = 'is_link';
} elseif (!empty($is_quote)) {
- $var = 'edit-quote';
+ $type = 'is_quote';
} elseif (!empty($is_audio)) {
- $var = 'edit-audio';
+ $type = 'is_audio';
} elseif (!empty($is_post)) {
- $var = 'edit-post';
+ $type = 'is_post';
}
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
if (empty($url)) {
$url = $title;
}
- edit_image($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category, 'image');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
if (empty($url)) {
$url = $title;
}
- edit_video($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category, 'video');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
if (empty($url)) {
$url = $title;
}
- edit_link($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category, 'link');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
if (empty($url)) {
$url = $title;
}
- edit_quote($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft, $category, 'quote');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
if (empty($url)) {
$url = $title;
}
- edit_audio($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft, $category, 'audio');
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
if (empty($url)) {
$url = $title;
}
- edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $revertPost, $publishDraft, $category);
+ edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, null, $revertPost, $publishDraft, $category, 'post');
} else {
$message['error'] = '';
@@ -2846,8 +2728,8 @@ post('/:year/:month/:name/edit', function () {
config('views.root', 'system/admin/views');
- render($var, array(
- 'title' => 'Edit content - ' . blog_title(),
+ render('edit-content', array(
+ 'title' => $type . ' - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '
' . $message['error'] . '
',
@@ -2860,6 +2742,7 @@ post('/:year/:month/:name/edit', function () {
'postAudio' => $audio,
'postTag' => $tag,
'postUrl' => $url,
+ 'type' => $type,
'postContent' => $content,
'bodyclass' => 'editcontent',
'breadcrumb' => '
' . config('breadcrumb.home') . ' » Edit content'
diff --git a/system/includes/functions.php b/system/includes/functions.php
index 2fb0664..a71b217 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -628,6 +628,9 @@ function get_profile_posts($name, $page, $perpage)
// Return draft list
function get_draft($profile, $page, $perpage)
{
+
+ $user = $_SESSION[config("site.url")]['user'];
+ $role = user('role', $user);
$posts = get_draft_posts();
$tmp = array();
@@ -635,7 +638,7 @@ function get_draft($profile, $page, $perpage)
foreach ($posts as $index => $v) {
$str = explode('/', $v['dirname']);
$author = $str[count($str) - 4];
- if (strtolower($profile) === strtolower($author)) {
+ if (strtolower($profile) === strtolower($author) || $role === 'admin') {
$tmp[] = $v;
}
}
@@ -969,12 +972,14 @@ function get_tagcount($var, $str)
$posts = get_post_sorted();
$tmp = array();
-
+
foreach ($posts as $index => $v) {
$arr = explode('_', $v[$str]);
- $url = $arr[1];
- if (stripos($url, "$var") !== false) {
- $tmp[] = $v;
+ $mtag = explode(',', rtrim($arr[1], ','));
+ foreach ($mtag as $t) {
+ if (strtolower($t) === strtolower($var)) {
+ $tmp[] = $v;
+ }
}
}
@@ -1889,6 +1894,13 @@ function get_menu($custom)
} else {
echo '
' . config('breadcrumb.home') . '';
}
+ if (config('blog.enable') == 'true' ) {
+ if ($req == site_path() . '/blog' || stripos($req, site_path() . '/blog?page') !== false) {
+ echo '
' . 'Blog' . '';
+ } else {
+ echo '
' . 'Blog' . '';
+ }
+ }
echo '';
}
}
@@ -2454,7 +2466,7 @@ function toolbar()
$base = site_url();
echo <<
+
EOF;
echo '