예제 #1
0
            printf('<input type="hidden" name="tables[%s]" value="%s" />', esc_html_attr($i, false), esc_html_attr($tab, false));
        }
        ?>

				<p>
					<label for="srch">Search for (case sensitive string):</label>
					<input class="text" type="text" name="srch" id="srch" value="<?php 
        esc_html_attr($srch, true);
        ?>
" />
				</p>

				<p>
					<label for="rplc">Replace with:</label>
					<input class="text" type="text" name="rplc" id="rplc" value="<?php 
        esc_html_attr($rplc, true);
        ?>
" />
				</p>

				<?php 
        icit_srdb_submit('Submit Search string', 'Are you REALLY sure you want to go ahead and do this?');
        ?>
			</fieldset>
		</form>	<?php 
        break;
    case 5:
        @set_time_limit(60 * 10);
        // Try to push the allowed memory up, while we're at it
        @ini_set('memory_limit', '1024M');
        // Process the tables
        ?>
" />
				<input type="hidden" name="pass" id="pass" value="<?php 
        esc_html_attr($pass, true);
        ?>
" />
				<input type="hidden" name="char" id="char" value="<?php 
        esc_html_attr($char, true);
        ?>
" />
				<input type="hidden" name="guid" id="guid" value="<?php 
        esc_html_attr($guid, true);
        ?>
" /> <?php 
        foreach ($tables as $i => $tab) {
            printf('<input type="hidden" name="tables[%s]" value="%s" />', esc_html_attr($i, false), esc_html_attr($tab, false));
        }
        ?>
                                <p>
                                    <label for="srchfile">Upload comma delimited CSV or XLSX with two columns (other columns will be ignored):</label>
                                    <input type="file" name="srchfile" />
                                </p>
                        <?php 
        icit_srdb_submit('Submit Search File', 'Are you REALLY sure you want to go ahead and do this?');
        ?>
                    </fieldset>
                </form>
                <?php 
        break;
    case 5:
        @set_time_limit(60 * 10);
function displaySetOptionsPage($wp_settings_array, $d_settings_array)
{
    $errors = "";
    $abort = false;
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_TERMS, $errors);
    $terms_count = count($result);
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_NODE_TYPES, $errors);
    $node_types_result = $result;
    $node_types_count = count($result);
    $node_types_params_list = buildNodeTypesParamsList($result);
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_POSTS, $errors);
    $posts_count = count($result);
    showHTMLHeader("Drupal migration", $errors);
    ?>
	<form action="<?php 
    step_form_action();
    ?>
" method="post">

	<form action="../" onsubmit="return checkCheckBoxes(this);" >
	<input type="hidden" name="wp_host" id="wp_host" value="<?php 
    esc_html_attr($wp_settings_array['host'], true);
    ?>
">
	<input type="hidden" name="d_host" id="d_host" value="<?php 
    esc_html_attr($d_settings_array['host'], true);
    ?>
">
	<input type="hidden" name="wp_data" id="wp_data" value="<?php 
    esc_html_attr($wp_settings_array['data'], true);
    ?>
">
	<input type="hidden" name="d_data" id="d_data" value="<?php 
    esc_html_attr($d_settings_array['data'], true);
    ?>
">
	<input type="hidden" name="wp_user" id="wp_user" value="<?php 
    esc_html_attr($wp_settings_array['user'], true);
    ?>
">
	<input type="hidden" name="d_user" id="d_user" value="<?php 
    esc_html_attr($d_settings_array['user'], true);
    ?>
">
	<input type="hidden" name="wp_pass" id="wp_pass" value="<?php 
    esc_html_attr($wp_settings_array['pass'], true);
    ?>
">
	<input type="hidden" name="d_pass" id="d_pass" value="<?php 
    esc_html_attr($d_settings_array['pass'], true);
    ?>
">
	<input type="hidden" name="wp_char" id="wp_char" value="<?php 
    esc_html_attr($wp_settings_array['char'], true);
    ?>
">
	<input type="hidden" name="d_char" id="d_char" value="<?php 
    esc_html_attr($d_settings_array['char'], true);
    ?>
">
	
	<table class="settings_table">
		<caption>Migration options</caption>
		<thead>
			<tr>
				<th class="description">Description</th>				
				<th class="setting">Setting</th>		
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="description">Delete additional authors in WordPress? (Default admin user created during installation will not be deleted.)</td>				
				<td class="setting"><input type="checkbox" name="formDeleteAuthors" value="Yes" /></td>
			</tr>
			<tr>
					<?php 
    showContentTypeConversion($node_types_result, $node_types_count);
    ?>
			</tr>
			<tr>
				<td class="description">Drupal file directory</td>
				<td class="setting"><input type="text" size="20" maxlength="255" name="formFilePath" value="/files/"></td>				
			</tr>
			<tr>
				<td class="description">Permalink structure</td>
				<td class="setting"><input type="text" size="20" maxlength="255" name="formPermalinkStructure" value="/content/%postname%/"></td>				
			</tr>
			<tr>
				<td>Please select which Drupal terms will be used as WordPress categories. The remaining terms will be converted into WordPress post tags. It's best not to create too many categories.</td>
				<td><select size="5" name="formTerms[]" multiple="yes">
				<?php 
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_TERMS, $errors);
    $terms_count = count($result);
    if ($terms_count) {
        foreach ($result as $row_key => $row_val) {
            echo "<option value='" . $row_val['tid'] . "'>" . $row_val['name'] . " (ID " . $row_val['tid'] . ")</option>";
        }
    }
    ?>
				</select></td>
			</tr>
			<tr>
				<td>Please select your WordPress default category.</td>
				<td><select size="5" name="formDefaultCategory">
				<?php 
    if ($terms_count) {
        foreach ($result as $row_key => $row_val) {
            echo "<option value='" . $row_val['tid'] . "'>" . $row_val['name'] . " (ID " . $row_val['tid'] . ")</option>";
        }
    }
    ?>
				</select></td>
			</tr>			
			
			
		</tbody>
	</table>
		<?php 
    step_submit("Migrate now", "This will alter your WordPress tables. Are you sure?");
    ?>
	</form>
	
	
	<script>
	function checkCheckBoxes(theForm) {
		if (
			
		<?php 
    $checkCount = 0;
    if ($node_types_count) {
        foreach ($node_types_result as $row_key => $row_val) {
            echo "theForm.formContentTypes[{$checkCount}].checked == false";
            $checkCount = $checkCount + 1;
            if ($checkCount < $node_types_count) {
                echo " && ";
            } else {
                echo " ) ";
            }
        }
    }
    ?>
		{
			alert ('You didn\'t choose any of the checkboxes!');
			return false;
		} else { 	
			return true;
		}
	}
	</script>
	
<?php 
    showHTMLFooter();
}
function displayAnalysisResultsPage($wp_settings_array, $d_settings_array)
{
    $errors = "";
    $abort = false;
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_TERMS, $errors);
    $terms_count = count($result);
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_NODE_TYPES, $errors);
    $node_types_result = $result;
    $node_types_count = count($result);
    $node_types_params_list = buildNodeTypesParamsList($result);
    $result = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_POSTS, $errors);
    $posts_count = count($result);
    // Check for problems
    $result_dup_terms = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_DUPLICATE_TERMS, $errors);
    $duplicate_terms_count = count($result_dup_terms);
    $result_terms_charlength_exceeded = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_TERMS_CHARLENGTH, $errors);
    $terms_charlength_exceeded_count = count($result_terms_charlength_exceeded);
    $result_dup_aliases = runFetchFromDatabase($d_settings_array, QUERY_DRUPAL_GET_DUPLICATE_ALIAS, $errors);
    $duplicate_aliases_count = count($result_dup_aliases);
    if ($duplicate_terms_count > 0 || $terms_charlength_exceeded_count > 0 || $duplicate_aliases_count > 0) {
        $abort = true;
    }
    // Show the database analysis results
    showHTMLHeader("Drupal database analysis", $errors);
    echo "<table class=\"analysis_table\"><caption>Drupal properties</caption><thead>";
    echo "<th class=\"property\">Property</th><th class=\"found\">Found in Drupal</th></thead><tbody>";
    echo "<tr><td>Terms</td><td>{$terms_count} terms</td></tr>";
    echo "<tr><td>Node types</td><td>{$node_types_count} node types (" . $node_types_params_list . ")</td></tr>";
    echo "<tr><td>Entries</td><td>{$posts_count} entries</td></tr>";
    echo "</tbody></table>";
    // Any potential problems? Don't show migration options
    if ($abort) {
        echo "<table class=\"problems_table\"><caption id=\"problems\">Possible problems</caption><thead>";
        echo "<th class=\"problem_property\">Problem</th><th class=\"problem_found\">Description</th></thead><tbody>";
        // Duplicate terms?
        if ($duplicate_terms_count > 0) {
            showDuplicateTermsRow($result_dup_terms, $duplicate_terms_count, $d_settings_array);
        }
        // Exceeded terms character length?
        if ($terms_charlength_exceeded_count > 0) {
            showCharLengthExceededRow($result_terms_charlength_exceeded, $terms_charlength_exceeded_count, $d_settings_array);
        }
        // Duplicate aliases?
        if ($duplicate_aliases_count > 0) {
            showDuplicateAliasesRow($result_dup_aliases, $duplicate_aliases_count, $d_settings_array);
        }
        echo "</tbody></table>";
    }
    ?>
	<form action="<?php 
    step_form_action();
    ?>
" method="post">
		<input type="hidden" name="wp_host" id="wp_host" value="<?php 
    esc_html_attr($wp_settings_array['host'], true);
    ?>
">
		<input type="hidden" name="d_host" id="d_host" value="<?php 
    esc_html_attr($d_settings_array['host'], true);
    ?>
">
		<input type="hidden" name="wp_data" id="wp_data" value="<?php 
    esc_html_attr($wp_settings_array['data'], true);
    ?>
">
		<input type="hidden" name="d_data" id="d_data" value="<?php 
    esc_html_attr($d_settings_array['data'], true);
    ?>
">
		<input type="hidden" name="wp_user" id="wp_user" value="<?php 
    esc_html_attr($wp_settings_array['user'], true);
    ?>
">
		<input type="hidden" name="d_user" id="d_user" value="<?php 
    esc_html_attr($d_settings_array['user'], true);
    ?>
">
		<input type="hidden" name="wp_pass" id="wp_pass" value="<?php 
    esc_html_attr($wp_settings_array['pass'], true);
    ?>
">
		<input type="hidden" name="d_pass" id="d_pass" value="<?php 
    esc_html_attr($d_settings_array['pass'], true);
    ?>
">
		<input type="hidden" name="wp_char" id="wp_char" value="<?php 
    esc_html_attr($wp_settings_array['char'], true);
    ?>
">
		<input type="hidden" name="d_char" id="d_char" value="<?php 
    esc_html_attr($d_settings_array['char'], true);
    ?>
">		
	<?php 
    step_submit("Set options");
    ?>
	</form>
	
	<div style="visibility:hidden">
		<p id="status"></p>
	</div>
	
	<?php 
    showHTMLFooter();
}
function displayConnectionSettingsPage($wp_settings_array, $d_settings_array)
{
    $errors = "";
    showHTMLHeader("", $errors);
    ?>
<p>This tool performs the bulk of the migration from <strong>Drupal 6</strong> to <strong>WordPress 3.5</strong>. It works pretty well with our own Drupal installations but you may need to make some tweaks to get things right for you, either to the code or to the migrated WordPress database. If you're not sure how to make the appropriate changes or would simply like someone else to do the work, please <a href="http://anothercoffee.net">contact Another Cup of Coffee Limited</a> and we'll be happy to provide a quotation.</p>

<p><strong>CAUTION:</strong> Make a backup of both your Drupal and WordPress databases before running this tool. <em>USE IS ENTIRELY AT YOUR OWN RISK.</em></p>

<form action="<?php 
    step_form_action();
    ?>
" method="post">
<TABLE>
<CAPTION>Database connection details</CAPTION>
<thead>
</thead>
<tbody>
<TR>
	<TH>Server Name:</TH>
	<TD><input class="setting" type="text" name="wp_host" id="wp_host" value="<?php 
    esc_html_attr($wp_settings_array['host'], true);
    ?>
" /></TD>
</TR>
<TR>
	<TH>Username:</TH>
	<TD><input class="setting" type="text" name="wp_user" id="wp_user" value="<?php 
    esc_html_attr($wp_settings_array['user'], true);
    ?>
" /></TD>
</TR>
<TR>
	<TH>Password:</TH>
	<TD><input class="setting" type="password" name="wp_pass" id="wp_pass" value="<?php 
    esc_html_attr($wp_settings_array['pass'], true);
    ?>
" /></TD>
</TR>
<TR>
	<TH>WordPress Database Name:</TH>
	<TD><input class="setting" type="text" name="wp_data" id="wp_data" value="<?php 
    esc_html_attr($wp_settings_array['data'], true);
    ?>
" /></TD>
</TR>
<TR>
	<TH>WordPressCharset:</TH>
	<TD><input class="setting" type="text" name="d_char" id="d_char" value="<?php 
    esc_html_attr($d_settings_array['char'], true);
    ?>
" /></TD>
</TR>
<TR>
	<TH>Drupal Database Name:</TH>
	<TD><input class="setting" type="text" name="d_data" id="d_data" value="<?php 
    esc_html_attr($d_settings_array['data'], true);
    ?>
" /></TD>
</TR>
<TR>
	<TH>Drupal Charset:</TH>
	<TD><input class="setting" type="text" name="d_char" id="d_char" value="<?php 
    esc_html_attr($d_settings_array['char'], true);
    ?>
" /></TD>
</TR>
</tbody>
</TABLE>

<p>First we will analyze your Drupal database. No changes will be made.</p>
		<?php 
    step_submit('Analyze Drupal');
    ?>
</form>

<?php 
    showHTMLFooter();
}