diff --git a/system/admin/admin.php b/system/admin/admin.php index 61a11ea..488dc0d 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -45,8 +45,8 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null) $oldurl = explode('_', $oldfile); $post_title = $title; - $post_tag = preg_replace(array('/[^a-zA-Z0-9,.-]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag)); - $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); + $post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag)); + $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); $post_content = '' . "\n\n" . $content; if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { @@ -95,7 +95,7 @@ function edit_page($title, $url, $content, $oldfile, $destination = null) { $dir = substr($oldfile, 0, strrpos($oldfile, '/')); $post_title = $title; - $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); + $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); $post_content = '' . "\n\n" . $content; if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { @@ -132,8 +132,8 @@ function add_post($title, $tag, $url, $content, $user) { $post_date = date('Y-m-d-H-i-s'); $post_title = $title; - $post_tag = preg_replace(array('/[^a-zA-Z0-9,.-]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag)); - $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); + $post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag)); + $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); $post_content = '' . "\n\n" . $content; if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { @@ -162,7 +162,7 @@ function add_post($title, $tag, $url, $content, $user) { function add_page($title, $url, $content) { $post_title = $title; - $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); + $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); $post_content = '' . "\n\n" . $content; if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { @@ -271,9 +271,8 @@ function migrate($title, $time, $tags, $content, $url, $user, $source) { $post_date = date('Y-m-d-H-i-s', $time); $post_title = $title; - $post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $tags); - $post_tag = rtrim(ltrim($post_tag, ',\.\-'), ',\.\-'); - $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); + $post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tags)); + $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); if(!empty($source)) { $post_content = '' . "\n\n" . $content . "\n\n" . 'Source: ' . $title . ''; } @@ -320,11 +319,11 @@ function get_feed($feed_url, $credit, $message=null) { $time = new DateTime($entry->pubDate); $timestamp= $time->format("Y-m-d H:i:s"); $time = strtotime($timestamp); - $tags = strip_tags(preg_replace(array('/[^a-zA-Z0-9,.-]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($entry->category))); + $tags = strip_tags(preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($entry->category))); $title = rtrim($entry->title, ' \,\.\-'); $title = ltrim($title, ' \,\.\-'); $user = $_SESSION['user']; - $url = strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($title))); + $url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($title))); if ($credit == 'yes') { $source = $entry->link; } diff --git a/system/includes/functions.php b/system/includes/functions.php index 55acede..17ec99c 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -591,7 +591,7 @@ function get_related($tag) { $perpage = config('related.count'); $posts = get_tag(strip_tags($tag), 1, $perpage+1, true); $tmp = array(); - $req = $_SERVER['REQUEST_URI']; + $req = urldecode($_SERVER['REQUEST_URI']); foreach ($posts as $post) { $url = $post->url;