diff --git a/system/admin/admin.php b/system/admin/admin.php
index 8afcb56..37855be 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 = '
Your username and password mismatch.';
+ return $str = 'Your username and password mismatch.';
}
} else if (old_password_verify($pass, $user_enc, $user_pass)) {
update_user($user, $pass, $user_role);
@@ -104,46 +104,46 @@ function add_content($title, $tag, $url, $content, $user, $description = null, $
$tagmd = "\n";
} else {
$tagmd = "";
- }
+ }
if ($media!== null) {
$post_media = "\n";
} else {
$post_media = "";
- }
+ }
$post_content = "" . $post_description . $tagmd . $post_media . "\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
-
+
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
-
+
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
-
+
if (empty($draft)) {
$dir = 'content/' . $user . '/blog/' . $category. '/'.$type. '/';
} else {
$dir = 'content/' . $user . '/blog/' . $category. '/draft/';
}
-
+
if (is_dir($dir)) {
file_put_contents($dir . $filename, print_r($post_content, true));
} else {
mkdir($dir, 0775, true);
file_put_contents($dir . $filename, print_r($post_content, true));
}
-
+
save_tag_i18n($post_tag, $post_tagmd);
rebuilt_cache('all');
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename, $category, $type);
-
+
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
} else {
$redirect = site_url() . 'admin/draft';
}
-
+
header("Location: $redirect");
}
}
@@ -154,7 +154,7 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
$olddate = date('Y-m-d-H-i-s', strtotime($date));
-
+
if ($date !== null) {
$oldurl[0] = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/' . $olddate;
}
@@ -177,47 +177,47 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul
$tagmd = "\n";
} else {
$tagmd = "";
- }
+ }
if ($media !== null) {
$post_media = "\n";
} else {
$post_media = "";
- }
+ }
$post_content = "" . $post_description . $tagmd . $post_media . "\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
-
+
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
-
+
if(!empty($revertPost) || !empty($publishDraft)) {
-
+
$dirBlog = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/' . $type . '/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/draft/';
-
+
if($dir[4] == 'draft') {
- $filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
+ $filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
- $filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
+ $filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
-
+
if (is_dir($dirBlog)) {
} else {
- mkdir($dirBlog, 0775, true);
+ mkdir($dirBlog, 0775, true);
}
-
+
if (is_dir($dirDraft)) {
} else {
- mkdir($dirDraft, 0775, true);
+ mkdir($dirDraft, 0775, true);
}
-
+
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
-
+
} else {
-
+
if ($dir[3] === $category) {
$newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md';
if ($oldfile === $newfile) {
@@ -227,37 +227,37 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul
file_put_contents($newfile, print_r($post_content, true));
}
} else {
-
+
$dirBlog = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/' . $type. '/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/draft/';
if($dir[4] == 'draft') {
- $filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
+ $filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
- $filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
+ $filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
if (is_dir($dirBlog)) {
} else {
- mkdir($dirBlog, 0775, true);
+ mkdir($dirBlog, 0775, true);
}
if (is_dir($dirDraft)) {
} else {
- mkdir($dirDraft, 0775, true);
+ mkdir($dirDraft, 0775, true);
}
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
-
+
}
-
+
}
if(!empty($publishDraft)) {
$dt = $olddate;
- $t = str_replace('-', '', $dt);
+ $t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
} else {
@@ -267,19 +267,19 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
}
-
+
// The post date
$postdate = strtotime($timestamp);
-
+
// The post URL
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}
-
+
save_tag_i18n($post_tag, $post_tagmd);
-
+
rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile, $category, $type);
if ($destination == 'post') {
@@ -375,7 +375,7 @@ function add_sub_page($title, $url, $content, $static, $description = null)
function edit_page($title, $url, $content, $oldfile, $destination = null, $description = null, $static = null)
{
$dir = substr($oldfile, 0, strrpos($oldfile, '/'));
-
+
$post_title = safe_html($title);
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description);
@@ -410,7 +410,7 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
} else {
$posturl = site_url() . $post_url;
}
-
+
rebuilt_cache('all');
clear_page_cache($post_url);
if ($destination == 'post') {
@@ -471,7 +471,7 @@ function edit_category($title, $url, $content, $oldfile, $destination = null, $d
}
$post_content = '' . $post_description . "\n\n" . $content;
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) {
-
+
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
@@ -482,9 +482,9 @@ function edit_category($title, $url, $content, $oldfile, $destination = null, $d
rename($oldfile, $newfile);
file_put_contents($newfile, print_r($post_content, true));
}
-
+
rename_category_folder($post_url, $oldfile);
-
+
rebuilt_cache('all');
if ($destination == 'post') {
header("Location: $posturl");
@@ -681,7 +681,7 @@ function get_user_posts()
echo '| ' . i18n('Title') . ' | ' . i18n('Published') . ' | ';
if (config("views.counter") == "true")
echo 'Views | ';
- echo '' . i18n('Tag') . ' | ' . i18n('Operations') . ' |
';
+ echo '' . i18n('Category') . ' | ' . i18n('Tags') . ' | ' . i18n('Operations') . ' | ';
$i = 0;
$len = count($posts);
foreach ($posts as $p) {
@@ -698,6 +698,7 @@ function get_user_posts()
echo '' . format_date($p->date) . ' | ';
if (config("views.counter") == "true")
echo '' . $p->views . ' | ';
+ echo '' . $p->category . ' | ';
echo '' . $p->tag . ' | ';
echo '' . i18n('Edit') . ' ' . i18n('Delete') . ' | ';
echo '';
@@ -815,7 +816,7 @@ function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category
if (file_exists($p)) {
unlink($p);
}
-
+
// Delete post permalink
$pp = 'cache/page/' . $b . 'post#' . $post_url . '.cache';
if (file_exists($pp)) {
@@ -873,7 +874,7 @@ function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category
foreach (glob('cache/page/' . $b . 'search#*.cache', GLOB_NOSORT) as $file) {
unlink($file);
}
-
+
// Delete category
$cc = 'cache/page/' . $b . 'category#' . $category . '.cache';
if (file_exists($cc)) {
@@ -882,7 +883,7 @@ function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category
foreach (glob('cache/page/' . $b . 'category#' . $category . '~*.cache', GLOB_NOSORT) as $file) {
unlink($file);
}
-
+
// Delete type
$tp = 'cache/page/' . $b . 'type#' . $type . '.cache';
if (file_exists($tp)) {
diff --git a/system/admin/views/add-content.html.php b/system/admin/views/add-content.html.php
index d65688a..50ce84d 100644
--- a/system/admin/views/add-content.html.php
+++ b/system/admin/views/add-content.html.php
@@ -1,10 +1,10 @@
-
-
+
@@ -27,77 +27,81 @@ $desc = get_category_info(null);
diff --git a/system/admin/views/add-page.html.php b/system/admin/views/add-page.html.php
index 22051d7..5fb3bf2 100644
--- a/system/admin/views/add-page.html.php
+++ b/system/admin/views/add-page.html.php
@@ -1,5 +1,5 @@
-
+
@@ -14,21 +14,28 @@