From 95657bc6773c23c04843d51d5224df0bbd5191f0 Mon Sep 17 00:00:00 2001 From: andi Date: Wed, 8 Jun 2005 20:27:58 +0200 Subject: Spellchecker fixes The spellchecker now works in IE6, Firefox and Opera 8 :-) SACK was updated to the latest release (plus a minor fix) Proper UTF-8 headers were added to the AJAX PHP backends darcs-hash:20050608182758-9977f-1eacd0ba9993a62f094433d982f668e38d17ba14.gz --- lib/exe/ajax.php | 5 ++++- lib/exe/spellcheck.php | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 02911b858..c75bce52d 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -17,12 +17,15 @@ require_once(DOKU_INC.'inc/common.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/auth.php'); +header('Content-Type: text/html; charset=utf-8'); + + //call the requested function $call = 'ajax_'.$_POST['call']; if(function_exists($call)){ $call(); }else{ - print "The called function does not exist!"; + print "The called function '".htmlspecialchars($call)."' does not exist!"; } /** diff --git a/lib/exe/spellcheck.php b/lib/exe/spellcheck.php index c6a883e32..bdd6789d4 100644 --- a/lib/exe/spellcheck.php +++ b/lib/exe/spellcheck.php @@ -51,6 +51,8 @@ require_once (DOKU_INC.'inc/init.php'); require_once (DOKU_INC.'inc/utf8.php'); require_once (DOKU_INC.'inc/aspell.php'); +header('Content-Type: text/html; charset=utf-8'); + //create spell object $spell = new Aspell($conf['lang'],'null','utf-8'); $spell->setMode(PSPELL_FAST); @@ -84,7 +86,12 @@ function spell_check() { // $string = preg_replace('!()!e','spellclean(\\1)',$string); // run aspell in terse sgml mode - $spell->runAspell("!\n+sgml\n".$string,$out,$err); + if(!$spell->runAspell("!\n+sgml\n".$string,$out,$err)){ + print '2'; //to indicate an error + print "An error occured while trying to run the spellchecker:\n"; + print $err; + return; + } // go through the result $lines = split("\n",$out); -- cgit v1.2.3