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 12f4ac1..35777c6 100644
--- a/system/admin/admin.php
+++ b/system/admin/admin.php
@@ -347,7 +347,9 @@ function get_recent_posts() {
$posts = get_profile($_SESSION[config("site.url")]['user'], 1, 5);
if(!empty($posts)) {
echo '
';
- echo '| Title | Published | Views | Tag | Operations |
';
+ echo '| Title | Published | ';
+ if(config("views.counter") == "true") echo 'Views | ';
+ echo 'Tag | Operations |
';
$i = 0; $len = count($posts);
foreach($posts as $p) {
if ($i == 0) {
@@ -363,7 +365,7 @@ function get_recent_posts() {
echo '';
echo '| ' . $p->title . ' | ';
echo '' . date('d F Y', $p->date) . ' | ';
- echo '' . $p->views . ' | ';
+ if(config("views.counter") == "true") echo '' . $p->views . ' | ';
echo '' . $p->tag . ' | ';
echo 'Edit Delete | ';
echo '
';
@@ -380,7 +382,9 @@ function get_recent_pages() {
if(!empty($posts)) {
krsort($posts);
echo '';
- echo '| Title | Views | Operations |
';
+ echo '| Title | ';
+ if(config("views.counter") == "true") echo 'Views | ';
+ echo 'Operations |
';
$i = 0; $len = count($posts);
foreach($posts as $p) {
if ($i == 0) {
@@ -395,7 +399,7 @@ function get_recent_pages() {
$i++;
echo '';
echo '| ' . $p->title . ' | ';
- echo '' . $p->views . ' | ';
+ if(config("views.counter") == "true") echo '' . $p->views . ' | ';
echo 'Edit Delete | ';
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 @@
- | Title | Published | Views | Author | Tag | Operations |
+ | Title | Published | Views | Author | Tag | Operations |
">
title ?> |
date) ?> |
- views ?> |
+ views ?> |
author ?> |
tag ?> |
Edit Delete |
diff --git a/system/htmly.php b/system/htmly.php
index dc41f02..0fd5586 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -111,19 +111,30 @@ 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);
$current = $post['current'];
- add_view($current->file);
-
- if (!login()) {
- file_cache($_SERVER['REQUEST_URI']);
- }
if (!$current) {
not_found();
}
+
+ if(config("views.counter") == "true")
+ {
+ add_view($current->file);
+
+ if (!login()) {
+ file_cache($_SERVER['REQUEST_URI']);
+ }
+ }
+
$bio = get_bio($current->author);
@@ -567,6 +578,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) {
@@ -574,11 +593,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(
diff --git a/system/includes/functions.php b/system/includes/functions.php
index ae46284..716c6e6 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -223,7 +223,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;
}
@@ -457,8 +460,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;
}
}