<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="File" module="OFS.Image"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>_Cacheable__manager_id</string> </key>
            <value> <string>http_cache</string> </value>
        </item>
        <item>
            <key> <string>_EtagSupport__etag</string> </key>
            <value> <string>ts44338476.75</string> </value>
        </item>
        <item>
            <key> <string>__name__</string> </key>
            <value> <string>spellchecker.php</string> </value>
        </item>
        <item>
            <key> <string>content_type</string> </key>
            <value> <string>application/x-php</string> </value>
        </item>
        <item>
            <key> <string>data</string> </key>
            <value> <string encoding="cdata"><![CDATA[

<?php\r\n
header(\'Content-type: text/html; charset=utf-8\');\r\n
\r\n
// The following variables values must reflect your installation needs.\r\n
\r\n
$aspell_prog\t= \'"C:\\Program Files\\Aspell\\bin\\aspell.exe"\';\t// by FredCK (for Windows)\r\n
//$aspell_prog\t= \'aspell\';\t\t\t\t\t\t\t\t\t\t// by FredCK (for Linux)\r\n
\r\n
$lang\t\t\t= \'en_US\';\r\n
$aspell_opts\t= "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt";\t\t// by FredCK\r\n
\r\n
$tempfiledir\t= "./";\r\n
\r\n
$spellercss\t\t= \'../spellerStyle.css\';\t\t\t\t\t\t// by FredCK\r\n
$word_win_src\t= \'../wordWindow.js\';\t\t\t\t\t\t\t// by FredCK\r\n
\r\n
$textinputs\t\t= $_POST[\'textinputs\']; # array\r\n
$input_separator = "A";\r\n
\r\n
# set the JavaScript variable to the submitted text.\r\n
# textinputs is an array, each element corresponding to the (url-encoded)\r\n
# value of the text control submitted for spell-checking\r\n
function print_textinputs_var() {\r\n
\tglobal $textinputs;\r\n
\tforeach( $textinputs as $key=>$val ) {\r\n
\t\t# $val = str_replace( "\'", "%27", $val );\r\n
\t\techo "textinputs[$key] = decodeURIComponent(\\"" . htmlspecialchars($val, ENT_QUOTES) . "\\");\\n";\r\n
\t}\r\n
}\r\n
\r\n
# make declarations for the text input index\r\n
function print_textindex_decl( $text_input_idx ) {\r\n
\techo "words[$text_input_idx] = [];\\n";\r\n
\techo "suggs[$text_input_idx] = [];\\n";\r\n
}\r\n
\r\n
# set an element of the JavaScript \'words\' array to a misspelled word\r\n
function print_words_elem( $word, $index, $text_input_idx ) {\r\n
\techo "words[$text_input_idx][$index] = \'" . escape_quote( $word ) . "\';\\n";\r\n
}\r\n
\r\n
\r\n
# set an element of the JavaScript \'suggs\' array to a list of suggestions\r\n
function print_suggs_elem( $suggs, $index, $text_input_idx ) {\r\n
\techo "suggs[$text_input_idx][$index] = [";\r\n
\tforeach( $suggs as $key=>$val ) {\r\n
\t\tif( $val ) {\r\n
\t\t\techo "\'" . escape_quote( $val ) . "\'";\r\n
\t\t\tif ( $key+1 < count( $suggs )) {\r\n
\t\t\t\techo ", ";\r\n
\t\t\t}\r\n
\t\t}\r\n
\t}\r\n
\techo "];\\n";\r\n
}\r\n
\r\n
# escape single quote\r\n
function escape_quote( $str ) {\r\n
\treturn preg_replace ( "/\'/", "\\\\\'", $str );\r\n
}\r\n
\r\n
\r\n
# handle a server-side error.\r\n
function error_handler( $err ) {\r\n
\techo "error = \'" . preg_replace( "/[\'\\\\\\\\]/", "\\\\\\\\$0", $err ) . "\';\\n";\r\n
}\r\n
\r\n
## get the list of misspelled words. Put the results in the javascript words array\r\n
## for each misspelled word, get suggestions and put in the javascript suggs array\r\n
function print_checker_results() {\r\n
\r\n
\tglobal $aspell_prog;\r\n
\tglobal $aspell_opts;\r\n
\tglobal $tempfiledir;\r\n
\tglobal $textinputs;\r\n
\tglobal $input_separator;\r\n
\t$aspell_err = "";\r\n
\t# create temp file\r\n
\t$tempfile = tempnam( $tempfiledir, \'aspell_data_\' );\r\n
\r\n
\t# open temp file, add the submitted text.\r\n
\tif( $fh = fopen( $tempfile, \'w\' )) {\r\n
\t\tfor( $i = 0; $i < count( $textinputs ); $i++ ) {\r\n
\t\t\t$text = urldecode( $textinputs[$i] );\r\n
\r\n
\t\t\t// Strip all tags for the text. (by FredCK - #339 / #681)\r\n
\t\t\t$text = preg_replace( "/<[^>]+>/", " ", $text ) ;\r\n
\r\n
\t\t\t$lines = explode( "\\n", $text );\r\n
\t\t\tfwrite ( $fh, "%\\n" ); # exit terse mode\r\n
\t\t\tfwrite ( $fh, "^$input_separator\\n" );\r\n
\t\t\tfwrite ( $fh, "!\\n" ); # enter terse mode\r\n
\t\t\tforeach( $lines as $key=>$value ) {\r\n
\t\t\t\t# use carat on each line to escape possible aspell commands\r\n
\t\t\t\tfwrite( $fh, "^$value\\n" );\r\n
\t\t\t}\r\n
\t\t}\r\n
\t\tfclose( $fh );\r\n
\r\n
\t\t# exec aspell command - redirect STDERR to STDOUT\r\n
\t\t$cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1";\r\n
\t\tif( $aspellret = shell_exec( $cmd )) {\r\n
\t\t\t$linesout = explode( "\\n", $aspellret );\r\n
\t\t\t$index = 0;\r\n
\t\t\t$text_input_index = -1;\r\n
\t\t\t# parse each line of aspell return\r\n
\t\t\tforeach( $linesout as $key=>$val ) {\r\n
\t\t\t\t$chardesc = substr( $val, 0, 1 );\r\n
\t\t\t\t# if \'&\', then not in dictionary but has suggestions\r\n
\t\t\t\t# if \'#\', then not in dictionary and no suggestions\r\n
\t\t\t\t# if \'*\', then it is a delimiter between text inputs\r\n
\t\t\t\t# if \'@\' then version info\r\n
\t\t\t\tif( $chardesc == \'&\' || $chardesc == \'#\' ) {\r\n
\t\t\t\t\t$line = explode( " ", $val, 5 );\r\n
\t\t\t\t\tprint_words_elem( $line[1], $index, $text_input_index );\r\n
\t\t\t\t\tif( isset( $line[4] )) {\r\n
\t\t\t\t\t\t$suggs = explode( ", ", $line[4] );\r\n
\t\t\t\t\t} else {\r\n
\t\t\t\t\t\t$suggs = array();\r\n
\t\t\t\t\t}\r\n
\t\t\t\t\tprint_suggs_elem( $suggs, $index, $text_input_index );\r\n
\t\t\t\t\t$index++;\r\n
\t\t\t\t} elseif( $chardesc == \'*\' ) {\r\n
\t\t\t\t\t$text_input_index++;\r\n
\t\t\t\t\tprint_textindex_decl( $text_input_index );\r\n
\t\t\t\t\t$index = 0;\r\n
\t\t\t\t} elseif( $chardesc != \'@\' && $chardesc != "" ) {\r\n
\t\t\t\t\t# assume this is error output\r\n
\t\t\t\t\t$aspell_err .= $val;\r\n
\t\t\t\t}\r\n
\t\t\t}\r\n
\t\t\tif( $aspell_err ) {\r\n
\t\t\t\t$aspell_err = "Error executing `$cmd`\\\\n$aspell_err";\r\n
\t\t\t\terror_handler( $aspell_err );\r\n
\t\t\t}\r\n
\t\t} else {\r\n
\t\t\terror_handler( "System error: Aspell program execution failed (`$cmd`)" );\r\n
\t\t}\r\n
\t} else {\r\n
\t\terror_handler( "System error: Could not open file \'$tempfile\' for writing" );\r\n
\t}\r\n
\r\n
\t# close temp file, delete file\r\n
\tunlink( $tempfile );\r\n
}\r\n
\r\n
\r\n
?>\r\n
<html>\r\n
<head>\r\n
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n
<link rel="stylesheet" type="text/css" href="<?php echo $spellercss ?>" />\r\n
<script language="javascript" src="<?php echo $word_win_src ?>"></script>\r\n
<script language="javascript">\r\n
var suggs = new Array();\r\n
var words = new Array();\r\n
var textinputs = new Array();\r\n
var error;\r\n
<?php\r\n
\r\n
print_textinputs_var();\r\n
\r\n
print_checker_results();\r\n
\r\n
?>\r\n
\r\n
var wordWindowObj = new wordWindow();\r\n
wordWindowObj.originalSpellings = words;\r\n
wordWindowObj.suggestions = suggs;\r\n
wordWindowObj.textInputs = textinputs;\r\n
\r\n
function init_spell() {\r\n
\t// check if any error occured during server-side processing\r\n
\tif( error ) {\r\n
\t\talert( error );\r\n
\t} else {\r\n
\t\t// call the init_spell() function in the parent frameset\r\n
\t\tif (parent.frames.length) {\r\n
\t\t\tparent.init_spell( wordWindowObj );\r\n
\t\t} else {\r\n
\t\t\talert(\'This page was loaded outside of a frameset. It might not display properly\');\r\n
\t\t}\r\n
\t}\r\n
}\r\n
\r\n
\r\n
\r\n
</script>\r\n
\r\n
</head>\r\n
<!-- <body onLoad="init_spell();">\t\tby FredCK -->\r\n
<body onLoad="init_spell();" bgcolor="#ffffff">\r\n
\r\n
<script type="text/javascript">\r\n
wordWindowObj.writeBody();\r\n
</script>\r\n
\r\n
</body>\r\n
</html>\r\n


]]></string> </value>
        </item>
        <item>
            <key> <string>precondition</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>size</string> </key>
            <value> <int>5884</int> </value>
        </item>
        <item>
            <key> <string>title</string> </key>
            <value> <string></string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
