是一个优秀的语义个人发布平台
源代码在线查看: link-import.php
// Links
// Copyright (C) 2002 Mike Little -- mike@zed1.com
require_once('../wp-config.php');
$parent_file = 'link-manager.php';
$title = __('Import Blogroll');
$this_file = 'link-import.php';
$step = $_POST['step'];
if (!$step) $step = 0;
?>
switch ($step) {
case 0:
{
$standalone = 0;
include_once('admin-header.php');
if ($user_level < get_settings('links_minadminlevel'))
die (__("Cheatin’ uh?"));
$opmltype = 'blogrolling'; // default.
?>
and sign in. Once you’ve done that, click on Get Code, and then
look for the OPML
code') ?>.
that in the \'Welcome Back\' box on the right, click on share, and then
look for the OPML
link (favorites.opml).') ?>
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
foreach ($categories as $category) {
?>
} // end foreach
?>
break;
} // end case 0
case 1: {
$standalone = 0;
include_once('admin-header.php');
if ($user_level < get_settings('links_minadminlevel'))
die (__("Cheatin' uh ?"));
?>
$cat_id = $_POST['cat_id'];
if (($cat_id == '') || ($cat_id == 0)) {
$cat_id = 1;
}
$opml_url = $_POST['opml_url'];
if (isset($opml_url) && $opml_url != '') {
$blogrolling = true;
}
else // try to get the upload file.
{
$uploaddir = get_settings('fileupload_realpath');
$uploadfile = $uploaddir.'/'.$_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
//echo "Upload successful.";
$blogrolling = false;
$opml_url = $uploadfile;
} else {
echo __("Upload error");
}
}
if (isset($opml_url) && $opml_url != '') {
$opml = implode('', file($opml_url));
include_once('link-parse-opml.php');
$link_count = count($names);
for ($i = 0; $i < $link_count; $i++) {
if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4))
$titles[$i] = '';
$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, '{$feeds[$i]}')\n";
$result = $wpdb->query($query);
echo sprintf(__("Inserted %s"), $names[$i]);
}
?>
} // end if got url
else
{
echo "" . __("You need to supply your OPML url. Press back on your browser and try again") . "\n";
} // end else
?>
break;
} // end case 1
} // end switch
?>