2003-05-30 20:06:21 -04:00
|
|
|
<?php
|
|
|
|
// Links
|
|
|
|
// Copyright (C) 2002 Mike Little -- mike@zed1.com
|
2003-12-07 22:46:42 -05:00
|
|
|
|
2003-06-12 18:42:48 -04:00
|
|
|
require_once('../wp-config.php');
|
2003-05-30 20:06:21 -04:00
|
|
|
|
2003-12-10 19:22:36 -05:00
|
|
|
$parent_file = 'link-manager.php';
|
2003-05-30 20:06:21 -04:00
|
|
|
$title = 'Import Blogroll';
|
2003-12-10 19:22:36 -05:00
|
|
|
$this_file = 'link-import.php';
|
2003-05-30 20:06:21 -04:00
|
|
|
|
2004-04-20 18:56:47 -04:00
|
|
|
$step = $_POST['step'];
|
2003-05-30 20:06:21 -04:00
|
|
|
if (!$step) $step = 0;
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
switch ($step) {
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
$standalone = 0;
|
2003-12-10 19:22:36 -05:00
|
|
|
include_once('admin-header.php');
|
2003-08-03 19:46:20 -04:00
|
|
|
if ($user_level < get_settings('links_minadminlevel'))
|
2003-06-01 05:01:04 -04:00
|
|
|
die ("Cheatin’ uh?");
|
2003-12-09 19:43:15 -05:00
|
|
|
|
2003-12-07 22:46:42 -05:00
|
|
|
$opmltype = 'blogrolling'; // default.
|
2003-05-30 20:06:21 -04:00
|
|
|
?>
|
2003-12-07 22:46:42 -05:00
|
|
|
|
|
|
|
<ul id="adminmenu2">
|
2003-12-10 19:22:36 -05:00
|
|
|
<li><a href="link-manager.php" >Manage Links</a></li>
|
2003-12-23 16:47:03 -05:00
|
|
|
<li><a href="link-add.php">Add Link</a></li>
|
2003-12-10 19:22:36 -05:00
|
|
|
<li><a href="link-categories.php">Link Categories</a></li>
|
|
|
|
<li class="last"><a href="link-import.php" class="current">Import Blogroll</a></li>
|
2003-12-07 22:46:42 -05:00
|
|
|
</ul>
|
|
|
|
|
2003-05-30 20:06:21 -04:00
|
|
|
<div class="wrap">
|
2003-06-01 05:01:04 -04:00
|
|
|
|
2004-04-19 02:13:26 -04:00
|
|
|
<h2>Import your blogroll from another system </h2>
|
2003-12-10 19:22:36 -05:00
|
|
|
<!-- <form name="blogroll" action="link-import.php" method="get"> -->
|
|
|
|
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
|
2003-12-09 19:43:15 -05:00
|
|
|
|
2003-06-01 05:01:04 -04:00
|
|
|
<ol>
|
|
|
|
<li>Go to <a href="http://www.blogrolling.com">Blogrolling.com</a>
|
|
|
|
and sign in. Once you've done that, click on <strong>Get Code</strong>, and then
|
|
|
|
look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr>
|
2003-08-09 19:10:16 -04:00
|
|
|
code</strong><?php echo gethelp_link($this_file,'opml_code');?>.</li>
|
2003-10-30 19:37:06 -05:00
|
|
|
<li>Or go to <a href="http://blo.gs">Blo.gs</a> and sign in. Once you've done
|
|
|
|
that in the 'Welcome Back' box on the right, click on <strong>share</strong>, and then
|
|
|
|
look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr>
|
|
|
|
link</strong> (favorites.opml)<?php echo gethelp_link($this_file,'opml_code');?>.</li>
|
|
|
|
<li>Select that text and copy it or copy the link/shortcut into the box below.<br />
|
2003-05-30 20:06:21 -04:00
|
|
|
<input type="hidden" name="step" value="1" />
|
2003-12-09 19:43:15 -05:00
|
|
|
Your OPML URL:<?php echo gethelp_link($this_file,'opml_code');?> <input type="text" name="opml_url" size="65" />
|
2003-10-30 19:37:06 -05:00
|
|
|
</li>
|
2003-12-09 19:43:15 -05:00
|
|
|
<li>
|
|
|
|
<strong>or</strong> you can upload an OPML file from your desktop aggregator:<br />
|
|
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
|
|
|
|
<label>Upload this file: <input name="userfile" type="file" /></label>
|
2003-10-30 19:37:06 -05:00
|
|
|
</li>
|
|
|
|
|
2003-06-01 05:01:04 -04:00
|
|
|
<li>Now select a category you want to put these links in.<br />
|
2003-08-09 19:10:16 -04:00
|
|
|
Category: <?php echo gethelp_link($this_file,'link_category');?><select name="cat_id">
|
2003-05-30 20:06:21 -04:00
|
|
|
<?php
|
2003-06-01 05:01:04 -04:00
|
|
|
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
|
|
|
|
foreach ($categories as $category) {
|
2003-05-30 20:06:21 -04:00
|
|
|
?>
|
2003-06-01 05:01:04 -04:00
|
|
|
<option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option>
|
2003-05-30 20:06:21 -04:00
|
|
|
<?php
|
2003-06-01 05:01:04 -04:00
|
|
|
} // end foreach
|
2003-05-30 20:06:21 -04:00
|
|
|
?>
|
|
|
|
</select>
|
2003-12-09 19:43:15 -05:00
|
|
|
|
2003-06-01 05:01:04 -04:00
|
|
|
</li>
|
|
|
|
|
2003-08-09 19:10:16 -04:00
|
|
|
<li><input type="submit" name="submit" value="Import!" /><?php echo gethelp_link($this_file,'import');?></li>
|
2003-06-01 05:01:04 -04:00
|
|
|
</ol>
|
2003-05-30 20:06:21 -04:00
|
|
|
</form>
|
2003-06-01 05:01:04 -04:00
|
|
|
|
2003-05-30 20:06:21 -04:00
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
} // end case 0
|
|
|
|
|
|
|
|
case 1: {
|
|
|
|
$standalone = 0;
|
2003-12-10 19:22:36 -05:00
|
|
|
include_once('admin-header.php');
|
2003-08-03 19:46:20 -04:00
|
|
|
if ($user_level < get_settings('links_minadminlevel'))
|
2003-05-30 20:06:21 -04:00
|
|
|
die ("Cheatin' uh ?");
|
|
|
|
?>
|
|
|
|
<div class="wrap">
|
2003-06-01 05:01:04 -04:00
|
|
|
|
2004-04-19 02:13:26 -04:00
|
|
|
<h2>Importing...</h2>
|
2003-05-30 20:06:21 -04:00
|
|
|
<?php
|
2004-04-20 18:56:47 -04:00
|
|
|
$cat_id = $_POST['cat_id'];
|
2003-05-30 20:06:21 -04:00
|
|
|
if (($cat_id == '') || ($cat_id == 0)) {
|
|
|
|
$cat_id = 1;
|
|
|
|
}
|
2003-12-09 19:43:15 -05:00
|
|
|
|
2004-04-20 18:56:47 -04:00
|
|
|
$opml_url = $_POST['opml_url'];
|
2003-12-09 19:43:15 -05:00
|
|
|
if (isset($opml_url) && $opml_url != '') {
|
|
|
|
$blogrolling = true;
|
2003-05-30 20:06:21 -04:00
|
|
|
}
|
2003-12-09 19:43:15 -05:00
|
|
|
else // try to get the upload file.
|
|
|
|
{
|
2004-03-01 01:13:32 -05:00
|
|
|
$uploaddir = get_settings('fileupload_realpath');
|
2003-12-09 19:43:15 -05:00
|
|
|
$uploadfile = $uploaddir.'/'.$_FILES['userfile']['name'];
|
|
|
|
|
|
|
|
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
|
|
|
|
{
|
|
|
|
//echo "Upload successful.<p />";
|
|
|
|
$blogrolling = false;
|
|
|
|
$opml_url = $uploadfile;
|
|
|
|
} else {
|
|
|
|
echo "Upload error<p />";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($opml_url) && $opml_url != '') {
|
2003-05-30 20:06:21 -04:00
|
|
|
$opml = implode('', file($opml_url));
|
2003-12-10 19:22:36 -05:00
|
|
|
include_once('link-parse-opml.php');
|
2003-10-30 19:37:06 -05:00
|
|
|
|
2003-05-30 20:06:21 -04:00
|
|
|
$link_count = count($names);
|
2003-06-01 05:01:04 -04:00
|
|
|
for ($i = 0; $i < $link_count; $i++) {
|
2003-05-30 20:06:21 -04:00
|
|
|
if ('Last' == substr($titles[$i], 0, 4))
|
2003-06-01 05:01:04 -04:00
|
|
|
$titles[$i] = '';
|
2003-12-09 19:43:15 -05:00
|
|
|
if ('http' == substr($titles[$i], 0, 4))
|
2003-05-30 20:06:21 -04:00
|
|
|
$titles[$i] = '';
|
2004-04-19 02:13:26 -04:00
|
|
|
$query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
|
2004-04-20 18:01:15 -04:00
|
|
|
VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
|
2003-06-01 05:01:04 -04:00
|
|
|
$result = $wpdb->query($query);
|
2003-12-09 19:43:15 -05:00
|
|
|
echo "<p>Inserted <strong>{$names[$i]}</strong></p>";
|
2003-05-30 20:06:21 -04:00
|
|
|
}
|
|
|
|
?>
|
2003-12-10 19:22:36 -05:00
|
|
|
<p>Inserted <?php echo $link_count ?> links into category <?php echo $cat_id; ?>. All done! Go <a href="link-manager.php">manage those links</a>.</p>
|
2003-05-30 20:06:21 -04:00
|
|
|
<?php
|
2003-12-09 19:43:15 -05:00
|
|
|
} // end if got url
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<p>You need to supply your OPML url. Press back on your browser and try again</p>\n";
|
|
|
|
} // end else
|
2003-06-01 05:01:04 -04:00
|
|
|
|
2003-12-09 19:43:15 -05:00
|
|
|
?>
|
2003-05-30 20:06:21 -04:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
} // end case 1
|
|
|
|
} // end switch
|
|
|
|
?>
|
2003-12-09 19:43:15 -05:00
|
|
|
</div>
|
2003-05-30 20:06:21 -04:00
|
|
|
</body>
|
|
|
|
</html>
|