/**
* phpwcms content management system
*
* @author Oliver Georgi
* @copyright Copyright (c) 2002-2021, Oliver Georgi
* @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
* @link http://www.phpwcms.org
*
**/
// set page processiong start time
list($usec, $sec) = explode(' ', microtime());
$phpwcms_rendering_start = $usec + $sec;
// define some general vars
$content = array();
$phpwcms = array();
$BL = array();
$template_default = array();
$indexpage = array();
// load general configuration
$basepath = str_replace('\\', '/', dirname(__FILE__));
if(!is_file($basepath.'/include/config/conf.inc.php')) {
if(is_file($basepath.'/setup/index.php')) {
header('Location: setup/index.php');
exit();
}
die('Error: Config file missing. Check your setup!');
}
require_once $basepath.'/include/config/conf.inc.php';
require_once $basepath.'/include/inc_lib/default.inc.php';
require_once PHPWCMS_ROOT.'/include/inc_lib/helper.session.php';
require_once PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php';
// Get user Agent BOT check
$IS_A_BOT = $phpwcms['USER_AGENT']['bot'];
// start session - neccessary if frontend users are available
// but neccessary also to check if a bot is visiting the site
// -> if so then do not initialize session for larger search engines
if(!$IS_A_BOT && (!empty($phpwcms['SESSION_FEinit']) || isset($_GET['phpwcms-preview']))) {
_initSession();
}
// some initial actions
cleanupPOSTandGET();
buildGlobalGET();
define('FE_CURRENT_URL', abs_url(array(),array('phpwcms_output_action')) );
// init some special rights and also frontend edit
init_frontend_edit();
// buffer everything
ob_start();
$content['page_end'] = '';
require_once PHPWCMS_ROOT.'/include/config/conf.template_default.inc.php';
require_once PHPWCMS_ROOT.'/include/config/conf.indexpage.inc.php';
require_once PHPWCMS_ROOT.'/include/inc_lib/general.inc.php';
require_once PHPWCMS_ROOT.'/include/inc_front/cnt.lang.inc.php';
require_once PHPWCMS_ROOT.'/include/inc_lib/modules.check.inc.php';
require_once PHPWCMS_ROOT.'/include/inc_lib/article.contenttype.inc.php';
require PHPWCMS_ROOT.'/include/inc_lib/imagick.convert.inc.php';
require PHPWCMS_ROOT.'/include/inc_front/front.func.inc.php';
require PHPWCMS_ROOT.'/include/inc_front/ext.func.inc.php';
require PHPWCMS_ROOT.'/include/inc_front/content.func.inc.php';
// SEO logging
if(!empty($phpwcms['enable_seolog']) && !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) === false) {
$phpwcms['seo_referrer_data'] = seReferrer( $_SERVER['HTTP_REFERER'] );
if( is_array( $phpwcms['seo_referrer_data'] ) ) {
$phpwcms['seo_referrer_data']['hash'] = md5(strtolower($phpwcms['seo_referrer_data']['domain'].$phpwcms['seo_referrer_data']['query']));
@_dbInsert('phpwcms_log_seo', $phpwcms['seo_referrer_data'], 'DELAYED');
}
}
$phpwcms["templates"] = TEMPLATE_PATH;
$content['page_start'] = sprintf(
PHPWCMS_DOCTYPE,
$phpwcms['htmlhead_inject_prefix'],
str_replace( '{DOCTYPE_LANG}', $phpwcms['DOCTYPE_LANG'], PHPWCMS_DOCTYPE_LANG ) . ' id="'.str_replace(array('.','/'), '-', PHPWCMS_HOST).'"',
empty($content['htmltag_inject']) ? '' : ' '.$content['htmltag_inject'],
$phpwcms['htmlhead_inject_suffix'],
sprintf(PHPWCMS_HEADER_COMMENT, empty($phpwcms['header_comment']) ? '' : LF . ' ' . trim($phpwcms['header_comment']) . LF),
$phpwcms['htmlhead_inject']
);
// Compatibility Mode
if(!empty($phpwcms['X-UA-Compatible'])) {
$content['page_start'] .= '
}
// HTML5 does not like content-style-type
if($phpwcms['mode_XHTML'] != 3) {
$content['page_start'] .= '
$content['page_start'] .= '
} else {
$content['page_start'] .= '
}
// Viewport setting
if(!empty($phpwcms['viewport'])) {
$content['page_start'] .= '
}
// Base Href
if(!empty($phpwcms['base_href'])) {
if($phpwcms['base_href'] === true) {
$content['page_start'] .= '
} else {
$content['page_start'] .= '
$phpwcms['base_href'] = true;
}
} else {
$phpwcms['base_href'] = false;
}
$content['page_start'] .= '
'.html_specialchars($content["pagetitle"]).''.LF;// Deprecated custom page CSS
$content['page_start'] .= get_body_attributes($pagelayout);
// Add all CSS files here
if(count($block['css'])) {
foreach($block['css'] as $value) {
$content['page_start'] .= '
}
}
$content['page_start'] .= $block["htmlhead"];
if(!empty($phpwcms['IE7-js']) && $phpwcms['USER_AGENT']['agent'] == 'IE' && version_compare($phpwcms['USER_AGENT']['version'], '9.0', '
$content['page_start'] .= ' '.LF;
}
$content['page_start'] .= ''.LF;
if(!$phpwcms['base_href'] && $phpwcms['rewrite_url'] && strpos($content['page_start'], '
$content['page_start'] = str_replace('
', '', $content['page_start']);}
// inject body tag in case of class or id attribute
$content['page_start'] .= '
if(!empty($template_default['body']['id'])) {
$content['page_start'] .= ' id="'.$template_default['body']['id'].$content['body_id'].'"';
}
if(!empty($template_default['body']['class'])) {
$content['page_start'] .= ' class="'.$template_default['body']['class'].$content['body_id'].'"';
}
$content['page_start'] .= '>'.LF;
// this regex's inits rewrite
if(PHPWCMS_REWRITE) {
$content["all"] = preg_replace_callback('/( href| action)(="index.php\?)([a-zA-Z0-9@,\.\+\-_\*#\/%=&;]+?)"/', 'url_search', $content["all"]);
$content["all"] = preg_replace_callback('/οnclick="location.href=\'index.php\?([a-zA-Z0-9@,\.\+\-_\*#\/%=&;]+?)\'/', 'js_url_search', $content["all"]);
if(PHPWCMS_REWRITE_EXT && strpos($content["all"], PHPWCMS_REWRITE_EXT.'&')) {
$content['all'] = str_replace(PHPWCMS_REWRITE_EXT.'&', PHPWCMS_REWRITE_EXT.'?', $content["all"]);
}
$content['all'] = str_replace('img/cmsimage.php', 'im', $content['all']);
$content['page_start'] = str_replace('img/cmsimage.php', 'im', $content['page_start']);
}
$content['all'] = str_replace('{PHPWCMS_RESIZE_IMAGE}', PHPWCMS_RESIZE_IMAGE, $content['all']);
// real page ending
if(count($block['bodyjs'])) {
$content['page_end'] .= implode(LF, $block['bodyjs']);
}
if(!empty($phpwcms['browser_check']['fe'])) {
$content['page_end'] .= '
if(!empty($phpwcms['browser_check']['vs'])) {
$content['page_end'] .= 'vs:' . $phpwcms['browser_check']['vs'];
}
$content['page_end'] .= '}; ';
}
$content['page_end'] .= LF.''.LF.'