|
|
@ -115,7 +115,7 @@ function remove_accent($str) |
|
|
// Add content
|
|
|
// Add content
|
|
|
function add_content($title, $tag, $url, $content, $user, $draft, $category, $type, $description = null, $media = null, $dateTime = null) |
|
|
function add_content($title, $tag, $url, $content, $user, $draft, $category, $type, $description = null, $media = null, $dateTime = null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ','))); |
|
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ','))); |
|
|
$tag = array_filter(array_unique($tag)); |
|
|
$tag = array_filter(array_unique($tag)); |
|
|
$tagslang = "content/data/tags.lang"; |
|
|
$tagslang = "content/data/tags.lang"; |
|
|
@ -137,10 +137,10 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty |
|
|
$post_tagmd[] = $t; |
|
|
$post_tagmd[] = $t; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$post_tag = safe_tag(implode(',', $post_tag)); |
|
|
$post_tag = safe_tag(implode(',', $post_tag)); |
|
|
$post_tagmd = safe_html(implode(',', $post_tagmd)); |
|
|
$post_tagmd = safe_html(implode(',', $post_tagmd)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
$post_tag = safe_tag(implode(',', $tag)); |
|
|
$post_tag = safe_tag(implode(',', $tag)); |
|
|
$post_tagmd = safe_html(implode(',', $tag)); |
|
|
$post_tagmd = safe_html(implode(',', $tag)); |
|
|
@ -151,7 +151,7 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty |
|
|
$post_tag = strtolower(preg_replace(array('/[^a-zA-Z0-9,. \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($post_tag))); |
|
|
$post_tag = strtolower(preg_replace(array('/[^a-zA-Z0-9,. \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($post_tag))); |
|
|
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); |
|
|
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); |
|
|
$description = safe_html($description); |
|
|
$description = safe_html($description); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$post_t = explode(',', $post_tag); |
|
|
$post_t = explode(',', $post_tag); |
|
|
$pret_t = explode(',', $post_tagmd); |
|
|
$pret_t = explode(',', $post_tagmd); |
|
|
$tags = tag_cloud(true); |
|
|
$tags = tag_cloud(true); |
|
|
@ -178,7 +178,7 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$post_tag = implode(',', array_keys($newtag)); |
|
|
$post_tag = implode(',', array_keys($newtag)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$posts = get_blog_posts(); |
|
|
$posts = get_blog_posts(); |
|
|
foreach ($posts as $index => $v) { |
|
|
foreach ($posts as $index => $v) { |
|
|
$arr = explode('_', $v['basename']); |
|
|
$arr = explode('_', $v['basename']); |
|
|
@ -188,7 +188,7 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty |
|
|
$post_url = $post_url; |
|
|
$post_url = $post_url; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($description !== null) { |
|
|
if ($description !== null) { |
|
|
if (!empty($description)) { |
|
|
if (!empty($description)) { |
|
|
$post_description = "\n<!--d " . $description . " d-->"; |
|
|
$post_description = "\n<!--d " . $description . " d-->"; |
|
|
@ -253,7 +253,7 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty |
|
|
// Edit content
|
|
|
// Edit content
|
|
|
function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, $type, $destination = null, $description = null, $date = null, $media = null) |
|
|
function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, $type, $destination = null, $description = null, $date = null, $media = null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ','))); |
|
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ','))); |
|
|
$tag = array_filter(array_unique($tag)); |
|
|
$tag = array_filter(array_unique($tag)); |
|
|
$tagslang = "content/data/tags.lang"; |
|
|
$tagslang = "content/data/tags.lang"; |
|
|
@ -278,15 +278,14 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ |
|
|
$post_tagmd[] = $t; |
|
|
$post_tagmd[] = $t; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$post_tag = safe_tag(implode(',', $post_tag)); |
|
|
$post_tag = safe_tag(implode(',', $post_tag)); |
|
|
$post_tagmd = safe_html(implode(',', $post_tagmd)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$post_tagmd = safe_html(implode(',', $post_tagmd)); |
|
|
} else { |
|
|
} else { |
|
|
$post_tag = safe_tag(implode(',', $tag)); |
|
|
$post_tag = safe_tag(implode(',', $tag)); |
|
|
$post_tagmd = safe_html(implode(',', $tag)); |
|
|
$post_tagmd = safe_html(implode(',', $tag)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$oldurl = explode('_', $oldfile); |
|
|
$oldurl = explode('_', $oldfile); |
|
|
$dir = explode('/', $oldurl[0]); |
|
|
$dir = explode('/', $oldurl[0]); |
|
|
$olddate = date('Y-m-d-H-i-s', strtotime($date)); |
|
|
$olddate = date('Y-m-d-H-i-s', strtotime($date)); |
|
|
@ -522,18 +521,16 @@ function add_page($title, $url, $content, $draft, $description = null) |
|
|
$filename = $post_url . '.md'; |
|
|
$filename = $post_url . '.md'; |
|
|
$dir = 'content/static/'; |
|
|
$dir = 'content/static/'; |
|
|
$dirDraft = 'content/static/draft/'; |
|
|
$dirDraft = 'content/static/draft/'; |
|
|
|
|
|
|
|
|
if (!is_dir($dir)) { |
|
|
|
|
|
mkdir($dir, 0775, true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!is_dir($dirDraft)) { |
|
|
|
|
|
mkdir($dirDraft, 0775, true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (empty($draft)) { |
|
|
if (empty($draft)) { |
|
|
|
|
|
if (!is_dir($dir)) { |
|
|
|
|
|
mkdir($dir, 0775, true); |
|
|
|
|
|
} |
|
|
file_put_contents($dir . $filename, print_r($post_content, true)); |
|
|
file_put_contents($dir . $filename, print_r($post_content, true)); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if (!is_dir($dirDraft)) { |
|
|
|
|
|
mkdir($dirDraft, 0775, true); |
|
|
|
|
|
} |
|
|
file_put_contents($dirDraft . $filename, print_r($post_content, true)); |
|
|
file_put_contents($dirDraft . $filename, print_r($post_content, true)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -566,6 +563,17 @@ function add_sub_page($title, $url, $content, $static, $draft, $description = nu |
|
|
} else { |
|
|
} else { |
|
|
$post_description = ""; |
|
|
$post_description = ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$posts = get_static_subpages(); |
|
|
|
|
|
$timestamp = date('YmdHis'); |
|
|
|
|
|
foreach ($posts as $index => $v) { |
|
|
|
|
|
if (strtolower($v['basename']) === strtolower($post_url . '.md')) { |
|
|
|
|
|
$post_url = $post_url .'-'. $timestamp; |
|
|
|
|
|
} else { |
|
|
|
|
|
$post_url = $post_url; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content; |
|
|
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content; |
|
|
|
|
|
|
|
|
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) { |
|
|
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) { |
|
|
|