<?php

// cb.php
// -------------------------------------------------------------------------------------------------
// Clear any cached brand options, SEO and substritutions, then redirect user to previous page
//
// Revision   > $Rev: 83 $
// Date		  > $Date: 2009-06-29 11:25:53 +0100 (Mon, 29 Jun 2009) $
// Author     > RAK for DML
// Copyright  > (C) Digital Mail Limited (2005-2009)
// -------------------------------------------------------------------------------------------------

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

session_name('DMXSessionID');
session_start();
unset($_SESSION['ABS_OPT'], $_SESSION['ABS_SEO'], $_SESSION['ABS_SUB']);
setcookie('dmb1_backup_session_ref', '', 1); // 0 denotes eternal
session_write_close();

$abs_root = '';
@include(DOCROOT . '/abs_version_control.php');
$fwd = isset($_GET['fwd']) ? $_GET['fwd'] : '/';
header('LOCATION: ' . $abs_root . $fwd);
exit;

?>