/**
* *** this needs to be edited for a new installation ***
*
* this is supposed to be called as e.g.
* http://anyall.org/blog/blogger/http://socialscienceplusplus.blogspot.com/2008/10/mydebatesorg-and-poten
tially-coolest.html
* and then redirect to e.g.
* http://anyall.org/blog/2008/10/mydebatesorg-online-polling-and-potentially-the-coolest-question-corpus-
ever/
*
* it accesses wordpress's own metainfo saved from the blogger migration,
* to guarantee redirection to the correct new version -- no hacks with strings.
*
* So there are 2 redirects total:
* (1) the blogspot.com page meta-refreshes to here
* (2) this "page" sends to the final wordpress post url
*
* This script is "installed" by placing it directly in the wordpress root.
**/
require_once( dirname(__FILE__) . '/wp-load.php' );
wp();
//print_r($wpdb);
$path = $_SERVER['path_info'];
$path = preg_replace('/^\/+/', '', $path);
$path = preg_replace('/^https?:\/+socialscienceplusplus\.blogspot\.com/','/', $path);
$path = preg_replace('/^\/+/', '', $path);
$path = "/" . $path;
//echo $path;
$res = $wpdb->get_results(
$wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='blogger_permalink' AND meta_value = '%
s'", $path) );
//print_r($res);
if (count($res)==0) {
//echo "Error, path '$path' matches no blogger imports.";
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://anyall.org/blog/");
} else if (count($res) > 1) {
echo "Error, path '$path' matches many blogger imports.";
} else {
$post_id = $res[0]->post_id;
//print_r($post_id);
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://anyall.org/blog/?p=$post_id");
exit();
}
?>?
>
POSTAR UM COMENTARIO