first commit
This commit is contained in:
245
autoload/site/class.FSite.php
Normal file
245
autoload/site/class.FSite.php
Normal file
@@ -0,0 +1,245 @@
|
||||
<?
|
||||
/* 2011-09-26 - dodanie typu strony LINK */
|
||||
|
||||
namespace site;
|
||||
|
||||
class FSite {
|
||||
|
||||
public function getSiteMap()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$query = $dbs -> query( 'SELECT id FROM pcms_menu WHERE enabled = 1' );
|
||||
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
|
||||
{
|
||||
$row['pages'] = '';
|
||||
|
||||
$query2 = $db -> prepare( 'SELECT id FROM pcms_page WHERE enabled = "1" AND id_menu = :id_menu ORDER BY o ASC' );
|
||||
$query2 -> bindValue( ':id_menu', $row['id'], \PDO::PARAM_INT );
|
||||
$query2 -> execute();
|
||||
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
|
||||
$row['pages'][] = \site\FSite::loadSite( $row2['id'] );
|
||||
$query2 -> closeCursor();
|
||||
|
||||
$sitemap[] = $row;
|
||||
}
|
||||
return $sitemap;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $site;
|
||||
|
||||
$out = '';
|
||||
$ls = '';
|
||||
$bs = \System::formGet( 'bs' );
|
||||
|
||||
$link = 's,' . $site -> get_id() . ',[bs],' . \System::seo( $site -> get_title() );
|
||||
|
||||
switch ( $site -> get_site_type() )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
$ls = ceil( \article\FArticle::getCountArticles() / $site -> get_article_number() );
|
||||
if ( $bs < 1 )
|
||||
$bs = 1;
|
||||
else if ( $bs > $ls )
|
||||
$bs = $ls;
|
||||
$from = $site -> get_article_number() * ( $bs - 1 );
|
||||
if ( $from < 0 )
|
||||
$from = 0;
|
||||
$articles = \article\FArticle::getArticles( $from );
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$ls = ceil( \guestbook\FGuestBook::getCountEntries() / \guestbook\FGuestBook::getLimit() );
|
||||
|
||||
if ( $bs < 1 )
|
||||
$bs = 1;
|
||||
else if ( $bs > $ls )
|
||||
$bs = $ls;
|
||||
$from = \guestbook\FGuestBook::getLimit() * ( $bs - 1 );
|
||||
if ( $from < 0 )
|
||||
$from = 0;
|
||||
$aEntries = \guestbook\FGuestBook::getEntries( $from , \guestbook\FGuestBook::getLimit() );
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( $site -> get_site_type() )
|
||||
{
|
||||
case 1:
|
||||
$out = \site\VSite::drawEntryArticles( $articles );
|
||||
break;
|
||||
case 2:
|
||||
$out = \site\VSite::drawFullArticles( $articles );
|
||||
break;
|
||||
case 3:
|
||||
$out = \site\VSite::drawListArticles( $articles );
|
||||
break;
|
||||
case 4:
|
||||
$out = \site\VSite::drawMiniatureArticles( $articles );
|
||||
break;
|
||||
case 5:
|
||||
$out = \guestbook\VGuestBook::drawGuestBook( $aEntries );
|
||||
break;
|
||||
case 6:
|
||||
$out = \newsletter\VNewsletter::drawNewsletterForm();
|
||||
break;
|
||||
case 7:
|
||||
$out = \site\VSite::drawContactSite();
|
||||
break;
|
||||
case 'registration':
|
||||
$out = \user\VUser::drawRegisterForm();
|
||||
break;
|
||||
case 'user_panel':
|
||||
$out = \user\VUser::drawUserPanel();
|
||||
break;
|
||||
case 'password_recovery':
|
||||
$out = \user\VUser::drawPassRecoveryForm();
|
||||
break;
|
||||
case 'search':
|
||||
$out = \site\VSite::drawSearchFormFull();
|
||||
break;
|
||||
case 'sitemap':
|
||||
$out = \site\VSite::drawSiteMap();
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $ls > 1 )
|
||||
{
|
||||
$a = \System::getPagingVar( "a" , $bs , $ls );
|
||||
$b = \System::getPagingVar( "b" , $bs , $ls );
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _a = $bs-$b;
|
||||
$tpl -> _b = $bs+$a;
|
||||
$tpl -> _ls = $ls;
|
||||
$tpl -> _link = $link;
|
||||
$tpl -> _bs = $bs;
|
||||
$out .= $tpl -> fetch( 'templates/site-paging.php' );
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function loadSiteStatic( $type )
|
||||
{
|
||||
global $lang;
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'registration':
|
||||
$site = new \site\Site;
|
||||
$site -> set_show_title( true );
|
||||
$site -> set_title( ucfirst( $lang -> getTrans( 'T_REJESTRACJA' ) ) );
|
||||
$site -> set_site_type( 'registration' );
|
||||
break;
|
||||
case 'password_recovery':
|
||||
$site = new \site\Site;
|
||||
$site -> set_show_title( true );
|
||||
$site -> set_title( ucfirst( $lang -> getTrans( 'T_ODZYSKIWANIE_HASLA' ) ) );
|
||||
$site -> set_site_type( 'password_recovery' );
|
||||
break;
|
||||
case 'search':
|
||||
$site = new \site\Site;
|
||||
$site -> set_show_title( true );
|
||||
$site -> set_title( ucfirst( $lang -> getTrans( 'T_WYSZUKIWARKA' ) ) );
|
||||
$site -> set_site_type( 'search' );
|
||||
break;
|
||||
case 'sitemap':
|
||||
$site = new \site\Site;
|
||||
$site -> set_show_title( true );
|
||||
$site -> set_title( ucfirst( $lang -> getTrans( 'T_MAPA_STRONY' ) ) );
|
||||
$site -> set_site_type( 'sitemap' );
|
||||
break;
|
||||
}
|
||||
return $site;
|
||||
}
|
||||
|
||||
public function loadSite( $id = '' )
|
||||
{
|
||||
global $cache , $config , $db;
|
||||
|
||||
$current_lang = \System::getSessionVar( 'current_lang' );
|
||||
if ( !$id ) $id = \site\FSite::getMainSiteId();
|
||||
|
||||
$key = 'loadSite:param:' . $id;
|
||||
|
||||
if ( !$params = $cache -> fetch( $key ) )
|
||||
{
|
||||
$query = $db -> prepare( 'SELECT id_menu , id_page_type , id_sort_type , article_number , show_title , link FROM pcms_page WHERE id = :id' );
|
||||
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
|
||||
$query -> execute();
|
||||
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
|
||||
{
|
||||
$params = $row;
|
||||
}
|
||||
$query -> closeCursor();
|
||||
$cache -> store( $key , $params , $config['cache_expire_long'] );
|
||||
}
|
||||
|
||||
$key = 'loadSite:translation:' . $id . ':' . $current_lang;
|
||||
|
||||
if ( !$translation = $cache -> fetch( $key ) )
|
||||
{
|
||||
$query = $db -> prepare( 'SELECT title, meta_description, meta_keywords, seo_link FROM pcms_page_translation WHERE page_id = :page_id AND lang_id = :lang_id' );
|
||||
$query -> bindValue( ':page_id' , $id , \PDO::PARAM_INT );
|
||||
$query -> bindValue( ':lang_id' , $current_lang , \PDO::PARAM_STR );
|
||||
$query -> execute();
|
||||
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
|
||||
{
|
||||
$row['title'] = \System::getPageTitle( $id , $current_lang );
|
||||
$translation = $row;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['title'] = \System::getPageTitle( $id , $current_lang );
|
||||
$row['meta_description'] = '';
|
||||
$row['meta_keywords'] = '';
|
||||
$translation = $row;
|
||||
}
|
||||
$query -> closeCursor();
|
||||
$cache -> store( $key , $translation , $config['cache_expire_long'] );
|
||||
}
|
||||
|
||||
$site = new \site\Site;
|
||||
$site -> set_id( $id );
|
||||
$site -> set_menu( $params['id_menu'] );
|
||||
$site -> set_sort_type( $params['id_sort_type'] );
|
||||
$site -> set_article_number( $params['article_number'] );
|
||||
$site -> set_show_title( $params['show_title'] );
|
||||
$site -> set_title( $translation['title'] );
|
||||
$site -> set_description( $translation['meta_description'] );
|
||||
$site -> set_keywords( $translation['meta_keywords'] );
|
||||
$site -> set_link( $params['link'] );
|
||||
$site -> set_site_type( $params['id_page_type'] );
|
||||
$site -> set_seo_link( $translation['seo_link'] );
|
||||
|
||||
return $site;
|
||||
}
|
||||
|
||||
public function getMainSiteId()
|
||||
{
|
||||
global $db , $cache , $config;
|
||||
|
||||
$key = 'getMainSiteId';
|
||||
|
||||
if ( !$id = $cache -> fetch( $key ) )
|
||||
{
|
||||
$query = $db -> prepare( 'SELECT id FROM pcms_page WHERE enabled = :enabled ORDER BY o ASC LIMIT 1' );
|
||||
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
|
||||
$query -> execute();
|
||||
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
|
||||
{
|
||||
$id = $row['id'];
|
||||
}
|
||||
$query -> closeCursor();
|
||||
$cache -> store( $key , $id , $config['cache_expire_long'] );
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
?>
|
||||
128
autoload/site/class.Site.php
Normal file
128
autoload/site/class.Site.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?
|
||||
/* 2011-09-26 - dodanie typu strony LINK */
|
||||
|
||||
namespace site;
|
||||
|
||||
class Site {
|
||||
|
||||
private $_id;
|
||||
private $_menu;
|
||||
private $_site_type;
|
||||
private $_sort_type;
|
||||
private $_article_number;
|
||||
private $_show_title;
|
||||
private $_title;
|
||||
private $_description;
|
||||
private $_keywords;
|
||||
private $_link;
|
||||
private $_seo_link;
|
||||
|
||||
public function get_seo_link() {
|
||||
return $this->_seo_link;
|
||||
}
|
||||
|
||||
public function set_seo_link($_seo_link) {
|
||||
$this->_seo_link = $_seo_link;
|
||||
}
|
||||
|
||||
public function get_id()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
public function set_id($_id)
|
||||
{
|
||||
$this->_id = $_id;
|
||||
}
|
||||
|
||||
public function get_menu()
|
||||
{
|
||||
return $this->_menu;
|
||||
}
|
||||
|
||||
public function set_menu($_menu)
|
||||
{
|
||||
$this->_menu = $_menu;
|
||||
}
|
||||
|
||||
public function get_site_type()
|
||||
{
|
||||
return $this->_site_type;
|
||||
}
|
||||
|
||||
public function set_site_type($_site_type)
|
||||
{
|
||||
$this->_site_type = $_site_type;
|
||||
}
|
||||
|
||||
public function get_sort_type()
|
||||
{
|
||||
return $this->_sort_type;
|
||||
}
|
||||
|
||||
public function set_sort_type($_sort_type)
|
||||
{
|
||||
$this->_sort_type = $_sort_type;
|
||||
}
|
||||
|
||||
public function get_article_number()
|
||||
{
|
||||
return $this->_article_number;
|
||||
}
|
||||
|
||||
public function set_article_number($_article_number)
|
||||
{
|
||||
$this->_article_number = $_article_number;
|
||||
}
|
||||
|
||||
public function get_show_title()
|
||||
{
|
||||
return $this->_show_title;
|
||||
}
|
||||
|
||||
public function set_show_title($_show_title)
|
||||
{
|
||||
$this->_show_title = $_show_title;
|
||||
}
|
||||
|
||||
public function get_title()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
public function set_title($_title)
|
||||
{
|
||||
$this->_title = $_title;
|
||||
}
|
||||
|
||||
public function get_description()
|
||||
{
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
public function set_description($_description)
|
||||
{
|
||||
$this->_description = $_description;
|
||||
}
|
||||
|
||||
public function get_keywords()
|
||||
{
|
||||
return $this->_keywords;
|
||||
}
|
||||
|
||||
public function set_keywords($_keywords)
|
||||
{
|
||||
$this->_keywords = $_keywords;
|
||||
}
|
||||
|
||||
public function get_link()
|
||||
{
|
||||
return $this->_link;
|
||||
}
|
||||
|
||||
public function set_link($_link)
|
||||
{
|
||||
$this->_link = $_link;
|
||||
}
|
||||
}
|
||||
?>
|
||||
239
autoload/site/class.VSite.php
Normal file
239
autoload/site/class.VSite.php
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
namespace site;
|
||||
|
||||
class VSite {
|
||||
|
||||
public function drawSWL()
|
||||
{
|
||||
if ( !file_exists( 'd962fcdeea9d1f4fca8a6b2c75083ec0.php' ) )
|
||||
return false;
|
||||
|
||||
require_once("d962fcdeea9d1f4fca8a6b2c75083ec0.php");
|
||||
|
||||
$seomatik = new \Seomatik();
|
||||
$seomatik->setSeparator("<br />"); // ustawienie separatora linków
|
||||
$seomatik->setTarget(true); // dodanie do ka¿dego linku parametru target="_blank"
|
||||
$seomatik->setClass("klasa"); // dodanie do ka¿dego linku klasy CSS, w tym przypadku "klasa"
|
||||
|
||||
return '<div id="links">' . $seomatik->show() . '</div>';
|
||||
}
|
||||
|
||||
public function drawProlink()
|
||||
{
|
||||
$out = '';
|
||||
if ( file_exists( 'prolink.php' ) )
|
||||
{
|
||||
include_once 'prolink.php';
|
||||
$out .= prolink_getLinks();
|
||||
}
|
||||
if ( file_exists( $_SERVER['DOCUMENT_ROOT'] . '/0da28b1f60770aa73489a6cfdf5499e0/SeoPilotClient.php' ) )
|
||||
{
|
||||
require_once( $_SERVER['DOCUMENT_ROOT'] . '/0da28b1f60770aa73489a6cfdf5499e0/SeoPilotClient.php' );
|
||||
$o['charset'] = 'utf-8';
|
||||
$seopilot = new \SeoPilotClient($o);
|
||||
unset($o);
|
||||
$out .= $seopilot->build_links();
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function drawAdverts()
|
||||
{
|
||||
$advert = \admin\factory\Adverts::getAcitveAdvert();
|
||||
|
||||
if ( $advert && !\System::getSessionVar('advert_close') )
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _advert = $advert;
|
||||
return $tpl -> fetch( 'templates/site-advert.php' );
|
||||
}
|
||||
}
|
||||
|
||||
public function drawSiteMap()
|
||||
{
|
||||
$sitemap = \site\FSite::getSiteMap();
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _sitemap = $sitemap;
|
||||
return $tpl -> fetch( 'templates/site-sitemap.php' );
|
||||
}
|
||||
|
||||
public function drawSearchFormFull()
|
||||
{
|
||||
global $config , $lang;
|
||||
|
||||
$articles = '';
|
||||
$message = '';
|
||||
|
||||
if ( !isset( $config['search_limit'] ) )
|
||||
$limit = 10;
|
||||
else
|
||||
$limit = $config['search_limit'];
|
||||
|
||||
if ( \System::formGet( 's_text' ) )
|
||||
\System::setSessionVar( 'search_text' , \System::saveString( \System::formGet( 's_text' ) , true ) );
|
||||
|
||||
$text = \System::getSessionVar( 'search_text' );
|
||||
|
||||
if ( $text && strlen( $text ) >= 3 )
|
||||
{
|
||||
$bs = \System::formGet( 'bs' );
|
||||
$ls = ceil( \article\FArticle::searchArtileByTextCount( $text ) / $limit );
|
||||
|
||||
if ( $bs < 1 )
|
||||
$bs = 1;
|
||||
else if ( $bs > $ls )
|
||||
$bs = $ls;
|
||||
$from = $limit * ( $bs - 1 );
|
||||
if ( $from < 0 )
|
||||
$from = 0;
|
||||
|
||||
$articles = \article\FArticle::searchArtileByText( $text , $from , $limit );
|
||||
}
|
||||
else if ( $text )
|
||||
$message = $lang -> getTrans( 'T_MINIMALNA_ILOSC_ZNAKOW_WYSZUKIWARKA' );
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _text = $text;
|
||||
$tpl -> _articles = $articles;
|
||||
$tpl -> _message = $message;
|
||||
$out = $tpl -> fetch( 'templates/site-search-results.php' );
|
||||
|
||||
if ( isset( $ls ) && $ls > 1 )
|
||||
{
|
||||
$a = \System::getPagingVar( "a" , $bs , $ls );
|
||||
$b = \System::getPagingVar( "b" , $bs , $ls );
|
||||
$link = '[bs],wyszukiwarka';
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _a = $bs-$b;
|
||||
$tpl -> _b = $bs+$a;
|
||||
$tpl -> _ls = $ls;
|
||||
$tpl -> _link = $link;
|
||||
$tpl -> _bs = $bs;
|
||||
$out .= $tpl -> fetch( 'templates/site-paging.php' );
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function drawSearchForm()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
return $tpl -> fetch( 'templates/site-search-form.php' );
|
||||
}
|
||||
|
||||
public function drawChangeLog()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_ZMIANY' ) );
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$out .= $tpl -> fetch( 'templates/change-log.php' );
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function drawNameDay()
|
||||
{
|
||||
global $sys;
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _nameday = $sys -> getNameDay();
|
||||
return $tpl -> fetch( 'templates/site-name-day.php');
|
||||
}
|
||||
|
||||
public function drawClock()
|
||||
{
|
||||
global $sys;
|
||||
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _data = $sys -> getFormatDate();
|
||||
return $tpl -> fetch('templates/site-clock.php');
|
||||
}
|
||||
|
||||
public function drawBanners()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _banners = \System::getBanners();
|
||||
return $tpl -> fetch( 'templates/site-banners.php' );
|
||||
}
|
||||
|
||||
public function drawCopyright()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
return $tpl -> fetch( 'templates/site-copyright.php' );
|
||||
}
|
||||
|
||||
public function drawVisitCounter()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _visit_counter = \System::getSystemSettings('visit_count');
|
||||
return $tpl -> fetch('templates/site-visit-counter.php');
|
||||
}
|
||||
|
||||
public function drawGuestBook()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
return $tpl -> fetch( 'templates/site-guest-book.php' );
|
||||
}
|
||||
|
||||
public function drawContactSite()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _firm_name = \System::getSystemSettings( 'firm_name' );
|
||||
$tpl -> _street = \System::getSystemSettings( 'street' );
|
||||
$tpl -> _city = \System::getSystemSettings( 'city' );
|
||||
$tpl -> _postal_code = \System::getSystemSettings( 'postal_code' );
|
||||
$tpl -> _phone = \System::getSystemSettings( 'phone' );
|
||||
$tpl -> _fax = \System::getSystemSettings( 'fax' );
|
||||
$tpl -> _email = \System::getSystemSettings( 'email' );
|
||||
$tpl -> _nip = \System::getSystemSettings( 'nip' );
|
||||
$tpl -> _contact_form = \System::getSystemSettings( 'contact_form' );
|
||||
return $tpl -> fetch( 'templates/site-contact.php' );
|
||||
}
|
||||
|
||||
public function drawContactMini()
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _firm_name = \System::getSystemSettings( 'firm_name' );
|
||||
$tpl -> _street = \System::getSystemSettings( 'street' );
|
||||
$tpl -> _city = \System::getSystemSettings( 'city' );
|
||||
$tpl -> _postal_code = \System::getSystemSettings( 'postal_code' );
|
||||
$tpl -> _phone = \System::getSystemSettings( 'phone' );
|
||||
$tpl -> _fax = \System::getSystemSettings( 'fax' );
|
||||
$tpl -> _email = \System::getSystemSettings( 'email' );
|
||||
$tpl -> _nip = \System::getSystemSettings( 'nip' );
|
||||
return $tpl -> fetch( 'templates/site-contact-mini.php' );
|
||||
}
|
||||
|
||||
public function drawMiniatureArticles( $articles )
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _articles = $articles;
|
||||
return $tpl -> fetch( 'templates/article-miniature.php' );
|
||||
}
|
||||
|
||||
public function drawEntryArticles( $articles )
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _articles = $articles;
|
||||
return $tpl -> fetch( 'templates/article-entry.php' );
|
||||
}
|
||||
|
||||
public function drawListArticles( $articles )
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _articles = $articles;
|
||||
return $tpl -> fetch( 'templates/article-list.php' );
|
||||
}
|
||||
|
||||
public function drawFullArticles( $articles )
|
||||
{
|
||||
$tpl = new \Savant3;
|
||||
$tpl -> _articles = $articles;
|
||||
return $tpl -> fetch( 'templates/article-full.php' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user