first commit

This commit is contained in:
2023-09-04 21:59:34 +02:00
commit 650ef5b3e1
196 changed files with 24080 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace admin\controls;
class Adverts {
public static function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del' )
{
if ( \admin\factory\Adverts::deleteAdvert( \System::formGetInt( 'id' ) ) )
\System::setAlert( 'Reklama została usunięta.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\Adverts::editAdvert( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Adverts::editAdvert();
return \admin\view\Adverts::showAdverts();
}
}
?>

View File

@@ -0,0 +1,105 @@
<?php
namespace admin\controls;
class Articles
{
public static function getContentArticleSort()
{
return \admin\view\Articles::drawPagesArticles();
}
public static function getContentArticlesArchive()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'show' )
return false;
else
{
if ( $rw == 'restore' && \admin\factory\Articles::restoreArticle( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został przywrócony.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'del' && \admin\factory\Articles::deleteArticle( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został usunięty.' );
header( 'Location: ./' );
exit;
}
return \admin\view\Articles::showArticlesArchive();
}
}
public static function getContentArticles()
{
$rw = \System::formGet( 'rw' );
if ( \System::formGet( 'act' ) )
{
\System::setSessionVar( 'act' , \System::formGet( 'act' ) );
\System::setSessionVar( 'art_id' , \System::formGet( 'id' ) );
}
$act = \System::getSessionVar( 'act' );
if ( $act == 'show_versions' )
{
if ( $rw == 'restore' && \admin\factory\Articles::restoreArticleVersion( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został przywrócony.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'show' )
return \admin\view\Articles::drawArticle( \System::formGetInt( 'id' ) );
return \admin\view\Articles::showVersions( \System::getSessionVar( 'art_id' ) );
}
else
{
\admin\factory\Articles::deleteNonAssignImages();
if ( $rw == 'change-enabled' && \admin\factory\Articles::changeArticleEnabled( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Widoczność artykułu została zmieniona.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'del' && \admin\factory\Articles::setAsArchive( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został przeniesiony do archiwum.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'save' && \admin\factory\Articles::saveArticle() )
{
\System::setAlert( 'Artykuł został zapisany.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'add_new' && \admin\factory\Articles::addArticle() )
{
\System::setAlert( 'Artykuł został dodany.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\Articles::editArticle( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Articles::addArticle();
return \admin\view\Articles::showArticles();
}
}
}
?>

View File

@@ -0,0 +1,40 @@
<?
namespace admin\controls;
class Banners
{
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'down' && \admin\factory\Banners::moveBannerDown( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Baner został przesunięty w dół.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'up' && \admin\factory\Banners::moveBannerUp( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Baner został przesunięty w górę' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'del' && \admin\factory\Banners::deleteBanner( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Baner został usunięty.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\Banners::editBanner( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Banners::editBanner();
return \admin\view\Banners::showBanners();
}
}
?>

View File

@@ -0,0 +1,11 @@
<?php
namespace admin\controls;
class Filemanager {
public function getContent()
{
return \admin\view\FileManager::showFileManager();
}
}
?>

View File

@@ -0,0 +1,26 @@
<?
namespace admin\controls;
class GuestBook
{
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del' && \admin\factory\GuestBook::deleteEntry( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Usunięto wpis z księgi gości.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\GuestBook::editEntry( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\GuestBook::editEntry();
return \admin\view\GuestBook::showEntries();
}
}
?>

View File

@@ -0,0 +1,37 @@
<?
// po poprawkach
namespace admin\controls;
class Languages
{
public function getContentTranslation()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del' && \admin\factory\Languages::deleteTranslation( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Tłumaczenie zostało usunięte.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\Languages::editTranslation( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Languages::editTranslation();
return \admin\view\Languages::showTranslations();
}
public function getContentLanguages()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\Languages::editLanguage( \System::formGet( 'id' ) );
return \admin\view\Languages::showLanguages();
}
}
?>

View File

@@ -0,0 +1,40 @@
<?php
namespace admin\controls;
class Layouts {
public static function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del' && \admin\factory\Layouts::deleteLayout( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Szablon został usunięty.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'save_new' && \admin\factory\Layouts::addLayout() )
{
\System::setAlert( 'Szablon został dodany.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'save' && \admin\factory\Layouts::saveLayout() )
{
\System::setAlert( 'Szablon został zapisany.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\Layouts::editLayout( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Layouts::addLayout();
return \admin\view\Layouts::showLayouts();
}
}
?>

View File

@@ -0,0 +1,21 @@
<?php
namespace admin\controls;
class Newsletter {
public function getContentEmails()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del' && \admin\factory\Newsletter::deleteEmail( \System::formGetInt( 'id' ) ) )
\System::setAlert( 'Wybrany email został usunięty.' );
if ( $rw == 'add' )
return \admin\view\Newsletter::editEmail();
if ( $rw == 'edit' )
return \admin\view\Newsletter::editEmail( \System::formGetInt( 'id' ) );
return \admin\view\Newsletter::showEmailList();
}
}

View File

@@ -0,0 +1,134 @@
<?php
namespace admin\controls;
class Page {
public static function checkUrlParams()
{
global $user;
$rw = \System::formGet( 'rw' );
switch ( $rw )
{
case 'user_logon':
$user = \user\FUser::Login( \System::formGet( 'login' ), \System::formGet( 'password' ) );
\System::setSessionVar( 'user', $user, true );
break;
case 'user_logout':
\System::deleteSessionVar( 'user' , true );
break;
case 'db_edit_save':
$db_edit_table = \System::getSessionVar( 'db_edit_table' );
$db_edit_key = \System::getSessionVar( 'db_edit_key' );
$db_edit_val = \System::getSessionVar( 'db_edit_val' );
$db_edit_pols = \System::getSessionVar( 'db_edit_pols' );
$db_edit_pass = \System::getSessionVar( 'db_edit_pass' );
$db_edit_pols_t = \System::getSessionVar( 'db_edit_pols_type' );
\DataBase::SaveData( $db_edit_table , $db_edit_key , $db_edit_val , $db_edit_pols , $db_edit_pass , $db_edit_pols_t );
break;
case 'db_edit_add_new':
$db_edit_table = \System::getSessionVar( 'db_edit_table' );
$db_edit_pols = \System::getSessionVar( 'db_edit_pols' );
$db_edit_pass = \System::getSessionVar( 'db_edit_pass' );
$db_edit_pols_hidden = \System::getSessionVar( 'db_edit_pols_hidden' );
$db_edit_pols_t = \System::getSessionVar( 'db_edit_pols_type' );
$time = \System::formGetHash( 'time' );
\DataBase::AddData( $db_edit_table , $db_edit_pols , $db_edit_pols_hidden , $db_edit_pols_t , $time , $db_edit_pass );
break;
}
}
public static function getContent()
{
global $user;
if ( !$user || !$user -> _values['admin'] )
return \admin\view\Users::drawLoginForm();
if ( \System::formGet( 'p' ) )
\System::setSessionVar( 'page_type' , \System::formGet( 'p' ) );
$page_type = \System::getSessionVar( 'page_type' );
switch ( $page_type )
{
case 'newsletter_emails':
return \admin\controls\Newsletter::getContentEmails();
break;
case 'static_containers':
return \admin\controls\SContainers::getContent();
break;
case 'filemanager':
return \admin\controls\Filemanager::getContent();
break;
case 'adverts':
return \admin\controls\Adverts::getContent();
break;
case 'page_article_sort':
return \admin\controls\Articles::getContentArticleSort();
break;
case 'users':
return \admin\controls\Users::getContentUsers();
break;
case 'article_archive':
return \admin\controls\Articles::getContentArticlesArchive();
break;
case 'page_definition':
return \admin\controls\Pages::getContent();
break;
case 'page_articles':
default;
return \admin\controls\Articles::getContentArticles();
break;
case 'admins':
return \admin\controls\Users::getContentAdmins();
break;
case 'lang':
return \admin\controls\Languages::getContentLanguages();
break;
case 'translation':
return \admin\controls\Languages::getContentTranslation();
break;
case 'settings':
return \admin\controls\Settings::getContent();
break;
case 'guest_book':
return \admin\controls\GuestBook::getContent();
break;
case 'banner':
return \admin\controls\Banners::getContent();
break;
case 'layout':
return \admin\controls\Layouts::getContent();
break;
case 'banned_email':
return \admin\controls\Restriction::getContentEmails();
break;
case 'banned_login':
return \admin\controls\Restriction::getContentLogins();
break;
}
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
namespace admin\controls;
class Pages {
public static function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del_menu' )
{
\admin\factory\Menu::deleteMenu( \System::formGetInt( 'id' ) );
header( 'Location: ./' );
exit;
}
if ( $rw == 'save' && \admin\factory\Pages::savePage() )
{
\System::setAlert( 'Strona została zapisana.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'add_new' && \admin\factory\Pages::addPage() )
{
\System::setAlert( 'Strona została dodana.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'add_menu' )
return \admin\view\Menu::editMenu();
if ( $rw == 'edit_menu' )
return \admin\view\Menu::editMenu( \System::formGetInt( 'id' ) );
if ( $rw == 'edit' )
return \admin\view\Pages::editPage( \System::formGet( 'id' ), \System::formGetInt( 'menu_id' ) );
if ( $rw == 'add' )
return \admin\view\Pages::addPage( \System::formGetInt( 'menu_id' ), \System::formGetInt( 'parent_id' ) );
if ( $rw == 'article_list' )
return \admin\view\Pages::showAssignedArticles( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\Pages::deletePage( \System::formGetInt( 'id' ) );
return \admin\view\Pages::showPages();
}
}
?>

View File

@@ -0,0 +1,39 @@
<?
// po poprawkach
namespace admin\controls;
class Restriction
{
public function getContentEmails()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\Restriction::editBannedEmail( \System::formGet( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Restriction::editBannedEmail();
if ( $rw == 'del' )
\admin\factory\Restriction::deleteBannedEmail( \System::formGet( 'id' ) );
return \admin\view\Restriction::showBannedEmails();
}
public function getContentLogins()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\Restriction::editBannedLogin( \System::formGet( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Restriction::editBannedLogin();
if ( $rw == 'del' )
\admin\factory\Restriction::deleteBannedLogin( \System::formGet( 'id' ) );
return \admin\view\Restriction::showBannedLogins();
}
}
?>

View File

@@ -0,0 +1,27 @@
<?php
namespace admin\controls;
class SContainers {
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'del' && \admin\factory\SContainers::deleteContainer( \System::formGetInt( 'id' ) ) )
\System::setAlert( 'Wybrany kontener został usunięty.' );
if ( $rw == 'edit' )
return \admin\view\SContainers::editContainer( \System::formGet( 'id' ) );
if ( $rw == 'add' )
return \admin\view\SContainers::editContainer();
if ( $rw == 'save' )
\admin\factory\SContainers::saveContainer();
if ( $rw == 'save_new')
\admin\factory\SContainers::addContainer();
return \admin\view\SContainers::showContainerList();
}
}

View File

@@ -0,0 +1,16 @@
<?
namespace admin\controls;
class Settings
{
public static function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'save_settings' )
\admin\factory\Settings::saveSettings();
return \admin\view\Settings::showSettings();
}
}
?>

View File

@@ -0,0 +1,39 @@
<?php
//po poprawkach
namespace admin\controls;
class Users {
public function getContentAdmins()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'add' )
return \admin\view\Users::editAdmin();
if ( $rw == 'edit' )
return \admin\view\Users::editAdmin( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\Users::deleteAdmin( \System::formGetInt( 'id' ) );
return \admin\view\Users::showAdmins();
}
public function getContentUsers()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'add' )
return \admin\view\Users::editUser();
if ( $rw == 'edit' )
return \admin\view\Users::editUser( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\Users::deleteUser( \System::formGetInt( 'id' ) );
return \admin\view\Users::showUsers();
}
}
?>