//error_reporting(E_ALL);
//error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
//ini_set('display_errors',1);ini_set('log_errors',1);ini_set('error_log',ZDEF_PATH_TO_WEHUB_ACCOUNT.'error-logs/php-error.log');
ob_start();
define(ZDEF_MAX_IMAGE_DOWNLOAD_WIDTH,3840); // Mac 27" monitor is 3840 (16:9)
if(!ZDEF_AJAX_PAGE_LOAD){
?>
/* this allows us to autofocus this field without actaully making it a part of the list of elements that can be tabbed into */?>
if(!WEBPAGE_IS_LANDING_PAGE && ZDEF_NOIMGS!==1){ // ZDEF_NOIMGS is a flag used when resizing browser to get coerced .img_ sizes so we don't need images and we don't need a header because headers have no coerced images
$head=ZDEF_PATH_TO_SUBDOMAIN.'gbl/head.inc.php';
if(ZDEF_TEST==1 && !file_exists($head))errorMessage('Local Header not Found: '.$head);
if(!file_exists($head)){
//if(defined('ORG_LIBRARY_VERSION ')){
//$head=ZDEF_PATH_TO_LIBRARY.'webpages/gbl/head'.ORG_LIBRARY_VERSION .'.inc.php';
//}else{
$head=ZDEF_PATH_TO_LIBRARY.'webpages/gbl/head.inc.php';
//}
}
if(ZDEF_TEST==1 && !file_exists($head))errorMessage('Header not Found: '.$head);
include $head;// we make sure to compress the heading so we don't get gaps between the menu list items because of white space
}
$requestForSQLOnly=false;// we're just doing housekeeping here
}
if( USER_IS_LOGGED_IN==1 && WEBPAGE_ITEM_PUBLISHER_TOOLKIT!='' && !in_array(WEBPAGE_ITEM_PUBLISHER_TOOLKIT,$cln_wgl) ){
// $theWidgets[WEBPAGE_ITEM_PUBLISHER_TOOLKIT]='';
// $theWidgets[WEBPAGE_ITEM_PUBLISHER_TOOLKIT.'_'.WEBPAGE_ITEM_TYPE]='';
}
if(1==2 && WEBPAGE_ITEM_TOOLKIT!=''){
include ZDEF_PATH_TO_LIBRARY.'widgets/toolkit.widget.php';// this includes the toolkit when it is needed on the first page loaded
}
$webpage=ZDEF_PATH_TO_WEBPAGE;
if(!file_exists($webpage)){
if(ZDEF_TEST==1 || ZDEF_FORCEVARS===ZDEF_TESTSTRING){
echo getcwd();
echo ' (from WPC) body path was '.$webpage.' ';
echo str_repeat('ERR ',200);flush();die;
}
$webpage=ZDEF_PATH_TO_LIBRARY.'webpages/'.substr(ZDEF_RESOURCE_NAME,0,-4).'.inc.php';
if(ZDEF_TEST==1){echo 'library path was '.$webpage;}
if(!file_exists($webpage)){
$webpage = ZDEF_PATH_TO_LIBRARY.'webpages/page-not-found.inc.php'; // this is the central server page-not-found, zztest checks for the webpage record, this is the check for the existence of the actual webpage. Both will end up on page-not-found eventually if necessary
define('WEBPAGE_NOT_FOUND',1);
}
}
echo '
';// this div contains all the body tiers and is used in page swaps
if(USER_IS_LOGGED_IN==1)require_once 'jensiis/insert.PHP.markers.inc.php';
if(WEBPAGE_ITEMDEF_ID!=0){// get a section header if one exists
// get the item section header code if a section exists
$sectionHeader=false;
if(WEBPAGE_SAVED_VERSION=='1'){
$sectionHeader=ZDEF_PATH_TO_SUBDOMAIN.'saved/'.WEBPAGE_ITEM_TYPE.'/'.WEBPAGE_ITEM_TYPE.'.section.header.inc.php';
if(!file_exists($sectionHeader))$sectionHeader=false;
}
if(!$sectionHeader)$sectionHeader=ZDEF_PATH_TO_SUBDOMAIN.'published/'.WEBPAGE_ITEM_TYPE.'/'.WEBPAGE_ITEM_TYPE.'.section.header.inc.php';
if(file_exists($sectionHeader)){
//if(USER_IS_LOGGED_IN==1){$webpageHTML=file_get_contents($sectionHeader);$webpageHTML=insertPHPMarkers($webpageHTML);eval('?'.'>'.$webpageHTML.'<'.'?');}else{ DO NOT have any PHP in section headers until you figure out how to keep phpinsert numbers from starting at 1 again for the page body
require $sectionHeader;
}
}
if(USER_IS_LOGGED_IN==1){
$webpageHTML=file_get_contents($webpage);// $webpageHTML will be defined in zztest IF we are in the publisher doing a Rollback. HTML usually comes from the flat file in /published.
$webpageHTML=insertPHPMarkers($webpageHTML);
eval('?'.'>'.$webpageHTML.'<'.'?');// we can use eval because php snippets do not contain any user-provided code. All code that is not php snippet can be eval'd because HTML purifier escapes any php markers < ? ? >
}else{
require $webpage;
}
if(WEBPAGE_ITEMDEF_ID!=0 && WEBPAGE_IS_ITEM_INDEX!=1){// get a section footer if one exists and if we aren't on the itemindex
$sectionFooter=false;
if(WEBPAGE_SAVED_VERSION=='1'){
$sectionFooter=ZDEF_PATH_TO_SUBDOMAIN.'saved/'.WEBPAGE_ITEM_TYPE.'/'.WEBPAGE_ITEM_TYPE.'.section.footer.inc.php';
if(!file_exists($sectionFooter))$sectionFooter=false;
}
if(!$sectionFooter)$sectionFooter=ZDEF_PATH_TO_SUBDOMAIN.'published/'.WEBPAGE_ITEM_TYPE.'/'.WEBPAGE_ITEM_TYPE.'.section.footer.inc.php';
if(file_exists($sectionFooter)){
//if(USER_IS_LOGGED_IN==1){$webpageHTML=file_get_contents($sectionFooter);$webpageHTML=insertPHPMarkers($webpageHTML);eval('?'.'>'.$webpageHTML.'<'.'?');}else{ DO NOT have any PHP in section headers until you figure out how to keep phpinsert numbers from starting at 1 again for the page body
require $sectionFooter;
}
}
$requestForSQLOnly=false;// we're just doing housekeeping here
echo '
'; // close b_
if(!ZDEF_AJAX_PAGE_LOAD){
if(!WEBPAGE_IS_LANDING_PAGE && ZDEF_NOIMGS!==1){ // ZDEF_NOIMGS is a flag used when resizing browser to get coerced .img_ sizes so we don't need images and we don't need a footer because footers have no coerced images ){
$foot=ZDEF_PATH_TO_SUBDOMAIN.'gbl/foot.inc.php';
if(!file_exists($foot)){
$foot=ZDEF_PATH_TO_LIBRARY.'webpages/gbl/foot.inc.php';
}
if(!file_exists($foot))errorMessage('Footer not Found: '.$foot);
include $foot;
if(ORG_PRIVACY_POPUP!=='')require ZDEF_PATH_TO_SUBDOMAIN.'published/'.ORG_PRIVACY_POPUP;
}
echo '
';
if(USER_IS_LOGGED_IN==1){
echo '
';
dbSel($db,ZDEF_DATA_DB_NAME,'ssv21a');// select the 'data' data base
require ZDEF_PATH_TO_LIBRARY.'jensiis/jensiis.controls.inc.php';
require ZDEF_PATH_TO_LIBRARY.'jensiis/resource.panel.inc.php';
echo '
';
}
}?>
/* closes wpg */ ?>
$output=ob_get_contents();
ob_end_clean();
if(ZDEF_TEST!==1)$output=str_replace(array("\n", "\t", "\r"),'',$output);
//trim(preg_replace('/\t+/', '', $string))
// DOMDocument changes html. don't write the DOMDocument
$doc = new DOMDocument();
libxml_use_internal_errors(true);// prevent html format errors from bubbling up to my error handler
$doc->loadHTML($output);
$xpath = new DomXPath($doc);
require_once('WPC.widget.definitions.inc.php');
function uStartsWith($a){
foreach($a as $class){
if (strpos($class, 'u') === 0){
if(is_numeric(substr(str_replace('_','',$class),1)))return $class;
}
}
return '';
}
//=================== LOOK FOR OPENGRAPH and TITLE/DESCRIPTION information embedded in generated page (e.g. obituaries)
//$expression = './/*[starts-with(name(@*),"data_")]';
//$expression = './/div[@id='..' or @class=']';
$expression = '//*[@data_ogurl or @data_ogtitle or @data_ogimg]';
$nodes = $xpath->query($expression);
// this data overrides the constants set in zztest because it is defined first
foreach($nodes as $node){
foreach( $node->attributes as $attr ){
if( $attr->nodeName !='class' && $attr->nodeName != 'id' ){
$dataName=$attr->nodeName;
$value=$attr->nodeValue;
if($dataName=='data_ogtitle'){define('WEBPAGE_OG_TITLE',$value);define('WEBPAGE_TITLE',$value);}
if($dataName=='data_ogimg')define('WEBPAGE_OG_IMAGE',$value);
if($dataName=='data_ogurl')define('WEBPAGE_OG_URL',$value);
}
}
}
//echo '