Might fix some OPML imports but I'm pretty sure I just broke others.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-04-19 06:13:26 +00:00
parent ecdd48e62a
commit 8546d782a6
2 changed files with 16 additions and 10 deletions

View File

@ -32,7 +32,7 @@ switch ($step) {
<div class="wrap"> <div class="wrap">
<h3>Import your blogroll from another system </h3> <h2>Import your blogroll from another system </h2>
<!-- <form name="blogroll" action="link-import.php" method="get"> --> <!-- <form name="blogroll" action="link-import.php" method="get"> -->
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll"> <form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
@ -86,7 +86,7 @@ switch ($step) {
?> ?>
<div class="wrap"> <div class="wrap">
<h3>Importing...</h3> <h2>Importing...</h2>
<?php <?php
$cat_id = $HTTP_POST_VARS['cat_id']; $cat_id = $HTTP_POST_VARS['cat_id'];
if (($cat_id == '') || ($cat_id == 0)) { if (($cat_id == '') || ($cat_id == 0)) {
@ -122,8 +122,8 @@ switch ($step) {
$titles[$i] = ''; $titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4)) if ('http' == substr($titles[$i], 0, 4))
$titles[$i] = ''; $titles[$i] = '';
$query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner) $query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID)\n"; VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, {$feeds[$i]})\n";
$result = $wpdb->query($query); $result = $wpdb->query($query);
echo "<p>Inserted <strong>{$names[$i]}</strong></p>"; echo "<p>Inserted <strong>{$names[$i]}</strong></p>";
} }

View File

@ -6,11 +6,14 @@ require_once(ABSPATH.WPINC.'/functions.php');
// we need to map XML attribute names to our columns // we need to map XML attribute names to our columns
// if we are doing OPML use this map // if we are doing OPML use this map
$opml_map = array( $opml_map = array(
'link_url' => 'URL', 'link_url' => 'URL',
'link_name' => 'TEXT', 'link_url' => 'HTMLURL',
'link_target' => 'TARGET', 'link_name' => 'TEXT',
'link_description' => 'DESCRIPTION' 'link_name' => 'TITLE',
); 'link_target' => 'TARGET',
'link_description' => 'DESCRIPTION',
'link_rss' => 'XMLURL'
);
$map = $opml_map; $map = $opml_map;
@ -20,7 +23,7 @@ $map = $opml_map;
**/ **/
function startElement($parser, $tagName, $attrs) { function startElement($parser, $tagName, $attrs) {
global $updated_timestamp, $all_links, $map; global $updated_timestamp, $all_links, $map;
global $names, $urls, $targets, $descriptions; global $names, $urls, $targets, $descriptions, $feeds;
if ($tagName == 'OUTLINE') { if ($tagName == 'OUTLINE') {
if ($map['link_url'] != '') if ($map['link_url'] != '')
@ -31,11 +34,14 @@ function startElement($parser, $tagName, $attrs) {
$link_target = $attrs[$map['link_target']]; $link_target = $attrs[$map['link_target']];
if ($map['link_description'] != '') if ($map['link_description'] != '')
$link_description = $attrs[$map['link_description']]; $link_description = $attrs[$map['link_description']];
if ($map['link_rss'] != '')
$link_rss = $attrs[$map['link_rss']];
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n"); //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
// save the data away. // save the data away.
$names[] = $link_name; $names[] = $link_name;
$urls[] = $link_url; $urls[] = $link_url;
$targets[] = $link_target; $targets[] = $link_target;
$feeds[] = $link_rss;
$descriptions[] = $link_description; $descriptions[] = $link_description;
} }
} }