|
|
@ -84,18 +84,37 @@ function remove_accent($str) |
|
|
// Add content
|
|
|
// Add content
|
|
|
function add_content($title, $tag, $url, $content, $user, $description = null, $media = null, $draft, $category, $type) |
|
|
function add_content($title, $tag, $url, $content, $user, $description = null, $media = null, $draft, $category, $type) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ','))); |
|
|
|
|
|
$tag = array_filter(array_unique($tag)); |
|
|
|
|
|
$taglang = array_flip(unserialize(file_get_contents('content/data/tags.lang'))); |
|
|
|
|
|
$tflip = array_intersect_key($taglang, array_flip($tag)); |
|
|
|
|
|
$post_tag = array(); |
|
|
|
|
|
$post_tagmd = array(); |
|
|
|
|
|
foreach ($tag as $t) { |
|
|
|
|
|
if (array_key_exists($t, $tflip)) { |
|
|
|
|
|
foreach ($tflip as $tfp => $tf){ |
|
|
|
|
|
if($t === $tfp) { |
|
|
|
|
|
$post_tag[] = $tf; |
|
|
|
|
|
$post_tagmd[] = $tfp; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
$post_tag[] = $t; |
|
|
|
|
|
$post_tagmd[] = $t; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$post_tag = safe_tag(implode(',', $post_tag)); |
|
|
|
|
|
$post_tagmd = safe_html(implode(',', $post_tagmd)); |
|
|
|
|
|
|
|
|
$post_date = date('Y-m-d-H-i-s'); |
|
|
$post_date = date('Y-m-d-H-i-s'); |
|
|
$post_title = safe_html($title); |
|
|
$post_title = safe_html($title); |
|
|
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media)); |
|
|
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media)); |
|
|
$pt = safe_tag($tag); |
|
|
|
|
|
$post_tag = strtolower(preg_replace(array('/[^a-zA-Z0-9,. \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($pt))); |
|
|
|
|
|
$post_tagmd = safe_html($tag); |
|
|
|
|
|
$post_tag = rtrim($post_tag, ','); |
|
|
|
|
|
$post_tagmd = preg_replace("/\s*,\s*/", ",", rtrim($post_tagmd, ',')); |
|
|
|
|
|
|
|
|
$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); |
|
|
@ -121,8 +140,8 @@ function add_content($title, $tag, $url, $content, $user, $description = null, $ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$post_tag = implode(',', array_keys($newtag)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$post_tag = implode(',', array_keys($newtag)); |
|
|
|
|
|
|
|
|
if ($description !== null) { |
|
|
if ($description !== null) { |
|
|
$post_description = "\n<!--d " . $description . " d-->"; |
|
|
$post_description = "\n<!--d " . $description . " d-->"; |
|
|
} else { |
|
|
} else { |
|
|
@ -177,6 +196,30 @@ function add_content($title, $tag, $url, $content, $user, $description = null, $ |
|
|
// Edit content
|
|
|
// Edit content
|
|
|
function edit_content($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $media = null, $revertPost, $publishDraft, $category, $type) |
|
|
function edit_content($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $media = null, $revertPost, $publishDraft, $category, $type) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ','))); |
|
|
|
|
|
$tag = array_filter(array_unique($tag)); |
|
|
|
|
|
$taglang = array_flip(unserialize(file_get_contents('content/data/tags.lang'))); |
|
|
|
|
|
$tflip = array_intersect_key($taglang, array_flip($tag)); |
|
|
|
|
|
$post_tag = array(); |
|
|
|
|
|
$post_tagmd = array(); |
|
|
|
|
|
foreach ($tag as $t) { |
|
|
|
|
|
if (array_key_exists($t, $tflip)) { |
|
|
|
|
|
foreach ($tflip as $tfp => $tf){ |
|
|
|
|
|
if($t === $tfp) { |
|
|
|
|
|
$post_tag[] = $tf; |
|
|
|
|
|
$post_tagmd[] = $tfp; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
$post_tag[] = $t; |
|
|
|
|
|
$post_tagmd[] = $t; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$post_tag = safe_tag(implode(',', $post_tag)); |
|
|
|
|
|
$post_tagmd = safe_html(implode(',', $post_tagmd)); |
|
|
|
|
|
|
|
|
$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)); |
|
|
@ -187,11 +230,7 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul |
|
|
|
|
|
|
|
|
$post_title = safe_html($title); |
|
|
$post_title = safe_html($title); |
|
|
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media)); |
|
|
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media)); |
|
|
$pt = safe_tag($tag); |
|
|
|
|
|
$post_tag = strtolower(preg_replace(array('/[^a-zA-Z0-9,. \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($pt))); |
|
|
|
|
|
$post_tagmd = safe_html($tag); |
|
|
|
|
|
$post_tag = rtrim($post_tag, ','); |
|
|
|
|
|
$post_tagmd = preg_replace("/\s*,\s*/", ",", rtrim($post_tagmd, ',')); |
|
|
|
|
|
|
|
|
$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); |
|
|
|
|
|
|
|
|
|