Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /*--------------------------------------------------------------- eplos CMS - ver..
Decoded Output download
<?php
/*---------------------------------------------------------------
eplos CMS - version 3.02.001
Copyright (c) 2012 by proaction Ltd., All rights reserved!
Last upadated: 2014.10.03 10:55
The entire contents of this file are protected by international
copyright and trademark laws. The owner of the copyrights and
trademarks are proaction Hungaria Ltd. For more information
please visit our web site: http://www.eplos.hu
----------------------------------------------------------------*/
require_once $config['dir']['classes'].'BFL-Portal.php'; require_once $config['dir']['classes'].'BFL-Page.php'; require_once $config['dir']['classes'].'BFL-Picture.php'; require_once $config['dir']['classes'].'BFL-Document.php'; require_once $config['dir']['classes'].'BFL-Parameter.php'; require_once $config['dir']['classes'].'BFL-Template.php'; require_once $config['dir']['classes'].'BFL-LanguageVersion.php'; require_once $config['dir']['classes'].'BFL-RSSChannel.php'; require_once $config['dir']['classes'].'SYS-FTP.php'; class BFLPortalPublicate{ public $portal = false; private $page = false; private $pageId = 0; private $containerPage = false; private $errorMessage = ''; private $ftp = false; private $languageVersion = false; private $arrCMSColours; private $arrProcessedTemplateIds = false; private $eventLog = false; private $arrParseParameters; private $arrPages; private $arrTemplates; private $arrPictures; private $arrDocuments; private $arrLanguageVersions; private $arrPictureExtensions; private $arrHostingInfo; private $arrSQLTables; private $arrElementsCount; private $arrHeadTemplate; private $arrMetaTags; private $arrPagers; private $unresolvedPageReferences; private $editMode; private $disableEditSigns = false; function __construct($a10){ global $config, $session; if ($a10) $this->portal = new BFLPortal((integer)$a10); $this->arrCMSColours = split(',', ','.$config['param']['colours']); $this->arrProcessedTemplateIds = array(); $this->arrPages = array(); $this->arrPagers = array(); $this->arrPictures = array(); $this->arrDocuments = array(); $this->arrPictureExtensions = array(IMAGETYPE_GIF=>".gif", IMAGETYPE_JPEG=>".jpg", IMAGETYPE_PNG=>".png"); $this->arrSQLTables = array(); $this->arrHostingInfo = $this->portal->GetHostingInformation(); $this->arrHeadTemplate = $this->portal->GetHeadTemplate(); $this->arrHostingInfo['hostURL'] = 'http://'.$this->arrHostingInfo['hostURL']; if (substr($this->arrHostingInfo['hostURL'],-1,1)!='/') $this->arrHostingInfo['hostURL'].='/';} function Start(){ global $config, $session; if (!is_object($this->portal) && !$this->portal->GetId()) return false; $this->eventLog = new EventLog('BFLPortalPublicate-Error'); $this->editMode = false; $this->arrElementsCount = array('pages'=>0, 'pictures'=>0); if (!$this->ftp){ $this->ftp = new FTP($this->arrHostingInfo['serverURL']); if ($this->arrHostingInfo['passiveMode']) $this->ftp->passiveMode = true; if ($this->arrHostingInfo['port']) $this->ftp->port = $this->arrHostingInfo['port']; if ($this->ftp->Login($this->arrHostingInfo['login'], $this->arrHostingInfo['password'])){ $this->ftp->SetRootDirectory($this->arrHostingInfo['initialDirectory']); }else{ $this->errorMessage = $this->ftp->GetErrorMessage(); }} if ($this->errorMessage) return false; if ($rsPictures = $this->portal->GetPicturesToDelete()){ $pictureId = 0; foreach ($rsPictures->GetRecords() as $arrP){ if (!$pictureId) $pictureId = $arrP['id']; $picturePath = $this->portal->pictureDirectory.'/'.$arrP['fileName']; $picturePath.= '-'.$arrP['width'].'x'.$arrP['height']; $picturePath.= $this->arrPictureExtensions[$arrP['type']]; $this->ftp->DeleteFile($picturePath); if ($pictureId && ($pictureId!=$arrP['id'])){ $bflPicture = new BFLPicture($pictureId, true); $bflPicture->Delete(); $pictureId = $arrP['id']; }}} if ($this->portal->HasProperty(33)){ $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; $sqlCommand = "
"; $sqlCommand.= "SET NAMES utf8;
"; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, $sqlCommand); fclose($tmpfile); } while ($arrJob = $this->portal->GetNextItemToPublish()){ if ($arrJob['itemType']=='page'){ if ($arrJob['operation']=='remove'){ if ($this->RemovePage($arrJob['itemId'], $arrJob['oldFileName'], $arrJob['sqlTable'])){ $this->portal->ClosePublication($arrJob['id'], $arrJob['itemId']); $this->arrElementsCount['pages']++; } }elseif ($arrJob['operation']=='replace'){ if ($this->PublicatePage($arrJob['itemId'], $arrJob['fileName'], $arrJob['oldFileName'], $arrJob['sqlTable'])){ $this->portal->ClosePublication($arrJob['id'], $arrJob['itemId']); $this->arrElementsCount['pages']++; } }} elseif ($arrJob['itemType']=='rsschannel') { $rssChannel = new BFLRSSChannel((integer)$arrJob['itemId']); $this->PublicateRSSChannel($rssChannel); $this->portal->ClosePublication($arrJob['id'], 0); }} if ($this->portal->HasProperty(33)){ if (isset($this->portal->parameter['sqlRefreshTempDir'])){ $fileName = $this->portal->parameter['sqlRefreshTempDir'].'sqlchanges.sql'; }else{ $fileName = 'php_temp/sqlchanges.sql'; } $this->ftp->DeleteFile($fileName); $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; if (file_exists($tmpfileName)){ if ($this->ftp->UploadFile($tmpfileName, $fileName, FTP_ASCII)){ $result = SYS::URLGet($this->arrHostingInfo['hostURL'].'index.php?refreshsql=1'); if (!preg_match("/succeed/i", $result)){ $result = SYS::URLGet($this->arrHostingInfo['hostURL'].'sqlrefresh'); if (!preg_match("/succeed/i", $result)){ $this->eventLog->WriteEntry('SQL connector request failed ('.$this->arrHostingInfo['hostURL'].'sqlrefresh)'); } } } unlink($tmpfileName); }} $this->ftp->Disconnect(); } function ShowPage($a15, $a29, $a12, $a1=false){ global $session, $config; if (!is_object($this->portal) && !$this->portal->GetId()) return false; $this->editMode = true; $this->disableEditSigns = $a1; $this->page = $a15; if ($a29) $this->containerPage = $a29; else $this->containerPage = $a15; $this->unresolvedPageReferences = array(); $this->arrParseParameters = array( 'portalid'=> $this->portal->GetId(), 'editorsessionid'=> $session->GetId(), 'cmssystemroot'=> $config["url"]["systemRoot"], 'homepageroot'=>$this->arrHostingInfo['hostURL'], 'editmode'=>true, ); $template = $this->GetTemplate($this->page->templateId); $html = $this->ReplaceTemplates($this->page->templateId, $template->GetContent(), array()); $this->CollectPagers($html); $html = preg_replace("/(<%Parameter[^%]*Name=\"url\"[^%]*%>)\?/i", "\1&", $html); $arrHTML = $this->ParseTemplate($html, $this->page, array($this->page), 0, array()); $html = $arrHTML['template']; if (preg_match("/<%htmlHead%>/i", $html, $arrM)){ $htmlHead = $this->ParseHTMLHead(($a12?$a12:$this->page), $html); $htmlHead = "<head>
".$htmlHead."
</head>"; $html = str_replace($arrM[0], $htmlHead, $html); } $documentDirectory = $this->arrHostingInfo['hostURL'].$this->portal->documentUrlDirectory; $html = str_replace("uploads/document.php?id=", "document?id=", $html); if (preg_match_all("/[^\/](document\?id=([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = $arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); }}} elseif (preg_match_all("/[^\/](document\?([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = (integer)$arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); }}} $html = str_replace($this->arrHostingInfo['hostURL'].'picture?id=', 'picture?id=', $html); $html = str_replace($this->arrHostingInfo['hostURL'].'http://', 'http://', $html); if (!preg_match("/<%METATags%>/i", $html)){ $html = preg_replace("/<head>/i", "<head>
<%METATags%>", $html); } if (preg_match("/<%METATags%>/i", $html)){ $arrMETATags = $this->SetMETATags($this->page, $html, ''); $html = preg_replace('/<%METATags%>/i', implode("
", $arrMETATags), $html); } $html = preg_replace_callback("/<%PHP%>(.*)<%ENDPHP%>/si","EvalPHPBuffer",$html); return $html;} function RemovePage($a13, $a25, $a6){ global $config; if ($this->portal->HasProperty(33) && $a6){ if (!isset($this->arrSQLTables[$a6])){ $this->arrSQLTables[$a6] = array( 'name'=>$this->portal->GetDBTableById($a6), 'columns'=>$this->portal->GetDBTableColumns($a6) ); } $sqlCommand= "DELETE FROM `".$this->arrSQLTables[$a6]['name']."` ". "WHERE id='".$a13."';
"; $sqlCommand.= "DELETE FROM `".$this->arrSQLTables[$a6]['name']."_parent` ". "WHERE pageId='".$a13."';
"; $sqlCommand.= "DELETE FROM `".$this->arrSQLTables[$a6]['name']."_tag` ". "WHERE pageId='".$a13."';
"; $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; if (!$tmpfile = fopen($tmpfileName, "a")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, $sqlCommand); fclose($tmpfile); } $fileName = str_replace("/", "-SLASH-", $a25); if ($this->portal->pageDirectory!='') $fileName = $this->portal->pageDirectory.'/'.$fileName; $this->ftp->DeleteFile($fileName); return true;} function CollectPagers($a23){ if (preg_match_all("/<%PAGER ([^%]*)%>/i", $a23, $arrM)){ foreach ($arrM[1] as $params){ $arrData = array('name'=>'', 'limit'=>''); $arrDetails = array('name','limit'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $params, $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $this->arrPagers[$arrData['name']] = array('limit'=>$arrData['limit']); }}} function PublicatePage($a13, $a25, $a17, $a6){ global $config; $this->page = new BFLPage($a13, false); $template = $this->GetTemplate($this->page->templateId); $sqlTable = ($a6?$a6:$template->sqlTable); $sqlCommand = ''; $hasContentSQLField = false; if ($this->page->GetIsBlankPage()) return true; if ($this->portal->HasProperty(33) && $sqlTable){ if (!isset($this->arrSQLTables[$sqlTable])){ $this->arrSQLTables[$sqlTable] = array('name'=>$this->portal->GetDBTableById($sqlTable), 'columns'=>$this->portal->GetDBTableColumns($sqlTable)); if ($this->arrSQLTables[$sqlTable]['name']){ $sqlCommand.= "CREATE TABLE IF NOT EXISTS `".$this->arrSQLTables[$sqlTable]['name']."` ("; foreach ($this->arrSQLTables[$sqlTable]['columns'] as $arrC){ $parameter = $arrC['columnName']; if (preg_match("/^([^(]*)\(([^\)]*)\)$/", $parameter, $arrMatches)){ $parameter = $arrMatches[1]; $parameterExtra = $arrMatches[2]; } if (strtoupper($parameter) == 'CONTENT'){ $sqlCommand.="`content` TEXT NULL, "; $hasContentSQLField = true; } elseif (in_array($arrC['type'], array('id','date'))){ $sqlCommand.="`".$parameter."` INTEGER(11) NULL, "; } elseif ($arrC['type']=='dateintervall'){ $sqlCommand.="`".$parameter."From` INTEGER(11) NULL, "; $sqlCommand.="`".$parameter."To` INTEGER(11) NULL, "; } elseif ($arrC['type']=='mapmarker'){ $sqlCommand.="`".$parameter."Lat` DECIMAL(18,12) NULL, "; $sqlCommand.="`".$parameter."Lon` DECIMAL(18,12) NULL, "; } elseif ($arrC['type'] == 'boolean'){ $sqlCommand.="`".$parameter."` ENUM('0','1') NULL, "; } elseif ($arrC['type'] == 'text'){ $sqlCommand.="`".$parameter."` TEXT NULL, "; } elseif ($arrC['type'] == 'text2'){ $sqlCommand.="`".$parameter."` VARCHAR(500), "; } else{ $sqlCommand.="`".$parameter."` VARCHAR(255) NULL, "; } } $sqlCommand.= "PRIMARY KEY `id` (`id`)"; $sqlCommand.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8;
"; $sqlCommand.= "CREATE TABLE IF NOT EXISTS `".$this->arrSQLTables[$sqlTable]['name']."_parent` ("; $sqlCommand.= "`pageId` int(11) unsigned NOT NULL,"; $sqlCommand.= "`parentPageId` int(11) unsigned NOT NULL,"; $sqlCommand.= "`listType` int(11) unsigned NOT NULL,"; $sqlCommand.= "`listOrder` int(11) unsigned NOT NULL,"; $sqlCommand.= "PRIMARY KEY `id` (`pageId`, `parentPageId`,`listType`),"; $sqlCommand.= "KEY `parentPageId` (`parentPageId`,`listType`),"; $sqlCommand.= "KEY `pageId` (`pageId`),"; $sqlCommand.= "KEY `listOrder` (`listOrder`)"; $sqlCommand.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8;
"; $sqlCommand.= "CREATE TABLE IF NOT EXISTS `".$this->arrSQLTables[$sqlTable]['name']."_tag` ("; $sqlCommand.= "`pageId` int(11) unsigned NOT NULL,"; $sqlCommand.= "`tag` varchar(255) NOT NULL,"; $sqlCommand.= "PRIMARY KEY `id` (`pageId`, `tag`),"; $sqlCommand.= "KEY `tag` (`tag`),"; $sqlCommand.= "KEY `pageId` (`pageId`)"; $sqlCommand.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8;
"; }}} if ($a17 && ($a17!=$a25)){ $fileName = str_replace("/", "-SLASH-", $a17); if ($this->portal->pageDirectory!='') $fileName = $this->portal->pageDirectory.'/'.$fileName.$this->portal->pageExtension; $this->ftp->DeleteFile($fileName); } if ($a25 && $template->GetContent()){ $this->arrParseParameters = array( 'portalid'=> $this->portal->GetId(), 'editmode'=>false, 'homepageroot'=>$this->arrHostingInfo['hostURL'], ); $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_page_'.$a13.'.tmp'; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } $html = $this->ReplaceTemplates($this->page->templateId, $template->GetContent(), array()); $this->CollectPagers($html); $arrHTML = $this->ParseTemplate($html, $this->page, array($this->page), 0, array()); $html = $arrHTML['template']; if (!preg_match("/<%METATags%>/i", $html)){ $html = preg_replace("/<head>/i", "<head>
<%METATags%>", $html); } if (preg_match("/<%METATags%>/i", $html)){ $arrMETATags = $this->SetMETATags($this->page, $html, ''); $html = preg_replace('/<%METATags%>/i', implode("
", $arrMETATags), $html); } if (preg_match("/<%htmlHead%>/i", $html, $arrM)){ $rsParentPages = $this->page->GetSubpageIds(95, 1, 999, 'active', false, false, array(1)); if (!$rsParentPages->GetCount()) $rsParentPages->Add(array('0')); $headCode = '<?php '. 'if (isset($eploscms_parentPages) && is_array($eploscms_parentPages)) array_push($eploscms_parentPages, '.$rsParentPages->Implode().");
". 'else $eploscms_parentPages = array('.$rsParentPages->Implode().");
". '$eploscms_parentPages[] = '.$this->page->GetId().";
". '$eploscms_fileName = "'.$this->page->fileName.'";'. '$eploscms_requestUri = $_SERVER["REQUEST_URI"];'. 'if ($eploscms_baseDir == $eploscms_requestUri) $eploscms_requestUri.= $config["param"]["defaultPage"]; '. 'if (strpos($eploscms_requestUri, "?")) '. '$eploscms_requestUri = substr($eploscms_requestUri,0,strpos($eploscms_requestUri, "?")); '. 'if (!isset($eploscms_useContainer)) $eploscms_useContainer = false; '. '$eploscms_baseDir = str_replace("index.php", "", $_SERVER["SCRIPT_NAME"]); '. 'if ($eploscms_baseDir.$eploscms_fileName != $eploscms_requestUri){'. '$eploscms_subPage = substr($eploscms_requestUri, strlen($eploscms_baseDir.$eploscms_fileName)+1, strlen($eploscms_requestUri)); '. '$eploscms_subPage = str_replace("/","-SLASH-", $eploscms_subPage); '. 'if ($eploscms_subPage) $eploscms_subPage = "php_pages/".$eploscms_subPage; '. '}else{'. '$eploscms_subPage = "";'. '}'. '?>'. '<?php '.' '.'if (!$eploscms_subPage || !$eploscms_fileName){?>'. $this->ParseHTMLHead($this->page, $html). '<?php '.' '.'}else{'.' '. 'if ($eploscms_subPage && file_exists($eploscms_subPage) && !$eploscms_useContainer){'. 'ob_start(); '. 'require($eploscms_subPage); '. '$eploscms_content = ob_get_clean(); '. '}'. '}'. 'echo $eploscms_head; '. '?> '; $html = str_replace($arrM[0], "<head>
".$headCode."
</head>", $html); }elseif ($template->type == 'content'){ $htmlHead = $this->ParseHTMLHead($this->page, $html); $rsParentPages = $this->page->GetSubpageIds(95, 1, 999, 'active', false, false, array(1)); if (!$rsParentPages->GetCount()) $rsParentPages->Add(array('0')); $html = '<?php '. 'if (isset($eploscms_parentPages) && is_array($eploscms_parentPages)) array_push($eploscms_parentPages, '.$rsParentPages->Implode().");
". 'else $eploscms_parentPages = array('.$rsParentPages->Implode().");
". '$eploscms_parentPages[] = '.$this->page->GetId().";
". '$eploscms_head = <<<EPLOSCMS_HEAD'."
". $htmlHead."
". "EPLOSCMS_HEAD;
". "?>
".$html; } if (preg_match_all("/picture\?id=([0-9]*)[^v]*version=([0-9x]*)/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ $pictureId = $arrM[1][$i]; $version = $arrM[2][$i]; if (!isset($this->arrPictures[$pictureId])) $this->arrPictures[$pictureId] = new BFLPicture($pictureId); $picture = $this->arrPictures[$pictureId]; list($picturePath) = $this->GetPicturePath($picture, $version); $html = str_replace($arrM[0][$i], $this->arrHostingInfo['hostURL'].$picturePath, $html); }} $html = str_replace("page.php?id=", "page?id=", $html); $html = str_replace("page.php?pageid=", "page?id=", $html); if ($d = strpos($html, 'page?id=')){ if (preg_match_all("/page\?id=([0-9]+)([a-zA-Z&0-9=;]*)/i", $html, $arrP, PREG_SET_ORDER)){ foreach ($arrP as $arrPD){ $page = $this->GetPage($arrPD[1]); $template = $this->GetTemplate($page->templateId); if ($template->type == 'content'){ if (preg_match("/containerId=([0-9]+)/i", $arrPD[2], $arrC)){ $containerPage = $this->GetPage($arrC[1]); $html = str_replace($arrPD[0], $this->arrHostingInfo['hostURL'].$containerPage->fileName."/".$page->fileName, $html); }else{ $html = str_replace($arrPD[0], $this->arrHostingInfo['hostURL']."<?=\$eploscms_pageName?>/".$page->fileName, $html); } }else{ $html = str_replace($arrPD[0], $this->arrHostingInfo['hostURL'].$page->fileName, $html); } } }} $documentDirectory = $this->arrHostingInfo['hostURL'].$this->portal->documentUrlDirectory; $html = str_replace("uploads/document.php?id=", "document?id=", $html); if (preg_match_all("/[^\/](document\?id=([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = $arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); } }} elseif (preg_match_all("/[^\/](document\?([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = (integer)$arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); } }} $html = str_replace($this->arrHostingInfo['hostURL'].'http://', 'http://', $html); $html = preg_replace("/<%PHP%>/i", "<?php ", $html); $html = preg_replace("/<%ENDPHP%>/i", " ?>", $html); $containerScript = '<?php '. '\$eploscms_fileName = "'.$a25.'"; '. '\$eploscms_requestUri = \$_SERVER["REQUEST_URI"];'. 'if (\$eploscms_baseDir == $eploscms_requestUri) $eploscms_requestUri.= $config["param"]["defaultPage"];'. 'if (strpos(\$eploscms_requestUri,\'?\')) \$eploscms_requestUri = substr(\$eploscms_requestUri,0,strpos(\$eploscms_requestUri, \'?\'));'. 'if (!isset(\$eploscms_useContainer)) $eploscms_useContainer = false; '. '\$eploscms_baseDir = str_replace("index.php", "", \$_SERVER["SCRIPT_NAME"]); '. 'if (\$eploscms_baseDir.\$eploscms_fileName != \$eploscms_requestUri){'. '\$eploscms_subPage = substr(\$eploscms_requestUri, strlen(\$eploscms_baseDir.\$eploscms_fileName)+1, strlen(\$eploscms_requestUri)); '. '\$eploscms_subPage = str_replace("/","-SLASH-", \$eploscms_subPage); '. '\$eploscms_subPage = "php_pages/".\$eploscms_subPage; '. '}else{'. '\$eploscms_subPage = ""; '. '}'. 'if (\$eploscms_subPage && file_exists(\$eploscms_subPage)){'. 'if (!$eploscms_useContainer) echo $eploscms_content; '. '$eploscms_useContainer = true; '. '}else{'. '?> '; $html = preg_replace("/<%CONTAINER%>/i", $containerScript, $html); $html = preg_replace("/<%ENDCONTAINER%>/i", "<?php }?>", $html); $html = str_replace("@NAME","<%newsLetterAddresseeName%>", $html); $html = preg_replace("/href=\"javascript:EplosCMS\_OpenWindow\('([^']*)'[^\)]*\)\"/i", 'href="$1" class="image-pop-up"', $html); fwrite($tmpfile, $html); fclose($tmpfile); $fileName = str_replace("/","-SLASH-",$a25); if ($this->portal->pageDirectory!=''){ if (substr($this->portal->pageDirectory,-1,1)=='/') $this->portal->pageDirectory = substr($this->portal->pageDirectory,0,strlen($this->portal->pageDirectory-2)); $fileName = $this->portal->pageDirectory.'/'.$fileName.$this->portal->pageExtension; } $this->ftp->UploadFile($tmpfileName, $fileName, FTP_ASCII); unlink($tmpfileName); } if ($this->portal->HasProperty(33) && $sqlTable){ if ($a25){ $sqlCommand.= "REPLACE INTO `".$this->arrSQLTables[$sqlTable]['name']."` VALUES ("; $index = 0; foreach ($this->arrSQLTables[$sqlTable]['columns'] as $arrC){ $parameter = $arrC['parameter']; $value = ''; $value2 = ''; $needValue2 = false; if (preg_match("/^([^(]*)\(([^\)]*)\)$/", $arrC['parameter'], $arrMatches)){ $arrC['parameter'] = $arrMatches[1]; $parameter = $arrMatches[1]; $parameterExtra = $arrMatches[2]; } if (strtoupper($arrC['parameter']) == 'CONTENT'){ $value = $this->page->GetContentString($parameterExtra); }else{ $arrParameter = $this->page->GetParameter($parameter, false); if ($arrParameter['type'] == 'picture'){ if ($arrParameter['value']){ if (!isset($this->arrPictures[$arrParameter['value']])) $this->arrPictures[$arrParameter['value']] = new BFLPicture($arrParameter['value']); $picture = $this->arrPictures[$arrParameter['value']]; list($value) = $this->GetPicturePath($picture, $parameterExtra); }else $value = ''; }elseif ($arrC['type'] == 'dateintervall'){ if (strpos($arrParameter['value'], '--')){ list($from, $to) = explode('--', $arrParameter['value']); $to = '-'.$to; }else{ list($from, $to) = explode('-', $arrParameter['value']); } $value = (integer)$from; $value2 = (integer)$to; $needValue2 = true; }elseif ($arrC['type'] == 'mapmarker'){ list ($lat, $lon) = split(',', $arrParameter['value']); $value = ($lat ? $lat: '0'); $value2 = ($lon ? $lon: '0'); $needValue2 = true; }elseif ($arrC['type'] == 'boolean'){ $value = ($arrParameter['value'] ? '1' : '0'); }else{ $value = $arrParameter['value']; } } if ($index) $sqlCommand.= ", "; $index++; $sqlCommand.= "'".$this->escapeSQL($value)."'"; if ($needValue2) $sqlCommand.= ",'".$this->escapeSQL($value2)."'"; } $sqlCommand.= ");
"; if ($rsParentPages = $this->page->GetSubpageIds(96, 1, 99, 'active', false, false, false, false, false)){ $arrParentPages = $rsParentPages->GetRecords(); foreach (array_chunk($arrParentPages,10) as $arrChunkedData){ $sqlCommand.= "REPLACE INTO `".$this->arrSQLTables[$sqlTable]['name']."_parent` "; $sqlCommand.= "(pageId, parentPageId, listType, listOrder) VALUES "; $arrValues = array(); foreach ($arrChunkedData as $arrP){ $arrValues[] = "('".$a13."', '".$arrP['id']."','".$arrP['listType']."','".$arrP['subpageOrder']."')"; } if (count($arrValues)) $sqlCommand.= implode(', ', $arrValues); $sqlCommand.= ";
"; } } if ($rsTags = $this->page->GetTags(false)){ $arrTags = $rsTags->GetRecords(); foreach (array_chunk($arrTags,10) as $arrChunkedData){ $sqlCommand.= "REPLACE INTO `".$this->arrSQLTables[$sqlTable]['name']."_tag` (pageId, tag) VALUES "; $arrValues = array(); $i = 1; foreach ($arrChunkedData as $arrT){ $arrValues[] = "('".$a13."', '".$arrT['name']."')"; } if (count($arrValues)) $sqlCommand.= implode(', ', $arrValues); $sqlCommand.= ";
"; } }} $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; if (!$tmpfile = fopen($tmpfileName, "a")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, $sqlCommand); fclose($tmpfile); } return true;} private function PublicateRSSChannel($a9){ global $config; if (!is_object($this->arrLanguageVersions[$a9->languageId])) $this->arrLanguageVersions[$a9->languageId] = new BFLLanguageVersion($this->portal->GetId(), $a9->languageId); $languageVersion = $this->arrLanguageVersions[$a9->languageId]; if ($a9->type == 'rssfeed') $template = file_get_contents($config['dir']['templates'].'_rssfeed.xml'); elseif ($a9->type == 'googlesitemap') $template = file_get_contents($config['dir']['templates'].'_googlesitemap.xml'); $arrM = explode("<%SEP%>", $template); list ($headTemplate, $itemTemplate, $footerTemplate) = $arrM; $headTemplate = str_replace('<%title%>', str_replace(']]>', ']]>', $a9->title), $headTemplate); $headTemplate = str_replace('<%pictureURL%>', $a9->pictureURL, $headTemplate); $headTemplate = str_replace('<%pictureWidth%>', $a9->pictureWidth, $headTemplate); $headTemplate = str_replace('<%pictureHeight%>', $a9->pictureHeight, $headTemplate); $headTemplate = str_replace('<%pictureTitle%>', strip_tags($a9->pictureTitle), $headTemplate); $headTemplate = str_replace('<%homePageRoot%>', $this->arrHostingInfo['hostURL'], $headTemplate); $headTemplate = str_replace('<%description%>', strip_tags($a9->description), $headTemplate); $headTemplate = str_replace('<%language%>', $languageVersion->GetCode(), $headTemplate); $headTemplate = str_replace('<%fileName%>', $a9->fileName, $headTemplate); $tmpfileName = $config['dir']['temp'].'rss_'.$a9->GetId().'.tmp'; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, trim($headTemplate)."
"); if ($a9->type == 'rssfeed') $limit = 25; elseif ($a9->type == 'googlesitemap') $limit = 9000; $rsPages = $this->portal->GetPagesToRSSChannel($limit, $a9->parentPageIds, $a9->templateIds, $a9->itemTitle, $a9->itemDescription, $a9->itemPubDate, $a9->languageId); foreach ($rsPages->GetRecords() as $arrPage){ if (!$arrPage['title']) continue; if (!($this->arrPages[$arrPage['id']])){ $this->arrPages[$arrPage['id']] = new BFLPage($arrPage['id']); } $url = $this->arrPages[$arrPage['id']]->GetURL(false); if ($url=='') continue; $url = $this->arrHostingInfo['hostURL'].$url; $item = $itemTemplate; $item = str_replace('<%itemTitle%>', str_replace(']]>', ']]>', $arrPage['title']), $item); $item = str_replace('<%itemLink%>', $url, $item); $item = str_replace('<%itemPubDate%>', date("D, d M Y H:i:s O", $arrPage['pubDate']), $item); $item = str_replace('<%itemPubDate2%>', date("Y-m-d\TH:iP", $arrPage['pubDate']), $item); $item = str_replace('<%itemDescription%>', str_replace(']]>', ']]>', str_replace("
", "", $arrPage['description'])), $item); fwrite($tmpfile, trim($item)."
"); } fwrite($tmpfile, trim($footerTemplate)."
"); fclose($tmpfile); $this->ftp->ChangeRootDirectory(); $this->ftp->UploadFile($tmpfileName, $a9->fileName, FTP_ASCII); unlink($tmpfileName); } private function GetTemplate($a22, $a19=''){ if (!$a22 && !$a19) return false; $template = new BFLTemplate($a22); if (!$a22){ $template->portalId = $this->portal->GetId(); $template->name = $a19; $template->Load(); } $this->arrTemplates[$template->GetId()] = $template; $this->arrTemplates[$template->name] = $template; return $template;} private function GetPage($a22){ $pageId = (integer)$a22; if (isset($this->arrPages[$pageId])){ return $this->arrPages[$pageId]; }else{ return new BFLPage($pageId); }} private function GetPageIdByReference($a8, $a21){ $pageId = $this->portal->GetPageIdByReference($a8, $a21); if (!$pageId){ $this->unresolvedPageReferences[] = $a8; } return $pageId;} private function ReplaceTemplates($a3, $a4, $a31){ global $session, $config; if (in_array($a3, $a31)) return "***RECURSION LIMIT EXCEEDED***"; $a4 = preg_replace("/<link ([^>]*)href=([\"'])/i","<link $1href=$2<%homePageRoot%>",$a4); $a4 = preg_replace("/src=([\"'])/i","src=$1<%homePageRoot%>",$a4); $a4 = preg_replace("/background[ ]*=[ ]*([\"'])/i","background=$1",$a4); $a4 = preg_replace("/background\-image[\ ]*:[\ ]*url\(/i","background-image:url(<%homePageRoot%>",$a4); $a4 = preg_replace("/param name=[\"']movie[\"'] value=([\"'])/i","param name=\"movie\" value=$1",$a4); $a4 = str_replace("<%homePageRoot%><%homePageRoot%>","<%homePageRoot%>",$a4); $a4 = str_replace("<%homePageRoot%><%Parameter","<%Parameter",$a4); $a4 = str_replace("<%homePageRoot%>http://","http://",$a4); $a4 = str_replace("<%homePageRoot%>/"."/","/"."/",$a4); $a4 = str_replace("<%homePageRoot%>javascript:","javascript:",$a4); $a4 = str_replace("<%homePageRoot%>mailto:","mailto:",$a4); $a4 = str_replace("<%homePageRoot%>#","#",$a4); $arrInvalidTags = array('<%eplosEditPanel%>', '<%SearchAbleArea%>','<%EndSearchAbleArea%>', '<%PageListAdd[^%]*%>', '<%PictureListAdd[^%]*%>', '<%homePageURL%>'); foreach ($arrInvalidTags as $tag) $a4 = preg_replace('/'.$tag.'/i', '', $a4); $a31[] = $a3; $a4 = preg_replace("/<%INCLUDE[\ ]+([^%]+)%>/i", "<%TEMPLATE $1%>", $a4); while(preg_match("/<%COMPONENT[\ ]+([^%]+)%>/i",$a4,$arrM)){ $componentName = ''; $templateId = ''; $templateName = ''; if (preg_match("/NAME=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $componentName = $arrM2[1]; if (preg_match("/TEMPLATEID=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateId = $arrM2[1]; if (preg_match("/TEMPLATENAME=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateName = $arrM2[1]; $template = $this->GetTemplate($templateId, ($templateName?$templateName:$componentName)); $templateId = $template->GetId(); $pageId = $this->portal->GetComponentPageId($templateId, $this->page->languageId); if (!$pageId && $templateId && $session->user){ $newPage = new BFLPage(); $newPage->name = $template->description.' (COMPONENT-'.$this->page->languageId.')'; $newPage->templateId = $templateId; $newPage->portalId = $this->page->portalId; $newPage->languageId = $this->page->languageId; $newPage->Save($session->user); $pageId = $newPage->GetId(); $this->arrPages[$pageId] = $newPage; } if (!$this->editMode && $pageId){ $page = $this->GetPage($pageId); $extension = strtolower(trim(substr($page->fileName, strrpos($page->fileName, '.'), 4))); $replace = '<?php include("'.str_replace("/","-SLASH-", $page->fileName.$this->portal->pageExtension).'");?>'; }else{ $page = $this->GetPage($pageId); $replace = $this->ReplaceTemplates($template->GetId(), $template->GetContent(), $a31); $arrHTML = $this->ParseTemplate($replace, $page, array($page), 0, array()); $replace = $arrHTML['template']; } $a4 = str_replace($arrM[0], $replace, $a4); } if ($this->editMode && preg_match("/<\?/", $a4)){ $a4 = str_replace("
", "<%EOL%>", $a4); $a4 = preg_replace('/<\?.*?(\?>|$)/', '', $a4); $a4 = str_replace("<%EOL%>", "
", $a4); } while(preg_match("/<%TEMPLATE[\ ]+([^%]+)%>/i",$a4,$arrM)){ $hasTemplate = true; $pageIdPM = 0; $templateName = ''; $templateId = 0; if (preg_match("/NAME=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateName = $arrM2[1]; if (preg_match("/ID=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateId = (integer)$arrM2[1]; if (preg_match("/PAGEIDINPUBLICMODE=\"([0-9]+)\"/i", $arrM[1], $arrM2)) $pageIdPM = (integer)$arrM2[1]; elseif (preg_match("/PAGEIDINPUBLICMODE=\"([0-9,]+)\"/i", $arrM[1], $arrM2)){ $arrPageIds = explode(',', str_replace(' ', '',$arrM2[1])); $pageIdPM = (integer)$arrPageIds[$this->page->languageId-1]; } if (!$this->editMode && $pageIdPM){ $page = $this->GetPage($pageIdPM); $extension = strtolower(trim(substr($page->fileName, strrpos($page->fileName, '.'), 4))); if ($extension == 'html') $replace = '<?php readfile("'.$page->fileName.'");?>'; else $replace = '<?php include("'.str_replace("/","-SLASH-", $page->fileName.$this->portal->pageExtension).'");?>'; }else{ $template = $this->GetTemplate($templateId, $templateName); if (!$template){ $this->eventLog->WriteEntry('Nem hatrozhat meg a sablon! db='.$config['db']['database'].', portalId='.$this->portal->GetId().', pageId='.$this->page->GetId().', templateId='.$templateId.', templateName='.$templateName); } if ($config['param']['cacheTemplate'] && $this->editMode && ($pageIdPM || $template->GetCacheAble())){ $cacheFileName = $config['dir']['templateCache'].$session->GetDatabase().'-'.$this->portal->GetId().'-' .($pageIdPM?$pageIdPM:$this->page->GetId()).'-T'.$template->GetId().'.html'; if (file_exists($cacheFileName) && ($this->portal->GetLastChangesTime() < filectime($cacheFileName) )){ $replace = file_get_contents($cacheFileName); }else{ $replace = $this->ReplaceTemplates($template->GetId(), $template->GetContent(), $a31); if ($pageIdPM) $page = $this->GetPage($pageIdPM); else $page = $this->page; $arrHTML = $this->ParseTemplate($replace, $page, array($page), 0, array()); if ($fp = fopen($cacheFileName, 'w')){ fputs($fp, $arrHTML['template']); fclose($fp); } } }else{ $replace = $this->ReplaceTemplates($template->GetId(), $template->GetContent(), $a31, $pageIdPM); }} $a4 = str_replace($arrM[0], $replace."
", $a4); } array_pop($a31); return trim($a4);} private function ParsePageListItems($a7, $a28, $a36, $a35, $a26, $a34, $a5=1, $a20=999){ $cnt = $a7->GetCount(); $html = ''; $arrHTML = array(); if (!$cnt) return false; $arrParameters = array('pageindex'=>1, 'firstitem'=>1); $half = ceil($cnt/2)+1; $index = 1; foreach ($a7->GetRecords() as $arrId){ if ($index < $a5){ $index++; continue; } if ($index >= $a5+$a20) break; $page = $this->GetPage($arrId[0]); if ($page->GetIsContainerContent()) $arrParameters['containerpageid'] = $a28; else $arrParameters['containerpageid'] = 0; if (in_array($arrId[0], $a36)) $arrParameters['activeitem'] = true; else $arrParameters['activeitem'] = false; if ($arrParameters['pageindex'] == $cnt) $arrParameters['lastitem'] = 1; if ($arrParameters['pageindex']%2==1){ $arrParameters['odditem'] = 1; $arrParameters['evenitem'] = 0; }else{ $arrParameters['odditem'] = 0; $arrParameters['evenitem'] = 1; } for ($i=2;$i<=5;$i++) $arrParameters['pageindexmod'.$i] = (($arrParameters['pageindex']%$i)==0); $arrParameters['half'] = ($half == $arrParameters['pageindex']); if ($this->editMode) $arrParameters['activeMenuSelector'] = ''; else $arrParameters['activeMenuSelector'] = '<?php if (in_array("'.$arrId[0].'", $eploscms_parentPages)) echo "active-menu";?>'; $arrHTML = $this->ParseTemplate($a35['template'], $page, $a34, $a26, $arrParameters); $html.= $arrHTML['template']; $arrParameters['pageindex']++; $arrParameters['firstitem']=0; $index++; } unset($a7); return $html;} function ParseTemplate($a4, $a18, $a34, $a26, $a33){ global $session, $config; if ($a18->GetContentType() == 'page'){ $a34[] = $a18; } $arrPageIds = array(); foreach ($a34 as $arrP) $arrPageIds[] = $arrP->GetId(); foreach ($this->arrParseParameters as $name=>$value) $a4 = preg_replace("/<%".$name."%>/i", $value, $a4); foreach ($a33 as $name=>$value) $a4 = preg_replace("/<%".$name."%>/i", $value, $a4); $arrTemplate = array(); $arrPageListData = false; $arrPictureListData = false; $arrDocumentListData = false; foreach(explode("
",$a4) as $row){ if ($arrPageListData){ if (trim(strtoupper($row)) == '<%ENDPAGELIST%>'){ if ($pageListCounter==1){ $arrPages = $a34; $object = $this->LoadRelatedPage($arrPageListData, $a34, $a18, true); if (!$arrPageListData['type']) $arrPageListData['type'] = 1; if (!$arrPageListData['start']) $arrPageListData['start'] = 1; if (!$arrPageListData['limit']) $arrPageListData['limit'] = 999; if ($arrPageListData['pager']){ if ($this->arrPagers[$arrPageListData['pager']]){ $arrPageListData['limit'] = $this->arrPagers[$arrPageListData['pager']]['limit']; } if ($this->editMode){ $pagerIndex = max(1, (integer)$_REQUEST[$arrPageListData['pager']]); $arrPageListData['start'] = ($pagerIndex-1) * $arrPageListData['limit'] + 1; }else{ $containerPageId = 0; for ($i=count($a34)-1;$i>=0;$i--){ if (!$a34[$i]->GetIsContainerContent()){ $containerPageId = $a34[$i]->GetId(); break; } } $rsIds = $object->GetSubpageIds($arrPageListData['type'], 1, 999, 'active', $arrPageListData['reverse'], split(',', str_replace("[^0-9,]","", $arrPageListData['templateids'])), split(',', str_replace("[^0-9,]","", $arrPageListData['types'])), $arrPageListData['filter'], false, $arrPageListData['orderby']); $cnt = $rsIds->GetCount(); $pagerSize = ceil($cnt / $arrPageListData['limit']); for ($pagerI=1; $pagerI<=$pagerSize; $pagerI++){ $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_'.$this->portal->GetId().'_pager_'.$pagerI.'.tmp'; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } $html = $this->ParsePageListItems($rsIds, $containerPageId, $arrPageIds, $arrPageListData, $a26, $arrPages, ($pagerI-1)*$arrPageListData['limit']+1, $arrPageListData['limit']); fwrite($tmpfile, $html); fclose($tmpfile); $fileName = sprintf('_pager_%08d_%02d',$object->GetId(), $pagerI); if ($this->portal->pageDirectory!=''){ if (substr($this->portal->pageDirectory,-1,1)=='/') $this->portal->pageDirectory = substr($this->portal->pageDirectory,0,strlen($this->portal->pageDirectory-2)); $fileName = $this->portal->pageDirectory.'/'.$fileName; } $this->ftp->UploadFile($tmpfileName, $fileName, FTP_ASCII); unlink($tmpfileName); } $php = file_get_contents($config['dir']['templates'].'_pager_replace.php'); $php = str_replace("<%name%>", $arrPageListData['pager'], $php); $php = str_replace("<%pageId%>", $object->GetId(), $php); $arrTemplate[] = $php; } } if ($this->editMode || !$arrPageListData['pager']){ $rsIds = $object->GetSubpageIds($arrPageListData['type'], $arrPageListData['start'], $arrPageListData['limit'], 'active', $arrPageListData['reverse'], split(',', str_replace("[^0-9,]","", $arrPageListData['templateids'])), split(',', str_replace("[^0-9,]","", $arrPageListData['types'])), $arrPageListData['filter'], $this->editMode, $arrPageListData['orderby']); $containerPageId = 0; for ($i=count($a34)-1;$i>=0;$i--){ if (!$a34[$i]->GetIsContainerContent()){ $containerPageId = $a34[$i]->GetId(); break; } } if ($a35['pageid']!=='0') $arrPages[] = $object; if (!$html = $this->ParsePageListItems($rsIds, $containerPageId, $arrPageIds, $arrPageListData, $a26, $arrPages)){ $arrPageListData = false; $pageListCounter = 0; continue; } $arrTemplate[] = $html; } $arrPageListData = false; continue; }else{ $pageListCounter--; } } if ((trim(strtoupper($row))=='<%PAGELIST%>') || preg_match("/<%PAGELIST ([^>]*)%>/i", $row)){ $pageListCounter++; } $arrPageListData['template'].= $row."
"; continue; } if ($arrPictureListData){ if (trim(strtoupper($row)) == '<%ENDPICTURELIST%>'){ $page = $this->LoadRelatedPage($arrPictureListData, $a34, $a18, true); if (!$arrPictureListData['type']) $arrPictureListData['type'] = 1; if (!$arrPictureListData['start']) $arrPictureListData['start'] = 1; if (!$arrPictureListData['limit']) $arrPictureListData['limit'] = 999; if ($rsIds = $page->GetPictureIds($arrPictureListData['type'], $arrPictureListData['start'], $arrPictureListData['limit'], $arrPictureListData['reverse'], 'active', $this->editMode)){ $cnt = $rsIds->GetCount(); if (!$cnt){ $arrPictureListData = false; $pageListCounter = 0; continue; } $arrParameters = array('pictureindex'=>1, 'firstitem'=>1); $half = ceil($cnt/2)+1; foreach ($rsIds->GetRecords() as $arrId){ if (!isset($this->arrPictures[$arrId[0]])) $this->arrPictures[$arrId[0]] = new BFLPicture($arrId[0]); $picture = $this->arrPictures[$arrId[0]]; if ($arrParameters['pictureindex'] == $cnt) $arrParameters['lastitem'] = 1; if ($arrParameters['pictureindex']%2==1){ $arrParameters['odditem'] = 1; $arrParameters['evenitem'] = 0; }else{ $arrParameters['odditem'] = 0; $arrParameters['evenitem'] = 1; } for ($i=2;$i<=5;$i++) $arrParameters['pictureindexmod'.$i] = (($arrParameters['pictureindex']%$i)==0); $arrParameters['half'] = ($half == $arrParameters['pictureindex']); $arrHTML = $this->ParseTemplate($arrPictureListData['template'], $picture, $a34, $a26, $arrParameters); $template = $arrHTML['template']; $arrTemplate[] = $template; $arrParameters['pictureindex']++; $arrParameters['firstitem']=0; } } $arrPictureListData = false; continue; } $arrPictureListData['template'].= $row."
"; continue; } if ($arrDocumentListData){ if (trim(strtoupper($row)) == '<%ENDDOCUMENTLIST%>'){ $page = $this->LoadRelatedPage($arrDocumentListData, $a34, $a18, true); if (!$arrDocumentListData['type']) $arrDocumentListData['type'] = 1; if (!$arrDocumentListData['start']) $arrDocumentListData['start'] = 1; if (!$arrDocumentListData['limit']) $arrDocumentListData['limit'] = 999; if ($rsIds = $page->GetDocumentIds($arrDocumentListData['type'], $arrDocumentListData['start'], $arrDocumentListData['limit'], $arrDocumentListData['reverse'], 'active', $this->editMode)){ $cnt = $rsIds->GetCount(); if (!$cnt){ $arrDocumentListData = false; $pageListCounter = 0; continue; } $arrParameters = array('pageindex'=>1, 'firstitem'=>1); $half = ceil($cnt/2)+1; foreach ($rsIds->GetRecords() as $arrId){ $document = new BFLDocument($arrId[0]); if ($arrParameters['pageindex'] == $cnt) $arrParameters['lastitem'] = 1; if ($arrParameters['pageindex']%2==1){ $arrParameters['odditem'] = 1; $arrParameters['evenitem'] = 0; }else{ $arrParameters['odditem'] = 0; $arrParameters['evenitem'] = 1; } for ($i=2;$i<=5;$i++) $arrParameters['pageindexmod'.$i] = (($arrParameters['pageindex']%$i)==0); $arrParameters['half'] = ($half == $arrParameters['pageindex']); $arrHTML = $this->ParseTemplate($arrDocumentListData['template'], $document, $a34, $a26, $arrParameters); $template = $arrHTML['template']; $arrTemplate[] = $template; $arrParameters['pageindex']++; $arrParameters['firstitem']=0; } } $arrDocumentListData = false; continue; } $arrDocumentListData['template'].= $row."
"; continue; } if (trim(strtoupper($row)) == '<%ENDIF%>'){ if ($a26>0) $a26--; continue; } if (preg_match("/<%IF([A-Z]*)([^>]*)%>/i", $row, $arrM)){ if ($a26>0){ $a26++; continue; } $arrCondition = array('operation'=>'', 'ignoreineditmode'=>'yes'); $arrDetails = array('name','id','value','ignoreineditmode','pageid','type','version', 'templateids','types','field', 'fatherid','page'); if ($arrM[1]){ $arrM[1] = strtolower(trim($arrM[1])); if (substr($arrM[1],0,3) == 'not'){ $arrCondition['negation'] = true; $arrCondition['operation'] = trim(substr($arrM[1],3,strlen($arrM[1]))); }else{ $arrCondition['negation'] = false; $arrCondition['operation'] = trim($arrM[1]); } $row = str_replace($arrM[1], '', $row); } $details = trim($arrM[2]); if ($arrCondition['types']) $arrCondition['types'] = split(', ', preg_replace("/[^0-9,]/", "", $arrCondition['types'])); if ($arrCondition['templateids']) $arrCondition['templateids'] = split(', ', preg_replace("/[^0-9,]/", "", $arrCondition['templateids'])); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[2], $arrM2)){ $arrCondition[strtolower(trim($d))] = strtolower($arrM2[1]); $details = str_replace($arrM2[0], '', $details); } } $arrCondition['details'] = strtolower($details); if (in_array($arrCondition['name'], array('language'))) $arrCondition['ignoreineditmode'] = 'no'; if (in_array($arrCondition['details'], array('editmode','lastitem','firstitem','odditem', 'evenitem','pageindex','pageindexmod2', 'pageindexmod3','pageindexmod4','pageindexmod5', 'half','parentpage','related','activeitem',))) $arrCondition['ignoreineditmode'] = 'no'; if (in_array($arrCondition['operation'], array('parentpage','related','forefather'))) $arrCondition['ignoreineditmode'] = 'no'; if ($arrCondition['fatherid']) $arrCondition['pageid'] = $arrCondition['fatherid']; if ($this->editMode && ($arrCondition['ignoreineditmode']!='no')) continue; $value = ''; $page = $this->LoadRelatedPage($arrCondition, $a34, $a18, false); if (!isset($this->arrPages[$arrCondition['pageid']])) $this->arrPages[$arrCondition['pageid']] = $page; if ($arrCondition['operation']=='parameter') { if ($arrCondition['name']){ $arrParameter = $page->GetParameter($arrCondition['name'], $this->editMode); if (($arrParameter['type']=='image') && ($arrCondition['field'])){ if (!isset($this->arrPictures[$arrParameter['value']])) $this->arrPictures[$arrParameter['value']] = new BFLPicture($arrParameter['value']); $picture = $this->arrPictures[$arrParameter['value']]; $arrParameter = $picture->GetParameter($arrCondition['field'], $arrCondition['version']); } elseif (($arrParameter['type']=='document') && ($arrCondition['field'])){ $document = new BFLDocument(); $arrParameter = $document->GetParameter($arrCondition['field'], $arrCondition['version']); } elseif (($arrParameter['type']=='multiparam') && $arrCondition['field']){ foreach(explode("
", $arrParameter['value']) as $nameValuePair){ $arrT = explode("=", $nameValuePair, 2); if ($arrT[0] == $arrCondition['field']){ $arrParameter['value'] = $arrT[1]; break; } } } $value = $arrParameter['value']; } } elseif ($arrCondition['operation']=='pagelist') { if (!$arrCondition['type']) $arrCondition['type'] = 1; $value = ($page->CheckPageListExists($arrCondition['type'], $arrCondition['templateids'], $arrCondition['types'], $this->editMode) > 0); } elseif ($arrCondition['operation']=='picturelist') { if (!$arrCondition['type']) $arrCondition['type'] = 1; $value = ($page->CheckPictureListExists($arrCondition['type'], $this->editMode) > 0); } elseif ($arrCondition['operation']=='documentlist') { if (!$arrCondition['type']) $arrCondition['type'] = 1; $value = ($page->CheckDocumentListExists($arrCondition['type'], $this->editMode) > 0); } elseif ($arrCondition['operation']=='forefather') { if ($a18->GetContentType() == 'page'){ if ($a18->GetId() == $arrCondition['pageid']) $value = true; else $value = $a18->CheckPageIsForfather($arrCondition['pageid'], $this->editMode, $arrCondition['types']); } } elseif ($arrCondition['operation']=='related') { if ($a18->GetContentType() == 'page') $value = $a18->CheckPageIsRelated($page->GetId(), $this->editMode); } elseif ($arrCondition['details']=='parentpage'){ if ($a18->GetContentType() == 'page') $value = $a34[0]->CheckPageIsForfather($a18->GetId(), $this->editMode, $arrCondition['types']); } elseif (in_array($arrCondition['details'], array_keys($this->arrParseParameters))){ $value = $this->arrParseParameters[$arrCondition['details']]; } elseif (in_array($arrCondition['details'], array_keys($a33))){ $value = $a33[$arrCondition['details']]; } $condition = (($arrCondition['value'] && ($arrCondition['value']==$value)) || (!$arrCondition['value'] && $value)); if ($arrCondition['negation'] && $condition) $a26++; if (!$arrCondition['negation'] && !$condition) $a26++; continue; } if ($a26>0) continue; while (preg_match("/<%PAGER([^>]*)%>/i", $row, $arrM)){ $arrData = array('type'=>1, 'name'=>'p', 'classname'=>'pager', 'labelnext'=>'', 'labelprev'=>'', 'hash'=>''); $arrDetails = array('type','pageid','classname','limit','name','hash','labelnext','labelprev'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $object = $this->LoadRelatedPage($arrData, $a34, $a18, true); $php = file_get_contents($config['dir']['templates'].'_pager_ol.php'); $cnt = $object->CheckPageListExists($arrData['type'], '', '', $this->editMode); $php = str_replace('<%cnt%>', $cnt, $php); $php = str_replace('<%pageid%>', $object->GetId(), $php); foreach ($arrData as $key=>$value){ $php = str_replace('<%'.$key.'%>', $value, $php); } if ($this->editMode){ $requestUri = $_SERVER['REQUEST_URI']; $requestUri = preg_replace("/&".$arrData['name']."=[0-9]*/", "", $requestUri); if ($arrData['hash'] && ($arrData['hash'][0]!='#')){ $arrData['hash'] = '#'.$arrData['hash']; } $php = str_replace('<%hash%>', $arrData['hash'], $php); $php = str_replace('<%url%>', $requestUri.'&', $php); ob_start(); eval($php); $result = ob_get_contents(); ob_end_clean(); $row = str_replace($arrM[0], $result, $row); }else{ $php = str_replace('<%url%>', $object->GetURL().'?', $php); $row = str_replace($arrM[0], '<?php '.$php.'?>', $row); }} while (preg_match("/<%PAGELISTCOUNT([^>]*)%>/i", $row, $arrM)){ $arrData = array('type'=>1); $arrDetails = array('type','pageid','page'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $object = $this->LoadRelatedPage($arrData, $a34, $a18, true); $value = $object->CheckPageListExists($arrData['type'], '', '', $this->editMode); $row = str_replace($arrM[0], (integer)$value, $row); } while (preg_match("/<%PAGELISTEDIT([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>'edit'); $arrDetails = array('type','pageid','templateids','withbox','listparameters', 'language', 'editparameters', 'format','convert','style','portalid', 'page', 'listwintitle','editwintitle','addwintitle', 'title'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $page = $this->LoadRelatedPage($arrData, $a34, $a18, true); $arrData['pageid'] = $page->GetId(); $html = '<span class="eploscms list'.($arrData['widthbox']?' witbox':'').'" data-operation="pagelist_'.$arrData['operation'].'"'; if ($arrData['type']) $html.=' data-type="'.$arrData['type'].'"'; if ($arrData['pageid']) $html.=' data-pageid="'.$arrData['pageid'].'"'; if ($arrData['portalid']) $html.=' data-portalid="'.$arrData['portalid'].'"'; if ($arrData['language']) $html.=' data-language="'.$arrData['language'].'"'; else $html.=' data-language="'.$page->languageId.'"'; if ($arrData['templateids']) $html.=' data-templateids="'.$arrData['templateids'].'"'; if ($arrData['parameters']) $html.=' data-parameters="'.$arrData['parameters'].'"'; if ($arrData['listparameters']) $html.=' data-listparameters="'.$arrData['listparameters'].'"'; if ($arrData['editparameters']) $html.=' data-editparameters="'.$arrData['editparameters'].'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['listwintitle']) $html.= ' data-listwintitle="'.$arrData['listwintitle'].'" '; if ($arrData['addwintitle']) $html.= ' data-addwintitle="'.$arrData['addwintitle'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } while (preg_match("/<%DOCUMENTLISTEDIT([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>'edit'); $arrDetails = array('type','pageid','title','withbox','parameters', 'format', 'convert', 'style','portalid','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $page = $this->LoadRelatedPage($arrData, $a34, $a18, true); $arrData['pageid'] = $page->GetId(); if ($arrData['portalid']) $html.=' data-portalid="'.$arrData['portalid'].'"'; $html = '<span class="eploscms list'.($arrData['withbox']?' witbox':'').'" data-operation="documentlist_'.$arrData['operation'].'"'; if ($arrData['type']) $html.=' data-type="'.$arrData['type'].'"'; if ($arrData['pageid']) $html.=' data-pageid="'.$arrData['pageid'].'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } while (preg_match("/<%PICTURELISTEDIT([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>'edit'); $arrDetails = array('type','pageid','title','withbox','parameters', 'format', 'convert', 'style', 'portalid','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $page = $this->LoadRelatedPage($arrData, $a34, $a18, true); $arrData['pageid'] = $page->GetId(); if ($arrData['portalid']) $html.=' data-portalid="'.$arrData['portalid'].'"'; $html = '<span class="eploscms list'.($arrData['withbox']?' witbox':'').'" data-operation="picturelist_'.$arrData['operation'].'"'; if ($arrData['type']) $html.=' data-type="'.$arrData['type'].'"'; if ($arrData['pageid']) $html.=' data-pageid="'.$arrData['pageid'].'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } while (preg_match("/<%PARAMETEREDIT[ ]+([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>strtolower(trim($arrM[1]))); $arrDetails = array('pageid','title','withbox','name', 'id', 'format', 'field', 'pictureversion', 'defaultpictureversion', 'picturealign', 'defaultpicturealign', 'style','convert','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; $arrM[1] = str_replace($arrM2[0], '', $arrM[1]); } } if (!$arrData['name'] && $arrData['id']) $arrData['name'] = $arrData['id']; $page = $this->LoadRelatedPage($arrData, $a34, $a18, false); if (strpos($arrData['name'], ',')) $arrData['type'] = 'multiparam'; else{ $arrParameter = $page->GetParameter($arrData['name'], $this->editMode); $arrData['type'] = $arrParameter['type']; } $html = '<span class="eploscms edit'.($arrData['withbox']?' witbox':'').'"'; $html.= ' data-operation="parameter_edit"'; $html.= ' data-type="'.$arrData['type'].'"'; if ($arrData['name']) $html.=' data-name="'.$arrData['name'].'"'; elseif ($arrData['id']) $html.=' data-id="'.$arrData['id'].'"'; if ($arrData['field']) $html.=' data-field="'.$arrData['field'].'"'; $html.=' data-pageid="'.$page->GetId().'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; if ($arrData['defaultpictureversion']) $html.= ' data-defpicvers="'.$arrData['defaultpictureversion'].'" '; if ($arrData['pictureversion']) $html.= ' data-defpicvers="'.$arrData['pictureversion'].'" '; if ($arrData['defaultpicturealign']) $html.= ' data-defpicalign="'.$arrData['defaultpicturealign'].'" '; if ($arrData['picturealign']) $html.= ' data-defpicalign="'.$arrData['picturealign'].'" '; if ($arrData['type']=='text') $html.= ' data-styleformats="'.str_replace("
", ',', $this->portal->textEditorStyles).'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } if ((trim(strtoupper($row)) == '<%PAGELIST%>') || preg_match("/<%PAGELIST ([^>]*)%>/i", $row, $arrM)){ $pageListCounter = 1; $arrPageListData = array('type'=>1); $arrDetails = array('type','pageid','start','limit','reverse','types','templateids', 'orderby','filter', 'portalid', 'pager','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrPageListData[strtolower(trim($d))] = $arrM2[1]; } } continue; } if ((trim(strtoupper($row)) == '<%PICTURELIST%>') || preg_match("/<%PICTURELIST ([^>]*)%>/i", $row, $arrM)){ $pageListCounter = 1; $arrPictureListData = array('type'=>1); $arrDetails = array('type','pageid','page','start','limit','reverse','portalid'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrPictureListData[strtolower(trim($d))] = strtolower($arrM2[1]); } } continue; } if ((trim(strtoupper($row)) == '<%DOCUMENTLIST%>') || preg_match("/<%DOCUMENTLIST ([^>]*)%>/i", $row, $arrM)){ $pageListCounter = 1; $arrDocumentListData = array('type'=>1); $arrDetails = array('type','pageid','page','start','limit','reverse','portalid'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrDocumentListData[strtolower(trim($d))] = strtolower($arrM2[1]); } } continue; } while (preg_match("/<%PARAMETER[ ]+([^>]*)%>/i", $row, $arrM)){ $arrData = array('name'=>''); $arrDetails = array('htmlobjectid','name', 'convert','maxchar','maxlength','field', 'containerpageid','pageid','version','id','showpicturealts','tagseparator', 'tagformat','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ if ($d!='convert') $arrM2[1] = strtolower($arrM2[1]); $arrData[strtolower(trim($d))] = $arrM2[1]; $arrM[1] = str_replace($arrM2[0], '', $arrM[1]); } } if (!$arrData['name'] && $arrData['id']) $arrData['name'] = $arrData['id']; if (!$arrData['maxlength'] && $arrData['maxchar']) $arrData['maxlength'] = $arrData['maxchar']; if (($arrData['containerpageid']=='current') && $this->containerPage) $arrData['containerpageid'] = $this->containerPage->GetId(); elseif ($arrData['containerpageid']=='parent'){ $arrData['containerpageid'] = $a34[count($a34)-2]->GetId(); } elseif ($arrData['containerpageid']=='auto') $arrData['containerpageid'] = (integer)$a33['containerpageid']; $element = $this->LoadRelatedPage($arrData, $a34, $a18, false); if ($element->GetContentType() == 'page'){ if (!$element->GetIsContainerContent()) $arrData['containerpageid'] = 0; if ($arrData['name']){ if ($arrData['name'] == '*'){ $arrParameter['value'] = $element->GetParameters(); } elseif ($arrData['name'] == 'url'){ if ($this->editMode){ $arrParameter = array('value'=>'page?id='.$element->GetId()); if (isset($arrData['containerpageid'])) $arrParameter['value'].= '&containerId='.$arrData['containerpageid']; if ($session) $arrParameter['value'].= '&sessionId='.$session->GetId(); }else{ if (isset($arrData['containerpageid']) && $arrData['containerpageid']){ if ($arrData['containerpageid']=='current'){ $arrParameter = $element->GetParameter($arrData['name'], false); if ($arrData['convert']=='phpstring') $arrParameter['value'] = '".$eploscms_pageName."/'.$arrParameter['value']; else $arrParameter['value'] = '<?=$eploscms_pageName?>/'.$arrParameter['value']; }else{ if (!isset($this->arrPages[$arrData['containerpageid']])) $this->arrPages[$arrData['containerpageid']] = new BFLPage($arrData['containerpageid']); $containerPage = $this->arrPages[$arrData['containerpageid']]; $arrParameter = $element->GetParameter($arrData['name'], false); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$containerPage->fileName.'/'.$arrParameter['value']; } }else{ $arrParameter = $element->GetParameter($arrData['name'], false); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$arrParameter['value']; } } }else{ $arrParameter = $element->GetParameter($arrData['name'], $this->editMode); if (($arrParameter['type']=='enum') && ($arrData['field']=='text')){ foreach (explode("
", $arrParameter['format']) as $tRow){ list ($tValue, $tName) = explode('=', $tRow); if ($tValue==$arrParameter['value']){ $arrParameter['value'] = $tName; break; } } } if ($this->editMode && strpos($arrParameter["value"], 'page?id=')){ if (preg_match_all("/page\?id=([0-9]+)([a-zA-Z&0-9=;]*)/i", $arrParameter["value"], $arrP, PREG_SET_ORDER)){ foreach ($arrP as $arrPD){ if (preg_match("/containerId=[0-9]+/i", $arrPD[2])) continue; $page = $this->GetPage($arrPD[1]); $template = $this->GetPage($page->templateId); if ($template->type == 'content'){ $arrParameter["value"] = str_replace($arrPD[0], 'page?id='.$arrPD[1].'&containerId='.$this->containerPage->GetId(), $arrParameter["value"]); } } } } } } if (($arrParameter['type']=='picture') && ($arrData['field'])){ $arrParameter = $element->GetParameter($arrData['name'], false); if (!isset($this->arrPictures[$arrParameter['value']])) $this->arrPictures[$arrParameter['value']] = new BFLPicture($arrParameter['value']); $picture = $this->arrPictures[$arrParameter['value']]; if ($arrData['field'] == 'url'){ if ($this->editMode){ $arrParameter = array('value'=>'picture?id='.$picture->GetId().'&version='.$arrData['version']); }else{ $arrParameter = $picture->GetParameter($arrData['field'], $arrData['version'], false); list($arrParameter['value']) = $this->GetPicturePath($picture, $arrData['version']); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$arrParameter['value']; } } elseif ($arrData['field']=='width'){ list ($picturePath, $width, $height) = $this->GetPicturePath($picture, $arrData['version']); $arrParameter['value'] = $width; } elseif ($arrData['field']=='height'){ list ($picturePath, $width, $height) = $this->GetPicturePath($picture, $arrData['version']); $arrParameter['value'] = $height; } elseif ($arrData['field']=='alt'){ $arrParameter = $picture->GetParameter('alt'.$this->page->languageId, $arrData['version'], $this->editMode); } else $arrParameter = $picture->GetParameter($arrData['field'], $arrData['version'], $this->editMode); } elseif (($arrParameter['type']=='document') && $arrData['field']){ $document = new BFLDocument((integer)$arrParameter['value']); if ($arrData['field'] == 'filename'){ $arrParameter['value'] = basename($document->fileName); }elseif ($arrData['field'] == 'url'){ $arrParameter['value'] = $this->arrHostingInfo['hostURL']. $this->portal->documentUrlDirectory.'/'.$document->fileName; } } elseif ($arrParameter['type']=='tags'){ if (!empty($arrParameter['format'])){ foreach (explode("
", $arrParameter['format']) as $p){ $arrT = explode("=", $p); $arrParameter[strtolower(trim($arrT[0]))] = trim($arrT[1]); } } if ($arrData['tagseparator']) $separator = html_entity_decode($arrData['tagseparator']); else $separator = ','; if ($arrData['tagformat']) $format = html_entity_decode($arrData['tagformat']); else $format = '@name'; $arrParameter['value'] = ''; if ($rsTags = $element->GetTags(true, $arrParameter['rangeid'])){ foreach ($rsTags->GetRecords() as $arrT){ $html = str_replace('@name', $arrT['name'], str_replace('@id', $arrT['id'], $format)); if ($arrParameter['value']) $arrParameter['value'].=$separator; $arrParameter['value'].= $html; } } } elseif (($arrParameter['type']=='email') && ($arrData['htmlobjectid'])){ if ($arrParameter['value']){ if (preg_match("/^([^@]*)@(.*)\.([0-9a-z]{2,4})$/", strtolower(trim($arrParameter['value'])), $arrE)){ $html = '<script type="text/javascript">'; $html.= 'v = "'.$arrE[3].';'.$arrE[1].';'.$arrE[2].'";'; $html.= 'a = v.split(";");'; $html.= 'v = a[1]+"@"+a[2]+"."+a[0];'; $html.= 'i = document.getElementById("'.$arrData['htmlobjectid'].'");'; $html.= 'i.href = "ma"+"il"+"to"+":"+v;'; $html.= 'if (i.innerHTML=="") i.innerHTML = v;'; $html.= '</script>'; $arrParameter['value'] = $html; } } } elseif ($arrParameter['type']=='dateintervall'){ if (substr($arrData['convert'],0,5)=="date:") $dateFormat = trim(substr($arrData['convert'],5,10)); if (strpos($arrParameter['value'], '--')){ list ($from, $to) = split("--", $arrParameter['value']); if ($to) $to*= -1; }else{ list ($from, $to) = split("-", $arrParameter['value']); } $arrParameter['value'] = ''; if ($arrData['field'] == 'from'){ if ($dateFormat) $arrParameter['value'] = date($dateFormat, $from); else $arrParameter['value'] = $from; }elseif ($arrData['field'] == 'to'){ if ($dateFormat) $arrParameter['value'] = date($dateFormat, ($to?$to:$from)); else $arrParameter['value'] = ($to?$to:$from); }else{ if ($from){ if ($dateFormat) $arrParameter['value'] = date($dateFormat, $from); else $arrParameter['value'] = $from; } if ($to){ if ($dateFormat) $arrParameter['value'].= ' - '.date($dateFormat, $to); else $arrParameter['value'].= ' - '.$to; } } } elseif ($arrParameter['type']=='mapmarker'){ $lat = 0; $lon = 0; if (strpos($arrParameter['value'], ',')){ list ($lat, $lon) = split(",", $arrParameter['value']); } if ($arrData['field'] == 'lat') $arrParameter['value'] = (float)$lat; elseif ($arrData['field'] == 'lon') $arrParameter['value'] = (float)$lon; } elseif (($arrParameter['type']=='multiparam') && $arrData['field']){ foreach(explode("
", $arrParameter['value']) as $nameValuePair){ $arrT = explode("=", $nameValuePair, 2); if ($arrT[0] == $arrData['field']){ $arrParameter['value'] = $arrT[1]; break; } } } } elseif ($element->GetContentType() == 'picture') { if (($arrData['field'] == 'url')){ if ($this->editMode) $arrParameter = array('value'=>'picture?id='.$element->GetId().'&version='.$arrData['version']); else{ list ($picturePath) = $this->GetPicturePath($element, $arrData['version']); $arrParameter = array('value'=>$picturePath); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$arrParameter['value']; } } elseif ($arrData['field']=='width'){ list ($picturePath, $width, $height) = $this->GetPicturePath($element, $arrData['version']); $arrParameter['value'] = $width; } elseif ($arrData['field']=='height'){ list ($picturePath, $width, $height) = $this->GetPicturePath($element, $arrData['version']); $arrParameter['value'] = $height; } elseif ($arrData['field']=='alt'){ $arrParameter = $element->GetParameter('alt'.$this->page->languageId, $arrData['version'], $this->editMode); } else $arrParameter = $element->GetParameter($arrData['field'], $arrData['version'], $this->editMode); } elseif ($element->GetContentType() == 'document') { if (($arrData['field'] == 'url') && $this->editMode) $arrParameter = array('value'=>'document?id='.$element->GetId()); else $arrParameter = $element->GetParameter($arrData['field'], $this->editMode); } $value = $arrParameter['value']; if ($arrData['showpicturealts']=='yes'){ if (preg_match_all("/<img ([^>]*)>/i", $value, $arrSPM, PREG_PATTERN_ORDER)){ for ($i=0; $i<count($arrSPM[0]); $i++){ if (preg_match("/style=\"([^\"]*)\"/i", $arrSPM[1][$i], $arrSPM2)) $style = trim($arrSPM2[1]); if (preg_match("/alt=\"([^\"]*)\"/i", $arrSPM[1][$i], $arrSPM2)) $alt = trim($arrSPM2[1]); if (preg_match("/src=\"picture\?[^\"]*version=([0-9]*)[^\"]*\"/i", $arrSPM[1][$i], $arrSPM2)) $width = trim($arrSPM2[1]); if ($alt && $width){ $picture = str_replace($style, '', $arrSPM[0][$i]); $pichtml = '<div class="picturecont" style="'.$style.';width:'.$width.'px">'.$picture.'<span>'.$alt.'</span></div>'; }else $pichtml = $arrSPM[0][$i]; $value = str_replace($arrSPM[0][$i], $pichtml, $value); } } } if ($arrData['maxlength']) $value = str_replace('"', '"', SYS::crop($value, $arrData['maxlength'])); if ((substr($arrData['convert'],0,5)=="date:") && ($arrParameter['type']!='dateintervall')){ if ($value) $value = date(trim(substr($arrData['convert'],5,10)), (integer)$value); }else $arrData['convert'] = strtolower($arrData['convert']); if ($arrData['convert']=='https') $value=str_replace("http:","https:",$value); elseif ($arrData['convert']=='addslashes') $value=str_replace("
","\n",addslashes($value)); elseif ($arrData['convert']=='addslashes2') $value=str_replace("
","\n",str_replace('"', '\"', $value)); elseif ($arrData['convert']=='phpstring'){ $value=str_replace('\".$eploscms_pageName.\"', '".$eploscms_pageName."', str_replace("
","\n",str_replace('"', '\"', $value))); $value=str_replace('<?=$eploscms_pageName?>', '$eploscms_pageName', $value); } elseif ($arrData['convert']=='urlencode') $value=urlencode($value); elseif ($arrData['convert']=='html') $value=htmlspecialchars($value); elseif ($arrData['convert']=='base64') $value=base64_encode($value); elseif ($arrData['convert']=='md5') $value=md5($value); elseif ($arrData['convert']=='nl2br') $value=nl2br($value); elseif ($arrData['convert']=='upper') $value=strtoupper($value); elseif ($arrData['convert']=='lower') $value=strtolower($value); elseif ($arrData['convert']=='striptags') $value=str_replace("
"," ",addslashes(strip_tags($value))); elseif ($arrData['convert']=='number') $value=ereg_replace("[^0-9]","",$value); elseif (($arrData['convert']=='value') && $arrParameter['format']){ $arrValues = explode("
",$arrParameter['format']); foreach ($arrValues as $v){ list ($vId, $vValue) = explode("=", $v); if ($vId == $value){ $value = $vValue; } } } elseif ($arrData['convert']=='url'){ $prefix = strtolower(substr($arrParameter['value'],0,7)); if (($prefix!='http://') && ($prefix!='https:/')) $value = 'http://'.$value; } elseif (is_array($value) && ($arrData['convert']=='phparray')){ $phpArray = "array("; $isFirstParameter = true; foreach ($value as $name=>$v){ if (!$isFirstParameter) $phpArray.= ', '; $phpArray.= '"'.$name.'"=>"'.str_replace('"', '\"', $v['value']).'"'; $isFirstParameter = false; } $phpArray.=")"; $value = $phpArray; } elseif ($arrData['convert']=='xml'){ $d=explode("
",$value); $value=""; foreach($d as $v){ $d2=explode("=",$v); $d2[1]=trim(substr($v,strlen($d2[0])+1)); $prefix=$suffix=""; if(strpos($d2[1],"<")."x"!="x"){ $prefix="<![CDATA["; $suffix="]]>"; } if($d2[0]) $value.="<".$d2[0].">".$prefix.$d2[1].$suffix."</".$d2[0].">
"; } } $row = str_replace($arrM[0], $value, $row); } $arrTemplate[] = $row; } array_pop($a31); return array('template'=>implode("
", $arrTemplate));} private function LoadRelatedPage($a37, $a34, $a18, $a16){ if (isset($a37['page'])){ $a37['pageid'] = $a37['page']; } if ($a37['pageid']=='current'){ $page = $a34[0]; } elseif ($a37['pageid']=='parent'){ $page = $a34[count($a34)-2]; } elseif ($a37['pageid']==='0'){ $page = $this->portal; } elseif (preg_match("/^[0-9]+$/", $a37['pageid'])){ $page = $this->GetPage($a37['pageid']); } elseif ($a37['pageid']){ $lastPage = $a34[count($a34)-1]; $arrParameters = $lastPage->GetParameter($a37['pageid'], $this->editMode); if ($arrParameters['value']){ $page = $this->GetPage($arrParameters['value']); }else{ $pageid = $this->GetPageIdByReference($arrData['pageid'], $a18->language); $page = $this->GetPage($pageid); }} elseif (!$a16 && $a18){ $page = $a18; } elseif ($a18 && $a16 && ($a18->GetContentType() == 'page')){ $page = $a18; } else $page = $a34[count($a34)-1]; return $page;} private function GetPicturePath($a11, $a2){ if (in_array($a2, array(1,2,3,4))) $a2 = $this->portal->pictureSizes[(integer)$a2-1]; list ($width, $height) = split('x', $a2); $arrPData = $a11->GetPicture($width, $height); $picturePath = $this->portal->pictureDirectory; $picturePath.= '/'.$a11->fileName; $picturePath.= '-'.$arrPData['width'].'x'.$arrPData['height']; $picturePath.= $this->arrPictureExtensions[$arrPData['type']]; if ($arrPData['toPublicate'] && !$this->editMode){ if ($this->portal->watermarkPictureSize){ list ($wtWidth, $wtHeight) = split('x', $this->portal->watermarkPictureSize); if (($wtWidth<=$width) && ($wtHeight<=$height)){ $watermarkPath = $this->portal->GetWaterMarkPath(); if (!class_exists('SYSPicture')) include('SYS-Picture.php'); $tmpFilePath = SYSPicture::AddWatermarkToPicture($watermarkPath, $this->portal->watermarkPosition, $arrPData); }} if ($tmpFilePath && file_exists($tmpFilePath)){ $result = $this->ftp->UploadFile($tmpFilePath, $picturePath, FTP_BINARY); unlink($tmpFilePath); unset($tmpFilePath); }elseif (file_exists($arrPData["filePath"])){ $result = $this->ftp->UploadFile($arrPData["filePath"], $picturePath, FTP_BINARY); } if ($result) $a11->SetVersionPublicated($arrPData['width'], $arrPData['height']); $this->arrElementsCount['pictures']++; } $picturePath = str_replace("public/", "", $picturePath); return array($picturePath, $arrPData['width'], $arrPData['height']);} private function ParseHTMLHead($a15, $a14){ $headContent = $this->arrHeadTemplate['content']; $headContent = preg_replace("/<link ([^>]*)href=([\"'])/i","<link $1href=$2<%homePageRoot%>",$headContent); $headContent = preg_replace("/src=([\"'])/i","src=$1<%homePageRoot%>",$headContent); $headContent = str_replace("<%homePageRoot%><%Parameter","<%Parameter",$headContent); $headContent = str_replace("<%homePageRoot%><%homePageRoot%>","<%homePageRoot%>",$headContent); $headContent = str_replace("<%homePageRoot%>http://","http://",$headContent); $arrHTML = $this->ParseTemplate($headContent, $a15, array($a15), 0, array()); $headContent = $arrHTML['template']; $arrMetaTags = $this->SetMETATags($a15, $a14, $headContent); $headContent = implode("
", $arrMetaTags)."
".$headContent; return " ".trim($headContent);} private function SetMETATags($a15, $a27, $a24){ if ($a24=='') $a24 = $a27; $pageId = $a15->GetId(); if ($this->arrMetaTags[$pageId]) return $this->arrMetaTags[$pageId]; $arrValues = $a15->GetMetaData($this->editMode); $title = trim($arrValues['title']); if (!$title){ $arrParam = $a15->GetParameter('name'); $title = trim($arrParam['value']); }else{ $a24 = preg_replace("/<title>[^<]*<\/title>/i", "", $a24); } $description = SYS::crop(trim($arrValues['description']), 300); if (!$description){ foreach (explode(',', $this->portal->leadParameterNames) as $name){ $arrParam = $a15->GetParameter(trim($name)); if ($arrParam['value']){ $description = SYS::crop(trim($arrParam['value']), 300); break; }}} $description = trim(preg_replace("/[
]/", " ", $description)); $this->arrMetaTags[$pageId] = array(); if (!preg_match("/<meta charset/i", $a24)){ $this->arrMetaTags[$pageId][] = '<meta charset="'.$this->portal->charCode.'" />'; } if (!preg_match("/<title>/i", $a24)){ $this->arrMetaTags[$pageId][] = '<title>'.$title.'</title>'; } if (!preg_match("/<meta name=\"description\"/i", $a24)){ $this->arrMetaTags[$pageId][] = '<meta name="description" content="'.str_replace('"', '\"', trim($description)).'" />'; } $this->arrMetaTags[$pageId][] = '<meta name="distribution" content="local" />'; if (!$this->editMode){ $arrGlobalKeywords = explode(',',trim($this->portal->GetKeywords($a15->languageId))); $arrCustomedKeywords = explode(',', $arrValues['keywords']); $arrValidGlobalKeywords = array(); $arrChars = array('.', '_', '/', '_', '(', ')'); $content = strip_tags($a27); for ($i=0;$i<count($arrGlobalKeywords);$i++){ $keyword = trim($arrGlobalKeywords[$i]); if (!$keyword) continue; $keyword = str_replace('"', '\"', $keyword); foreach ($arrChars as $char) $keyword = str_replace($char, "\".$char, $keyword); if (preg_match("/[^a-z]".$keyword."[^a-z]/i", $content)) $arrValidGlobalKeywords[] = str_replace('"', '\"',trim($arrGlobalKeywords[$i])); } if (count($arrCustomedKeywords)){ for ($i=0;$i<count($arrCustomedKeywords);$i++){ $keyword = trim($arrCustomedKeywords[$i]); if ($keyword) $arrCustomedKeywords[$i] = str_replace('"', '\"', $keyword); } $arrKeywords = array_merge($arrCustomedKeywords, $arrValidGlobalKeywords); }else{ $arrKeywords = $arrValidGlobalKeywords; } if (!$arrKeywords[0]) unset($arrKeywords[0]); $arrKeywords = array_chunk($arrKeywords, 20); $arrKeywords = $arrKeywords[0]; if (!preg_match("/<meta name=\"keywords\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta name="keywords" content="'.implode(", ", $arrKeywords).'" />'; if (!preg_match("/<meta name=\"author\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta name="author" content="proaction Kft." />'; if (!preg_match("/<meta name=\"copyright\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta name="copyright" content="All rights reserved" />'; $this->arrMetaTags[$pageId][] = '<meta name="generator" content="Eplos CMS 3.0" />'; $this->arrMetaTags[$pageId][] = '<meta name="robots" content="index, follow" />'; if (!$this->portal->HasProperty(35)){ $this->arrMetaTags[$pageId][] = '<base href="'.$this->arrHostingInfo['hostURL'].'" />'; if (!preg_match("/<meta itemprop=\"name\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta itemprop="name" content="'.str_replace('"', '\"', $title).'" />'; if (!preg_match("/<meta itemprop=\"description\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta itemprop="description" content="'.str_replace('"', '\"', trim($description)).'" />'; if (!preg_match("/<meta property=\"og:title\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta property="og:title" content="'.str_replace('"', '\"', $title).'" />'; if (!preg_match("/<meta property=\"og:image\"/i", $a24)) if ($pictureId = $a15->GetOnePicture()){ if (!isset($this->arrPictures[$pictureId])) $this->arrPictures[$pictureId] = new BFLPicture($pictureId); $picture = $this->arrPictures[$pictureId]; list($picturePath) = $this->GetPicturePath($picture, "600x200"); if ($picturePath){ $this->arrMetaTags[$pageId][] = '<meta property="og:image" content="'.$this->arrHostingInfo['hostURL'].$picturePath.'" />'; } } }} return $this->arrMetaTags[$pageId];} private function escapeSQL($a30){ return str_replace(array('\', "", "
", "
", "'", ""), array('\\', '\0', '\n', '\r', "\'", '\Z'), $a30);} function GetElementsCount(){return $this->arrElementsCount;}function GetErrorMessage(){return $this->errorMessage;}function GetHostingInfo(){return $this->arrHostingInfo;}function GetUnresolvedPageReferences(){return $this->unresolvedPageReferences;}} function EvalPHPBuffer($a32) {if (!trim($a32[1])) return ''; ob_start(); eval($a32[1]); $result = ob_get_contents(); ob_end_clean(); return $result; }
?>
Did this file decode correctly?
Original Code
<?php
/*---------------------------------------------------------------
eplos CMS - version 3.02.001
Copyright (c) 2012 by proaction Ltd., All rights reserved!
Last upadated: 2014.10.03 10:55
The entire contents of this file are protected by international
copyright and trademark laws. The owner of the copyrights and
trademarks are proaction Hungaria Ltd. For more information
please visit our web site: http://www.eplos.hu
----------------------------------------------------------------*/
require_once $config['dir']['classes'].'BFL-Portal.php'; require_once $config['dir']['classes'].'BFL-Page.php'; require_once $config['dir']['classes'].'BFL-Picture.php'; require_once $config['dir']['classes'].'BFL-Document.php'; require_once $config['dir']['classes'].'BFL-Parameter.php'; require_once $config['dir']['classes'].'BFL-Template.php'; require_once $config['dir']['classes'].'BFL-LanguageVersion.php'; require_once $config['dir']['classes'].'BFL-RSSChannel.php'; require_once $config['dir']['classes'].'SYS-FTP.php'; class BFLPortalPublicate{ public $portal = false; private $page = false; private $pageId = 0; private $containerPage = false; private $errorMessage = ''; private $ftp = false; private $languageVersion = false; private $arrCMSColours; private $arrProcessedTemplateIds = false; private $eventLog = false; private $arrParseParameters; private $arrPages; private $arrTemplates; private $arrPictures; private $arrDocuments; private $arrLanguageVersions; private $arrPictureExtensions; private $arrHostingInfo; private $arrSQLTables; private $arrElementsCount; private $arrHeadTemplate; private $arrMetaTags; private $arrPagers; private $unresolvedPageReferences; private $editMode; private $disableEditSigns = false; function __construct($a10){ global $config, $session; if ($a10) $this->portal = new BFLPortal((integer)$a10); $this->arrCMSColours = split(',', ','.$config['param']['colours']); $this->arrProcessedTemplateIds = array(); $this->arrPages = array(); $this->arrPagers = array(); $this->arrPictures = array(); $this->arrDocuments = array(); $this->arrPictureExtensions = array(IMAGETYPE_GIF=>".gif", IMAGETYPE_JPEG=>".jpg", IMAGETYPE_PNG=>".png"); $this->arrSQLTables = array(); $this->arrHostingInfo = $this->portal->GetHostingInformation(); $this->arrHeadTemplate = $this->portal->GetHeadTemplate(); $this->arrHostingInfo['hostURL'] = 'http://'.$this->arrHostingInfo['hostURL']; if (substr($this->arrHostingInfo['hostURL'],-1,1)!='/') $this->arrHostingInfo['hostURL'].='/';} function Start(){ global $config, $session; if (!is_object($this->portal) && !$this->portal->GetId()) return false; $this->eventLog = new EventLog('BFLPortalPublicate-Error'); $this->editMode = false; $this->arrElementsCount = array('pages'=>0, 'pictures'=>0); if (!$this->ftp){ $this->ftp = new FTP($this->arrHostingInfo['serverURL']); if ($this->arrHostingInfo['passiveMode']) $this->ftp->passiveMode = true; if ($this->arrHostingInfo['port']) $this->ftp->port = $this->arrHostingInfo['port']; if ($this->ftp->Login($this->arrHostingInfo['login'], $this->arrHostingInfo['password'])){ $this->ftp->SetRootDirectory($this->arrHostingInfo['initialDirectory']); }else{ $this->errorMessage = $this->ftp->GetErrorMessage(); }} if ($this->errorMessage) return false; if ($rsPictures = $this->portal->GetPicturesToDelete()){ $pictureId = 0; foreach ($rsPictures->GetRecords() as $arrP){ if (!$pictureId) $pictureId = $arrP['id']; $picturePath = $this->portal->pictureDirectory.'/'.$arrP['fileName']; $picturePath.= '-'.$arrP['width'].'x'.$arrP['height']; $picturePath.= $this->arrPictureExtensions[$arrP['type']]; $this->ftp->DeleteFile($picturePath); if ($pictureId && ($pictureId!=$arrP['id'])){ $bflPicture = new BFLPicture($pictureId, true); $bflPicture->Delete(); $pictureId = $arrP['id']; }}} if ($this->portal->HasProperty(33)){ $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; $sqlCommand = "\n"; $sqlCommand.= "SET NAMES utf8;\n"; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, $sqlCommand); fclose($tmpfile); } while ($arrJob = $this->portal->GetNextItemToPublish()){ if ($arrJob['itemType']=='page'){ if ($arrJob['operation']=='remove'){ if ($this->RemovePage($arrJob['itemId'], $arrJob['oldFileName'], $arrJob['sqlTable'])){ $this->portal->ClosePublication($arrJob['id'], $arrJob['itemId']); $this->arrElementsCount['pages']++; } }elseif ($arrJob['operation']=='replace'){ if ($this->PublicatePage($arrJob['itemId'], $arrJob['fileName'], $arrJob['oldFileName'], $arrJob['sqlTable'])){ $this->portal->ClosePublication($arrJob['id'], $arrJob['itemId']); $this->arrElementsCount['pages']++; } }} elseif ($arrJob['itemType']=='rsschannel') { $rssChannel = new BFLRSSChannel((integer)$arrJob['itemId']); $this->PublicateRSSChannel($rssChannel); $this->portal->ClosePublication($arrJob['id'], 0); }} if ($this->portal->HasProperty(33)){ if (isset($this->portal->parameter['sqlRefreshTempDir'])){ $fileName = $this->portal->parameter['sqlRefreshTempDir'].'sqlchanges.sql'; }else{ $fileName = 'php_temp/sqlchanges.sql'; } $this->ftp->DeleteFile($fileName); $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; if (file_exists($tmpfileName)){ if ($this->ftp->UploadFile($tmpfileName, $fileName, FTP_ASCII)){ $result = SYS::URLGet($this->arrHostingInfo['hostURL'].'index.php?refreshsql=1'); if (!preg_match("/succeed/i", $result)){ $result = SYS::URLGet($this->arrHostingInfo['hostURL'].'sqlrefresh'); if (!preg_match("/succeed/i", $result)){ $this->eventLog->WriteEntry('SQL connector request failed ('.$this->arrHostingInfo['hostURL'].'sqlrefresh)'); } } } unlink($tmpfileName); }} $this->ftp->Disconnect(); } function ShowPage($a15, $a29, $a12, $a1=false){ global $session, $config; if (!is_object($this->portal) && !$this->portal->GetId()) return false; $this->editMode = true; $this->disableEditSigns = $a1; $this->page = $a15; if ($a29) $this->containerPage = $a29; else $this->containerPage = $a15; $this->unresolvedPageReferences = array(); $this->arrParseParameters = array( 'portalid'=> $this->portal->GetId(), 'editorsessionid'=> $session->GetId(), 'cmssystemroot'=> $config["url"]["systemRoot"], 'homepageroot'=>$this->arrHostingInfo['hostURL'], 'editmode'=>true, ); $template = $this->GetTemplate($this->page->templateId); $html = $this->ReplaceTemplates($this->page->templateId, $template->GetContent(), array()); $this->CollectPagers($html); $html = preg_replace("/(<%Parameter[^%]*Name=\"url\"[^%]*%>)\?/i", "\\1&", $html); $arrHTML = $this->ParseTemplate($html, $this->page, array($this->page), 0, array()); $html = $arrHTML['template']; if (preg_match("/<%htmlHead%>/i", $html, $arrM)){ $htmlHead = $this->ParseHTMLHead(($a12?$a12:$this->page), $html); $htmlHead = "<head>\n".$htmlHead."\n</head>"; $html = str_replace($arrM[0], $htmlHead, $html); } $documentDirectory = $this->arrHostingInfo['hostURL'].$this->portal->documentUrlDirectory; $html = str_replace("uploads/document.php?id=", "document?id=", $html); if (preg_match_all("/[^\/](document\?id=([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = $arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); }}} elseif (preg_match_all("/[^\/](document\?([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = (integer)$arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); }}} $html = str_replace($this->arrHostingInfo['hostURL'].'picture?id=', 'picture?id=', $html); $html = str_replace($this->arrHostingInfo['hostURL'].'http://', 'http://', $html); if (!preg_match("/<%METATags%>/i", $html)){ $html = preg_replace("/<head>/i", "<head>\n<%METATags%>", $html); } if (preg_match("/<%METATags%>/i", $html)){ $arrMETATags = $this->SetMETATags($this->page, $html, ''); $html = preg_replace('/<%METATags%>/i', implode("\n", $arrMETATags), $html); } $html = preg_replace_callback("/<%PHP%>(.*)<%ENDPHP%>/si","EvalPHPBuffer",$html); return $html;} function RemovePage($a13, $a25, $a6){ global $config; if ($this->portal->HasProperty(33) && $a6){ if (!isset($this->arrSQLTables[$a6])){ $this->arrSQLTables[$a6] = array( 'name'=>$this->portal->GetDBTableById($a6), 'columns'=>$this->portal->GetDBTableColumns($a6) ); } $sqlCommand= "DELETE FROM `".$this->arrSQLTables[$a6]['name']."` ". "WHERE id='".$a13."';\n"; $sqlCommand.= "DELETE FROM `".$this->arrSQLTables[$a6]['name']."_parent` ". "WHERE pageId='".$a13."';\n"; $sqlCommand.= "DELETE FROM `".$this->arrSQLTables[$a6]['name']."_tag` ". "WHERE pageId='".$a13."';\n"; $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; if (!$tmpfile = fopen($tmpfileName, "a")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, $sqlCommand); fclose($tmpfile); } $fileName = str_replace("/", "-SLASH-", $a25); if ($this->portal->pageDirectory!='') $fileName = $this->portal->pageDirectory.'/'.$fileName; $this->ftp->DeleteFile($fileName); return true;} function CollectPagers($a23){ if (preg_match_all("/<%PAGER ([^%]*)%>/i", $a23, $arrM)){ foreach ($arrM[1] as $params){ $arrData = array('name'=>'', 'limit'=>''); $arrDetails = array('name','limit'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $params, $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $this->arrPagers[$arrData['name']] = array('limit'=>$arrData['limit']); }}} function PublicatePage($a13, $a25, $a17, $a6){ global $config; $this->page = new BFLPage($a13, false); $template = $this->GetTemplate($this->page->templateId); $sqlTable = ($a6?$a6:$template->sqlTable); $sqlCommand = ''; $hasContentSQLField = false; if ($this->page->GetIsBlankPage()) return true; if ($this->portal->HasProperty(33) && $sqlTable){ if (!isset($this->arrSQLTables[$sqlTable])){ $this->arrSQLTables[$sqlTable] = array('name'=>$this->portal->GetDBTableById($sqlTable), 'columns'=>$this->portal->GetDBTableColumns($sqlTable)); if ($this->arrSQLTables[$sqlTable]['name']){ $sqlCommand.= "CREATE TABLE IF NOT EXISTS `".$this->arrSQLTables[$sqlTable]['name']."` ("; foreach ($this->arrSQLTables[$sqlTable]['columns'] as $arrC){ $parameter = $arrC['columnName']; if (preg_match("/^([^(]*)\(([^\)]*)\)$/", $parameter, $arrMatches)){ $parameter = $arrMatches[1]; $parameterExtra = $arrMatches[2]; } if (strtoupper($parameter) == 'CONTENT'){ $sqlCommand.="`content` TEXT NULL, "; $hasContentSQLField = true; } elseif (in_array($arrC['type'], array('id','date'))){ $sqlCommand.="`".$parameter."` INTEGER(11) NULL, "; } elseif ($arrC['type']=='dateintervall'){ $sqlCommand.="`".$parameter."From` INTEGER(11) NULL, "; $sqlCommand.="`".$parameter."To` INTEGER(11) NULL, "; } elseif ($arrC['type']=='mapmarker'){ $sqlCommand.="`".$parameter."Lat` DECIMAL(18,12) NULL, "; $sqlCommand.="`".$parameter."Lon` DECIMAL(18,12) NULL, "; } elseif ($arrC['type'] == 'boolean'){ $sqlCommand.="`".$parameter."` ENUM('0','1') NULL, "; } elseif ($arrC['type'] == 'text'){ $sqlCommand.="`".$parameter."` TEXT NULL, "; } elseif ($arrC['type'] == 'text2'){ $sqlCommand.="`".$parameter."` VARCHAR(500), "; } else{ $sqlCommand.="`".$parameter."` VARCHAR(255) NULL, "; } } $sqlCommand.= "PRIMARY KEY `id` (`id`)"; $sqlCommand.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8;\n"; $sqlCommand.= "CREATE TABLE IF NOT EXISTS `".$this->arrSQLTables[$sqlTable]['name']."_parent` ("; $sqlCommand.= "`pageId` int(11) unsigned NOT NULL,"; $sqlCommand.= "`parentPageId` int(11) unsigned NOT NULL,"; $sqlCommand.= "`listType` int(11) unsigned NOT NULL,"; $sqlCommand.= "`listOrder` int(11) unsigned NOT NULL,"; $sqlCommand.= "PRIMARY KEY `id` (`pageId`, `parentPageId`,`listType`),"; $sqlCommand.= "KEY `parentPageId` (`parentPageId`,`listType`),"; $sqlCommand.= "KEY `pageId` (`pageId`),"; $sqlCommand.= "KEY `listOrder` (`listOrder`)"; $sqlCommand.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8;\n"; $sqlCommand.= "CREATE TABLE IF NOT EXISTS `".$this->arrSQLTables[$sqlTable]['name']."_tag` ("; $sqlCommand.= "`pageId` int(11) unsigned NOT NULL,"; $sqlCommand.= "`tag` varchar(255) NOT NULL,"; $sqlCommand.= "PRIMARY KEY `id` (`pageId`, `tag`),"; $sqlCommand.= "KEY `tag` (`tag`),"; $sqlCommand.= "KEY `pageId` (`pageId`)"; $sqlCommand.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8;\n"; }}} if ($a17 && ($a17!=$a25)){ $fileName = str_replace("/", "-SLASH-", $a17); if ($this->portal->pageDirectory!='') $fileName = $this->portal->pageDirectory.'/'.$fileName.$this->portal->pageExtension; $this->ftp->DeleteFile($fileName); } if ($a25 && $template->GetContent()){ $this->arrParseParameters = array( 'portalid'=> $this->portal->GetId(), 'editmode'=>false, 'homepageroot'=>$this->arrHostingInfo['hostURL'], ); $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_page_'.$a13.'.tmp'; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } $html = $this->ReplaceTemplates($this->page->templateId, $template->GetContent(), array()); $this->CollectPagers($html); $arrHTML = $this->ParseTemplate($html, $this->page, array($this->page), 0, array()); $html = $arrHTML['template']; if (!preg_match("/<%METATags%>/i", $html)){ $html = preg_replace("/<head>/i", "<head>\n<%METATags%>", $html); } if (preg_match("/<%METATags%>/i", $html)){ $arrMETATags = $this->SetMETATags($this->page, $html, ''); $html = preg_replace('/<%METATags%>/i', implode("\n", $arrMETATags), $html); } if (preg_match("/<%htmlHead%>/i", $html, $arrM)){ $rsParentPages = $this->page->GetSubpageIds(95, 1, 999, 'active', false, false, array(1)); if (!$rsParentPages->GetCount()) $rsParentPages->Add(array('0')); $headCode = '<?php '. 'if (isset($eploscms_parentPages) && is_array($eploscms_parentPages)) array_push($eploscms_parentPages, '.$rsParentPages->Implode().");\n". 'else $eploscms_parentPages = array('.$rsParentPages->Implode().");\n". '$eploscms_parentPages[] = '.$this->page->GetId().";\n". '$eploscms_fileName = "'.$this->page->fileName.'";'. '$eploscms_requestUri = $_SERVER["REQUEST_URI"];'. 'if ($eploscms_baseDir == $eploscms_requestUri) $eploscms_requestUri.= $config["param"]["defaultPage"]; '. 'if (strpos($eploscms_requestUri, "?")) '. '$eploscms_requestUri = substr($eploscms_requestUri,0,strpos($eploscms_requestUri, "?")); '. 'if (!isset($eploscms_useContainer)) $eploscms_useContainer = false; '. '$eploscms_baseDir = str_replace("index.php", "", $_SERVER["SCRIPT_NAME"]); '. 'if ($eploscms_baseDir.$eploscms_fileName != $eploscms_requestUri){'. '$eploscms_subPage = substr($eploscms_requestUri, strlen($eploscms_baseDir.$eploscms_fileName)+1, strlen($eploscms_requestUri)); '. '$eploscms_subPage = str_replace("/","-SLASH-", $eploscms_subPage); '. 'if ($eploscms_subPage) $eploscms_subPage = "php_pages/".$eploscms_subPage; '. '}else{'. '$eploscms_subPage = "";'. '}'. '?>'. '<?php '.' '.'if (!$eploscms_subPage || !$eploscms_fileName){?>'. $this->ParseHTMLHead($this->page, $html). '<?php '.' '.'}else{'.' '. 'if ($eploscms_subPage && file_exists($eploscms_subPage) && !$eploscms_useContainer){'. 'ob_start(); '. 'require($eploscms_subPage); '. '$eploscms_content = ob_get_clean(); '. '}'. '}'. 'echo $eploscms_head; '. '?> '; $html = str_replace($arrM[0], "<head>\n".$headCode."\n</head>", $html); }elseif ($template->type == 'content'){ $htmlHead = $this->ParseHTMLHead($this->page, $html); $rsParentPages = $this->page->GetSubpageIds(95, 1, 999, 'active', false, false, array(1)); if (!$rsParentPages->GetCount()) $rsParentPages->Add(array('0')); $html = '<?php '. 'if (isset($eploscms_parentPages) && is_array($eploscms_parentPages)) array_push($eploscms_parentPages, '.$rsParentPages->Implode().");\n". 'else $eploscms_parentPages = array('.$rsParentPages->Implode().");\n". '$eploscms_parentPages[] = '.$this->page->GetId().";\n". '$eploscms_head = <<<EPLOSCMS_HEAD'."\n". $htmlHead."\n". "EPLOSCMS_HEAD;\n". "?>\n".$html; } if (preg_match_all("/picture\?id=([0-9]*)[^v]*version=([0-9x]*)/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ $pictureId = $arrM[1][$i]; $version = $arrM[2][$i]; if (!isset($this->arrPictures[$pictureId])) $this->arrPictures[$pictureId] = new BFLPicture($pictureId); $picture = $this->arrPictures[$pictureId]; list($picturePath) = $this->GetPicturePath($picture, $version); $html = str_replace($arrM[0][$i], $this->arrHostingInfo['hostURL'].$picturePath, $html); }} $html = str_replace("page.php?id=", "page?id=", $html); $html = str_replace("page.php?pageid=", "page?id=", $html); if ($d = strpos($html, 'page?id=')){ if (preg_match_all("/page\?id=([0-9]+)([a-zA-Z&0-9=;]*)/i", $html, $arrP, PREG_SET_ORDER)){ foreach ($arrP as $arrPD){ $page = $this->GetPage($arrPD[1]); $template = $this->GetTemplate($page->templateId); if ($template->type == 'content'){ if (preg_match("/containerId=([0-9]+)/i", $arrPD[2], $arrC)){ $containerPage = $this->GetPage($arrC[1]); $html = str_replace($arrPD[0], $this->arrHostingInfo['hostURL'].$containerPage->fileName."/".$page->fileName, $html); }else{ $html = str_replace($arrPD[0], $this->arrHostingInfo['hostURL']."<?=\$eploscms_pageName?>/".$page->fileName, $html); } }else{ $html = str_replace($arrPD[0], $this->arrHostingInfo['hostURL'].$page->fileName, $html); } } }} $documentDirectory = $this->arrHostingInfo['hostURL'].$this->portal->documentUrlDirectory; $html = str_replace("uploads/document.php?id=", "document?id=", $html); if (preg_match_all("/[^\/](document\?id=([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = $arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); } }} elseif (preg_match_all("/[^\/](document\?([^\"']*))/", $html, $arrM)){ for ($i=0;$i<count($arrM[0]);$i++){ if (preg_match("/^[1-9][0-9]*$/", $arrM[2][$i])){ $documentId = (integer)$arrM[2][$i]; if (!isset($this->arrDocuments[$documentId])) $this->arrDocuments[$documentId] = new BFLDocument($documentId); $document = $this->arrDocuments[$documentId]; $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$document->fileName, $html); }else{ $html = str_replace($arrM[1][$i], $documentDirectory.'/'.$arrM[2][$i], $html); } }} $html = str_replace($this->arrHostingInfo['hostURL'].'http://', 'http://', $html); $html = preg_replace("/<%PHP%>/i", "<?php ", $html); $html = preg_replace("/<%ENDPHP%>/i", " ?>", $html); $containerScript = '<?php '. '\$eploscms_fileName = "'.$a25.'"; '. '\$eploscms_requestUri = \$_SERVER["REQUEST_URI"];'. 'if (\$eploscms_baseDir == $eploscms_requestUri) $eploscms_requestUri.= $config["param"]["defaultPage"];'. 'if (strpos(\$eploscms_requestUri,\'?\')) \$eploscms_requestUri = substr(\$eploscms_requestUri,0,strpos(\$eploscms_requestUri, \'?\'));'. 'if (!isset(\$eploscms_useContainer)) $eploscms_useContainer = false; '. '\$eploscms_baseDir = str_replace("index.php", "", \$_SERVER["SCRIPT_NAME"]); '. 'if (\$eploscms_baseDir.\$eploscms_fileName != \$eploscms_requestUri){'. '\$eploscms_subPage = substr(\$eploscms_requestUri, strlen(\$eploscms_baseDir.\$eploscms_fileName)+1, strlen(\$eploscms_requestUri)); '. '\$eploscms_subPage = str_replace("/","-SLASH-", \$eploscms_subPage); '. '\$eploscms_subPage = "php_pages/".\$eploscms_subPage; '. '}else{'. '\$eploscms_subPage = ""; '. '}'. 'if (\$eploscms_subPage && file_exists(\$eploscms_subPage)){'. 'if (!$eploscms_useContainer) echo $eploscms_content; '. '$eploscms_useContainer = true; '. '}else{'. '?> '; $html = preg_replace("/<%CONTAINER%>/i", $containerScript, $html); $html = preg_replace("/<%ENDCONTAINER%>/i", "<?php }?>", $html); $html = str_replace("@NAME","<%newsLetterAddresseeName%>", $html); $html = preg_replace("/href=\"javascript:EplosCMS\_OpenWindow\('([^']*)'[^\)]*\)\"/i", 'href="$1" class="image-pop-up"', $html); fwrite($tmpfile, $html); fclose($tmpfile); $fileName = str_replace("/","-SLASH-",$a25); if ($this->portal->pageDirectory!=''){ if (substr($this->portal->pageDirectory,-1,1)=='/') $this->portal->pageDirectory = substr($this->portal->pageDirectory,0,strlen($this->portal->pageDirectory-2)); $fileName = $this->portal->pageDirectory.'/'.$fileName.$this->portal->pageExtension; } $this->ftp->UploadFile($tmpfileName, $fileName, FTP_ASCII); unlink($tmpfileName); } if ($this->portal->HasProperty(33) && $sqlTable){ if ($a25){ $sqlCommand.= "REPLACE INTO `".$this->arrSQLTables[$sqlTable]['name']."` VALUES ("; $index = 0; foreach ($this->arrSQLTables[$sqlTable]['columns'] as $arrC){ $parameter = $arrC['parameter']; $value = ''; $value2 = ''; $needValue2 = false; if (preg_match("/^([^(]*)\(([^\)]*)\)$/", $arrC['parameter'], $arrMatches)){ $arrC['parameter'] = $arrMatches[1]; $parameter = $arrMatches[1]; $parameterExtra = $arrMatches[2]; } if (strtoupper($arrC['parameter']) == 'CONTENT'){ $value = $this->page->GetContentString($parameterExtra); }else{ $arrParameter = $this->page->GetParameter($parameter, false); if ($arrParameter['type'] == 'picture'){ if ($arrParameter['value']){ if (!isset($this->arrPictures[$arrParameter['value']])) $this->arrPictures[$arrParameter['value']] = new BFLPicture($arrParameter['value']); $picture = $this->arrPictures[$arrParameter['value']]; list($value) = $this->GetPicturePath($picture, $parameterExtra); }else $value = ''; }elseif ($arrC['type'] == 'dateintervall'){ if (strpos($arrParameter['value'], '--')){ list($from, $to) = explode('--', $arrParameter['value']); $to = '-'.$to; }else{ list($from, $to) = explode('-', $arrParameter['value']); } $value = (integer)$from; $value2 = (integer)$to; $needValue2 = true; }elseif ($arrC['type'] == 'mapmarker'){ list ($lat, $lon) = split(',', $arrParameter['value']); $value = ($lat ? $lat: '0'); $value2 = ($lon ? $lon: '0'); $needValue2 = true; }elseif ($arrC['type'] == 'boolean'){ $value = ($arrParameter['value'] ? '1' : '0'); }else{ $value = $arrParameter['value']; } } if ($index) $sqlCommand.= ", "; $index++; $sqlCommand.= "'".$this->escapeSQL($value)."'"; if ($needValue2) $sqlCommand.= ",'".$this->escapeSQL($value2)."'"; } $sqlCommand.= ");\n"; if ($rsParentPages = $this->page->GetSubpageIds(96, 1, 99, 'active', false, false, false, false, false)){ $arrParentPages = $rsParentPages->GetRecords(); foreach (array_chunk($arrParentPages,10) as $arrChunkedData){ $sqlCommand.= "REPLACE INTO `".$this->arrSQLTables[$sqlTable]['name']."_parent` "; $sqlCommand.= "(pageId, parentPageId, listType, listOrder) VALUES "; $arrValues = array(); foreach ($arrChunkedData as $arrP){ $arrValues[] = "('".$a13."', '".$arrP['id']."','".$arrP['listType']."','".$arrP['subpageOrder']."')"; } if (count($arrValues)) $sqlCommand.= implode(', ', $arrValues); $sqlCommand.= ";\n"; } } if ($rsTags = $this->page->GetTags(false)){ $arrTags = $rsTags->GetRecords(); foreach (array_chunk($arrTags,10) as $arrChunkedData){ $sqlCommand.= "REPLACE INTO `".$this->arrSQLTables[$sqlTable]['name']."_tag` (pageId, tag) VALUES "; $arrValues = array(); $i = 1; foreach ($arrChunkedData as $arrT){ $arrValues[] = "('".$a13."', '".$arrT['name']."')"; } if (count($arrValues)) $sqlCommand.= implode(', ', $arrValues); $sqlCommand.= ";\n"; } }} $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_portal_'.$this->portal->GetId().'.sql'; if (!$tmpfile = fopen($tmpfileName, "a")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, $sqlCommand); fclose($tmpfile); } return true;} private function PublicateRSSChannel($a9){ global $config; if (!is_object($this->arrLanguageVersions[$a9->languageId])) $this->arrLanguageVersions[$a9->languageId] = new BFLLanguageVersion($this->portal->GetId(), $a9->languageId); $languageVersion = $this->arrLanguageVersions[$a9->languageId]; if ($a9->type == 'rssfeed') $template = file_get_contents($config['dir']['templates'].'_rssfeed.xml'); elseif ($a9->type == 'googlesitemap') $template = file_get_contents($config['dir']['templates'].'_googlesitemap.xml'); $arrM = explode("<%SEP%>", $template); list ($headTemplate, $itemTemplate, $footerTemplate) = $arrM; $headTemplate = str_replace('<%title%>', str_replace(']]>', ']]>', $a9->title), $headTemplate); $headTemplate = str_replace('<%pictureURL%>', $a9->pictureURL, $headTemplate); $headTemplate = str_replace('<%pictureWidth%>', $a9->pictureWidth, $headTemplate); $headTemplate = str_replace('<%pictureHeight%>', $a9->pictureHeight, $headTemplate); $headTemplate = str_replace('<%pictureTitle%>', strip_tags($a9->pictureTitle), $headTemplate); $headTemplate = str_replace('<%homePageRoot%>', $this->arrHostingInfo['hostURL'], $headTemplate); $headTemplate = str_replace('<%description%>', strip_tags($a9->description), $headTemplate); $headTemplate = str_replace('<%language%>', $languageVersion->GetCode(), $headTemplate); $headTemplate = str_replace('<%fileName%>', $a9->fileName, $headTemplate); $tmpfileName = $config['dir']['temp'].'rss_'.$a9->GetId().'.tmp'; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } fwrite($tmpfile, trim($headTemplate)."\n"); if ($a9->type == 'rssfeed') $limit = 25; elseif ($a9->type == 'googlesitemap') $limit = 9000; $rsPages = $this->portal->GetPagesToRSSChannel($limit, $a9->parentPageIds, $a9->templateIds, $a9->itemTitle, $a9->itemDescription, $a9->itemPubDate, $a9->languageId); foreach ($rsPages->GetRecords() as $arrPage){ if (!$arrPage['title']) continue; if (!($this->arrPages[$arrPage['id']])){ $this->arrPages[$arrPage['id']] = new BFLPage($arrPage['id']); } $url = $this->arrPages[$arrPage['id']]->GetURL(false); if ($url=='') continue; $url = $this->arrHostingInfo['hostURL'].$url; $item = $itemTemplate; $item = str_replace('<%itemTitle%>', str_replace(']]>', ']]>', $arrPage['title']), $item); $item = str_replace('<%itemLink%>', $url, $item); $item = str_replace('<%itemPubDate%>', date("D, d M Y H:i:s O", $arrPage['pubDate']), $item); $item = str_replace('<%itemPubDate2%>', date("Y-m-d\TH:iP", $arrPage['pubDate']), $item); $item = str_replace('<%itemDescription%>', str_replace(']]>', ']]>', str_replace("\n", "", $arrPage['description'])), $item); fwrite($tmpfile, trim($item)."\n"); } fwrite($tmpfile, trim($footerTemplate)."\n"); fclose($tmpfile); $this->ftp->ChangeRootDirectory(); $this->ftp->UploadFile($tmpfileName, $a9->fileName, FTP_ASCII); unlink($tmpfileName); } private function GetTemplate($a22, $a19=''){ if (!$a22 && !$a19) return false; $template = new BFLTemplate($a22); if (!$a22){ $template->portalId = $this->portal->GetId(); $template->name = $a19; $template->Load(); } $this->arrTemplates[$template->GetId()] = $template; $this->arrTemplates[$template->name] = $template; return $template;} private function GetPage($a22){ $pageId = (integer)$a22; if (isset($this->arrPages[$pageId])){ return $this->arrPages[$pageId]; }else{ return new BFLPage($pageId); }} private function GetPageIdByReference($a8, $a21){ $pageId = $this->portal->GetPageIdByReference($a8, $a21); if (!$pageId){ $this->unresolvedPageReferences[] = $a8; } return $pageId;} private function ReplaceTemplates($a3, $a4, $a31){ global $session, $config; if (in_array($a3, $a31)) return "***RECURSION LIMIT EXCEEDED***"; $a4 = preg_replace("/<link ([^>]*)href=([\"'])/i","<link $1href=$2<%homePageRoot%>",$a4); $a4 = preg_replace("/src=([\"'])/i","src=$1<%homePageRoot%>",$a4); $a4 = preg_replace("/background[ ]*=[ ]*([\"'])/i","background=$1",$a4); $a4 = preg_replace("/background\-image[\ ]*:[\ ]*url\(/i","background-image:url(<%homePageRoot%>",$a4); $a4 = preg_replace("/param name=[\"']movie[\"'] value=([\"'])/i","param name=\"movie\" value=$1",$a4); $a4 = str_replace("<%homePageRoot%><%homePageRoot%>","<%homePageRoot%>",$a4); $a4 = str_replace("<%homePageRoot%><%Parameter","<%Parameter",$a4); $a4 = str_replace("<%homePageRoot%>http://","http://",$a4); $a4 = str_replace("<%homePageRoot%>/"."/","/"."/",$a4); $a4 = str_replace("<%homePageRoot%>javascript:","javascript:",$a4); $a4 = str_replace("<%homePageRoot%>mailto:","mailto:",$a4); $a4 = str_replace("<%homePageRoot%>#","#",$a4); $arrInvalidTags = array('<%eplosEditPanel%>', '<%SearchAbleArea%>','<%EndSearchAbleArea%>', '<%PageListAdd[^%]*%>', '<%PictureListAdd[^%]*%>', '<%homePageURL%>'); foreach ($arrInvalidTags as $tag) $a4 = preg_replace('/'.$tag.'/i', '', $a4); $a31[] = $a3; $a4 = preg_replace("/<%INCLUDE[\ \t]+([^%]+)%>/i", "<%TEMPLATE $1%>", $a4); while(preg_match("/<%COMPONENT[\ \t]+([^%]+)%>/i",$a4,$arrM)){ $componentName = ''; $templateId = ''; $templateName = ''; if (preg_match("/NAME=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $componentName = $arrM2[1]; if (preg_match("/TEMPLATEID=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateId = $arrM2[1]; if (preg_match("/TEMPLATENAME=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateName = $arrM2[1]; $template = $this->GetTemplate($templateId, ($templateName?$templateName:$componentName)); $templateId = $template->GetId(); $pageId = $this->portal->GetComponentPageId($templateId, $this->page->languageId); if (!$pageId && $templateId && $session->user){ $newPage = new BFLPage(); $newPage->name = $template->description.' (COMPONENT-'.$this->page->languageId.')'; $newPage->templateId = $templateId; $newPage->portalId = $this->page->portalId; $newPage->languageId = $this->page->languageId; $newPage->Save($session->user); $pageId = $newPage->GetId(); $this->arrPages[$pageId] = $newPage; } if (!$this->editMode && $pageId){ $page = $this->GetPage($pageId); $extension = strtolower(trim(substr($page->fileName, strrpos($page->fileName, '.'), 4))); $replace = '<?php include("'.str_replace("/","-SLASH-", $page->fileName.$this->portal->pageExtension).'");?>'; }else{ $page = $this->GetPage($pageId); $replace = $this->ReplaceTemplates($template->GetId(), $template->GetContent(), $a31); $arrHTML = $this->ParseTemplate($replace, $page, array($page), 0, array()); $replace = $arrHTML['template']; } $a4 = str_replace($arrM[0], $replace, $a4); } if ($this->editMode && preg_match("/<\?/", $a4)){ $a4 = str_replace("\n", "<%EOL%>", $a4); $a4 = preg_replace('/<\?.*?(\?>|$)/', '', $a4); $a4 = str_replace("<%EOL%>", "\n", $a4); } while(preg_match("/<%TEMPLATE[\ \t]+([^%]+)%>/i",$a4,$arrM)){ $hasTemplate = true; $pageIdPM = 0; $templateName = ''; $templateId = 0; if (preg_match("/NAME=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateName = $arrM2[1]; if (preg_match("/ID=\"([^\"]+)\"/i", $arrM[1], $arrM2)) $templateId = (integer)$arrM2[1]; if (preg_match("/PAGEIDINPUBLICMODE=\"([0-9]+)\"/i", $arrM[1], $arrM2)) $pageIdPM = (integer)$arrM2[1]; elseif (preg_match("/PAGEIDINPUBLICMODE=\"([0-9,]+)\"/i", $arrM[1], $arrM2)){ $arrPageIds = explode(',', str_replace(' ', '',$arrM2[1])); $pageIdPM = (integer)$arrPageIds[$this->page->languageId-1]; } if (!$this->editMode && $pageIdPM){ $page = $this->GetPage($pageIdPM); $extension = strtolower(trim(substr($page->fileName, strrpos($page->fileName, '.'), 4))); if ($extension == 'html') $replace = '<?php readfile("'.$page->fileName.'");?>'; else $replace = '<?php include("'.str_replace("/","-SLASH-", $page->fileName.$this->portal->pageExtension).'");?>'; }else{ $template = $this->GetTemplate($templateId, $templateName); if (!$template){ $this->eventLog->WriteEntry('Nem hatrozhat meg a sablon! db='.$config['db']['database'].', portalId='.$this->portal->GetId().', pageId='.$this->page->GetId().', templateId='.$templateId.', templateName='.$templateName); } if ($config['param']['cacheTemplate'] && $this->editMode && ($pageIdPM || $template->GetCacheAble())){ $cacheFileName = $config['dir']['templateCache'].$session->GetDatabase().'-'.$this->portal->GetId().'-' .($pageIdPM?$pageIdPM:$this->page->GetId()).'-T'.$template->GetId().'.html'; if (file_exists($cacheFileName) && ($this->portal->GetLastChangesTime() < filectime($cacheFileName) )){ $replace = file_get_contents($cacheFileName); }else{ $replace = $this->ReplaceTemplates($template->GetId(), $template->GetContent(), $a31); if ($pageIdPM) $page = $this->GetPage($pageIdPM); else $page = $this->page; $arrHTML = $this->ParseTemplate($replace, $page, array($page), 0, array()); if ($fp = fopen($cacheFileName, 'w')){ fputs($fp, $arrHTML['template']); fclose($fp); } } }else{ $replace = $this->ReplaceTemplates($template->GetId(), $template->GetContent(), $a31, $pageIdPM); }} $a4 = str_replace($arrM[0], $replace."\n", $a4); } array_pop($a31); return trim($a4);} private function ParsePageListItems($a7, $a28, $a36, $a35, $a26, $a34, $a5=1, $a20=999){ $cnt = $a7->GetCount(); $html = ''; $arrHTML = array(); if (!$cnt) return false; $arrParameters = array('pageindex'=>1, 'firstitem'=>1); $half = ceil($cnt/2)+1; $index = 1; foreach ($a7->GetRecords() as $arrId){ if ($index < $a5){ $index++; continue; } if ($index >= $a5+$a20) break; $page = $this->GetPage($arrId[0]); if ($page->GetIsContainerContent()) $arrParameters['containerpageid'] = $a28; else $arrParameters['containerpageid'] = 0; if (in_array($arrId[0], $a36)) $arrParameters['activeitem'] = true; else $arrParameters['activeitem'] = false; if ($arrParameters['pageindex'] == $cnt) $arrParameters['lastitem'] = 1; if ($arrParameters['pageindex']%2==1){ $arrParameters['odditem'] = 1; $arrParameters['evenitem'] = 0; }else{ $arrParameters['odditem'] = 0; $arrParameters['evenitem'] = 1; } for ($i=2;$i<=5;$i++) $arrParameters['pageindexmod'.$i] = (($arrParameters['pageindex']%$i)==0); $arrParameters['half'] = ($half == $arrParameters['pageindex']); if ($this->editMode) $arrParameters['activeMenuSelector'] = ''; else $arrParameters['activeMenuSelector'] = '<?php if (in_array("'.$arrId[0].'", $eploscms_parentPages)) echo "active-menu";?>'; $arrHTML = $this->ParseTemplate($a35['template'], $page, $a34, $a26, $arrParameters); $html.= $arrHTML['template']; $arrParameters['pageindex']++; $arrParameters['firstitem']=0; $index++; } unset($a7); return $html;} function ParseTemplate($a4, $a18, $a34, $a26, $a33){ global $session, $config; if ($a18->GetContentType() == 'page'){ $a34[] = $a18; } $arrPageIds = array(); foreach ($a34 as $arrP) $arrPageIds[] = $arrP->GetId(); foreach ($this->arrParseParameters as $name=>$value) $a4 = preg_replace("/<%".$name."%>/i", $value, $a4); foreach ($a33 as $name=>$value) $a4 = preg_replace("/<%".$name."%>/i", $value, $a4); $arrTemplate = array(); $arrPageListData = false; $arrPictureListData = false; $arrDocumentListData = false; foreach(explode("\n",$a4) as $row){ if ($arrPageListData){ if (trim(strtoupper($row)) == '<%ENDPAGELIST%>'){ if ($pageListCounter==1){ $arrPages = $a34; $object = $this->LoadRelatedPage($arrPageListData, $a34, $a18, true); if (!$arrPageListData['type']) $arrPageListData['type'] = 1; if (!$arrPageListData['start']) $arrPageListData['start'] = 1; if (!$arrPageListData['limit']) $arrPageListData['limit'] = 999; if ($arrPageListData['pager']){ if ($this->arrPagers[$arrPageListData['pager']]){ $arrPageListData['limit'] = $this->arrPagers[$arrPageListData['pager']]['limit']; } if ($this->editMode){ $pagerIndex = max(1, (integer)$_REQUEST[$arrPageListData['pager']]); $arrPageListData['start'] = ($pagerIndex-1) * $arrPageListData['limit'] + 1; }else{ $containerPageId = 0; for ($i=count($a34)-1;$i>=0;$i--){ if (!$a34[$i]->GetIsContainerContent()){ $containerPageId = $a34[$i]->GetId(); break; } } $rsIds = $object->GetSubpageIds($arrPageListData['type'], 1, 999, 'active', $arrPageListData['reverse'], split(',', str_replace("[^0-9,]","", $arrPageListData['templateids'])), split(',', str_replace("[^0-9,]","", $arrPageListData['types'])), $arrPageListData['filter'], false, $arrPageListData['orderby']); $cnt = $rsIds->GetCount(); $pagerSize = ceil($cnt / $arrPageListData['limit']); for ($pagerI=1; $pagerI<=$pagerSize; $pagerI++){ $tmpfileName = $config['dir']['temp'].$config['db']['database'].'_'.$this->portal->GetId().'_pager_'.$pagerI.'.tmp'; if (!$tmpfile = fopen($tmpfileName, "w")){ $this->eventLog->WriteEntry('Temporary file can not be created ('.$tmpfileName.')'); return false; } $html = $this->ParsePageListItems($rsIds, $containerPageId, $arrPageIds, $arrPageListData, $a26, $arrPages, ($pagerI-1)*$arrPageListData['limit']+1, $arrPageListData['limit']); fwrite($tmpfile, $html); fclose($tmpfile); $fileName = sprintf('_pager_%08d_%02d',$object->GetId(), $pagerI); if ($this->portal->pageDirectory!=''){ if (substr($this->portal->pageDirectory,-1,1)=='/') $this->portal->pageDirectory = substr($this->portal->pageDirectory,0,strlen($this->portal->pageDirectory-2)); $fileName = $this->portal->pageDirectory.'/'.$fileName; } $this->ftp->UploadFile($tmpfileName, $fileName, FTP_ASCII); unlink($tmpfileName); } $php = file_get_contents($config['dir']['templates'].'_pager_replace.php'); $php = str_replace("<%name%>", $arrPageListData['pager'], $php); $php = str_replace("<%pageId%>", $object->GetId(), $php); $arrTemplate[] = $php; } } if ($this->editMode || !$arrPageListData['pager']){ $rsIds = $object->GetSubpageIds($arrPageListData['type'], $arrPageListData['start'], $arrPageListData['limit'], 'active', $arrPageListData['reverse'], split(',', str_replace("[^0-9,]","", $arrPageListData['templateids'])), split(',', str_replace("[^0-9,]","", $arrPageListData['types'])), $arrPageListData['filter'], $this->editMode, $arrPageListData['orderby']); $containerPageId = 0; for ($i=count($a34)-1;$i>=0;$i--){ if (!$a34[$i]->GetIsContainerContent()){ $containerPageId = $a34[$i]->GetId(); break; } } if ($a35['pageid']!=='0') $arrPages[] = $object; if (!$html = $this->ParsePageListItems($rsIds, $containerPageId, $arrPageIds, $arrPageListData, $a26, $arrPages)){ $arrPageListData = false; $pageListCounter = 0; continue; } $arrTemplate[] = $html; } $arrPageListData = false; continue; }else{ $pageListCounter--; } } if ((trim(strtoupper($row))=='<%PAGELIST%>') || preg_match("/<%PAGELIST ([^>]*)%>/i", $row)){ $pageListCounter++; } $arrPageListData['template'].= $row."\n"; continue; } if ($arrPictureListData){ if (trim(strtoupper($row)) == '<%ENDPICTURELIST%>'){ $page = $this->LoadRelatedPage($arrPictureListData, $a34, $a18, true); if (!$arrPictureListData['type']) $arrPictureListData['type'] = 1; if (!$arrPictureListData['start']) $arrPictureListData['start'] = 1; if (!$arrPictureListData['limit']) $arrPictureListData['limit'] = 999; if ($rsIds = $page->GetPictureIds($arrPictureListData['type'], $arrPictureListData['start'], $arrPictureListData['limit'], $arrPictureListData['reverse'], 'active', $this->editMode)){ $cnt = $rsIds->GetCount(); if (!$cnt){ $arrPictureListData = false; $pageListCounter = 0; continue; } $arrParameters = array('pictureindex'=>1, 'firstitem'=>1); $half = ceil($cnt/2)+1; foreach ($rsIds->GetRecords() as $arrId){ if (!isset($this->arrPictures[$arrId[0]])) $this->arrPictures[$arrId[0]] = new BFLPicture($arrId[0]); $picture = $this->arrPictures[$arrId[0]]; if ($arrParameters['pictureindex'] == $cnt) $arrParameters['lastitem'] = 1; if ($arrParameters['pictureindex']%2==1){ $arrParameters['odditem'] = 1; $arrParameters['evenitem'] = 0; }else{ $arrParameters['odditem'] = 0; $arrParameters['evenitem'] = 1; } for ($i=2;$i<=5;$i++) $arrParameters['pictureindexmod'.$i] = (($arrParameters['pictureindex']%$i)==0); $arrParameters['half'] = ($half == $arrParameters['pictureindex']); $arrHTML = $this->ParseTemplate($arrPictureListData['template'], $picture, $a34, $a26, $arrParameters); $template = $arrHTML['template']; $arrTemplate[] = $template; $arrParameters['pictureindex']++; $arrParameters['firstitem']=0; } } $arrPictureListData = false; continue; } $arrPictureListData['template'].= $row."\n"; continue; } if ($arrDocumentListData){ if (trim(strtoupper($row)) == '<%ENDDOCUMENTLIST%>'){ $page = $this->LoadRelatedPage($arrDocumentListData, $a34, $a18, true); if (!$arrDocumentListData['type']) $arrDocumentListData['type'] = 1; if (!$arrDocumentListData['start']) $arrDocumentListData['start'] = 1; if (!$arrDocumentListData['limit']) $arrDocumentListData['limit'] = 999; if ($rsIds = $page->GetDocumentIds($arrDocumentListData['type'], $arrDocumentListData['start'], $arrDocumentListData['limit'], $arrDocumentListData['reverse'], 'active', $this->editMode)){ $cnt = $rsIds->GetCount(); if (!$cnt){ $arrDocumentListData = false; $pageListCounter = 0; continue; } $arrParameters = array('pageindex'=>1, 'firstitem'=>1); $half = ceil($cnt/2)+1; foreach ($rsIds->GetRecords() as $arrId){ $document = new BFLDocument($arrId[0]); if ($arrParameters['pageindex'] == $cnt) $arrParameters['lastitem'] = 1; if ($arrParameters['pageindex']%2==1){ $arrParameters['odditem'] = 1; $arrParameters['evenitem'] = 0; }else{ $arrParameters['odditem'] = 0; $arrParameters['evenitem'] = 1; } for ($i=2;$i<=5;$i++) $arrParameters['pageindexmod'.$i] = (($arrParameters['pageindex']%$i)==0); $arrParameters['half'] = ($half == $arrParameters['pageindex']); $arrHTML = $this->ParseTemplate($arrDocumentListData['template'], $document, $a34, $a26, $arrParameters); $template = $arrHTML['template']; $arrTemplate[] = $template; $arrParameters['pageindex']++; $arrParameters['firstitem']=0; } } $arrDocumentListData = false; continue; } $arrDocumentListData['template'].= $row."\n"; continue; } if (trim(strtoupper($row)) == '<%ENDIF%>'){ if ($a26>0) $a26--; continue; } if (preg_match("/<%IF([A-Z]*)([^>]*)%>/i", $row, $arrM)){ if ($a26>0){ $a26++; continue; } $arrCondition = array('operation'=>'', 'ignoreineditmode'=>'yes'); $arrDetails = array('name','id','value','ignoreineditmode','pageid','type','version', 'templateids','types','field', 'fatherid','page'); if ($arrM[1]){ $arrM[1] = strtolower(trim($arrM[1])); if (substr($arrM[1],0,3) == 'not'){ $arrCondition['negation'] = true; $arrCondition['operation'] = trim(substr($arrM[1],3,strlen($arrM[1]))); }else{ $arrCondition['negation'] = false; $arrCondition['operation'] = trim($arrM[1]); } $row = str_replace($arrM[1], '', $row); } $details = trim($arrM[2]); if ($arrCondition['types']) $arrCondition['types'] = split(', ', preg_replace("/[^0-9,]/", "", $arrCondition['types'])); if ($arrCondition['templateids']) $arrCondition['templateids'] = split(', ', preg_replace("/[^0-9,]/", "", $arrCondition['templateids'])); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[2], $arrM2)){ $arrCondition[strtolower(trim($d))] = strtolower($arrM2[1]); $details = str_replace($arrM2[0], '', $details); } } $arrCondition['details'] = strtolower($details); if (in_array($arrCondition['name'], array('language'))) $arrCondition['ignoreineditmode'] = 'no'; if (in_array($arrCondition['details'], array('editmode','lastitem','firstitem','odditem', 'evenitem','pageindex','pageindexmod2', 'pageindexmod3','pageindexmod4','pageindexmod5', 'half','parentpage','related','activeitem',))) $arrCondition['ignoreineditmode'] = 'no'; if (in_array($arrCondition['operation'], array('parentpage','related','forefather'))) $arrCondition['ignoreineditmode'] = 'no'; if ($arrCondition['fatherid']) $arrCondition['pageid'] = $arrCondition['fatherid']; if ($this->editMode && ($arrCondition['ignoreineditmode']!='no')) continue; $value = ''; $page = $this->LoadRelatedPage($arrCondition, $a34, $a18, false); if (!isset($this->arrPages[$arrCondition['pageid']])) $this->arrPages[$arrCondition['pageid']] = $page; if ($arrCondition['operation']=='parameter') { if ($arrCondition['name']){ $arrParameter = $page->GetParameter($arrCondition['name'], $this->editMode); if (($arrParameter['type']=='image') && ($arrCondition['field'])){ if (!isset($this->arrPictures[$arrParameter['value']])) $this->arrPictures[$arrParameter['value']] = new BFLPicture($arrParameter['value']); $picture = $this->arrPictures[$arrParameter['value']]; $arrParameter = $picture->GetParameter($arrCondition['field'], $arrCondition['version']); } elseif (($arrParameter['type']=='document') && ($arrCondition['field'])){ $document = new BFLDocument(); $arrParameter = $document->GetParameter($arrCondition['field'], $arrCondition['version']); } elseif (($arrParameter['type']=='multiparam') && $arrCondition['field']){ foreach(explode("\n", $arrParameter['value']) as $nameValuePair){ $arrT = explode("=", $nameValuePair, 2); if ($arrT[0] == $arrCondition['field']){ $arrParameter['value'] = $arrT[1]; break; } } } $value = $arrParameter['value']; } } elseif ($arrCondition['operation']=='pagelist') { if (!$arrCondition['type']) $arrCondition['type'] = 1; $value = ($page->CheckPageListExists($arrCondition['type'], $arrCondition['templateids'], $arrCondition['types'], $this->editMode) > 0); } elseif ($arrCondition['operation']=='picturelist') { if (!$arrCondition['type']) $arrCondition['type'] = 1; $value = ($page->CheckPictureListExists($arrCondition['type'], $this->editMode) > 0); } elseif ($arrCondition['operation']=='documentlist') { if (!$arrCondition['type']) $arrCondition['type'] = 1; $value = ($page->CheckDocumentListExists($arrCondition['type'], $this->editMode) > 0); } elseif ($arrCondition['operation']=='forefather') { if ($a18->GetContentType() == 'page'){ if ($a18->GetId() == $arrCondition['pageid']) $value = true; else $value = $a18->CheckPageIsForfather($arrCondition['pageid'], $this->editMode, $arrCondition['types']); } } elseif ($arrCondition['operation']=='related') { if ($a18->GetContentType() == 'page') $value = $a18->CheckPageIsRelated($page->GetId(), $this->editMode); } elseif ($arrCondition['details']=='parentpage'){ if ($a18->GetContentType() == 'page') $value = $a34[0]->CheckPageIsForfather($a18->GetId(), $this->editMode, $arrCondition['types']); } elseif (in_array($arrCondition['details'], array_keys($this->arrParseParameters))){ $value = $this->arrParseParameters[$arrCondition['details']]; } elseif (in_array($arrCondition['details'], array_keys($a33))){ $value = $a33[$arrCondition['details']]; } $condition = (($arrCondition['value'] && ($arrCondition['value']==$value)) || (!$arrCondition['value'] && $value)); if ($arrCondition['negation'] && $condition) $a26++; if (!$arrCondition['negation'] && !$condition) $a26++; continue; } if ($a26>0) continue; while (preg_match("/<%PAGER([^>]*)%>/i", $row, $arrM)){ $arrData = array('type'=>1, 'name'=>'p', 'classname'=>'pager', 'labelnext'=>'', 'labelprev'=>'', 'hash'=>''); $arrDetails = array('type','pageid','classname','limit','name','hash','labelnext','labelprev'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $object = $this->LoadRelatedPage($arrData, $a34, $a18, true); $php = file_get_contents($config['dir']['templates'].'_pager_ol.php'); $cnt = $object->CheckPageListExists($arrData['type'], '', '', $this->editMode); $php = str_replace('<%cnt%>', $cnt, $php); $php = str_replace('<%pageid%>', $object->GetId(), $php); foreach ($arrData as $key=>$value){ $php = str_replace('<%'.$key.'%>', $value, $php); } if ($this->editMode){ $requestUri = $_SERVER['REQUEST_URI']; $requestUri = preg_replace("/&".$arrData['name']."=[0-9]*/", "", $requestUri); if ($arrData['hash'] && ($arrData['hash'][0]!='#')){ $arrData['hash'] = '#'.$arrData['hash']; } $php = str_replace('<%hash%>', $arrData['hash'], $php); $php = str_replace('<%url%>', $requestUri.'&', $php); ob_start(); eval($php); $result = ob_get_contents(); ob_end_clean(); $row = str_replace($arrM[0], $result, $row); }else{ $php = str_replace('<%url%>', $object->GetURL().'?', $php); $row = str_replace($arrM[0], '<?php '.$php.'?>', $row); }} while (preg_match("/<%PAGELISTCOUNT([^>]*)%>/i", $row, $arrM)){ $arrData = array('type'=>1); $arrDetails = array('type','pageid','page'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $object = $this->LoadRelatedPage($arrData, $a34, $a18, true); $value = $object->CheckPageListExists($arrData['type'], '', '', $this->editMode); $row = str_replace($arrM[0], (integer)$value, $row); } while (preg_match("/<%PAGELISTEDIT([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>'edit'); $arrDetails = array('type','pageid','templateids','withbox','listparameters', 'language', 'editparameters', 'format','convert','style','portalid', 'page', 'listwintitle','editwintitle','addwintitle', 'title'); foreach ($arrDetails as $d){ if (preg_match("/ ".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $page = $this->LoadRelatedPage($arrData, $a34, $a18, true); $arrData['pageid'] = $page->GetId(); $html = '<span class="eploscms list'.($arrData['widthbox']?' witbox':'').'" data-operation="pagelist_'.$arrData['operation'].'"'; if ($arrData['type']) $html.=' data-type="'.$arrData['type'].'"'; if ($arrData['pageid']) $html.=' data-pageid="'.$arrData['pageid'].'"'; if ($arrData['portalid']) $html.=' data-portalid="'.$arrData['portalid'].'"'; if ($arrData['language']) $html.=' data-language="'.$arrData['language'].'"'; else $html.=' data-language="'.$page->languageId.'"'; if ($arrData['templateids']) $html.=' data-templateids="'.$arrData['templateids'].'"'; if ($arrData['parameters']) $html.=' data-parameters="'.$arrData['parameters'].'"'; if ($arrData['listparameters']) $html.=' data-listparameters="'.$arrData['listparameters'].'"'; if ($arrData['editparameters']) $html.=' data-editparameters="'.$arrData['editparameters'].'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['listwintitle']) $html.= ' data-listwintitle="'.$arrData['listwintitle'].'" '; if ($arrData['addwintitle']) $html.= ' data-addwintitle="'.$arrData['addwintitle'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } while (preg_match("/<%DOCUMENTLISTEDIT([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>'edit'); $arrDetails = array('type','pageid','title','withbox','parameters', 'format', 'convert', 'style','portalid','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $page = $this->LoadRelatedPage($arrData, $a34, $a18, true); $arrData['pageid'] = $page->GetId(); if ($arrData['portalid']) $html.=' data-portalid="'.$arrData['portalid'].'"'; $html = '<span class="eploscms list'.($arrData['withbox']?' witbox':'').'" data-operation="documentlist_'.$arrData['operation'].'"'; if ($arrData['type']) $html.=' data-type="'.$arrData['type'].'"'; if ($arrData['pageid']) $html.=' data-pageid="'.$arrData['pageid'].'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } while (preg_match("/<%PICTURELISTEDIT([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>'edit'); $arrDetails = array('type','pageid','title','withbox','parameters', 'format', 'convert', 'style', 'portalid','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; } } $page = $this->LoadRelatedPage($arrData, $a34, $a18, true); $arrData['pageid'] = $page->GetId(); if ($arrData['portalid']) $html.=' data-portalid="'.$arrData['portalid'].'"'; $html = '<span class="eploscms list'.($arrData['withbox']?' witbox':'').'" data-operation="picturelist_'.$arrData['operation'].'"'; if ($arrData['type']) $html.=' data-type="'.$arrData['type'].'"'; if ($arrData['pageid']) $html.=' data-pageid="'.$arrData['pageid'].'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } while (preg_match("/<%PARAMETEREDIT[ \t]+([^>]*)%>/i", $row, $arrM)){ if (!$this->editMode || $this->disableEditSigns){ $row = str_replace($arrM[0], '', $row); continue; } $arrData = array('type'=>1, 'operation'=>strtolower(trim($arrM[1]))); $arrDetails = array('pageid','title','withbox','name', 'id', 'format', 'field', 'pictureversion', 'defaultpictureversion', 'picturealign', 'defaultpicturealign', 'style','convert','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrData[strtolower(trim($d))] = $arrM2[1]; $arrM[1] = str_replace($arrM2[0], '', $arrM[1]); } } if (!$arrData['name'] && $arrData['id']) $arrData['name'] = $arrData['id']; $page = $this->LoadRelatedPage($arrData, $a34, $a18, false); if (strpos($arrData['name'], ',')) $arrData['type'] = 'multiparam'; else{ $arrParameter = $page->GetParameter($arrData['name'], $this->editMode); $arrData['type'] = $arrParameter['type']; } $html = '<span class="eploscms edit'.($arrData['withbox']?' witbox':'').'"'; $html.= ' data-operation="parameter_edit"'; $html.= ' data-type="'.$arrData['type'].'"'; if ($arrData['name']) $html.=' data-name="'.$arrData['name'].'"'; elseif ($arrData['id']) $html.=' data-id="'.$arrData['id'].'"'; if ($arrData['field']) $html.=' data-field="'.$arrData['field'].'"'; $html.=' data-pageid="'.$page->GetId().'"'; if ($arrData['title']) $html.= ' data-title="'.$arrData['title'].'" '; if ($arrData['style']) $html.= ' data-style="'.$arrData['style'].'" '; if ($arrData['defaultpictureversion']) $html.= ' data-defpicvers="'.$arrData['defaultpictureversion'].'" '; if ($arrData['pictureversion']) $html.= ' data-defpicvers="'.$arrData['pictureversion'].'" '; if ($arrData['defaultpicturealign']) $html.= ' data-defpicalign="'.$arrData['defaultpicturealign'].'" '; if ($arrData['picturealign']) $html.= ' data-defpicalign="'.$arrData['picturealign'].'" '; if ($arrData['type']=='text') $html.= ' data-styleformats="'.str_replace("\n", ',', $this->portal->textEditorStyles).'" '; $html.='></span>'; if ($arrData['format']) $arrData['convert'] = $arrData['format']; if ($arrData['convert']=='addslashes') $html.= addslashes($html); $row = str_replace($arrM[0], $html, $row); } if ((trim(strtoupper($row)) == '<%PAGELIST%>') || preg_match("/<%PAGELIST ([^>]*)%>/i", $row, $arrM)){ $pageListCounter = 1; $arrPageListData = array('type'=>1); $arrDetails = array('type','pageid','start','limit','reverse','types','templateids', 'orderby','filter', 'portalid', 'pager','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrPageListData[strtolower(trim($d))] = $arrM2[1]; } } continue; } if ((trim(strtoupper($row)) == '<%PICTURELIST%>') || preg_match("/<%PICTURELIST ([^>]*)%>/i", $row, $arrM)){ $pageListCounter = 1; $arrPictureListData = array('type'=>1); $arrDetails = array('type','pageid','page','start','limit','reverse','portalid'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrPictureListData[strtolower(trim($d))] = strtolower($arrM2[1]); } } continue; } if ((trim(strtoupper($row)) == '<%DOCUMENTLIST%>') || preg_match("/<%DOCUMENTLIST ([^>]*)%>/i", $row, $arrM)){ $pageListCounter = 1; $arrDocumentListData = array('type'=>1); $arrDetails = array('type','pageid','page','start','limit','reverse','portalid'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ $arrDocumentListData[strtolower(trim($d))] = strtolower($arrM2[1]); } } continue; } while (preg_match("/<%PARAMETER[ \t]+([^>]*)%>/i", $row, $arrM)){ $arrData = array('name'=>''); $arrDetails = array('htmlobjectid','name', 'convert','maxchar','maxlength','field', 'containerpageid','pageid','version','id','showpicturealts','tagseparator', 'tagformat','page'); foreach ($arrDetails as $d){ if (preg_match("/".$d."=\"([^\"]*)\"/i", $arrM[1], $arrM2)){ if ($d!='convert') $arrM2[1] = strtolower($arrM2[1]); $arrData[strtolower(trim($d))] = $arrM2[1]; $arrM[1] = str_replace($arrM2[0], '', $arrM[1]); } } if (!$arrData['name'] && $arrData['id']) $arrData['name'] = $arrData['id']; if (!$arrData['maxlength'] && $arrData['maxchar']) $arrData['maxlength'] = $arrData['maxchar']; if (($arrData['containerpageid']=='current') && $this->containerPage) $arrData['containerpageid'] = $this->containerPage->GetId(); elseif ($arrData['containerpageid']=='parent'){ $arrData['containerpageid'] = $a34[count($a34)-2]->GetId(); } elseif ($arrData['containerpageid']=='auto') $arrData['containerpageid'] = (integer)$a33['containerpageid']; $element = $this->LoadRelatedPage($arrData, $a34, $a18, false); if ($element->GetContentType() == 'page'){ if (!$element->GetIsContainerContent()) $arrData['containerpageid'] = 0; if ($arrData['name']){ if ($arrData['name'] == '*'){ $arrParameter['value'] = $element->GetParameters(); } elseif ($arrData['name'] == 'url'){ if ($this->editMode){ $arrParameter = array('value'=>'page?id='.$element->GetId()); if (isset($arrData['containerpageid'])) $arrParameter['value'].= '&containerId='.$arrData['containerpageid']; if ($session) $arrParameter['value'].= '&sessionId='.$session->GetId(); }else{ if (isset($arrData['containerpageid']) && $arrData['containerpageid']){ if ($arrData['containerpageid']=='current'){ $arrParameter = $element->GetParameter($arrData['name'], false); if ($arrData['convert']=='phpstring') $arrParameter['value'] = '".$eploscms_pageName."/'.$arrParameter['value']; else $arrParameter['value'] = '<?=$eploscms_pageName?>/'.$arrParameter['value']; }else{ if (!isset($this->arrPages[$arrData['containerpageid']])) $this->arrPages[$arrData['containerpageid']] = new BFLPage($arrData['containerpageid']); $containerPage = $this->arrPages[$arrData['containerpageid']]; $arrParameter = $element->GetParameter($arrData['name'], false); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$containerPage->fileName.'/'.$arrParameter['value']; } }else{ $arrParameter = $element->GetParameter($arrData['name'], false); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$arrParameter['value']; } } }else{ $arrParameter = $element->GetParameter($arrData['name'], $this->editMode); if (($arrParameter['type']=='enum') && ($arrData['field']=='text')){ foreach (explode("\n", $arrParameter['format']) as $tRow){ list ($tValue, $tName) = explode('=', $tRow); if ($tValue==$arrParameter['value']){ $arrParameter['value'] = $tName; break; } } } if ($this->editMode && strpos($arrParameter["value"], 'page?id=')){ if (preg_match_all("/page\?id=([0-9]+)([a-zA-Z&0-9=;]*)/i", $arrParameter["value"], $arrP, PREG_SET_ORDER)){ foreach ($arrP as $arrPD){ if (preg_match("/containerId=[0-9]+/i", $arrPD[2])) continue; $page = $this->GetPage($arrPD[1]); $template = $this->GetPage($page->templateId); if ($template->type == 'content'){ $arrParameter["value"] = str_replace($arrPD[0], 'page?id='.$arrPD[1].'&containerId='.$this->containerPage->GetId(), $arrParameter["value"]); } } } } } } if (($arrParameter['type']=='picture') && ($arrData['field'])){ $arrParameter = $element->GetParameter($arrData['name'], false); if (!isset($this->arrPictures[$arrParameter['value']])) $this->arrPictures[$arrParameter['value']] = new BFLPicture($arrParameter['value']); $picture = $this->arrPictures[$arrParameter['value']]; if ($arrData['field'] == 'url'){ if ($this->editMode){ $arrParameter = array('value'=>'picture?id='.$picture->GetId().'&version='.$arrData['version']); }else{ $arrParameter = $picture->GetParameter($arrData['field'], $arrData['version'], false); list($arrParameter['value']) = $this->GetPicturePath($picture, $arrData['version']); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$arrParameter['value']; } } elseif ($arrData['field']=='width'){ list ($picturePath, $width, $height) = $this->GetPicturePath($picture, $arrData['version']); $arrParameter['value'] = $width; } elseif ($arrData['field']=='height'){ list ($picturePath, $width, $height) = $this->GetPicturePath($picture, $arrData['version']); $arrParameter['value'] = $height; } elseif ($arrData['field']=='alt'){ $arrParameter = $picture->GetParameter('alt'.$this->page->languageId, $arrData['version'], $this->editMode); } else $arrParameter = $picture->GetParameter($arrData['field'], $arrData['version'], $this->editMode); } elseif (($arrParameter['type']=='document') && $arrData['field']){ $document = new BFLDocument((integer)$arrParameter['value']); if ($arrData['field'] == 'filename'){ $arrParameter['value'] = basename($document->fileName); }elseif ($arrData['field'] == 'url'){ $arrParameter['value'] = $this->arrHostingInfo['hostURL']. $this->portal->documentUrlDirectory.'/'.$document->fileName; } } elseif ($arrParameter['type']=='tags'){ if (!empty($arrParameter['format'])){ foreach (explode("\n", $arrParameter['format']) as $p){ $arrT = explode("=", $p); $arrParameter[strtolower(trim($arrT[0]))] = trim($arrT[1]); } } if ($arrData['tagseparator']) $separator = html_entity_decode($arrData['tagseparator']); else $separator = ','; if ($arrData['tagformat']) $format = html_entity_decode($arrData['tagformat']); else $format = '@name'; $arrParameter['value'] = ''; if ($rsTags = $element->GetTags(true, $arrParameter['rangeid'])){ foreach ($rsTags->GetRecords() as $arrT){ $html = str_replace('@name', $arrT['name'], str_replace('@id', $arrT['id'], $format)); if ($arrParameter['value']) $arrParameter['value'].=$separator; $arrParameter['value'].= $html; } } } elseif (($arrParameter['type']=='email') && ($arrData['htmlobjectid'])){ if ($arrParameter['value']){ if (preg_match("/^([^@]*)@(.*)\.([0-9a-z]{2,4})$/", strtolower(trim($arrParameter['value'])), $arrE)){ $html = '<script type="text/javascript">'; $html.= 'v = "'.$arrE[3].';'.$arrE[1].';'.$arrE[2].'";'; $html.= 'a = v.split(";");'; $html.= 'v = a[1]+"@"+a[2]+"."+a[0];'; $html.= 'i = document.getElementById("'.$arrData['htmlobjectid'].'");'; $html.= 'i.href = "ma"+"il"+"to"+":"+v;'; $html.= 'if (i.innerHTML=="") i.innerHTML = v;'; $html.= '</script>'; $arrParameter['value'] = $html; } } } elseif ($arrParameter['type']=='dateintervall'){ if (substr($arrData['convert'],0,5)=="date:") $dateFormat = trim(substr($arrData['convert'],5,10)); if (strpos($arrParameter['value'], '--')){ list ($from, $to) = split("--", $arrParameter['value']); if ($to) $to*= -1; }else{ list ($from, $to) = split("-", $arrParameter['value']); } $arrParameter['value'] = ''; if ($arrData['field'] == 'from'){ if ($dateFormat) $arrParameter['value'] = date($dateFormat, $from); else $arrParameter['value'] = $from; }elseif ($arrData['field'] == 'to'){ if ($dateFormat) $arrParameter['value'] = date($dateFormat, ($to?$to:$from)); else $arrParameter['value'] = ($to?$to:$from); }else{ if ($from){ if ($dateFormat) $arrParameter['value'] = date($dateFormat, $from); else $arrParameter['value'] = $from; } if ($to){ if ($dateFormat) $arrParameter['value'].= ' - '.date($dateFormat, $to); else $arrParameter['value'].= ' - '.$to; } } } elseif ($arrParameter['type']=='mapmarker'){ $lat = 0; $lon = 0; if (strpos($arrParameter['value'], ',')){ list ($lat, $lon) = split(",", $arrParameter['value']); } if ($arrData['field'] == 'lat') $arrParameter['value'] = (float)$lat; elseif ($arrData['field'] == 'lon') $arrParameter['value'] = (float)$lon; } elseif (($arrParameter['type']=='multiparam') && $arrData['field']){ foreach(explode("\n", $arrParameter['value']) as $nameValuePair){ $arrT = explode("=", $nameValuePair, 2); if ($arrT[0] == $arrData['field']){ $arrParameter['value'] = $arrT[1]; break; } } } } elseif ($element->GetContentType() == 'picture') { if (($arrData['field'] == 'url')){ if ($this->editMode) $arrParameter = array('value'=>'picture?id='.$element->GetId().'&version='.$arrData['version']); else{ list ($picturePath) = $this->GetPicturePath($element, $arrData['version']); $arrParameter = array('value'=>$picturePath); $arrParameter['value'] = $this->arrHostingInfo['hostURL'].$arrParameter['value']; } } elseif ($arrData['field']=='width'){ list ($picturePath, $width, $height) = $this->GetPicturePath($element, $arrData['version']); $arrParameter['value'] = $width; } elseif ($arrData['field']=='height'){ list ($picturePath, $width, $height) = $this->GetPicturePath($element, $arrData['version']); $arrParameter['value'] = $height; } elseif ($arrData['field']=='alt'){ $arrParameter = $element->GetParameter('alt'.$this->page->languageId, $arrData['version'], $this->editMode); } else $arrParameter = $element->GetParameter($arrData['field'], $arrData['version'], $this->editMode); } elseif ($element->GetContentType() == 'document') { if (($arrData['field'] == 'url') && $this->editMode) $arrParameter = array('value'=>'document?id='.$element->GetId()); else $arrParameter = $element->GetParameter($arrData['field'], $this->editMode); } $value = $arrParameter['value']; if ($arrData['showpicturealts']=='yes'){ if (preg_match_all("/<img ([^>]*)>/i", $value, $arrSPM, PREG_PATTERN_ORDER)){ for ($i=0; $i<count($arrSPM[0]); $i++){ if (preg_match("/style=\"([^\"]*)\"/i", $arrSPM[1][$i], $arrSPM2)) $style = trim($arrSPM2[1]); if (preg_match("/alt=\"([^\"]*)\"/i", $arrSPM[1][$i], $arrSPM2)) $alt = trim($arrSPM2[1]); if (preg_match("/src=\"picture\?[^\"]*version=([0-9]*)[^\"]*\"/i", $arrSPM[1][$i], $arrSPM2)) $width = trim($arrSPM2[1]); if ($alt && $width){ $picture = str_replace($style, '', $arrSPM[0][$i]); $pichtml = '<div class="picturecont" style="'.$style.';width:'.$width.'px">'.$picture.'<span>'.$alt.'</span></div>'; }else $pichtml = $arrSPM[0][$i]; $value = str_replace($arrSPM[0][$i], $pichtml, $value); } } } if ($arrData['maxlength']) $value = str_replace('"', '"', SYS::crop($value, $arrData['maxlength'])); if ((substr($arrData['convert'],0,5)=="date:") && ($arrParameter['type']!='dateintervall')){ if ($value) $value = date(trim(substr($arrData['convert'],5,10)), (integer)$value); }else $arrData['convert'] = strtolower($arrData['convert']); if ($arrData['convert']=='https') $value=str_replace("http:","https:",$value); elseif ($arrData['convert']=='addslashes') $value=str_replace("\n","\\n",addslashes($value)); elseif ($arrData['convert']=='addslashes2') $value=str_replace("\n","\\n",str_replace('"', '\"', $value)); elseif ($arrData['convert']=='phpstring'){ $value=str_replace('\".$eploscms_pageName.\"', '".$eploscms_pageName."', str_replace("\n","\\n",str_replace('"', '\"', $value))); $value=str_replace('<?=$eploscms_pageName?>', '$eploscms_pageName', $value); } elseif ($arrData['convert']=='urlencode') $value=urlencode($value); elseif ($arrData['convert']=='html') $value=htmlspecialchars($value); elseif ($arrData['convert']=='base64') $value=base64_encode($value); elseif ($arrData['convert']=='md5') $value=md5($value); elseif ($arrData['convert']=='nl2br') $value=nl2br($value); elseif ($arrData['convert']=='upper') $value=strtoupper($value); elseif ($arrData['convert']=='lower') $value=strtolower($value); elseif ($arrData['convert']=='striptags') $value=str_replace("\n"," ",addslashes(strip_tags($value))); elseif ($arrData['convert']=='number') $value=ereg_replace("[^0-9]","",$value); elseif (($arrData['convert']=='value') && $arrParameter['format']){ $arrValues = explode("\n",$arrParameter['format']); foreach ($arrValues as $v){ list ($vId, $vValue) = explode("=", $v); if ($vId == $value){ $value = $vValue; } } } elseif ($arrData['convert']=='url'){ $prefix = strtolower(substr($arrParameter['value'],0,7)); if (($prefix!='http://') && ($prefix!='https:/')) $value = 'http://'.$value; } elseif (is_array($value) && ($arrData['convert']=='phparray')){ $phpArray = "array("; $isFirstParameter = true; foreach ($value as $name=>$v){ if (!$isFirstParameter) $phpArray.= ', '; $phpArray.= '"'.$name.'"=>"'.str_replace('"', '\"', $v['value']).'"'; $isFirstParameter = false; } $phpArray.=")"; $value = $phpArray; } elseif ($arrData['convert']=='xml'){ $d=explode("\n",$value); $value=""; foreach($d as $v){ $d2=explode("=",$v); $d2[1]=trim(substr($v,strlen($d2[0])+1)); $prefix=$suffix=""; if(strpos($d2[1],"<")."x"!="x"){ $prefix="<![CDATA["; $suffix="]]>"; } if($d2[0]) $value.="<".$d2[0].">".$prefix.$d2[1].$suffix."</".$d2[0].">\n"; } } $row = str_replace($arrM[0], $value, $row); } $arrTemplate[] = $row; } array_pop($a31); return array('template'=>implode("\n", $arrTemplate));} private function LoadRelatedPage($a37, $a34, $a18, $a16){ if (isset($a37['page'])){ $a37['pageid'] = $a37['page']; } if ($a37['pageid']=='current'){ $page = $a34[0]; } elseif ($a37['pageid']=='parent'){ $page = $a34[count($a34)-2]; } elseif ($a37['pageid']==='0'){ $page = $this->portal; } elseif (preg_match("/^[0-9]+$/", $a37['pageid'])){ $page = $this->GetPage($a37['pageid']); } elseif ($a37['pageid']){ $lastPage = $a34[count($a34)-1]; $arrParameters = $lastPage->GetParameter($a37['pageid'], $this->editMode); if ($arrParameters['value']){ $page = $this->GetPage($arrParameters['value']); }else{ $pageid = $this->GetPageIdByReference($arrData['pageid'], $a18->language); $page = $this->GetPage($pageid); }} elseif (!$a16 && $a18){ $page = $a18; } elseif ($a18 && $a16 && ($a18->GetContentType() == 'page')){ $page = $a18; } else $page = $a34[count($a34)-1]; return $page;} private function GetPicturePath($a11, $a2){ if (in_array($a2, array(1,2,3,4))) $a2 = $this->portal->pictureSizes[(integer)$a2-1]; list ($width, $height) = split('x', $a2); $arrPData = $a11->GetPicture($width, $height); $picturePath = $this->portal->pictureDirectory; $picturePath.= '/'.$a11->fileName; $picturePath.= '-'.$arrPData['width'].'x'.$arrPData['height']; $picturePath.= $this->arrPictureExtensions[$arrPData['type']]; if ($arrPData['toPublicate'] && !$this->editMode){ if ($this->portal->watermarkPictureSize){ list ($wtWidth, $wtHeight) = split('x', $this->portal->watermarkPictureSize); if (($wtWidth<=$width) && ($wtHeight<=$height)){ $watermarkPath = $this->portal->GetWaterMarkPath(); if (!class_exists('SYSPicture')) include('SYS-Picture.php'); $tmpFilePath = SYSPicture::AddWatermarkToPicture($watermarkPath, $this->portal->watermarkPosition, $arrPData); }} if ($tmpFilePath && file_exists($tmpFilePath)){ $result = $this->ftp->UploadFile($tmpFilePath, $picturePath, FTP_BINARY); unlink($tmpFilePath); unset($tmpFilePath); }elseif (file_exists($arrPData["filePath"])){ $result = $this->ftp->UploadFile($arrPData["filePath"], $picturePath, FTP_BINARY); } if ($result) $a11->SetVersionPublicated($arrPData['width'], $arrPData['height']); $this->arrElementsCount['pictures']++; } $picturePath = str_replace("public/", "", $picturePath); return array($picturePath, $arrPData['width'], $arrPData['height']);} private function ParseHTMLHead($a15, $a14){ $headContent = $this->arrHeadTemplate['content']; $headContent = preg_replace("/<link ([^>]*)href=([\"'])/i","<link $1href=$2<%homePageRoot%>",$headContent); $headContent = preg_replace("/src=([\"'])/i","src=$1<%homePageRoot%>",$headContent); $headContent = str_replace("<%homePageRoot%><%Parameter","<%Parameter",$headContent); $headContent = str_replace("<%homePageRoot%><%homePageRoot%>","<%homePageRoot%>",$headContent); $headContent = str_replace("<%homePageRoot%>http://","http://",$headContent); $arrHTML = $this->ParseTemplate($headContent, $a15, array($a15), 0, array()); $headContent = $arrHTML['template']; $arrMetaTags = $this->SetMETATags($a15, $a14, $headContent); $headContent = implode("\n\t", $arrMetaTags)."\n".$headContent; return "\t".trim($headContent);} private function SetMETATags($a15, $a27, $a24){ if ($a24=='') $a24 = $a27; $pageId = $a15->GetId(); if ($this->arrMetaTags[$pageId]) return $this->arrMetaTags[$pageId]; $arrValues = $a15->GetMetaData($this->editMode); $title = trim($arrValues['title']); if (!$title){ $arrParam = $a15->GetParameter('name'); $title = trim($arrParam['value']); }else{ $a24 = preg_replace("/<title>[^<]*<\/title>/i", "", $a24); } $description = SYS::crop(trim($arrValues['description']), 300); if (!$description){ foreach (explode(',', $this->portal->leadParameterNames) as $name){ $arrParam = $a15->GetParameter(trim($name)); if ($arrParam['value']){ $description = SYS::crop(trim($arrParam['value']), 300); break; }}} $description = trim(preg_replace("/[\r\n]/", " ", $description)); $this->arrMetaTags[$pageId] = array(); if (!preg_match("/<meta charset/i", $a24)){ $this->arrMetaTags[$pageId][] = '<meta charset="'.$this->portal->charCode.'" />'; } if (!preg_match("/<title>/i", $a24)){ $this->arrMetaTags[$pageId][] = '<title>'.$title.'</title>'; } if (!preg_match("/<meta name=\"description\"/i", $a24)){ $this->arrMetaTags[$pageId][] = '<meta name="description" content="'.str_replace('"', '\"', trim($description)).'" />'; } $this->arrMetaTags[$pageId][] = '<meta name="distribution" content="local" />'; if (!$this->editMode){ $arrGlobalKeywords = explode(',',trim($this->portal->GetKeywords($a15->languageId))); $arrCustomedKeywords = explode(',', $arrValues['keywords']); $arrValidGlobalKeywords = array(); $arrChars = array('.', '_', '/', '_', '(', ')'); $content = strip_tags($a27); for ($i=0;$i<count($arrGlobalKeywords);$i++){ $keyword = trim($arrGlobalKeywords[$i]); if (!$keyword) continue; $keyword = str_replace('"', '\"', $keyword); foreach ($arrChars as $char) $keyword = str_replace($char, "\\".$char, $keyword); if (preg_match("/[^a-z]".$keyword."[^a-z]/i", $content)) $arrValidGlobalKeywords[] = str_replace('"', '\"',trim($arrGlobalKeywords[$i])); } if (count($arrCustomedKeywords)){ for ($i=0;$i<count($arrCustomedKeywords);$i++){ $keyword = trim($arrCustomedKeywords[$i]); if ($keyword) $arrCustomedKeywords[$i] = str_replace('"', '\"', $keyword); } $arrKeywords = array_merge($arrCustomedKeywords, $arrValidGlobalKeywords); }else{ $arrKeywords = $arrValidGlobalKeywords; } if (!$arrKeywords[0]) unset($arrKeywords[0]); $arrKeywords = array_chunk($arrKeywords, 20); $arrKeywords = $arrKeywords[0]; if (!preg_match("/<meta name=\"keywords\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta name="keywords" content="'.implode(", ", $arrKeywords).'" />'; if (!preg_match("/<meta name=\"author\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta name="author" content="proaction Kft." />'; if (!preg_match("/<meta name=\"copyright\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta name="copyright" content="All rights reserved" />'; $this->arrMetaTags[$pageId][] = '<meta name="generator" content="Eplos CMS 3.0" />'; $this->arrMetaTags[$pageId][] = '<meta name="robots" content="index, follow" />'; if (!$this->portal->HasProperty(35)){ $this->arrMetaTags[$pageId][] = '<base href="'.$this->arrHostingInfo['hostURL'].'" />'; if (!preg_match("/<meta itemprop=\"name\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta itemprop="name" content="'.str_replace('"', '\"', $title).'" />'; if (!preg_match("/<meta itemprop=\"description\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta itemprop="description" content="'.str_replace('"', '\"', trim($description)).'" />'; if (!preg_match("/<meta property=\"og:title\"/i", $a24)) $this->arrMetaTags[$pageId][] = '<meta property="og:title" content="'.str_replace('"', '\"', $title).'" />'; if (!preg_match("/<meta property=\"og:image\"/i", $a24)) if ($pictureId = $a15->GetOnePicture()){ if (!isset($this->arrPictures[$pictureId])) $this->arrPictures[$pictureId] = new BFLPicture($pictureId); $picture = $this->arrPictures[$pictureId]; list($picturePath) = $this->GetPicturePath($picture, "600x200"); if ($picturePath){ $this->arrMetaTags[$pageId][] = '<meta property="og:image" content="'.$this->arrHostingInfo['hostURL'].$picturePath.'" />'; } } }} return $this->arrMetaTags[$pageId];} private function escapeSQL($a30){ return str_replace(array('\\', "\0", "\n", "\r", "'", "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\Z'), $a30);} function GetElementsCount(){return $this->arrElementsCount;}function GetErrorMessage(){return $this->errorMessage;}function GetHostingInfo(){return $this->arrHostingInfo;}function GetUnresolvedPageReferences(){return $this->unresolvedPageReferences;}} function EvalPHPBuffer($a32) {if (!trim($a32[1])) return ''; ob_start(); eval($a32[1]); $result = ob_get_contents(); ob_end_clean(); return $result; }
?>
Function Calls
None |
Stats
MD5 | a0a3336791c11848dbee0704322719ee |
Eval Count | 0 |
Decode Time | 410 ms |