<?php

/*
    Written by Jon Gales (me@jongales.com) in 2005
    
    This is a hack to get search URLs for MovableType to be different for multiple
    sites based on the same installation. This is as is code. I don't make any
    promises. 
    
*/


//your blog ID
$blog '1';

//template name
$template 'purseuing';

//URLs
$old_search_url 'http://www.site1.com/mt/mt-search.cgi';
$new_search_url 'http://www.site2.com/search/';


//Don't edit starting from here unless you know what you're doing
ob_start ("convert");

function 
get_html_curl ($url) {

    
/*
        The only reason cURL is used is that the server this 
        script was written for locked out access for include()
        and fopen() to access URLs. cURL works fine, and thus
        was used. Feel free to edit this if you do not have 
        cURL on your server.
    */
    
    
$ch curl_init();
    
curl_setopt ($chCURLOPT_URL$url);    
    
curl_setopt ($chCURLOPT_USERAGENT$user_agent);
    
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt ($chCURLOPT_FOLLOWLOCATION1);
    
curl_setopt ($chCURLOPT_TIMEOUT120);
    
$result curl_exec ($ch);
    
curl_close($ch);
    return 
$result;
}

function 
convert ($data) {
    global 
$old_search_url$new_search_url;
    
$data ereg_replace("$old_search_url""$new_search_url""$data");
    
$data ereg_replace('method="post"''method="get"'"$data");
    
    return 
$data;
}

$term ereg_replace(" ""+"addslashes($_GET['search']));

$url $old_search_url '?IncludeBlogs=' $blog '&Template=' $template '&search=' $term;

echo 
get_html_curl($url);

?>