<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

require_once('panel.class.php');

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) :
						'.'
				)
		)
	);

// -------------------------------------------------------------------------------------------------
// SET CONFIGURABLE OPTIONS
// -------------------------------------------------------------------------------------------------
	
define('ABS_ROOT', 			DOCROOT . DIRECTORY_SEPARATOR . '_CONTENT');
define('VERSION', 			'english_2');
define('DEFAULT_VERSION', 	'english_1');
define('TODAY', 			'20080209');

// Now find these panels
$find[] = 'numbers-0800--main1';
$find[] = 'numbers-0800--main2';
$find[] = 'numbers-0800--side1';
$find[] = 'fragment--sp_four_step_signup';
$find[] = 'dmshop-tariffs--public-ec-uk-ngn-free-entry';
$find[] = 'dmshop-tariffs--public-ec-uk-ngn-free-pro';
$find[] = 'dmshop-tariffs--public-ec-uk-ngn-free-enterprise';
$find[] = 'dmshop-tariffs--public-ec-uk-ngn-free-voice';
$find[] = 'dmshop-tariffs--public-ec-uk-ngn-free-fax';
$find[] = 'dmshop-tariffs--public-ec-uk-ngn-free-switchboard';

// -------------------------------------------------------------------------------------------------

$panel = new Panel(ABS_ROOT, VERSION, DEFAULT_VERSION, TODAY);

foreach($find as $p)
{
	list($owner, $panel_id) = explode('--', $p);
	$result = $panel->request($owner, $panel_id);
	echo('<p>Looking for ' . $p .  '<br />');
	echo('<font color="red">' . $result . '</font></p>');
}

echo($panel->debug->debug_msg);
$panel->debug_msg = '';
echo('<pre>' . print_r($panel, 1) . '</pre>');

?>