
<script type="text/javascript" src="importbuddy/assets/dist/js/importbuddy.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery('.leanModal').leanModal(
				{ top : 45, overlay : 0.4, closeButton: ".modal_close" }
		);
	});
</script>

<form onSubmit="jQuery('#urlReplace-restoreData').val( window.btoa( encodeURIComponent( JSON.stringify( window.restoreData ) ) ) );" action="?ajax=5" target="miniFrame" method="post" class="db_setting"><!-- this form is only submitted after running through javascript. submitting actual form instead of using jQuery post so we can target iframe. -->
	<input type="hidden" name="restoreData" id="urlReplace-restoreData" value=""><!-- this is the only thing that will need parsed by PHP on the receiving end. populated on submit after db test passes. -->

	<table class="settingsTable">
		<tr><th style="width: 30%;">&nbsp;</th><th style="width: 30%;">Old URL</th><th style="width: 10%;">&nbsp;</th><th style="width: 30%;">New URL</th></tr>

		<tr><!-- WORDPRESS ADDRESS (ALL SITE TYPES) -->
			<td>
				WordPress Address <span class="light">(Site URL)</span> <%= tip( 'This is the address where you want the final WordPress site you are restoring / migrating to reside. Ex: http://foo.com/wp' ) %>
			</td>
			<td>
				<input type="text" class="old_setting" value="<%= dat.siteurl %>" DISABLED>
			</td>
			<td class="settingCopy">
				<a href="#">&rarr;</a>
			</td>
			<td>
				<input type="text" value="<%= defaultURL %>" name="siteurl">
			</td>
		</tr>
		<br /><br />
		<% if ( dat.is_multisite === true ) { // multisite %>
		<tr><!-- MULTISITE DOMAIN -->
			<td style="vertical-align: top;">
				Multisite Domain <%= tip( 'This is the MultiSite main domain. Ex: foo.com. WARNING: Changing this may result in URL problems. Use caution.' ) %>
				<br>
				<span class="light">(Home URL)</span>
			</td>
			<td style="vertical-align: top;">
				<input type="text" class="old_setting" value="<%= dat.domain %>" DISABLED>
			</td>
			<td class="settingCopy" style="vertical-align: top;">
				<a href="#">&rarr;</a>
			</td>
			<td style="vertical-align: top;">
				<input type="text" value="<%= defaultDomain %>" name="homeurl">
				<br>Note: This URL above will also be the new Multisite Network URL.
			</td>
		</tr>

		<% } else { %>

		<tr><!-- CUSTOM HOME URL -->
			<td>
				<label style="width: 100%;" for="check_custom_home">
					Custom Site Address <span class="light">(Home URL)</span> <%= tip( 'OPTIONAL. This is also known as the site address. This is the home address where your main site resides. This may differ from your WordPress URL. For example: http://foo.com' ) %>
				</label>
			</td>
			<td>
				<input type="checkbox" name="customHomeEnabled" value="on" onClick="jQuery('#custom_home').toggle();" style="width: auto;"> <span class="light">Optional. Disabled by default.</span>
			</td>
			<td colspan="2">&nbsp;</td>
		</tr>
		<tr id="custom_home" style="display: none;"><!-- SITE ADDRESS (STANDALONE ONLY) -->
			<td>
				&nbsp;
			</td>
			<td>
				<input type="text" class="old_setting" value="<%= dat.homeurl %>" DISABLED>
			</td>
			<td class="settingCopy">
				<a href="#" title="Click to copy old setting over.">&rarr;</a>
			</td>
			<td>
				<input type="text" value="<%= defaultURL %>" name="homeurl">
			</td>
		</tr>

		<% } // end non-multisite %>


	</table>
	<br><br><br>

	<div class="main_box_foot">
		<br>
		<center>
			<input type="submit" name="nextStep" value="Next Step" class="button button-primary">
			<button href="#pb_advanced_modal" class="button button-secondary leanModal">Advanced Options</button>
		</center>

	</div>

	<div id="pb_advanced_modal" style="display: none;">
		<div class="modal">
			<div class="modal_header">
				<div>
					<h2>Advanced Options</h2>
					<p>Exercise caution using advanced options. Additional options available on subsequent steps.</p>
				</div>
				<a class="modal_close">
					<span class="modal_close_icon">&times;</span><span>Close</span>
				</a>
			</div>
			<div class="modal_content">

				<input type="checkbox" value="1" name="migrateDatabase"
					   onclick="
					if ( jQuery(this).is( ':checked' ) ) { // On checking this box, we need to hide options; unchecking show options.
							jQuery( '#database_migrate_options' ).slideDown();
						} else {
							jQuery( '#database_migrate_options' ).slideUp();
						}
						jQuery( '#database_migrate_options > input' ).removeAttr('checked'); // Uncheck all options within.
					" CHECKED> Migrate URLs/paths in database from old location to new. <br>
				<div id="database_migrate_options">
					<input type="checkbox" value="1" name="migrateDatabaseBruteForce" CHECKED> Migrate URLS/paths in database in all locations using brute force. <%= tip( 'By default Solid Backups will extensively examine and migrate unknown database tables.  Sometimes however this can cause timeouts on larger sites.  You may skip this intensive procedure to reduce required runtime for database migration steps. Note that some URLs or paths may not be updated if skipping this step.  All major WordPress URLs and paths will still be updated however.' ) %><br>
					Maximum time per chunk when interacting with database: <input type="text" name="max_execution_time" id="max_execution_time" value="<%= maxExecutionTime %>" size="5"> seconds. <%= tip( 'The maximum amount of time the Importer should allow a database import chunk to run. The Importer, by default, limits each chunk to your Maximum PHP runtime. If your database import step is timing out then lowering this value will instruct the script to limit each `chunk` to allow it to finish within this time period. Raising this value above your servers limits will not increase or override server settings.' ) %>
				</div>
				<br>

			</div>
		</div>
	</div>
</form>
