<?php

// Import the layout from XML

if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER ['HTTP_X_REQUESTED_WITH']  == 'XMLHttpRequest') {
	require( dirname(__FILE__) . '/../../../../wp-config.php' );
	if (!(is_user_logged_in() && current_user_can('edit_posts')))
		die("Athentication failed!");

	
	canvas_import_layout($_POST['path_to_xml']);
	if($_POST["restore"] == 'true') echo 'Success! Now, <a href="javascript:window.location.reload()">reload your Canvas</a>.';
}
?>