Browse Source

My bad

pull/640/head v2.8.3
danpros 2 years ago
parent
commit
9b162c2e5b
2 changed files with 12 additions and 17 deletions
  1. +6
    -8
      system/admin/admin.php
  2. +6
    -9
      system/includes/functions.php

+ 6
- 8
system/admin/admin.php View File

@ -120,11 +120,10 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty
$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);
if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION < 7) {
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media));
} else {
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media ?? ''));
if (is_null($media)) {
$media = '';
} }
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media));
$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);
@ -264,11 +263,10 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
} }
$post_title = safe_html($title); $post_title = safe_html($title);
if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION < 7) {
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media));
} else {
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media ?? ''));
if (is_null($media)) {
$media = '';
} }
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($media));
$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);


+ 6
- 9
system/includes/functions.php View File

@ -530,7 +530,7 @@ function get_category($category, $page, $perpage, $random)
// Return category info. // Return category info.
function get_category_info($category) function get_category_info($category)
{
{
$posts = get_category_files(); $posts = get_category_files();
$tmp = array(); $tmp = array();
@ -570,14 +570,11 @@ function get_category_info($category)
} }
} }
if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION < 7) {
if (strtolower($category) == 'uncategorized') {
return default_category();
}
} else {
if (strtolower($category ?? '') == 'uncategorized') {
return default_category();
}
if (is_null($category)) {
$category = '';
}
if (strtolower($category) == 'uncategorized') {
return default_category();
} }
return $tmp; return $tmp;


Loading…
Cancel
Save