Files
kobcrane-montaze.pl/autoload/admin/controls/class.Users.php
Jacek Pyziak c9ed7b5d5d 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.
2026-02-27 11:28:56 +01:00

66 lines
1.8 KiB
PHP

<?php
namespace admin\controls;
class Users
{
public static function user_delete()
{
global $user;
if ( !\admin\factory\Users::check_privileges( 'users_administration', $user['id'] ) )
return \S::alert('Nie masz uprawnień');
if ( \admin\factory\Users::user_delete( \S::get( 'id' ) ) )
\S::alert( 'Użytkownik został usunięty.' );
header( 'Location: /admin/users/view_list/' );
exit;
}
public static function user_save()
{
global $user;
if ( !\admin\factory\Users::check_privileges( 'users_administration', $user['id'] ) )
return \S::alert('Nie masz uprawnień');
$values = \S::json_to_array( \S::get( 'values' ) );
$response = \admin\factory\Users::user_save(
$values['id'], $values['login'], $values['status'], $values['active_to'], $values['password'], $values['password_re'], $values['admin'], $values['privileges'], $values['twofa_enabled'], $values['twofa_email']
);
echo json_encode( $response );
exit;
}
public static function user_edit()
{
global $user;
if ( !\admin\factory\Users::check_privileges( 'users_administration', $user['id'] ) )
return \S::alert('Nie masz uprawnień');
return \admin\view\Users::user_edit(
\admin\factory\Users::user_details(
\S::get( 'id' ) ),
\admin\factory\Users::user_privileges(
\S::get( 'id' ) )
);
}
public static function view_list()
{
global $user;
if( !\admin\factory\Users::check_privileges( 'users_administration', $user['id']))
return \S::alert('Nie masz uprawnień');
return \admin\view\Users::users_list();
}
static public function twofa() {
return \Tpl::view( 'site/unlogged', [
'content' => \Tpl::view( 'users/user-2fa' )
] );
}
}
?>