/**
* NXS Smarty - Platforma Internetowa dla dynamicznych stron WWW
* (C) JP Woch jan.woch@eps-interlogic.com | EPS Interlogic
* 2002.02.26
*
* Version: 08.05.17
*/
$GET = array();
print_r($_NXS);
// -- Start sessji
session_start();
$_SMARTY = Array();
$_NXS = Array('LinkType' => 2);
// -- Zmienne sessji szablonu SMARTY
if ($_SESSION['SMARTY']) { $_SMARTY = $_SESSION['SMARTY']; unset($_SESSION['SMARTY']); }
// Utworzenie sciezek do katalogow
define(DIR,getcwd());
// -- Zaladowanie nxsKernel'a
require_once DIR.'/modules/nxsKernel/nxsKernel.class.php';
// -- Utworzenie kernela
$nxsKernel = new nxsKernel();
// -- Zaladowanie biblioteki Smarty
$nxsKernel->LoadLibs("smarty","/libs/smarty/Smarty.class.php");
/**
* CONFIG
*/
if (file_exists("config.php")) {
require("config.php");
if ($nxsCONFIG) { ob_start(); eval ('?>' . $nxsKernel->decrypt($nxsCONFIG)); $config_err = ob_get_contents(); ob_end_clean(); }
// -- W przypadku gdy
if ($nxsCONFIG_BACKUP && $config_err) { ob_start(); eval ('?>' . $nxsKernel->decrypt($nxsCONFIG_BACKUP)); ob_end_clean(); }
elseif ($config_err) $nxsKernel->error("Brak pliku konfiguracyjnego");
} else $nxsKernel->error("Brak pliku konfiguracyjnego");
/************************************************************************************************
*
* 2. Obsługa zmiennych POST / URL / TOKEN
*
************************************************************************************************/
// -- Przepisanie zmiennych POST
if (count($_POST)>0) $POST = $_POST;
// -- Parsowanie URL
$nxsKernel->parseURL();
// -- Obsluga zmiennych TOKEN
if ($GET['token']) { $GET = array_merge($GET,out_token($GET['token'])); unset($GET['token']); }
// -- Includowanie configa
//if (file_exists("autostart.php")) require("autostart.php");
if ($_SESSION['user.login_hash']==md5($_SERVER['REMOTE_ADDR'])) $_SMARTY['NXSAdmin']['Bar'] = 'yes';
// -- Ustawienie def. templatow oraz tryb kompilacji na true
$_NXS['TEMPLATE']->file = 'normal.tpl';
$_NXS['TEMPLATE']->compile = true;
/************************************************************************************************
*
* 3. Content
*
************************************************************************************************/
// Sprawdz mapowanie contentu dla URL'a
if (($idContent = $nxsKernel->checkMappingURL($_NXS['URL'])) || is_numeric($nxsKernel->getURI())) {
if (!$idContent) $idContent = $nxsKernel->getURL();
if (eregi(",",$idContent)) {
$buff = split(",",$idContent);
$nxsKernel->idContent = $buff[0];
$nxsKernel->idMenu = $buff[1];
}
else $nxsKernel->idContent = $idContent;
if ($nxsKernel->idContent) {
$nxsContent = new nxsContent($nxsKernel->idContent);
$nxsContent->RychoSearch();
}
$Obj = $nxsKernel->getContent($nxsKernel->idContent,-1);
$_SMARTY['Content'] = $Obj->Content;
$_SMARTY['Title'] = $Obj->Title;
$_SMARTY['Date'] = $Obj->Date;
$Obj->Description = preg_replace("/({[\/]?[^}]*})/mU","",$Obj->Text);
$_SMARTY['MetaDescription'] = $Obj->Description = mb_substr($Obj->Description,0,160,'UTF-8');
$_SMARTY['MetaKeywords'] = $Obj->Keywords;
if ($_SMARTY['BackLink']) $_SESSION['SMARTY']['BackLink'] = $_SMARTY['BackLink'];
}
else {
// Ustawienie jezyka
if ($GET_EXT[0] == 'en') {
$_SMARTY['Lang'] = $_NXS['Lang'] = 'en';
$_SMARTY['BASEHREF'] = 'http://'.$_SERVER["HTTP_HOST"].'/en/';
}
else {
$_SMARTY['Lang'] = $_NXS['Lang'] = 'pl';
$_SMARTY['BASEHREF'] = 'http://'.$_SERVER["HTTP_HOST"].'/';
}
// Wyszsystko co wypluje include wpierdzielamy do _SMARTY['CONTENT']
ob_start();
if (file_exists($nxsKernel->getURI_FILE())) include($nxsKernel->getURI_FILE());
$_SMARTY['Content'] = ob_get_contents();
ob_end_clean();
}
// -- Includowanie configa
if (file_exists("autostart.php")) require("autostart.php");
/**
* 3. Szablony SMARTY
*
*/
$smarty = new Smarty;
$smarty->template_dir = DIR.'/templates';
$smarty->compile_dir = DIR.'/templates_c';
// Kompilacja szablonow
//$smarty->compile_check = $_NXS['TEMPLATE']->compile;
$smarty->compile_check = true;
$smarty->force_compile = true;
// Rejestracja wszelkich funkcji Smarty
if (file_exists($nxsKernel->registerSmartyFunction())) include($nxsKernel->registerSmartyFunction());
// Rejestracja zmiennych w szablonach
foreach ($_SMARTY as $variable_name => $value) $smarty->assign($variable_name,$value);
//if (!$_NXS['TEMPLATE']->file) $_NXS['TEMPLATE']->file = 'normal.tpl';
// Zlozenie z odpowiednim templatem
ob_start();
$smarty->display($_NXS['TEMPLATE']->file);
$Output = ob_get_contents();
ob_end_clean();
if ($_NXS['HeaderRedirect']) header("Location: ".$_NXS['HeaderRedirect']);
elseif ($GET_EXT[0] == 'pdf') {
require_once('libs/html2pdf/html2fpdf.php');
$pdf = new HTML2FPDF('P','mm','A4');
$pdf->SetDisplayMode(100);
$pdf->SetMargins(10, 10 , 10);
$replace_from = array('—','…','„','”');
$replace_to = array('-','...',',,','\'\'');
$file_content = str_replace($replace_from,$replace_to,$Output);
$file_content = mb_convert_encoding($file_content, 'ISO-8859-2', 'UTF-8');
$file_content = eregi_replace("
","
",$file_content);
$file_content = eregi_replace("><","> <",$file_content);
$file_content = eregi_replace("src=\"\/","src=\"http://".$_NXS['BASEHREF'],$file_content);
$file_content = eregi_replace("src=\"pliki","src=\"http://".$_NXS['BASEHREF']."/pliki",$file_content);
$pdf->AddPage();
$pdf->UseCSS(true);
$pdf->WriteHTML($file_content);
//echo $file_content;
$pdf->Output("milanowek_pl_".date("Y_m_d_H_i").".pdf", "D");
exit(0);
}
else {
// ExFrame::SQLStats();
echo $Output;
}
?>