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 147a6ff..48bebae 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -1,542 +1,532 @@ Your username and password mismatch.'; - } - } - else { - return $str = '
| Title | Published | Tag | Operations |
|---|---|---|---|
| ' . $p->title . ' | '; - echo '' . date('d F Y', $p->date) . ' | '; - echo '' . $p->tag . ' | '; - echo 'Edit Delete | '; - echo '
| Title | Published | '; + if (config("views.counter") == "true") + echo 'Views | '; + echo 'Tag | Operations |
|---|---|---|---|---|
| ' . $p->title . ' | '; + echo '' . date('d F Y', $p->date) . ' | '; + if (config("views.counter") == "true") + echo '' . $p->views . ' | '; + echo '' . $p->tag . ' | '; + echo 'Edit Delete | '; + echo '
| Title | Operations |
|---|---|
| ' . $p->title . ' | '; - echo 'Edit Delete | '; - echo '
| Title | Views | Operations |
|---|---|---|
| ' . $p->title . ' | '; + if (config("views.counter") == "true") + echo '' . $p->views . ' | '; + echo 'Add Sub Edit Delete | '; + echo '
| »' . $sp->title . ' | '; + if (config("views.counter") == "true") + echo '' . $sp->views . ' | '; + echo 'Edit Delete | '; + echo '
| Filename | Date | Operations |
|---|---|---|
| ' . $name . ' | '; - echo '' . $timestamp . ' | '; - echo 'Download | '; - echo '
| Filename | Date | Operations |
|---|---|---|
| ' . $name . ' | '; + echo '' . $timestamp . ' | '; + echo 'Download | '; + echo '
| Title | Published | Author | Tag | Operations | |
|---|---|---|---|---|---|
| Title | Published | Views | Author | Tag | Operations | title ?> | date) ?> | +views ?> | author ?> | tag ?> | Edit Delete | diff --git a/system/admin/views/user-posts.html.php b/system/admin/views/user-posts.html.php index 427f970..2fc3624 100644 --- a/system/admin/views/user-posts.html.php +++ b/system/admin/views/user-posts.html.php @@ -1,7 +1,7 @@
| Title | Published | Tag | Operations | |
|---|---|---|---|---|
| Title | Published | Views | Tag | Operations | title ?> | date) ?> | +views ?> | tag ?> | Edit Delete | diff --git a/system/htmly.php b/system/htmly.php index 0c29618..e0b310a 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -19,1123 +19,1148 @@ config('source', 'config/config.ini'); // This will match the root url get('/index', function () { - if(!login()) { - file_cache($_SERVER['REQUEST_URI']); - } - - $page = from($_GET, 'page'); - $page = $page ? (int)$page : 1; - $perpage = config('posts.perpage'); - - $posts = get_posts(null, $page, $perpage); - - $total = ''; - - $tl = blog_tagline(); - - if($tl){ $tagline = ' - ' . $tl;} else {$tagline = '';} - - if(empty($posts) || $page < 1){ - - // a non-existing page - render('no-posts',array( - 'head_contents' => head_contents(blog_title() . $tagline, blog_description(), site_url()), - 'bodyclass' => 'noposts', - )); - - die; - } - - render('main',array( - 'head_contents' => head_contents(blog_title() . $tagline, blog_description(), site_url()), - 'page' => $page, - 'posts' => $posts, - 'bodyclass' => 'infront', - 'breadcrumb' => '', - 'pagination' => has_pagination($total, $perpage, $page) - )); + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } + + $page = from($_GET, 'page'); + $page = $page ? (int) $page : 1; + $perpage = config('posts.perpage'); + + $posts = get_posts(null, $page, $perpage); + + $total = ''; + + $tl = blog_tagline(); + + if ($tl) { + $tagline = ' - ' . $tl; + } else { + $tagline = ''; + } + + if (empty($posts) || $page < 1) { + + // a non-existing page + render('no-posts', array( + 'head_contents' => head_contents(blog_title() . $tagline, blog_description(), site_url()), + 'bodyclass' => 'noposts', + )); + + die; + } + + render('main', array( + 'head_contents' => head_contents(blog_title() . $tagline, blog_description(), site_url()), + 'page' => $page, + 'posts' => $posts, + 'bodyclass' => 'infront', + 'breadcrumb' => '', + 'pagination' => has_pagination($total, $perpage, $page) + )); }); // Get submitted login data post('/login', function() { - - $proper = is_csrf_proper(from($_REQUEST, 'csrf_token')); - - $user = from($_REQUEST, 'user'); - $pass = from($_REQUEST, 'password'); - if($proper && !empty($user) && !empty($pass)) { - - session($user, $pass, null); - $log = session($user, $pass, null); - - if(!empty($log)) { - - config('views.root', 'system/admin/views'); - - render('login',array( - 'head_contents' => head_contents('Login - ' . blog_title(), 'Login page on ' .blog_title(), site_url()), - 'error' => '