From c4b4c89bd9c8198487f4b73c1a2eb76855b1060f Mon Sep 17 00:00:00 2001
From: danpros
+ +
+ +diff --git a/system/htmly.php b/system/htmly.php index 10fbcca..08ce25b 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -2302,7 +2302,7 @@ get('/post/:name', function ($name) { $post = find_post(null, null, $name); if (is_null($post)) { not_found(); - } else { + } else { $current = $post['current']; } $redir = site_url() . date('Y/m', $current->date) . '/' . $name; @@ -2319,9 +2319,9 @@ get('/post/:name', function ($name) { if (is_null($post)) { not_found(); - } else { - $current = $post['current']; - } + } else { + $current = $post['current']; + } if (config("views.counter") == "true") { add_view($current->file); @@ -2422,12 +2422,12 @@ get('/post/:name/edit', function ($name) { if (!$post) { $post = find_draft($year, $month, $name); - if (!$post) { - $post = find_scheduled($year, $month, $name); - if (!$post) { - not_found(); - } - } + if (!$post) { + $post = find_scheduled($year, $month, $name); + if (!$post) { + not_found(); + } + } } @@ -2633,12 +2633,12 @@ get('/post/:name/delete', function ($name) { if (!$post) { $post = find_draft($year, $month, $name); - if (!$post) { - $post = find_scheduled($year, $month, $name); - if (!$post) { - not_found(); - } - } + if (!$post) { + $post = find_scheduled($year, $month, $name); + if (!$post) { + not_found(); + } + } } @@ -3092,7 +3092,7 @@ get('/:static/:sub', function ($static, $sub) { $url = site_url() . 'search/' . remove_accent($search); header("Location: $url"); } - + if ($static === 'front') { $redir = site_url(); header("location: $redir", TRUE, 301); @@ -3320,9 +3320,9 @@ get('/:year/:month/:name', function ($year, $month, $name) { if (is_null($post)) { not_found(); - } else { - $current = $post['current']; - } + } else { + $current = $post['current']; + } if (config("views.counter") == "true") { add_view($current->file); @@ -3423,12 +3423,12 @@ get('/:year/:month/:name/edit', function ($year, $month, $name) { if (!$post) { $post = find_draft($year, $month, $name); - if (!$post) { - $post = find_scheduled($year, $month, $name); - if (!$post) { - not_found(); - } - } + if (!$post) { + $post = find_scheduled($year, $month, $name); + if (!$post) { + not_found(); + } + } } @@ -3634,12 +3634,12 @@ get('/:year/:month/:name/delete', function ($year, $month, $name) { if (!$post) { $post = find_draft($year, $month, $name); - if (!$post) { - $post = find_scheduled($year, $month, $name); - if (!$post) { - not_found(); - } - } + if (!$post) { + $post = find_scheduled($year, $month, $name); + if (!$post) { + not_found(); + } + } } diff --git a/system/includes/functions.php b/system/includes/functions.php index 160bb3f..4d746a7 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -190,7 +190,7 @@ function rebuilt_cache($type) $posts_cache_unsorted = array(); $page_cache = array(); $author_cache = array(); - $scheduled = array(); + $scheduled = array(); if (is_dir($dir) === false) { mkdir($dir, 0775, true); @@ -203,7 +203,7 @@ function rebuilt_cache($type) foreach ($tmp as $file) { if(strpos($file, '/draft/') === false && strpos($file, '/scheduled/') === false) { $posts_cache_unsorted[] = $file; - $posts_cache_sorted[] = pathinfo($file); + $posts_cache_sorted[] = pathinfo($file); } } } @@ -229,15 +229,15 @@ function rebuilt_cache($type) $string = serialize($category_cache); file_put_contents('cache/index/index-category.txt', print_r($string, true)); } elseif ($type === 'scheduled') { - $tmp = array(); - $tmp = glob('content/*/*/*/*/scheduled/*.md', GLOB_NOSORT); - if (is_array($tmp)) { - foreach ($tmp as $file) { - $scheduled[] = pathinfo($file); - } - } - usort($scheduled, "sortfile"); - $string = serialize($scheduled); + $tmp = array(); + $tmp = glob('content/*/*/*/*/scheduled/*.md', GLOB_NOSORT); + if (is_array($tmp)) { + foreach ($tmp as $file) { + $scheduled[] = pathinfo($file); + } + } + usort($scheduled, "sortfile"); + $string = serialize($scheduled); file_put_contents('cache/index/index-scheduled.txt', print_r($string, true)); } elseif ($type === 'all') { rebuilt_cache('posts'); @@ -549,7 +549,7 @@ function find_scheduled($year, $month, $name) function get_category($category, $page, $perpage, $random) { $posts = get_post_sorted(); - + if ($random === true) { shuffle($posts); } @@ -589,7 +589,7 @@ function get_category($category, $page, $perpage, $random) // Return category info. function get_category_info($category) -{ +{ $posts = get_category_files(); $tmp = array(); @@ -1576,7 +1576,7 @@ function tag_cloud($custom = null) $posts = get_post_unsorted(); $tags = array(); - + $tagcloud_count = config('tagcloud.count'); if(empty($tagcloud_count)) { $tagcloud_count = 40; @@ -3400,19 +3400,19 @@ function valueMaker($value) function publish_scheduled() { $posts = get_scheduled_posts(); - if (!empty($posts)) { - foreach ($posts as $index => $v) { - $str = explode('_', $v['basename']); - $old = $v['dirname'] . '/' . $v['basename']; - $new = dirname($v['dirname']) . '/' . $v['basename']; - $t = str_replace('-', '', $str[0]); + if (!empty($posts)) { + foreach ($posts as $index => $v) { + $str = explode('_', $v['basename']); + $old = $v['dirname'] . '/' . $v['basename']; + $new = dirname($v['dirname']) . '/' . $v['basename']; + $t = str_replace('-', '', $str[0]); $time = new DateTime($t); $timestamp = $time->format("Y m d H:i:s"); - if (date('Y m d H:i:s') >= $timestamp) { - rename($old, $new); - rebuilt_cache('all'); - clear_cache(); - } - } - } + if (date('Y m d H:i:s') >= $timestamp) { + rename($old, $new); + rebuilt_cache('all'); + clear_cache(); + } + } + } } \ No newline at end of file