<?php
// Call in the XComponents engine and options file
define('MOD_PHP', substr(PHP_SAPI, 0, 3) != 'cgi'); // Are we running as mod_php?
define('DOCROOT', 
	MOD_PHP && isset($_SERVER['DOCUMENT_ROOT']) ? 
		$_SERVER['DOCUMENT_ROOT'] : 
		(
			MOD_PHP && isset($_SERVER['SCRIPT_FILENAME']) ? 
				substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) : 
				(
					substr(str_repeat('../', count(explode('/', preg_replace('_/+_', '/', $_SERVER['PHP_SELF'])))-2), 0, -1) != '' ?
						substr(str_repeat('../', count(explode('/', preg_replace('_/+_', '/', $_SERVER['PHP_SELF'])))-2), 0, -1) :
						'.'
				)
		)
	);
include(DOCROOT . '/dmx/dmx_options.php');
include(DOCROOT . '/dmx/core/php/dmx_shop_handler.php');
include(DOCROOT . '/dmx/core/php/dmx_shop_components.php');

// Abs code starts here
$abs_root = '';
@include(DOCROOT . '/abs_version_control.php');
include(DOCROOT . $abs_root . '/common/header.php');
?>

	<?php
	// Search adaptingbody directory to get list of adaptable bodies
	$dh = dir($abs_adapt_body);
	while ($entry = $dh->read()) {
		if ($entry != '.' && $entry != '..' && substr($entry, 0, 2) != '._' && $entry != '.DS_Store' && $entry != 'index.php' && substr($entry, -9) != '_demo.php') {
			$ab[] = $entry;
		}
	}
	$dh->close();
	?>

<!-- MAIN CONTENT AREA -->
<div id="main_area" onmouseover="sub_menu_hide();">
	<div id="main_area_content">
		
		<div class="main_column">
		<!-- ----------------- -->
		<!-- BEGIN MAIN COLUMN -->
		<!-- ----------------- -->
			
<h1>Adapting body index page</h1>

<p><b>This site contains the following adapting bodies...</b></p>

<p>
<?php
// Show fragments that appear in the main column
for ($i=0; $i<count($ab); $i++) {
	echo '<a href=' . substr($ab[$i], 0, strlen($ab[$i])-4) . '_demo.php>' . $ab[$i] . '</a><br>' . "\n";
}
?>
</p>

		<!-- --------------- -->
		<!-- END MAIN COLUMN -->
		<!-- --------------- -->
		</div>
		
		<div class="sidebar">
		<!-- ------- -->
		<!-- SIDEBAR -->
		<!-- ------- -->
					
<div class="sidebar_box_heading">
	<h2>Controls</h2>
</div>
<div class="sidebar_box_content">
	<div>
		
		<p>
		<a href="../index.php">CMS control centre</a><br>
		</p>
		
		<p>
		<a href="../fragment/index.php">Fragment index</a><br>
		</p>
				
	</div>
</div>

		<!-- ----------- -->
		<!-- END SIDEBAR -->
		<!-- ----------- -->
		</div>
		
	</div>
</div>
<!-- END MAIN CONTENT AREA -->

<?php include(DOCROOT . $abs_root . '/common/footer.php'); ?>
