- 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.
22 lines
611 B
PHP
22 lines
611 B
PHP
<?
|
|
namespace front\factory;
|
|
class Authors
|
|
{
|
|
// szczególy autora
|
|
static public function get_single_author( $id_author )
|
|
{
|
|
global $mdb;
|
|
|
|
if ( !$author = \Cache::fetch( "get_single_author:$id_author" ) )
|
|
{
|
|
$author = $mdb -> get( 'pp_authors', '*', [ 'id' => (int)$id_author ] );
|
|
|
|
$results = $mdb -> select( 'pp_authors_langs', '*', [ 'id_author' => (int)$id_author ] );
|
|
if ( is_array( $results ) ) foreach ( $results as $row )
|
|
$author['languages'][$row['id_lang']] = $row;
|
|
|
|
\Cache::store( "get_single_author:$id_author", $author );
|
|
}
|
|
return $author;
|
|
}
|
|
} |