Compare commits
4 commits
2326bdf770
...
a5805a1f3f
Author | SHA1 | Date | |
---|---|---|---|
|
a5805a1f3f | ||
|
e1f77f2eac | ||
|
79ff2bc74d | ||
|
6b8420b10e |
8 changed files with 143 additions and 4 deletions
|
@ -11,13 +11,13 @@ echo Bootstrap::formInputHidden(array(
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" dir="auto" value="' . (isset($_POST['username']) ? Sanitize::html($_POST['username']) : '') . '" class="form-control form-control-lg" id="jsusername" name="username" placeholder="' . $L->g('Username') . '" autofocus>
|
<input type="text" dir="auto" value="' . (isset($_POST['username']) ? Sanitize::html($_POST['username']) : '') . '" class="form-control form-control-lg mb-2" id="jsusername" name="username" placeholder="' . $L->g('Username') . '" autofocus>
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="' . $L->g('Password') . '">
|
<input type="password" class="form-control form-control-lg mb-2" id="jspassword" name="password" placeholder="' . $L->g('Password') . '">
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
@ -34,4 +34,4 @@ echo '
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
echo '<p class="mt-3 text-right">' . $L->g('Powered by Koblog') . '</p>';
|
echo '<p class="mt-3 text-end">' . $L->g('Powered by Koblog') . '</p>';
|
||||||
|
|
49
bl-kernel/archives.class.php
Normal file
49
bl-kernel/archives.class.php
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<?php defined('KOBLOG') or die('Koblog CMS.');
|
||||||
|
|
||||||
|
class Archives extends dbList {
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(DB_ARCHIVES);
|
||||||
|
}
|
||||||
|
|
||||||
|
function numberOfPages($key)
|
||||||
|
{
|
||||||
|
return $this->countItems($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reindex()
|
||||||
|
{
|
||||||
|
global $pages;
|
||||||
|
$db = $pages->getDB($onlyKeys=false);
|
||||||
|
$archiveIndex = array();
|
||||||
|
foreach ($db as $pageKey=>$pageFields) {
|
||||||
|
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES'])) {
|
||||||
|
$date = $pageFields['date'];
|
||||||
|
$year = mb_substr($date, 0, 4);
|
||||||
|
$month = mb_substr($date, 0, 7);
|
||||||
|
|
||||||
|
// Index by years
|
||||||
|
if (isset($archiveIndex[$year])) {
|
||||||
|
array_push($archiveIndex[$year]['list'], $pageKey);
|
||||||
|
} else {
|
||||||
|
$archiveIndex[$year]['name'] = $year;
|
||||||
|
$archiveIndex[$year]['list'] = array($pageKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Index by month
|
||||||
|
if (isset($archiveIndex[$month])) {
|
||||||
|
array_push($archiveIndex[$month]['list'], $pageKey);
|
||||||
|
} else {
|
||||||
|
$archiveIndex[$month]['name'] = $month;
|
||||||
|
$archiveIndex[$month]['list'] = array($pageKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db = $archiveIndex;
|
||||||
|
$this->sortAlphanumeric();
|
||||||
|
return $this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
bl-kernel/authors.class.php
Normal file
37
bl-kernel/authors.class.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php defined('KOBLOG') or die('Koblog CMS.');
|
||||||
|
|
||||||
|
class Authors extends dbList {
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(DB_AUTHORS);
|
||||||
|
}
|
||||||
|
|
||||||
|
function numberOfPages($key)
|
||||||
|
{
|
||||||
|
return $this->countItems($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reindex()
|
||||||
|
{
|
||||||
|
global $pages;
|
||||||
|
$db = $pages->getDB($onlyKeys=false);
|
||||||
|
$authorsIndex = array();
|
||||||
|
foreach ($db as $pageKey=>$pageFields) {
|
||||||
|
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES'])) {
|
||||||
|
$authorName = $pageFields['username'];
|
||||||
|
if (isset($authorsIndex[$authorName])) {
|
||||||
|
array_push($authorsIndex[$authorName]['list'], $pageKey);
|
||||||
|
} else {
|
||||||
|
$authorsIndex[$authorName]['name'] = $authorName;
|
||||||
|
$authorsIndex[$authorName]['list'] = array($pageKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db = $authorsIndex;
|
||||||
|
$this->sortAlphanumeric();
|
||||||
|
return $this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -66,6 +66,8 @@ define('DB_PAGES', PATH_DATABASES . 'pages.php');
|
||||||
define('DB_SITE', PATH_DATABASES . 'site.php');
|
define('DB_SITE', PATH_DATABASES . 'site.php');
|
||||||
define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
||||||
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
||||||
|
define('DB_AUTHORS', PATH_DATABASES . 'authors.php');
|
||||||
|
define('DB_ARCHIVES', PATH_DATABASES . 'archives.php');
|
||||||
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
||||||
define('DB_USERS', PATH_DATABASES . 'users.php');
|
define('DB_USERS', PATH_DATABASES . 'users.php');
|
||||||
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
||||||
|
@ -88,6 +90,8 @@ include(PATH_ABSTRACT . 'plugin.class.php');
|
||||||
include(PATH_KERNEL . 'pages.class.php');
|
include(PATH_KERNEL . 'pages.class.php');
|
||||||
include(PATH_KERNEL . 'users.class.php');
|
include(PATH_KERNEL . 'users.class.php');
|
||||||
include(PATH_KERNEL . 'tags.class.php');
|
include(PATH_KERNEL . 'tags.class.php');
|
||||||
|
include(PATH_KERNEL . 'authors.class.php');
|
||||||
|
include(PATH_KERNEL . 'archives.class.php');
|
||||||
include(PATH_KERNEL . 'language.class.php');
|
include(PATH_KERNEL . 'language.class.php');
|
||||||
include(PATH_KERNEL . 'site.class.php');
|
include(PATH_KERNEL . 'site.class.php');
|
||||||
include(PATH_KERNEL . 'categories.class.php');
|
include(PATH_KERNEL . 'categories.class.php');
|
||||||
|
@ -126,6 +130,8 @@ include(PATH_HELPERS . 'cookie.class.php');
|
||||||
$pages = new Pages();
|
$pages = new Pages();
|
||||||
$users = new Users();
|
$users = new Users();
|
||||||
$tags = new Tags();
|
$tags = new Tags();
|
||||||
|
$authors = new Authors();
|
||||||
|
$archives = new Archives();
|
||||||
$categories = new Categories();
|
$categories = new Categories();
|
||||||
$site = new Site();
|
$site = new Site();
|
||||||
$url = new Url();
|
$url = new Url();
|
||||||
|
@ -191,6 +197,9 @@ define('TAG_URI_FILTER', $url->filters('tag'));
|
||||||
// Category URI filter
|
// Category URI filter
|
||||||
define('CATEGORY_URI_FILTER', $url->filters('category'));
|
define('CATEGORY_URI_FILTER', $url->filters('category'));
|
||||||
|
|
||||||
|
// Author URI filter
|
||||||
|
define('AUTHOR_URI_FILTER', $url->filters('author'));
|
||||||
|
|
||||||
// Page URI filter
|
// Page URI filter
|
||||||
define('PAGE_URI_FILTER', $url->filters('page'));
|
define('PAGE_URI_FILTER', $url->filters('page'));
|
||||||
|
|
||||||
|
@ -247,6 +256,7 @@ define('DOMAIN_ADMIN', DOMAIN_BASE . ADMIN_URI_FILTER . '/');
|
||||||
define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE . TAG_URI_FILTER, false, true));
|
define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE . TAG_URI_FILTER, false, true));
|
||||||
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
||||||
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
||||||
|
define('DOMAIN_AUTHORS', Text::addSlashes(DOMAIN_BASE . AUTHOR_URI_FILTER, false, true));
|
||||||
|
|
||||||
$ADMIN_CONTROLLER = '';
|
$ADMIN_CONTROLLER = '';
|
||||||
$ADMIN_VIEW = '';
|
$ADMIN_VIEW = '';
|
||||||
|
|
|
@ -71,6 +71,10 @@ elseif ($url->whereAmI()==='tag') {
|
||||||
elseif ($url->whereAmI()==='category') {
|
elseif ($url->whereAmI()==='category') {
|
||||||
$content = buildPagesByCategory();
|
$content = buildPagesByCategory();
|
||||||
}
|
}
|
||||||
|
// Build content by author
|
||||||
|
elseif ($url->whereAmI()==='author') {
|
||||||
|
$content = buildPagesByAuthor();
|
||||||
|
}
|
||||||
// Build content for the homepage
|
// Build content for the homepage
|
||||||
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
||||||
$content = buildPagesForHome();
|
$content = buildPagesForHome();
|
||||||
|
|
|
@ -16,6 +16,22 @@ function reindexTags()
|
||||||
return $tags->reindex();
|
return $tags->reindex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-index database of authors
|
||||||
|
// If you create/edit/remove a page is necessary regenerate the database of authors
|
||||||
|
function reindexAuthors()
|
||||||
|
{
|
||||||
|
global $authors;
|
||||||
|
return $authors->reindex();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-index database of archives
|
||||||
|
// If you create/edit/remove a page is necessary regenerate the database of archives
|
||||||
|
function reindexArchives()
|
||||||
|
{
|
||||||
|
global $archives;
|
||||||
|
return $archives->reindex();
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the page 404 Not found
|
// Generate the page 404 Not found
|
||||||
function buildErrorPage()
|
function buildErrorPage()
|
||||||
{
|
{
|
||||||
|
@ -84,16 +100,26 @@ function buildPagesByTag()
|
||||||
return buildPagesFor('tag', false, $tagKey);
|
return buildPagesFor('tag', false, $tagKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
||||||
|
function buildPagesByAuthor()
|
||||||
|
{
|
||||||
|
global $url;
|
||||||
|
|
||||||
|
$authorKey = $url->slug();
|
||||||
|
return buildPagesFor('author', false, false, $authorKey);
|
||||||
|
}
|
||||||
|
|
||||||
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
||||||
// Generate the global variables $content / $content, defined on 69.pages.php
|
// Generate the global variables $content / $content, defined on 69.pages.php
|
||||||
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
||||||
function buildPagesFor($for, $categoryKey = false, $tagKey = false)
|
function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = false)
|
||||||
{
|
{
|
||||||
global $pages;
|
global $pages;
|
||||||
global $categories;
|
global $categories;
|
||||||
global $tags;
|
global $tags;
|
||||||
global $site;
|
global $site;
|
||||||
global $url;
|
global $url;
|
||||||
|
global $authors;
|
||||||
|
|
||||||
// Get the page number from URL
|
// Get the page number from URL
|
||||||
$pageNumber = $url->pageNumber();
|
$pageNumber = $url->pageNumber();
|
||||||
|
@ -114,6 +140,9 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false)
|
||||||
} elseif ($for == 'tag') {
|
} elseif ($for == 'tag') {
|
||||||
$numberOfItems = $site->itemsPerPage();
|
$numberOfItems = $site->itemsPerPage();
|
||||||
$list = $tags->getList($tagKey, $pageNumber, $numberOfItems);
|
$list = $tags->getList($tagKey, $pageNumber, $numberOfItems);
|
||||||
|
} elseif ($for == 'author') {
|
||||||
|
$numberOfItems = $site->itemsPerPage();
|
||||||
|
$list = $authors->getList($authorKey, $pageNumber, $numberOfItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are not items, invalid tag, invalid category, out of range, etc...
|
// There are not items, invalid tag, invalid category, out of range, etc...
|
||||||
|
@ -341,6 +370,8 @@ function createPage($args)
|
||||||
|
|
||||||
reindexCategories();
|
reindexCategories();
|
||||||
reindexTags();
|
reindexTags();
|
||||||
|
reindexAuthors();
|
||||||
|
reindexArchives();
|
||||||
|
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
|
@ -392,6 +423,8 @@ function editPage($args)
|
||||||
|
|
||||||
reindexCategories();
|
reindexCategories();
|
||||||
reindexTags();
|
reindexTags();
|
||||||
|
reindexAuthors();
|
||||||
|
reindexArchives();
|
||||||
|
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
|
@ -417,6 +450,8 @@ function deletePage($key)
|
||||||
|
|
||||||
reindexCategories();
|
reindexCategories();
|
||||||
reindexTags();
|
reindexTags();
|
||||||
|
reindexAuthors();
|
||||||
|
reindexArchives();
|
||||||
|
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
|
|
|
@ -19,6 +19,7 @@ class Site extends dbJSON
|
||||||
'uriTag' => '/tag/',
|
'uriTag' => '/tag/',
|
||||||
'uriCategory' => '/category/',
|
'uriCategory' => '/category/',
|
||||||
'uriBlog' => '/blog/',
|
'uriBlog' => '/blog/',
|
||||||
|
'uriAuthor' => '/author/',
|
||||||
'url' => '',
|
'url' => '',
|
||||||
'emailFrom' => '',
|
'emailFrom' => '',
|
||||||
'dateFormat' => 'F j, Y',
|
'dateFormat' => 'F j, Y',
|
||||||
|
@ -99,6 +100,7 @@ class Site extends dbJSON
|
||||||
$filters['page'] = $this->getField('uriPage');
|
$filters['page'] = $this->getField('uriPage');
|
||||||
$filters['tag'] = $this->getField('uriTag');
|
$filters['tag'] = $this->getField('uriTag');
|
||||||
$filters['category'] = $this->getField('uriCategory');
|
$filters['category'] = $this->getField('uriCategory');
|
||||||
|
$filters['author'] = $this->getField('uriAuthor');
|
||||||
|
|
||||||
if ($this->getField('uriBlog')) {
|
if ($this->getField('uriBlog')) {
|
||||||
$filters['blog'] = $this->getField('uriBlog');
|
$filters['blog'] = $this->getField('uriBlog');
|
||||||
|
|
|
@ -154,6 +154,8 @@ EOF;
|
||||||
Theme::plugins('afterPageCreate');
|
Theme::plugins('afterPageCreate');
|
||||||
reindexCategories();
|
reindexCategories();
|
||||||
reindexTags();
|
reindexTags();
|
||||||
|
reindexAuthors();
|
||||||
|
reindexArchives();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue