pageHeader(); // Check we’re displaying an allowable block. $block_id = WT_Filter::getInteger('block_id'); if (array_key_exists($block_id, $blocks['main'])) { $module_name = $blocks['main'][$block_id]; } elseif (array_key_exists($block_id, $blocks['side'])) { $module_name = $blocks['side'][$block_id]; } else { exit; } if (array_key_exists($module_name, $all_blocks)) { $class_name = $module_name . '_WT_Module'; $module = new $class_name; $module->getBlock($block_id); } if (WT_DEBUG) { echo execution_stats(); } if (WT_DEBUG_SQL) { echo WT_DB::getQueryLog(); } exit; } $controller = new WT_Controller_Page(); if ($ctype === 'user') { $controller->restrictAccess(Auth::check()); } $controller ->setPageTitle($ctype === 'user' ? WT_I18N::translate('My page') : WT_TREE_TITLE) ->setMetaRobots('index,follow') ->setCanonicalUrl(WT_SCRIPT_NAME . '?ctype=' . $ctype . '&ged=' . WT_GEDCOM) ->pageHeader() // By default jQuery modifies AJAX URLs to disable caching, causing JS libraries to be loaded many times. ->addInlineJavascript('jQuery.ajaxSetup({cache:true});'); if ($ctype === 'user') { echo '
'; echo '

', WT_I18N::translate('My page'), '

'; } else { echo '
'; } if ($blocks['main']) { if ($blocks['side']) { echo '
'; } else { echo '
'; } foreach ($blocks['main'] as $block_id => $module_name) { $class_name = $module_name . '_WT_Module'; $module = new $class_name; if ($SEARCH_SPIDER || !$module->loadAjax()) { // Load the block directly $module->getBlock($block_id); } else { // Load the block asynchronously echo '
 
'; $controller->addInlineJavascript( 'jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '");' ); } } echo '
'; } if ($blocks['side']) { if ($blocks['main']) { echo '
'; } else { echo '
'; } foreach ($blocks['side'] as $block_id => $module_name) { $class_name = $module_name . '_WT_Module'; $module = new $class_name; if ($SEARCH_SPIDER || !$module->loadAjax()) { // Load the block directly $module->getBlock($block_id); } else { // Load the block asynchronously echo '
 
'; $controller->addInlineJavascript( 'jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '");' ); } } echo '
'; } echo '
';