Add author management functionality and update routing rules

- Updated .htaccess rules to allow trailing slashes for specific routes.
- Introduced a new .gitignore file to exclude the cache directory.
- Created project configuration file for Serena with language and tool settings.
- Implemented Authors class for managing author data, including methods for saving, deleting, and editing authors.
- Added factory class for Authors to handle database interactions related to authors.
- Developed Article class to manage article data and interactions, including fetching articles and updating views.
- Created Page class with a placeholder method for sorting pages.
- Added front factory class for fetching author details with caching.
This commit is contained in:
2026-02-27 11:28:56 +01:00
parent 146bdb0b14
commit c9ed7b5d5d
29 changed files with 2996 additions and 1844 deletions

View File

@@ -10,7 +10,7 @@ class Articles
$tpl -> $key = $val;
return $tpl -> render( 'articles/password-view' );
}
public static function map( $settings, $map_counter )
{
$tpl = new \Tpl;
@@ -18,34 +18,39 @@ class Articles
$tpl -> map_counter = $map_counter;
return $tpl -> render( 'articles/map' );
}
public static function tags_cloud()
{
global $settings;
if ( !$settings['tags'] )
return false;
$tpl = new \Tpl;
$tpl -> tags = \front\factory\Articles::tags();
return $tpl -> render( 'articles/tags-cloud' );
}
public static function news( $page_id, $articles )
public static function news( $page_id, $articles, $template = '' )
{
$tpl = new \Tpl;
$tpl -> page_id = $page_id;
$tpl -> articles = $articles;
return $tpl -> render( 'articles/news' );
if ( $template )
$tpl = $template;
else
$tpl = 'articles/news';
return \Tpl::view( $tpl, [
'page_id' => $page_id,
'articles' => $articles
] );
}
public static function articles_list( $articles )
{
$tpl = new \Tpl;
$tpl -> articles = $articles;
return $tpl -> render( 'articles/articles-list' );
}
public static function article( $values )
{
$tpl = new \Tpl;
@@ -53,26 +58,26 @@ class Articles
$tpl -> $key = $val;
return $tpl -> render( 'articles/article' );
}
public static function article_full( $article_id, $lang_id )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article_id, $lang_id );
return $tpl -> render( 'articles/article-full' );
}
public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
$articles[] = \front\factory\Articles::article_details( $article, $lang_id );
$tpl = new \Tpl;
$tpl -> page_id = $page['id'];
$tpl -> articles = $articles;
$out .= $tpl -> render( 'articles/articles-miniatures' );
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
@@ -81,24 +86,24 @@ class Articles
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
public static function entry_articles_list( $page, $lang_id, $bs = 1 )
{
global $page;
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
$articles[] = \front\factory\Articles::article_details( $article, $lang_id );
$tpl = new \Tpl;
$tpl -> page_id = $page['id'];
$tpl -> articles = $articles;
$out .= $tpl -> render( 'articles/articles-entries' );
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
@@ -107,28 +112,29 @@ class Articles
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
public static function full_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
{
$article_details = \front\factory\Articles::article_details( $article, $lang_id );
if ( $article_details['password'] and !\S::get_session( 'article-' . $article . '-' . $article_details['password'] ) )
$out .= \front\view\Articles::password_view( [ 'article' => $article ] );
else
{
$tpl = new \Tpl;
$tpl -> article = $article_details;
$out .= $tpl -> render( 'articles/article-full' );
{
$out .= \Tpl::view( 'articles/article-full', [
'article' => $article_details,
'table_of_contents' => \front\factory\Articles::generateTableOfContents( $article_details['language']['text'] )
] );
}
}
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
@@ -137,7 +143,7 @@ class Articles
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
}