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:
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
|
||||
class Site
|
||||
class Site
|
||||
{
|
||||
public static function route()
|
||||
{
|
||||
global $page, $lang_id;
|
||||
|
||||
|
||||
if ( \S::get( 'search' ) )
|
||||
{
|
||||
if ( $_POST['search_txt'] )
|
||||
@@ -15,26 +15,31 @@ class Site
|
||||
header( "Location: " . $_SERVER['REQUEST_URI'] );
|
||||
exit;
|
||||
}
|
||||
return \front\view\Search::search_results(
|
||||
\front\factory\Search::search_results( \S::get_session( 'search_txt' ), $lang_id )
|
||||
return \front\view\Search::search_results(
|
||||
\front\factory\Search::search_results( \S::get_session( 'search_txt' ), $lang_id )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ( \S::get( 'tag' ) )
|
||||
return \front\view\Articles::articles_list(
|
||||
\front\factory\Articles::articles_by_tags( \S::get( 'tag' ), $lang_id )
|
||||
return \front\view\Articles::articles_list(
|
||||
\front\factory\Articles::articles_by_tags( \S::get( 'tag' ), $lang_id )
|
||||
);
|
||||
|
||||
|
||||
if ( \S::get( 'article' ) )
|
||||
{
|
||||
$article = \front\factory\Articles::article_details( \S::get( 'article' ), $lang_id );
|
||||
|
||||
$article = new \Article( \S::get( 'article' ), $lang_id );
|
||||
if ( !\S::get_session( 'article-view-' . $article -> id ) )
|
||||
{
|
||||
$article -> updateView();
|
||||
\S::set_session( 'article-view-' . $article -> id, true );
|
||||
}
|
||||
|
||||
if ( $article['password'] and !\S::get_session( 'article-' . $article['id'] . '-' . $article['password'] ) )
|
||||
return \front\view\Articles::password_view( [ 'article' => $article ] );
|
||||
else
|
||||
return \front\view\Articles::article( [ 'article' => $article ] );
|
||||
}
|
||||
|
||||
|
||||
if ( $page['page_type'] !== null )
|
||||
{
|
||||
switch ( $page['page_type'] )
|
||||
@@ -62,43 +67,43 @@ class Site
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( !\S::get( 'module' ) || !\S::get( 'action' ) )
|
||||
return false;
|
||||
|
||||
|
||||
$class = '\front\controls\\' . ucfirst( \S::get( 'module' ) );
|
||||
$action = \S::get( 'action' );
|
||||
|
||||
|
||||
if ( class_exists( $class ) and method_exists( new $class, $action ) )
|
||||
return call_user_func_array( array( $class, $action ), array() );
|
||||
}
|
||||
|
||||
|
||||
public static function check_url_params()
|
||||
{
|
||||
global $lang, $config;
|
||||
|
||||
$a = \S::get( 'a' );
|
||||
|
||||
|
||||
switch ( $a )
|
||||
{
|
||||
case 'page':
|
||||
$page = \front\factory\Pages::page_details( \S::get( 'id' ) );
|
||||
\S::set_session( 'page', $page );
|
||||
break;
|
||||
|
||||
|
||||
case 'change_language':
|
||||
\S::set_session( 'current-lang', \S::get( 'id' ) );
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
break;
|
||||
|
||||
|
||||
case 'newsletter-sign':
|
||||
if ( \front\factory\Newsletter::newsletter_signin( \S::get( 'email' ) ) )
|
||||
\S::alert( 'Dziękujemy za zapisanie się do newslettera.' );
|
||||
header( 'Location: ' . $_SERVER['REQUEST_URI'] );
|
||||
exit;
|
||||
break;
|
||||
|
||||
|
||||
case 'newsletter-signout':
|
||||
if ( \front\factory\Newsletter::newsletter_signout( \S::get( 'email' ) ) )
|
||||
\S::alert( 'Twój adres email został usunięty z naszej bazy.' );
|
||||
@@ -106,10 +111,10 @@ class Site
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( \S::get( 'lang' ) )
|
||||
\S::set_session( 'current-lang', \S::get( 'lang' ) );
|
||||
|
||||
|
||||
if ( file_exists( 'modules/actions.php' ) )
|
||||
include 'modules/actions.php';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user