//  Copyright 2001 Jamie McClelland, pagetool@mediajumpstart.org

/*
    This file is part of the Search Installer, a
    plugin for Pagetool.

    The Search Installer, like Pagetool, is free
    software; you can redistribute it and/or modify it under the
    terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
*/

//// pagetool_search /////
// First, insert the php code into pt_core_wwwpages

$filename = $plugins_dir . "pt_search/pt_search.src";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);

/* The proper format for the name is pt_search, however, to preserve backward
compatability, I'm using pagetool_search. */

$new_name="pagetool_search";
$new_title="Pagetool Search";
$new_category="plugins";
$new_code_type="php";
$new_html = addslashes($contents);
$new_username="admin";
$new_security="public";
$new_header="header";
$new_sidebar="sidebar";
$new_footer="footer";

$sql="insert into pt_core_wwwpages (name,title,category,code_type,html,username,tstamp,security,page_header,page_sidebar,page_footer) values('$new_name','$new_title','$new_category','$new_code_type','$new_html','$new_username',now(),'$new_security','$new_header','$new_sidebar','$new_footer')";

pt_query($sql);
pt_errcheck("Pagetool Search $str_plugin_added_to_wwwpages");
echo "<br>";

// Now, insert the plugin into pt_core_plugins.
$sql="insert into pt_core_plugins (name, type) values('pt_search','app')";
pt_query($sql);
pt_errcheck("Pagetool Search $str_plugin_added_to_plugins");
echo "<br><br>";

if ($install_message!="n") {
	echo "";
}

//// pagetool_search_no /////
// First, insert the php code into pt_core_wwwpages

$filename = $plugins_dir . "pt_search/pt_search_no.src";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);

/* The proper format for the name is pt_search, however, to preserve backward
compatability, I'm using pagetool_search. */

$new_name="pagetool_search_no";
$new_title="Pagetool Search (Norwegian)";
$new_category="plugins";
$new_code_type="php";
$new_html = addslashes($contents);
$new_username="admin";
$new_security="public";
$new_header="header";
$new_sidebar="sidebar";
$new_footer="footer";

$sql="insert into pt_core_wwwpages (name,title,category,code_type,html,username,tstamp,security,page_header,page_sidebar,page_footer) values('$new_name','$new_title','$new_category','$new_code_type','$new_html','$new_username',now(),'$new_security','$new_header','$new_sidebar','$new_footer')";

pt_query($sql);
pt_errcheck("Pagetool Search (Norwegian) $str_plugin_added_to_wwwpages");
echo "<br>";

// Now, insert the plugin into pt_core_plugins.
$sql="insert into pt_core_plugins (name, type) values('pt_search_no','app')";
pt_query($sql);
pt_errcheck("Pagetool Search (Norwegian ) $str_plugin_added_to_plugins");
echo "<br><br>";

if ($install_message!="n") {
	echo "";
}