<?php
/*
 * Export Aggregators
 *
* Web Traffic Genius Pro v3.5.4
* Copyright (c) 2008-2010
* Success on the Internet Pty Ltd
* PO Box 25
* Salisbury SA 5108
* Australia
* Phone: +61 422 512 549
* Fax: +61 8 8425 9657
* Web: http://www.webtrafficgenius.com
* Support: http://www.marketing-assassins.com
*
*/
require_once(dirname(__FILE__) . '/config.php');
require_once(dirname(__FILE__) . '/php5_functions.php');
require_once(dirname(__FILE__) . '/other_functions.php');

function wtg_export_aggregators() {
	wtg_db_check_and_create();
	wtg_messages();
?>
	<div class="wrap">
		<h2>Export</h2>
		<p>This allows you to backup your configuration which can then be copied to another wordpress installation.</p>
		<p><b>Aggregators:</b></p>
		<form action="" method="post">
			<input type="submit" name="exportAggregators" value="Download Export File &raquo;" />
		</form>
		<br><br><br>
		<p><b>Extra Feeds:</b></p>
		<form action="" method="post">
			<input type="submit" name="exportExtrafeed" value="Download Export File &raquo;" />
		</form>
	</div>
<?php
}

function wtg_export_xml() {
	if (!isset($_POST['exportAggregators']) && !isset($_POST['exportExtrafeed'])) 
		return ;
	if(isset($_POST['exportAggregators'])) {
		$file_name = 'aggregators_template.xml';
		header('Content-Description: File Transfer');
		header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
		header("Content-Disposition: attachment; filename=$file_name");
		header('Pragma: no-cache');
		$ag = new WTG_Aggregator();
		$ag->initDB();
		echo $ag->get_db2xml();
		die();
	} else {
		$file_name = 'extra_feed.xml';
		header('Content-Description: File Transfer');
		header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
		header("Content-Disposition: attachment; filename=$file_name");
		header('Pragma: no-cache');
		$ag = new WTG_Extrafeed();
		$ag->initDB();
		echo $ag->get_db2xml();
		die();
	}
}