]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/search.pm
use cgitemplate, remove misctemplate
[ikiwiki.git] / IkiWiki / Plugin / search.pm
index 8fb9dff0ca082bb16b6332c052e848408db162b8..3f0b7c9ad4c657db023be5e489f069768dc8201a 100644 (file)
@@ -58,7 +58,7 @@ sub pagetemplate (@) {
        if ($template->query(name => "searchform")) {
                if (! defined $form) {
                        my $searchform = template("searchform.tmpl", blind_cache => 1);
-                       $searchform->param(searchaction => $config{cgiurl});
+                       $searchform->param(searchaction => IkiWiki::cgiurl());
                        $searchform->param(html5 => $config{html5});
                        $form=$searchform->output;
                }
@@ -176,7 +176,7 @@ sub cgi ($) {
                # only works for GET requests
                chdir("$config{wikistatedir}/xapian") || error("chdir: $!");
                $ENV{OMEGA_CONFIG_FILE}="./omega.conf";
-               $ENV{CGIURL}=$config{cgiurl},
+               $ENV{CGIURL}=IkiWiki::cgiurl();
                IkiWiki::loadindex();
                $ENV{HELPLINK}=htmllink("", "", "ikiwiki/searching",
                        noimageinline => 1, linktext => "Help");
@@ -227,20 +227,21 @@ sub setupfiles () {
                        "database_dir .\n".
                        "template_dir ./templates\n");
                
-               # Avoid omega interpreting anything in the misctemplate
+               # Avoid omega interpreting anything in the cgitemplate
                # as an omegascript command.
-               my $misctemplate=IkiWiki::misctemplate(gettext("search"), "\0",
+               eval q{use IkiWiki::CGI};
+               my $template=IkiWiki::cgitemplate(undef, gettext("search"), "\0",
                        searchform => "", # avoid showing the small search form
                );
                eval q{use HTML::Entities};
                error $@ if $@;
-               $misctemplate=encode_entities($misctemplate, '\$');
+               $template=encode_entities($template, '\$');
 
                my $querytemplate=readfile(IkiWiki::template_file("searchquery.tmpl"));
-               $misctemplate=~s/\0/$querytemplate/;
+               $template=~s/\0/$querytemplate/;
 
                writefile("query", $config{wikistatedir}."/xapian/templates",
-                       $misctemplate);
+                       $template);
                $setup=1;
        }
 }