<?php
//admin section redirections
if (!isset($afbAccount) || $afbAccount->account['account_admin'] !== 'yes'){
	//jump to home
	header("Location: http://".trim($_SERVER['HTTP_HOST'],'/').BASEURL);
	exit();
}


?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><?php echo $thispage['title']; ?> :: <?php echo getLangTerm('administration',false); ?> :: <?php echo strtolower(trim($_SERVER['HTTP_HOST'],'/')); ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<style type="text/css" media="all">@import "<?php echo BASEURL; ?>_includes/admin/theme/style.css.php";</style>
	<script type="text/javascript" src="<?php echo BASEURL; ?>_js/core.js.php"></script>
	<script type="text/javascript" src="<?php echo BASEURL; ?>_includes/admin/theme/theme.js.php"></script>
	<?php
	if ($thispage['calendar']){
		?>
		<script type="text/javascript" src="<?php echo BASEURL; ?>_includes/admin/theme/calendar.js.php"></script>
		<link type="text/css" rel="stylesheet" href="<?php echo BASEURL; ?>_includes/admin/theme/calendar.css.php">
		<script>
		YAHOO.namespace("example.calendar");

		var cal1SelectHandler = function(type,args,obj) { 
			var s = args[0].toString(); 
			var s = s.replace(/(,)/g,'-');
			xGetElementById('cal1_output').value = s;
			var selected = args[0];
			var t = this._toDate(selected[0]); 
			xInnerHtml('cal1_text',t.getDateString('%date%ord of %month, %year'));
			YAHOO.example.calendar.cal1.hide();
			
		};
		
		var cal2SelectHandler = function(type,args,obj) { 
			var s = args[0].toString(); 
			var s = s.replace(/(,)/g,'-');
			xGetElementById('cal2_output').value = s;
			var selected = args[0];
			var t = this._toDate(selected[0]); 
			xInnerHtml('cal2_text',t.getDateString('%date%ord of %month, %year'));
			YAHOO.example.calendar.cal2.hide();
		};
		
		//calinit
		function calinit() {
			YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1Container1", { title:"Please make a selection:", close:true });
			// Listener to show the 3-up Calendar when the button is clicked 
			YAHOO.util.Event.addListener("cal1_select", "click", YAHOO.example.calendar.cal1.show, YAHOO.example.calendar.cal1, true); 
			
			YAHOO.example.calendar.cal1.selectEvent.subscribe(cal1SelectHandler, YAHOO.example.calendar.cal1, true);
			<?php if ($thispage['cal1_year'] && $thispage['cal1_month'] && $thispage['cal1_day']) { ?>
			YAHOO.example.calendar.cal1.select('<?php echo $thispage['cal1_month']; ?>/<?php echo $thispage['cal1_day']; ?>/<?php echo $thispage['cal1_year']; ?>');
			YAHOO.example.calendar.cal1.setYear(<?php echo $thispage['cal1_year']; ?>);
			YAHOO.example.calendar.cal1.setMonth(<?php echo $thispage['cal1_month']; ?>);
			YAHOO.example.calendar.cal1.subtractMonths(1);
			<?php } ?>
			YAHOO.example.calendar.cal1.render();
			
			YAHOO.example.calendar.cal2 = new YAHOO.widget.Calendar("cal1","cal1Container2", { title:"Please make a selection:", close:true });
			// Listener to show the 3-up Calendar when the button is clicked 
			YAHOO.util.Event.addListener("cal2_select", "click", YAHOO.example.calendar.cal2.show, YAHOO.example.calendar.cal2, true); 
			YAHOO.example.calendar.cal2.selectEvent.subscribe(cal2SelectHandler, YAHOO.example.calendar.cal2, true);
			<?php if ($thispage['cal2_year'] && $thispage['cal2_month'] && $thispage['cal2_day']) { ?>
			YAHOO.example.calendar.cal2.select('<?php echo $thispage['cal2_month']; ?>/<?php echo $thispage['cal2_day']; ?>/<?php echo $thispage['cal2_year']; ?>');
			YAHOO.example.calendar.cal2.setYear(<?php echo $thispage['cal2_year']; ?>);
			YAHOO.example.calendar.cal2.setMonth(<?php echo $thispage['cal2_month']; ?>);
			YAHOO.example.calendar.cal2.subtractMonths(1);
			<?php } ?>
			YAHOO.example.calendar.cal1.render();
			
			YAHOO.util.Event.addListener("cal1_select", "click", YAHOO.example.calendar.cal2.hide, YAHOO.example.calendar.cal2, true);
			YAHOO.util.Event.addListener("cal2_select", "click", YAHOO.example.calendar.cal1.hide, YAHOO.example.calendar.cal1, true);
			
		}
		YAHOO.util.Event.addListener(window, "load", calinit);
		</script>
		<?php
	} //end calendar
	
	if ($thispage['editor']) {
		?>
		<script type="text/javascript" src="<?php echo BASEURL; ?>tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script language="javascript" type="text/javascript">
			tinyMCE.init({
				mode : "exact",
				elements : "<?php echo implode(',',$thispage['editor_elements']); ?>",
				theme : "advanced",
				theme_advanced_layout_manager : "SimpleLayout",
				plugins : "table,advhr,advimage,link,advlink,searchreplace,paste,noneditable,caption,ibrowser,contextmenu,flash",
				<?php if ($thispage['editor_readonly']) { ?>
					theme_advanced_buttons1 : "",
					theme_advanced_buttons2 : "",
					theme_advanced_buttons3 : "",
					theme_advanced_statusbar_location : "none",
				<?php } elseif ($thispage['editor_simple']) { ?>
					theme_advanced_buttons1_add : "strikethrough,bullist,numlist,copy,pastetext,pasteword",
					theme_advanced_buttons2 : "tablecontrols,code",
					theme_advanced_buttons3 : "",
					theme_advanced_statusbar_location : "none",
				<?php } else { ?>
					theme_advanced_buttons1_add : "bullist,numlist,cut,copy,pastetext,pasteword,separator,search,replace",
					theme_advanced_buttons2 : "advhr,link,unlink,ibrowser,caption,cleanup,removeformat,code,flash,tablecontrols",
					theme_advanced_buttons3 : "",
					theme_advanced_statusbar_location : "bottom",
				<?php } ?>
				<?php // content_css : "/theme/sc/tinymce.css.php", ?>
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				
				plugin_insertdate_dateFormat : "%Y-%m-%d",
				plugin_insertdate_timeFormat : "%H:%M:%S",
				extended_valid_elements : "hr[class|width|size|noshade],span[*]",
				paste_use_dialog : false,
				force_p_newlines : true,
				theme_advanced_resizing : true,
				theme_advanced_resize_horizontal : false,
				theme_advanced_disable : "strikethrough,help,sub,sup,forecolor,backcolor,charmap,visualaid,anchor,newdocument,paste",
				theme_advanced_blockformats : "p,h2,h3,h4,h5,h6"
			});
	
		</script>
	<?php
	}
	?>
</head>

<body id="body">
	<div id="wrapper">
		
		<div id="head">
			<div id="head_left">
				&nbsp;
			</div>
			
			<h2><?php echo getLangTerm('administration',false); ?></h2>
			
			<div id="head_right">
				&nbsp;
			</div>
			
			<div id="menu">
				<ul>
					<li><a href="<?php echo BASEURL; ?>" title="<?php echo $settings['site_name']; ?>"><span><?php echo $settings['site_name']; ?></span></a></li>
					<li><a href="index.php?admin" title="<?php echo getLangTerm('admin-home','"'); ?>"<?php if (!isset($_GET['section'])) { ?> class="selected"<?php } ?>><span><?php echo getLangTerm('admin-home',false); ?></span></a></li>
					<li><a href="index.php?admin&section=shares" title="<?php echo getLangTerm('shares','"'); ?>"<?php if ($_GET['section'] == 'shares') { ?> class="selected"<?php } ?>><span><?php echo getLangTerm('shares',false); ?></span></a></li>
					<li><a href="index.php?admin&section=blacklists" title="<?php echo getLangTerm('blacklists','"'); ?>"<?php if ($_GET['section'] == 'blacklists') { ?> class="selected"<?php } ?>><span><?php echo getLangTerm('blacklists',false); ?></span></a></li>
					<li><a href="index.php?admin&section=accounts" title="<?php echo getLangTerm('accounts','"'); ?>"<?php if ($_GET['section'] == 'accounts') { ?> class="selected"<?php } ?>><span><?php echo getLangTerm('accounts',false); ?></span></a></li>
					<li><a href="index.php?admin&section=reports" title="<?php echo getLangTerm('reports','"'); ?>"<?php if ($_GET['section'] == 'reports') { ?> class="selected"<?php } ?>><span><?php echo getLangTerm('reports',false); ?></span></a></li>
					<li><a href="index.php?admin&section=settings" title="<?php echo getLangTerm('settings','"'); ?>"<?php if ($_GET['section'] == 'settings') { ?> class="selected"<?php } ?>><span><?php echo getLangTerm('settings',false); ?></span></a></li>
				</ul>
			</div>

		</div> <!-- end head -->
		
		
		<div id="main">
			<div id="main_left">
				&nbsp;
			</div>
			<div id="main_head">
				<p><?php echo $thispage['title']; ?></p>
			</div>
			<div id="main_container">
				<div id="main_content">
