* @version $Id: check_me.mod,v 1.10.2.11 2005/10/16 13:05:34 tokul Exp $
* @package plugins
* @subpackage squirrelspell
*/
/**
* This function makes a javascript-powered link. Not sure why
* Philippe decided to move it outside the main code, but hey. ;)
* I bet for the i18n reasons.
*
* @param $jscode Javascript code to include in the link.
* @param $title A little pop-up title to provide for the links.
* @param $link The content of the link.
* @return void, since this just draws the content.
*/
function SpellLink($jscode, $title, $link) {
echo "
$link"
. ' | ';
}
/**
* Declaring globals for users with E_ALL set.
*/
global $SQSPELL_APP, $attachment_dir, $SQSPELL_EREG, $color;
$sqspell_text = $_POST['sqspell_text'];
$sqspell_use_app = $_POST['sqspell_use_app'];
/**
* Now we explode the lines for three reasons:
* 1) So we can ignore lines starting with ">" (reply's)
* 2) So we can stop processing when we get to "--" on a single line,
* which means that the signature is starting
* 3) So we can add an extra space at the beginning of each line. This way
* ispell/aspell don't treat these as command characters.
*/
$sqspell_raw_lines = explode("\n", $sqspell_text);
for ($i=0; $i'){
$sqspell_new_lines[$i] = ' ' . $sqspell_raw_lines[$i];
} else {
$sqspell_new_lines[$i] = ' ';
}
}
/**
* $sqspell_new_lines array now contains the lines to submit to the
* spellchecker.
*/
$sqspell_new_text=implode("\n", $sqspell_new_lines);
/**
* Define the command used to spellcheck the document.
*/
$sqspell_command=$SQSPELL_APP[$sqspell_use_app];
/**
* If you have php >= 4.3.0, we can use proc_open and safe mode
* and not mess w/ temp files. Otherwise we will do it the old
* way, (minus the uneeded call to cat that messes up Wintel
* boxen.)
* Thanks Ray Ferguson for providing this patch.
*/
if( check_php_version ( 4, 3 ) ) {
$descriptorspec = array(
0 => array('pipe', 'r'), // stdin is a pipe that the child will read from
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array('pipe', 'w'), // stderr is a pipe that the child will write to
);
$spell_proc = @proc_open($sqspell_command, $descriptorspec, $pipes);
if ( ! is_resource ( $spell_proc ) ) {
error_box ( sprintf(_("Could not run the spellchecker command (%s)."),
htmlspecialchars($sqspell_command) ) , $color );
// close html tags and abort script.
echo "