Browse Source

Clean up PHP error log

pull/558/merge
danpros 2 years ago
parent
commit
10ca416f0e
2 changed files with 19 additions and 13 deletions
  1. +3
    -3
      system/admin/admin.php
  2. +16
    -10
      system/htmly.php

+ 3
- 3
system/admin/admin.php View File

@ -120,7 +120,7 @@ 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);
$post_media = preg_replace('/\s\s+/', ' ', strip_tags($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);
@ -260,7 +260,7 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
} }
$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 ?? ''));
$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);
@ -408,7 +408,7 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
save_tag_i18n($post_tag, $post_tagmd); save_tag_i18n($post_tag, $post_tagmd);
rebuilt_cache('all'); rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile, $category, $type);
clear_post_cache($dt, $post_tag, $post_url, $oldfile, $category, $type);
if ($destination == 'post') { if ($destination == 'post') {
if(!empty($revertPost)) { if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft'; $drafturl = site_url() . 'admin/draft';


+ 16
- 10
system/htmly.php View File

@ -1736,7 +1736,9 @@ get('/category/:category', function ($category) {
$desc = get_category_info($category); $desc = get_category_info($category);
if(strtolower($category) !== 'uncategorized') { if(strtolower($category) !== 'uncategorized') {
$desc = $desc[0];
if(!empty($desc)) {
$desc = $desc[0];
}
} }
$total = get_categorycount($category); $total = get_categorycount($category);
@ -2224,7 +2226,11 @@ get('/post/:name', function ($name) {
if (config('permalink.type') != 'post') { if (config('permalink.type') != 'post') {
$post = find_post(null, null, $name); $post = find_post(null, null, $name);
$current = $post['current'];
if (is_null($post)) {
not_found();
} else {
$current = $post['current'];
}
$redir = site_url() . date('Y/m', $current->date) . '/' . $name; $redir = site_url() . date('Y/m', $current->date) . '/' . $name;
header("location: $redir", TRUE, 301); header("location: $redir", TRUE, 301);
} }
@ -2237,11 +2243,11 @@ get('/post/:name', function ($name) {
$post = find_post(null, null, $name); $post = find_post(null, null, $name);
$current = $post['current'];
if (!$current) {
if (is_null($post)) {
not_found(); not_found();
}
} else {
$current = $post['current'];
}
if (config("views.counter") == "true") { if (config("views.counter") == "true") {
add_view($current->file); add_view($current->file);
@ -3230,11 +3236,11 @@ get('/:year/:month/:name', function ($year, $month, $name) {
$post = find_post($year, $month, $name); $post = find_post($year, $month, $name);
$current = $post['current'];
if (!$current) {
if (is_null($post)) {
not_found(); not_found();
}
} else {
$current = $post['current'];
}
if (config("views.counter") == "true") { if (config("views.counter") == "true") {
add_view($current->file); add_view($current->file);


Loading…
Cancel
Save