diff --git a/config/config.ini.example b/config/config.ini.example index 41edb78..ccef248 100644 --- a/config/config.ini.example +++ b/config/config.ini.example @@ -80,5 +80,8 @@ lightbox = "off" ; Set the theme here views.root = "themes/logs" + ;Enable view Counter, the options is "true" and "false". If set to "true", you can see the Counts in Admin page. +views.counter = "true" + ; Framework config. No need to edit. views.layout = "layout" \ No newline at end of file diff --git a/system/admin/admin.php b/system/admin/admin.php index 121fe90..46e584e 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -321,7 +321,10 @@ function get_recent_posts() { $posts = get_profile($_SESSION[config("site.url")]['user'], 1, 5); if (!empty($posts)) { echo ''; - echo ''; + echo ''; + if (config("views.counter") == "true") + echo ''; + echo ''; $i = 0; $len = count($posts); foreach ($posts as $p) { @@ -336,7 +339,8 @@ function get_recent_posts() { echo ''; echo ''; echo ''; - echo ''; + if (config("views.counter") == "true") + echo ''; echo ''; echo ''; echo ''; @@ -368,7 +372,8 @@ function get_recent_pages() { echo ''; echo ''; - echo ''; + if (config("views.counter") == "true") + echo ''; echo ''; echo ''; @@ -379,7 +384,8 @@ function get_recent_pages() { { echo ''; echo ''; - echo ''; + if (config("views.counter") == "true") + echo ''; echo ''; echo ''; } diff --git a/system/admin/views/posts-list.html.php b/system/admin/views/posts-list.html.php index b3bbc93..9457c3e 100644 --- a/system/admin/views/posts-list.html.php +++ b/system/admin/views/posts-list.html.php @@ -1,7 +1,7 @@

TitlePublishedViewsTagOperations
TitlePublishedViewsTagOperations
' . $p->title . '' . date('d F Y', $p->date) . '' . $p->views . '' . $p->views . '' . $p->tag . 'Edit Delete
' . $p->title . '' . $p->views . '' . $p->views . 'Edit Delete
»' . $sp->title . '' . $sp->views . '' . $sp->views . 'Edit Delete
- + "> - + diff --git a/system/htmly.php b/system/htmly.php index b4c4540..25a5e82 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -111,6 +111,12 @@ post('/login', function() { // The blog post page get('/:year/:month/:name', function($year, $month, $name) { + if(config("views.counter") != "true") + { + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } + } $post = find_post($year, $month, $name); @@ -120,10 +126,13 @@ get('/:year/:month/:name', function($year, $month, $name) { not_found(); } - add_view($current->file); - - if (!login()) { - file_cache($_SERVER['REQUEST_URI']); + if(config("views.counter") == "true") + { + add_view($current->file); + + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } } $bio = get_bio($current->author); @@ -568,6 +577,14 @@ get('/:static', function($static) { } die; } else { + + if( config("views.counter") != "true") + { + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } + } + $post = get_static_post($static); if (!$post) { @@ -575,11 +592,13 @@ get('/:static', function($static) { } $post = $post[0]; - - add_view($post->file); - if (!login()) { - file_cache($_SERVER['REQUEST_URI']); + if(config("views.counter") == "true") + { + add_view($post->file); + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } } render('static', array( @@ -1092,7 +1111,10 @@ get('/:static/:sub', function($static,$sub) { } $post = $post[0]; - add_view($post->file); + if(config("views.counter") == "true") + { + add_view($post->file); + } if (!login()) { file_cache($_SERVER['REQUEST_URI']); diff --git a/system/includes/functions.php b/system/includes/functions.php index 19df00a..c5ed545 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -256,7 +256,10 @@ function get_posts($posts, $page = 1, $perpage = 0) { $post->body = $arr[0]; } - $post->views = get_views($post->file); + if(config("views.counter")) + { + $post->views = get_views($post->file); + } $tmp[] = $post; } @@ -490,8 +493,11 @@ function get_static_post($static) { $post->body = $arr[0]; } - $post->views = get_views($post->file); - + if(config("views.counter")) + { + $post->views = get_views($post->file); + } + $tmp[] = $post; } }
TitlePublishedViewsAuthorTagOperations
TitlePublishedViewsAuthorTagOperations
title ?> date) ?>views ?>views ?> author ?> tag ?> Edit Delete