* @copyright 1999-2020 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @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_DEFAULT, $SQSPELL_APP, $SQSPELL_SPELLCHECKER, $SQSPELL_FORCE_POPEN, $attachment_dir, $color; if (! sqgetGlobalVar('sqspell_text',$sqspell_text,SQ_POST)) { $sqspell_text = ''; } if (! sqgetGlobalVar('sqspell_use_app',$sqspell_use_app,SQ_POST)) { $sqspell_use_app = $SQSPELL_APP_DEFAULT; } /** * Now we explode the lines for two 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 */ $sqspell_raw_lines = explode("\n", $sqspell_text); for ($i=0; $ierror)) { $msg= '
' . nl2br(sm_encode_html_special_chars($check->error)) . '
' . '
'; sqspell_makeWindow(null, _("SquirrelSpell is misconfigured."), null, $msg); exit; } $missed_words=Array(); $misses = Array(); $locations = Array(); $errors=0; $results = $check->check_text($sqspell_new_text); /** * Check for execution errors */ if (!empty($check->error)) { $msg= '
' . nl2br(sm_encode_html_special_chars($check->error)) . '
' . '
'; sqspell_makeWindow(null, _("SquirrelSpell is misconfigured."), null, $msg); exit; } if (is_array($results)) { // convert variables to old style squirrelspell results if (!empty($results)) { foreach(array_keys($results) as $word) { if (isset($results[$word]['locations'])) { $missed_words[] = $word; $locations[$word] = implode(', ',$results[$word]['locations']); if (isset($results[$word]['suggestions'])) { $misses[$word] = implode(', ',$results[$word]['suggestions']); } else { $misses[$word] = '_NONE'; } } else { // $word without 'locations'. ignore it } } $errors = count($missed_words); } } else { if (!empty($check->error)) { $error_msg = nl2br(sm_encode_html_special_chars($check->error)); } else { $error_msg = _("Unknown error"); } $msg= '
' . $error_msg . '
' . '
'; sqspell_makeWindow(null, _("SquirrelSpell error."), null, $msg); exit; } if ($errors){ /** * Load the spelling errors into JavaScript arrays * (More dark magic!) */ $extrajs="\n" . "\n"; displayHtmlHeader(_("SquirrelSpell Results"),$extrajs); echo "\n"; ?>

"; echo $sptag . _("Line with an error:") . ''; ?>
'; ?> '; ?>
'; ?> '; ?>


' . ' '; ?>
' . '
'; sqspell_makeWindow(null, _("No errors found"), null, $msg); } /** * For Emacs weenies: * Local variables: * mode: php * End: * vim: syntax=php et ts=4 */