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,67 @@
<?php
namespace front\controls;
class Page {
public static function checkUrlParams()
{
global $lang, $config;
$rw = \System::formGet( 'rw' );
switch ( $rw )
{
case 'send-ac-form':
if ( $_SESSION['ac-check'] == $_POST['check'] || !$_POST['ac-name'] || !$_POST['ac-email'] || !$_POST['ac-text'] ):
\System::setAlert( 'Brak wszystkich wymaganych danych.' );
else:
$tpl = new \Savant3;
$tpl -> _data = $_POST;
$out = $tpl -> fetch( 'other/contact-message' );
if ( ( !empty( $_FILES["ac-file"] ) ) && ( $_FILES['ac-file']['error'] == 0 ) )
{
$filename = basename( $_FILES['ac-file']['name'] );
if ( in_array( $_FILES["ac-file"]["type"], \System::getImgFileTypes() ) )
{
$newname = 'temp/' . $filename;
move_uploaded_file( $_FILES['ac-file']['tmp_name'], $newname );
}
}
\System::sendEmail( \admin\factory\Settings::getSystemSettings( 'admin_email'), 'Wiadomość ze strony: www.' . $config['page'], $out, $replay = '', $newname );
\System::setAlert( 'Wiadomość została wysłana.' );
$_SESSION['ac-check'] = $_POST['check'];
endif;
break;
case 'change_language':
$id = \System::formGet( 'id' );
$lang = \language\FLanguage::loadLang( $id );
\System::setSessionVar( 'lang' , $lang );
break;
case 'change_site':
if ( \System::formGet( 'type' ) )
$site = \site\FSite::loadSiteStatic( \System::formGet( 'type' ) );
else
$site = new \site\Site( \System::formGetInt( 'id' ) );
\System::setSessionVar( 'site' , $site );
break;
case 'add_comment':
\article\FArticle::addComment( \System::formGetInt( 'article_id' ), \System::formGet( 'author' ), \System::formGet( 'text' ), \System::formGet( 'captcha_code' ), \System::formGet( 'check' ) );
break;
}
if ( \System::formGetInt( 'download' ) )
\System::downloadFile( \System::formGetInt( 'download' ) );
if ( \System::formGet( 'account_activation' ) && \System::formGetInt( 'value' ) )
\user\FUser::activateAccount( \System::saveString( \System::formGet( 'account_activation' ) ), \System::formGetInt( 'value' ) );
if ( \System::formGet( 'recover_password' ) && \System::formGetInt( 'value' ) )
\user\FUser::recoverPassword( \System::saveString( \System::formGet( 'recover_password' ) ), \System::formGetInt( 'value' ) );
}
}
?>

View File

@@ -0,0 +1,152 @@
<?php
namespace front\factory;
class Page {
const menu_pattern = '/MENU:[0-9]*/';
const arts_list_pattern = '/ARTYKULY-LISTA:[0-9]*/';
const lang_pattern = '/JEZYK:(.*)*]/';
const container_pattern = '/KONTENER:[0-9]*/';
public static function convertPage( $layout )
{
global $site, $xajax, $config, $lang;
$art_id = \System::formGetInt( 'art' );
if ( $art_id )
{
$layout_id = \article\FArticle::getArticleLayoutId( $art_id );
$layout = \admin\factory\Layouts::getLayout( $layout_id );
}
$html = stripslashes( $layout['html'] );
if ( ( $config['dev'] or \System::formGet( 'dev' ) == true ) and file_exists( 'dev.html' ) )
$html = file_get_contents ( 'dev.html' );
if ( \admin\factory\Settings::getSystemSettings( 'facebook_url' ) )
$html = str_replace( '</body>', \site\VSite::getFacebookLikeBox() . '</body>', $html );
$html = str_replace( '[ALERT]', \site\VSite::drawAlert(), $html );
$html = str_replace( '[COPYRIGHT]', \site\VSite::drawCopyright(), $html );
$html = str_replace( '[BANERY]', \site\VSite::drawBanners(), $html );
$html = str_replace( '[KONTAKT_MINI]', \site\VSite::drawContactMini(), $html );
$html = str_replace( '[ZEGAR]', \site\VSite::drawClock(), $html );
$html = str_replace( '[IMIENINY]', \site\VSite::drawNameDay(), $html );
$html = str_replace( '[FORMULARZ_KONTAKTOWY]', \site\VSite::drawContactForm(), $html );
$html = str_replace( '[WYSZUKIWARKA]', \site\VSite::drawSearchForm(), $html );
$html = str_replace( '[REKLAMA]', \site\VSite::drawAdverts(), $html );
$html = str_replace( '[PANEL_UZYTKOWNIKA]', \user\VUser::drawUserPanel(), $html );
$html = str_replace( '[JEZYKI]', \language\VLanguage::showLanguages(), $html );
$html = str_replace( '[NEWSLETTER]', \newsletter\VNewsletter::drawNewsletterSignForm(), $html );
$html = str_replace( '[STRONA_GLOWNA]', \System::getMainPage(), $html );
$html = str_replace( '[CSS]', stripslashes( $layout['css'] ), $html );
$html = str_replace( '[JAVA_SCRIPT]', stripslashes( $layout['javascript'] ), $html );
$html = str_replace( '[PAGE_ID]', $site -> _values['id'], $html );
$html = str_replace( '[AJAX]', $xajax -> getJavascript( '../resources/xajax/' ), $html );
$html = str_replace( '[LICZNIK_ODWIEDZIN]', \site\VSite::drawVisitCounter(), $html );
preg_match_all( self::lang_pattern, $html, $lang_t );
if ( is_array( $lang_t[0] ) ) foreach( $lang_t[0] as $lang_tmp )
{
$lang_tmp = explode( ':', $lang_tmp );
$lang_tmp = substr( $lang_tmp[1], 0, strlen( strip_tags( $lang_tmp[1] ) ) - 1 );
$html = str_replace( '[JEZYK:' . $lang_tmp . ']', $lang -> getTrans( $lang_tmp ), $html );
}
preg_match_all( self::menu_pattern, $html, $menu );
if ( is_array( $menu[0] ) ) foreach( $menu[0] as $menu_tmp )
{
$menu_tmp = explode( ':', $menu_tmp );
$html = str_replace( '[MENU:' . $menu_tmp[1] . ']', \menu\VMenu::show( $menu_tmp[1] ), $html );
}
preg_match_all( self::arts_list_pattern, $html, $arts_list );
if ( is_array( $arts_list[0] ) ) foreach( $arts_list[0] as $arts_list_tmp )
{
$arts_list_tmp = explode( ':', $arts_list_tmp );
$html = str_replace( '[ARTYKULY-LISTA:' . $arts_list_tmp[1] . ']', \article\VArticle::drawArticleListStatic( $arts_list_tmp[1] ), $html );
}
preg_match_all( self::container_pattern, $html, $container_list );
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
{
$container_list_tmp = explode( ':', $container_list_tmp );
$html = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \site\VSite::drawStaticContainer( $container_list_tmp[1] ), $html );
}
/* wyświetlenie artykułu i jego metadanych */
if ( $art_id )
{
$article = \article\FArticle::loadArticle( $art_id );
if ( $article -> _values['meta_keywords'] )
\System::setSessionVar( 'keywords', $article -> _values['meta_keywords'] );
if ( $article -> _values['meta_description'] )
\System::setSessionVar( 'description', $article -> _values['meta_description'] );
$keywords = \System::getSessionVar( 'keywords' );
$description = \System::getSessionVar( 'description' );
$site_title = \System::getRandomKeyWord( $keywords ) . ' &#8226; ' . $article -> _values['title']. ' &#8226; ' . \admin\factory\Settings::getSystemSettings( 'firm_name' );
$html = str_replace( '[ZAWARTOSC]', \article\VArticle::draw( $art_id ), $html );
}
/* wyświetlenie pozostałych rzeczy i ich metadanych */
else
{
if ( $site -> _values['meta_keywords'] != '' )
\System::setSessionVar( 'keywords', $site -> _values['meta_keywords'] );
if ( $site -> _values['meta_description'] != '' )
\System::setSessionVar( 'description', $site -> _values['meta_description'] );
$keywords = \System::getSessionVar( 'keywords' );
$description = \System::getSessionVar( 'description' );
$site_title = \System::getRandomKeyWord( $keywords ) . ' &#8226; ' . $site -> _values['title'] . ' &#8226; ' . \admin\factory\Settings::getSystemSettings( 'firm_name' );
if ( $site -> _values['meta_title'] )
$site_title = $site -> _values['meta_title'];
$html = str_replace( '[ZAWARTOSC]', \site\FSite::getContent(), $html );
}
if ( $site -> _values['show_title'] )
$title = \site\VSite::drawTitle( $site -> _values['title'] );
if ( $art_id && $article -> _values['replace_menu_title'] )
$title = \site\VSite::drawTitle( $article -> _values['title'] );
$keywords = \System::getSessionVar( 'keywords' );
$description = \System::getSessionVar( 'description' );
$html = str_replace( '[TYTUL_STRONY]', $title, $html );
$html = str_replace( '[TYTUL]', $site_title, $html );
$html = str_replace( '[SLOWA_KLUCZOWE]', $keywords, $html );
$html = str_replace( '[OPIS_STRONY]', $description, $html );
if ( strpos( $html, '[PHP]' ) !== false )
{
$text = explode( '[PHP]', $html );
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ )
{
$temp = explode( '[/PHP]' , $text[$i] );
$code = $temp[0];
ob_start();
eval( $code );
$out .= ob_get_contents();
ob_end_clean();
$out .= $temp[1];
}
$html = $before . $out;
}
return $html;
}
}
?>

View File

@@ -0,0 +1,12 @@
<?php
namespace front\view;
class Page {
public static function show()
{
$layout = \admin\factory\Layouts::getActiveLayout();
return \front\factory\Page::convertPage( $layout );
}
}
?>