first commit
This commit is contained in:
163
autoload/admin/controls/class.Articles.php
Normal file
163
autoload/admin/controls/class.Articles.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
class Articles
|
||||
{
|
||||
//autorzy artykułów
|
||||
static public function articles_authors()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'articles/articles-authors' );
|
||||
}
|
||||
|
||||
public static function duplicate_article()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Articles::duplicate_article( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Artykuł został zuplikowany' );
|
||||
|
||||
header( 'Location: /admin/articles/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function files_order_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
{
|
||||
echo json_encode( [ 'status' => 'error', 'msg' => 'Nie masz uprawnień' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( \admin\factory\Articles::files_order_save( \S::get( 'article_id' ), \S::get( 'order' ) ) )
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.' ] );
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function gallery_order_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
{
|
||||
echo json_encode( [ 'status' => 'error', 'msg' => 'Nie masz uprawnień' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( \admin\factory\Articles::gallery_order_save( \S::get( 'article_id' ), \S::get( 'order' ) ) )
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.' ] );
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function article_url_browser()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'articles/articles-browse-list', [
|
||||
'modal' => true
|
||||
] );
|
||||
}
|
||||
|
||||
public static function browse_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Articles::browse_list();
|
||||
}
|
||||
|
||||
public static function article_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Articles::articles_set_archive( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Artykuł został przeniesiony do archiwum.' );
|
||||
|
||||
header( 'Location: /admin/articles/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function article_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania artykułu wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( is_array( $values ) ) foreach ( $values as $key => $val )
|
||||
{
|
||||
if ( strpos( $key, 'ap_' ) !== false )
|
||||
$params[$key] = $val;
|
||||
}
|
||||
$values['params'] = $params;
|
||||
|
||||
if ( $id = \admin\factory\Articles::article_save(
|
||||
$values['id'], $values['title'], $values['main_image'], $values['entry'], $values['text'], $values['table_of_contents'], $values['status'], $values['show_title'], $values['show_table_of_contents'], $values['show_date_add'], $values['date_add'],
|
||||
$values['show_date_modify'], $values['date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
|
||||
$values['pages'], $values['noindex'], $values['repeat_entry'], $values['copy_from'], $values['social_icons'], $values['event_date'], $values['hidden-tags'], $values['block_direct_access'],
|
||||
$values['priority'], $values['password'], $values['pixieset'], $values['id_author'], $params
|
||||
) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.', 'id' => $id ];
|
||||
|
||||
\admin\factory\Articles::insert_missing_hash();
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function article_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
\admin\factory\Articles::delete_nonassigned_images();
|
||||
\admin\factory\Articles::delete_nonassigned_files();
|
||||
|
||||
return \admin\view\Articles::article_edit( [
|
||||
'article' => \admin\factory\Articles::article_details( \S::get( 'id' ) ),
|
||||
'menus' => \admin\factory\Pages::menus_list(),
|
||||
'languages' => \admin\factory\Languages::languages_list(),
|
||||
'layouts' => \admin\factory\Layouts::layouts_list(),
|
||||
'additional_params_lon' => \admin\factory\Articles::additional_params( 1 ),
|
||||
'additional_params_loff' => \admin\factory\Articles::additional_params( 0 ),
|
||||
'settings' => \admin\factory\Settings::settings_details(),
|
||||
'authors' => \admin\factory\Authors::get_simple_list(),
|
||||
'user' => $user
|
||||
] );
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Brak uprawnień.' );
|
||||
|
||||
return \admin\view\Articles::articles_list();
|
||||
}
|
||||
}
|
||||
?>
|
||||
44
autoload/admin/controls/class.ArticlesArchive.php
Normal file
44
autoload/admin/controls/class.ArticlesArchive.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class ArticlesArchive
|
||||
{
|
||||
|
||||
public static function article_restore()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\ArticlesArchive::article_restore( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Artykuł został przywrócony.' );
|
||||
header( 'Location: /admin/articles_archive/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function article_delete()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\ArticlesArchive::article_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Artykuł został usunięty.' );
|
||||
header( 'Location: /admin/articles_archive/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\ArticlesArchive::articles_list();
|
||||
}
|
||||
|
||||
}
|
||||
65
autoload/admin/controls/class.Authors.php
Normal file
65
autoload/admin/controls/class.Authors.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?
|
||||
namespace admin\controls;
|
||||
class Authors
|
||||
{
|
||||
// usunięcie autora
|
||||
static public function delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania autora wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( \admin\factory\Authors::delete_author( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Autor został usunięty.' );
|
||||
|
||||
header( 'Location: /admin/authors/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
// zapis autora
|
||||
static public function save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania autora wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $author_id = \admin\factory\Authors::save_author( $values['id'], $values['author'], $values['image'], $values['description'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Autor został zapisany.', 'id' => $author_id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
// edycja autora
|
||||
static public function edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'authors/author-edit', [
|
||||
'author' => \admin\factory\Authors::get_single_author( \S::get( 'id' ) ),
|
||||
'languages' => \admin\factory\Languages::languages_list()
|
||||
] );
|
||||
}
|
||||
|
||||
//autorzy artykułów
|
||||
static public function view_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'authors/view-list' );
|
||||
}
|
||||
}
|
||||
66
autoload/admin/controls/class.Backups.php
Normal file
66
autoload/admin/controls/class.Backups.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class Backups
|
||||
{
|
||||
public static function download_restore_file()
|
||||
{
|
||||
$file = '../restore.php';
|
||||
if ( file_exists( $file ) )
|
||||
{
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="'.basename($file).'"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize( $file ) );
|
||||
readfile( $file );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'backups_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Backups::backups_list(
|
||||
\admin\factory\Backups::backups_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function backup_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'backups_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = 'Podczas tworzenia kopi zapasowej wystąpił błąd. Proszę spróbować ponownie.';
|
||||
if ( \admin\factory\Backups::backup_save() )
|
||||
\S::alert( 'Kopia zapasowa został utworzona.' );
|
||||
|
||||
header( 'Location: /admin/backups/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'backups_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = 'Podczas usuwania kopi zapasowej wystąpił błąd. Proszę spróbować ponownie.';
|
||||
if ( \admin\factory\Backups::backup_delete( \S::get( 'name' ) ) )
|
||||
\S::alert( 'Kopia zapasowa został usunięta.' );
|
||||
|
||||
header( 'Location: /admin/backups/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
66
autoload/admin/controls/class.Banners.php
Normal file
66
autoload/admin/controls/class.Banners.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class Banners
|
||||
{
|
||||
public static function banner_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'baners_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Banners::banner_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Baner został usunięty.' );
|
||||
header( 'Location: /admin/banners/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function banner_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'baners_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania baneru wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $banner_id = \admin\factory\Banners::banner_save( $values['id'], $values['name'], $values['status'], $values['date_start'], $values['date_end'],
|
||||
$values['home_page'], $values['src'], $values['url'], $values['html'], $values['text'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Baner został zapisany.', 'id' => $banner_id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function banner_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'baners_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Banners::banner_edit(
|
||||
\admin\factory\Banners::banner_details(
|
||||
\S::get( 'id' )
|
||||
),
|
||||
\admin\factory\Languages::languages_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'baners_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Banners::banners_list();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
28
autoload/admin/controls/class.Emails.php
Normal file
28
autoload/admin/controls/class.Emails.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class Emails{
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'emails_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
return \admin\view\Emails::emails_list();
|
||||
}
|
||||
|
||||
public static function email_details()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'emails_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Emails::email_details(
|
||||
\admin\factory\Emails::email_details(
|
||||
\S::get( 'id' )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
15
autoload/admin/controls/class.Filemanager.php
Normal file
15
autoload/admin/controls/class.Filemanager.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Filemanager
|
||||
{
|
||||
public function draw()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'fileManager_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\FileManager::filemanager();
|
||||
}
|
||||
}
|
||||
?>
|
||||
126
autoload/admin/controls/class.Languages.php
Normal file
126
autoload/admin/controls/class.Languages.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?
|
||||
namespace admin\controls;
|
||||
|
||||
class Languages
|
||||
{
|
||||
public static function language_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Languages::language_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Język został usunięty.' );
|
||||
header( 'Location: /admin/languages/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function language_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania języka wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( \admin\factory\Languages::language_save(
|
||||
$values['id'], $values['name'], $values['status'], $values['start'], $values['o'], $values['domain'], $values['main_domain']
|
||||
) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Język został zapisany.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function language_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Languages::language_edit(
|
||||
\admin\factory\Languages::language_details(
|
||||
\S::get( 'id' )
|
||||
), \admin\factory\Languages::max_order()
|
||||
);
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Languages::languages_list();
|
||||
}
|
||||
|
||||
public static function translation_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Languages::translation_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Tłumaczenie zostało usunięte.' );
|
||||
header( 'Location: /admin/languages/translation_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function translation_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania tłumaczenia wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
$languages_list = \admin\factory\Languages::languages_list();
|
||||
if ( is_array( $languages_list ) and !empty( $languages_list ) ) foreach ( $languages_list as $language )
|
||||
{
|
||||
\S::delete_session( 'lang-' . $language['id'] );
|
||||
$languages[ $language['id'] ] = $values[ $language['id'] ];
|
||||
}
|
||||
|
||||
if ( $id = \admin\factory\Languages::translation_save( $values['id'], $values['text'], $languages ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Tłumaczenie zostało zapisane.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function translation_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Languages::translation_edit(
|
||||
\admin\factory\Languages::translation_details( \S::get( 'id' ) ),
|
||||
\admin\factory\Languages::languages_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function translation_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'language_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Languages::translations_list();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
59
autoload/admin/controls/class.Layouts.php
Normal file
59
autoload/admin/controls/class.Layouts.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Layouts
|
||||
{
|
||||
public static function layout_delete()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'template_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
if ( \admin\factory\Layouts::layout_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Szablon został usunięty.' );
|
||||
|
||||
header( 'Location: /admin/layouts/view_list/' );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
public static function layout_save()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'template_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania szablonu wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $id = \admin\factory\Layouts::layout_save( $values['id'], $values['name'], $values['status'], $values['pages'], $values['html'], $values['css'], $values['js'], $values['m_html'], $values['m_css'], $values['m_js'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Szablon został zapisany.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function layout_edit()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'template_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Layouts::layout_edit(
|
||||
\admin\factory\Layouts::layout_details(
|
||||
\S::get( 'id' )
|
||||
),
|
||||
\admin\factory\Layouts::menus_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'template_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Layouts::layouts_list();
|
||||
}
|
||||
}
|
||||
?>
|
||||
167
autoload/admin/controls/class.Newsletter.php
Normal file
167
autoload/admin/controls/class.Newsletter.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Newsletter
|
||||
{
|
||||
public static function emails_import()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( \admin\factory\Newsletter::emails_import( $values['emails'] ) )
|
||||
\S::alert( 'Emaile zostały zaimportowane.' );
|
||||
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Emaile zostały zaimportowane.' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function import()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'newsletter/import' );
|
||||
}
|
||||
|
||||
public static function emails_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Newsletter::emails_list();
|
||||
}
|
||||
|
||||
public static function send()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Newsletter::send( \S::get( 'dates' ), \S::get( 'template' ), \S::get( 'only_once' ) ) )
|
||||
\S::alert( 'Newsletter został dodany do kolejki wysyłania.' );
|
||||
|
||||
header( 'Location: /admin/newsletter/prepare/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function prepare()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Newsletter::prepare(
|
||||
\admin\factory\Newsletter::templates_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function settings_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
\admin\factory\Settings::settings_update( 'newsletter_footer_1', $values['newsletter_footer_1'] );
|
||||
\admin\factory\Settings::settings_update( 'newsletter_footer_2', $values['newsletter_footer_2'] );
|
||||
\admin\factory\Settings::settings_update( 'newsletter_header', $values['newsletter_header'] );
|
||||
|
||||
\S::alert( 'Ustawienia zostały zapisane.' );
|
||||
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Ustawienia zostały zapisane.' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function settings()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Newsletter::settings(
|
||||
\admin\factory\Settings::settings_details()
|
||||
);
|
||||
}
|
||||
|
||||
public static function email_templates_user()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Newsletter::email_templates_user();
|
||||
}
|
||||
|
||||
public static function email_templates_admin()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Newsletter::email_templates_admin();
|
||||
}
|
||||
|
||||
public static function email_template_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$is_admin = \admin\factory\Newsletter::is_admin_template( \S::get( 'id' ) );
|
||||
|
||||
if ( !$is_admin and \admin\factory\Newsletter::newsletter_template_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Szablon newslettera został usunięty.' );
|
||||
|
||||
if ( $is_admin )
|
||||
header( 'Location: /admin/newsletter/email_templates_admin/' );
|
||||
else
|
||||
header( 'Location: /admin/newsletter/email_templates_user/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function email_template_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Newsletter::email_template_edit(
|
||||
\admin\factory\Newsletter::email_template_detalis(
|
||||
\S::get( 'id' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function template_save()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $id = \admin\factory\Newsletter::template_save( $values['id'], $values['name'], $values['text'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Zmiany zostały zapisane.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
155
autoload/admin/controls/class.Pages.php
Normal file
155
autoload/admin/controls/class.Pages.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class Pages
|
||||
{
|
||||
static public function pages_url_browser()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'pages/pages-browse-list', [
|
||||
'menus' => \admin\factory\Pages::menus_list(),
|
||||
'modal' => true
|
||||
] );
|
||||
}
|
||||
|
||||
static public function browse_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Pages::browse_list(
|
||||
\admin\factory\Pages::menus_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function menu_delete()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Pages::menu_delete( \S::get( 'id' ) ) )
|
||||
\S::set_message( 'Menu zostało usunięte.' );
|
||||
else
|
||||
\S::alert( 'Podczas usuwania menu wystąpił błąd. Aby usunąć menu nie może ono posiadać przypiętych stron.' );
|
||||
header( 'Location: /admin/pages/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function page_delete()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Pages::page_delete( \S::get( 'id' ) ) )
|
||||
\S::set_message( 'Strona została usunięta.' );
|
||||
else
|
||||
\S::alert( 'Podczas usuwania strony wystąpił błąd. Aby usunąć stronę nie może ona posiadać przypiętych podstron.' );
|
||||
|
||||
header( 'Location: /admin/pages/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function page_articles()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Pages::page_articles( \S::get( 'id' ),
|
||||
\admin\factory\Pages::page_articles( \S::get( 'id' ) ) );
|
||||
}
|
||||
|
||||
public static function page_save()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania strony wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $id = \admin\factory\Pages::page_save(
|
||||
$values['id'], $values['title'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['menu_id'],
|
||||
$values['parent_id'], $values['page_type'], $values['sort_type'], $values['layout_id'], $values['articles_limit'], $values['show_title'],
|
||||
$values['status'], $values['link'], $values['noindex'], $values['start'], $values['site_title'], $values['block_direct_access'], $values['cache'], $values['canonical']
|
||||
) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Strona została zapisana.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function page_edit()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Pages::page_edit(
|
||||
\admin\factory\Pages::page_details(
|
||||
\S::get( 'id' )
|
||||
), \S::get( 'pid' ), \S::get( 'menu_id' ),
|
||||
\admin\factory\Pages::menu_lists(),
|
||||
\admin\factory\Layouts::layouts_list(),
|
||||
\admin\factory\Languages::languages_list(),
|
||||
\admin\factory\Settings::settings_details()
|
||||
);
|
||||
}
|
||||
|
||||
public static function menu_save()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania menu wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( \admin\factory\Pages::menu_save( $values['id'], $values['name'],
|
||||
$values['status'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Menu zostało zapisane.' ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function menu_edit()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Pages::menu_edit(
|
||||
\admin\factory\Pages::menu_details( \S::get( 'id' ) )
|
||||
);
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Pages::pages_list(
|
||||
\admin\factory\Pages::menus_list()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
75
autoload/admin/controls/class.Scontainers.php
Normal file
75
autoload/admin/controls/class.Scontainers.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class Scontainers
|
||||
{
|
||||
static public function ckeditor_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'scontainers_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( '/scontainers/ckeditor-list' );
|
||||
}
|
||||
|
||||
public static function container_delete()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'scontainers_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\Scontainers::container_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Kontener został usunięty.' );
|
||||
|
||||
header( 'Location: /admin/scontainers/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function container_save()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'scontainers_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania kontenera wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $id = \admin\factory\Scontainers::container_save( $values['id'], $values['title'], $values['text'], $values['status'], $values['show_title'],
|
||||
$values['src'], $values['html']
|
||||
) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Kontener został zapisany.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function container_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'scontainers_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Scontainers::container_edit(
|
||||
\admin\factory\Scontainers::container_details(
|
||||
\S::get( 'id' )
|
||||
), \admin\factory\Languages::languages_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
if ( !\admin\factory\Users::check_privileges( 'scontainers_administration',
|
||||
$user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Scontainers::containers_list();
|
||||
}
|
||||
|
||||
}
|
||||
59
autoload/admin/controls/class.SeoAdditional.php
Normal file
59
autoload/admin/controls/class.SeoAdditional.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
class SeoAdditional
|
||||
{
|
||||
public static function element_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'seo_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
if ( \admin\factory\SeoAdditional::element_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Element został usunięty.' );
|
||||
|
||||
header( 'Location: /admin/seo_additional/main_view/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function element_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'seo_administration', $user['id']))
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania elementu wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $id = \admin\factory\SeoAdditional::element_save( $values['id'], $values['url'], $values['status'], $values['title'], $values['keywords'], $values['description'], $values['text'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Zmiany zostały zapisane.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function element_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'seo_administration', $user['id']))
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\SeoAdditional::element_edit(
|
||||
\admin\factory\SeoAdditional::element_details(
|
||||
\S::get( 'id' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function main_view()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'seo_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\SeoAdditional::main_view();
|
||||
}
|
||||
}
|
||||
77
autoload/admin/controls/class.Settings.php
Normal file
77
autoload/admin/controls/class.Settings.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?
|
||||
namespace admin\controls;
|
||||
|
||||
class Settings
|
||||
{
|
||||
public static function settings_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'settings_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
$settings = \admin\factory\Settings::settings_details();
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
\admin\factory\Settings::settings_save(
|
||||
$values['firm_name'],
|
||||
$values['firm_adress'],
|
||||
$values['additional_info'],
|
||||
$values['contact_form'] == 'on' ? 1 : 0,
|
||||
$values['contact_email'],
|
||||
$values['email_host'],
|
||||
$values['email_port'],
|
||||
$values['email_login'],
|
||||
$values['email_password'],
|
||||
$values['google_maps'],
|
||||
$values['facebook_link'],
|
||||
$values['statistic_code'],
|
||||
$values['htaccess'],
|
||||
$values['robots'],
|
||||
$settings['newsletter_header'],
|
||||
$settings['newsletter_footer_1'],
|
||||
$settings['newsletter_footer_2'],
|
||||
$values['google_map_key'],
|
||||
$values['google_search_console'],
|
||||
$values['update'],
|
||||
$values['devel'],
|
||||
$values['news_limit'],
|
||||
$values['visit_counter'],
|
||||
$values['calendar'],
|
||||
$values['tags'],
|
||||
$values['ssl'],
|
||||
$values['mysql_debug'],
|
||||
$values['htaccess_cache'],
|
||||
$settings['visits'],
|
||||
$values['links_structure'],
|
||||
$values['link_version'],
|
||||
$values['widget_phone'],
|
||||
$values['update_key']
|
||||
);
|
||||
|
||||
\admin\factory\Settings::settings_update( 'image_px', $values['image_px'] );
|
||||
\admin\factory\Settings::settings_update( 'newsletter_cron', $values['newsletter_cron'] );
|
||||
\admin\factory\Settings::settings_update( 'lazy_loading', $values['lazy_loading'] == 'on' ? 1 : 0 );
|
||||
\admin\factory\Settings::settings_update( 'generate_webp', $values['generate_webp'] == 'on' ? 1 : 0 );
|
||||
\admin\factory\Settings::settings_update( 'contact_form_captcha', $values['contact_form_captcha'] == 'on' ? 1 : 0 );
|
||||
\admin\factory\Settings::settings_update( 'url_version', $values['url_version'] );
|
||||
|
||||
\S::alert( 'Ustawienia zostały zapisane.' );
|
||||
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Ustawienia zostały zapisane.' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function view()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'settings_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Settings::view(
|
||||
\admin\factory\Settings::settings_details()
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
29
autoload/admin/controls/class.Update.php
Normal file
29
autoload/admin/controls/class.Update.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Update
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
if ( !\admin\factory\Update::update() )
|
||||
\S::alert( 'W trakcie aktualizacji systemu wystąpił błąd. Proszę spróbować ponownie.' );
|
||||
else
|
||||
\S::set_message( 'Aktualizacja przebiegła pomyślnie.' );
|
||||
|
||||
header( 'Location: /admin/update/main_view/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function updateAll()
|
||||
{
|
||||
$response['status'] = \admin\factory\Update::update();
|
||||
$response['version'] = number_format( \S::get('version_current') + 0.001, 3, '.', '' );
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function main_view()
|
||||
{
|
||||
return \admin\view\Update::main_view();
|
||||
}
|
||||
}
|
||||
65
autoload/admin/controls/class.Users.php
Normal file
65
autoload/admin/controls/class.Users.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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' )
|
||||
] );
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user