Update admin.php

This commit is contained in:
danpros 2021-03-02 17:13:00 +07:00
commit ac65ba834f

View file

@ -140,14 +140,24 @@ function add_content($title, $tag, $url, $content, $user, $description = null, $
}
}
$post_tag = implode(',', array_keys($newtag));
$post_tag = implode(',', array_keys($newtag));
$posts = get_post_sorted();
foreach ($posts as $index => $v) {
$arr = explode('_', $v['basename']);
if (strtolower($arr[2]) === strtolower($post_url . '.md')) {
$post_url = $post_url .'-'. $timestamp;
} else {
$post_url = $post_url;
}
}
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}
@ -267,11 +277,11 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul
$post_tag = implode(',', array_keys($newtag));
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}
@ -411,11 +421,11 @@ function add_page($title, $url, $content, $description = null)
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description);
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}
@ -449,11 +459,11 @@ function add_sub_page($title, $url, $content, $static, $description = null)
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description);
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}
@ -488,11 +498,11 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description);
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}
@ -542,11 +552,11 @@ function add_category($title, $url, $content, $description = null)
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description);
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}
@ -581,11 +591,11 @@ function edit_category($title, $url, $content, $oldfile, $destination = null, $d
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description);
if ($description !== null) {
if (!empty($description)) {
if (!empty($description)) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "\n<!--d " . get_description($content) . " d-->";
}
}
} else {
$post_description = "";
}