<?php

// toolbar.php
// -----------------------------------------------------------------------------
// The admin toolbar for dmABS pages
//
// Project    > A16-dmABS-1.6-Feb09
// Copyright  > (C) Digital Mail Limited (2005 - 2009)
// Author     > RAK for DML
// -----------------------------------------------------------------------------

// Set unique key to ensure the next 'abs_action' comes from the site, and not another server
// This is passed back with the 'abs_action' command, and must be identical for the command to be followed
$_SESSION['ABS_AUTH']['key'] = md5(time());

$abs_self = $_SERVER['PHP_SELF'];
if (strpos($abs_self, '?') !== FALSE) $abs_self = substr($abs_self, 0, strrpos($abs_self, '?'));

?>

<!-- ADMIN TOOLBAR -->
<div id="admin_toolbar" style="display: <?=$abs_toolbar_display;?>">

	<div style="display: none;">
		<form name="toolbar_logout_form" method="post" action="<?=$abs_root;?>/common/authenticate.php">
		<input type="hidden" name="abs_auth_command" value="1" />
		<input type="hidden" name="abs_action" value="logout" />
		<input type="hidden" name="destination" value="<?=$abs_self;?>" />
		<input type="hidden" name="key" value="<?=$_SESSION['ABS_AUTH']['key'];?>" />
		</form>
	</div>
	
	<!-- RHS -->
	<div style="float: right;">
		<a href="#" onclick="abs_toolbar_show(0);">X</a>
	</div>
	
	<?php if ($abs_authorised) : ?>
		<div style="float: right; padding-right: 15px;">
			&nbsp;CURRENT VERSION &gt; <?=$abs_content['version'];?>
			( <?php echo(substr($abs_content['today'], -2) . '-' . substr($abs_content['today'], 4, 2) . '-' . substr($abs_content['today'], 0, 4)); ?> )
		</div>
	<?php endif; ?>
	
	<div id="devtag" style="float: right; padding-right: 15px;">
		<?php if (isset($dmx_debug_settings->send_tstd) && $dmx_debug_settings->send_tstd && $dmx_debug_settings->tstd != '') : ?>
			DEV TAG &gt; <?=$dmx_debug_settings->tstd;?>
		<?php endif; ?>
	</div>
	<!-- END RHS -->
	
	<ul id="tbarmenu_1">
		<li style="width: 130px; padding-top: 1px;"><?php if ($abs_authorised) : ?>ADMIN<?php else: ?>VISITOR<?php endif; ?> TOOLBAR  &gt;</li>
		<li><a href="#">Actions</a>
			<ul>
				<?php if ($abs_authorised) : ?>
					<li><a href="#" onclick="abs_toggle_edit_buttons(); return false;">Toggle EDIT buttons</a></li>
				<?php else: ?>
					<li><span>Toggle EDIT buttons</span></li>
				<?php endif; ?>
				<li><a href="#" class="popup" onclick="window.open('<?=$abs_root;?>/admin/substitutions.php', 'substitutions', 'width=600,height=' + document.documentElement.offsetHeight + ',scrollbars=yes');">Show Site Glossary</a></li>
				<li><a href="#" onclick="abs_show_sidepage('debugging_controls');">Show Debugging Controls</a></li>
				<li><a href="/dmx/server/" target="_blank" class="popup">Show Server Test Page</a></li>
				<li><a href="#" onclick="abs_clear_session('<?=$abs_root;?>', event);">Clear Current Session</a></li>
				<?php if ($abs_authorised) : ?>
					<li><a href="#" onclick="document.toolbar_logout_form.submit();">Logout</a></li>
				<?php elseif ($abs_sitemode == 'ADAPTED') : ?>
					<li><a href="<?=$abs_root;?>/admin/login.php?destination=<?=$abs_self;?>">Login to Admin Area</a></li>
				<?php else: ?>
					<li><span>Login</span></li>
				<?php endif; ?>
			</ul>
		</li>
		<?php if (!empty($abs_toolbar_extras)) : ?>
			<li><a href="#">Extras</a>
				<ul>
					<?php foreach ($abs_toolbar_extras as $extra) : ?>
						<li><a href="<?=$extra['href'];?>" onclick="<?=$extra['onclick'];?>"><?=$extra['text'];?></a></li>
					<?php endforeach; ?>
				</ul>
			</li>
		<?php else: ?>
			<li><span>Extras</span></li>
		<?php endif; ?>
		<li>
			<a href="#">Go to</a>
			<ul>
				<?php if ($abs_sitemode == 'ADAPTED') : ?>
					<li><a href="<?=$abs_root;?>/admin/">dmABS Admin Area</a></li>
				<?php endif;?>
				<li><a href="http://my.dmclub.net/DMCAdmin" target="_blank" class="popup">dmAdmin (at dmClub)</a></li>
				<li><a href="http://notes.dmclub.net/dealer_releases" target="_blank" class="popup">dmABS Area in dmNotes</a></li>
			<ul>
		</li>
	</ul>
	
</div>
<!-- END ADMIN TOOLBAR -->

