Happy New Year
[squirrelmail.git] / plugins / squirrelspell / modules / check_me.mod
index 35f27f7e5bf9e129894a25ba153118d546952753..38cc3bcfdf4bb5d6f16e28e32e8f5281a72c0c5a 100644 (file)
@@ -10,7 +10,7 @@
  * the interface window.
  *
  * @author Konstantin Riabitsev <icon at duke.edu>
- * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2021 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -36,7 +36,7 @@ function SpellLink($jscode, $title, $link) {
 /**
  * Declaring globals for users with E_ALL set.
  */
-global $SQSPELL_APP_DEFAULT, $SQSPELL_APP, $SQSPELL_SPELLCHECKER, 
+global $SQSPELL_APP_DEFAULT, $SQSPELL_APP, $SQSPELL_SPELLCHECKER,
   $SQSPELL_FORCE_POPEN, $attachment_dir, $color;
 
 if (! sqgetGlobalVar('sqspell_text',$sqspell_text,SQ_POST)) {
@@ -106,7 +106,7 @@ if ($SQSPELL_SPELLCHECKER===1) {
  */
 if (!empty($check->error)) {
   $msg= '<div style="text-align: center;">'
-      . nl2br(htmlspecialchars($check->error))
+      . nl2br(sm_encode_html_special_chars($check->error))
      . '<form onsubmit="return false">'
      . '<input type="submit" value="  ' . _("Close")
      . '  " onclick="self.close()" /></form></div>';
@@ -125,7 +125,7 @@ $results = $check->check_text($sqspell_new_text);
  */
 if (!empty($check->error)) {
   $msg= '<div style="text-align: center;">'
-      . nl2br(htmlspecialchars($check->error))
+      . nl2br(sm_encode_html_special_chars($check->error))
      . '<form onsubmit="return false">'
      . '<input type="submit" value="  ' . _("Close")
      . '  " onclick="self.close()" /></form></div>';
@@ -153,7 +153,7 @@ if (is_array($results)) {
     }
 } else {
     if (!empty($check->error)) {
-        $error_msg = nl2br(htmlspecialchars($check->error));
+        $error_msg = nl2br(sm_encode_html_special_chars($check->error));
     } else {
         $error_msg = _("Unknown error");
     }
@@ -181,8 +181,9 @@ if ($errors){
    */
   $extrajs.= "var sqspell_lines=new Array();\n";
   for ($i=0; $i<sizeof($sqspell_lines); $i++){
+    // use addcslashes for compatibility with magic_quotes_sybase
     $extrajs.= "sqspell_lines[$i] = \""
-      . chop(addslashes($sqspell_lines[$i])) . "\";\n";
+      . chop(addcslashes($sqspell_lines[$i], ">'\"\\\x0")) . "\";\n";
   }
   $extrajs.= "\n\n";
 
@@ -200,7 +201,7 @@ if ($errors){
    */
   $extrajs.= "var suggestions = new Array();\n";
   $i=0;
-  while (list($word, $value) = each($misses)){
+  foreach ($misses as $value){
     if ($value=='_NONE') $value='';
     $extrajs.= "suggestions[$i] = \"$value\";\n";
     $i++;
@@ -212,7 +213,7 @@ if ($errors){
    */
   $extrajs.= "var locations= new Array();\n";
   $i=0;
-  while (list($word, $value) = each($locations)){
+  foreach ($locations as $value){
     $extrajs.= "locations[$i] = \"$value\";\n";
     $i++;
   }
@@ -229,7 +230,7 @@ if ($errors){
 
 
   /**
-   * Did I mention that I hate dots on the end of contcatenated lines?
+   * Did I mention that I hate dots on the end of concatenated lines?
    * Dots at the beginning make so much more sense!
    */
   $extrajs.= "//-->\n"