2 header(
'Content-type: text/html; charset=utf-8');
10 $aspell_opts =
"-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt";
20 # set the JavaScript variable to the submitted text.
21 # textinputs is an array, each element corresponding to the (url-encoded)
22 # value of the text control submitted for spell-checking
25 foreach( $textinputs as $key=>$val ) {
26 # $val = str_replace( "'", "%27", $val );
27 echo
"textinputs[$key] = decodeURIComponent(\"" . htmlspecialchars($val, ENT_QUOTES) .
"\");\n";
31 # make declarations for the text input index
33 echo
"words[$text_input_idx] = [];\n";
34 echo
"suggs[$text_input_idx] = [];\n";
37 # set an element of the JavaScript 'words' array to a misspelled word
39 echo
"words[$text_input_idx][$index] = '" .
escape_quote( $word ) .
"';\n";
43 # set an element of the JavaScript 'suggs' array to a list of suggestions
45 echo
"suggs[$text_input_idx][$index] = [";
46 foreach( $suggs as $key=>$val ) {
49 if ( $key+1 < count( $suggs )) {
59 return preg_replace (
"/'/",
"\\'", $str );
63 # handle a server-side error.
65 echo
"error = '" . preg_replace(
"/['\\\\]/",
"\\\\$0", $err ) .
"';\n";
68 ## get the list of misspelled words. Put the results in the javascript words array
69 ## for each misspelled word, get suggestions and put in the javascript suggs array
79 $tempfile = tempnam( $tempfiledir,
'aspell_data_' );
81 # open temp file, add the submitted text.
82 if( $fh = fopen( $tempfile,
'w' )) {
83 for(
$i = 0;
$i < count( $textinputs );
$i++ ) {
84 $text = urldecode( $textinputs[
$i] );
87 $text = preg_replace(
"/<[^>]+>/",
" ", $text ) ;
89 $lines = explode(
"\n", $text );
90 fwrite ( $fh,
"%\n" ); # exit terse mode
91 fwrite ( $fh,
"^$input_separator\n" );
92 fwrite ( $fh,
"!\n" ); # enter terse mode
93 foreach( $lines as $key=>$value ) {
94 # use carat on each line to escape possible aspell commands
95 fwrite( $fh,
"^$value\n" );
100 # exec aspell command - redirect STDERR to STDOUT
101 $cmd =
"$aspell_prog $aspell_opts < $tempfile 2>&1";
102 if( $aspellret = shell_exec( $cmd )) {
103 $linesout = explode(
"\n", $aspellret );
105 $text_input_index = -1;
106 # parse each line of aspell return
107 foreach( $linesout as $key=>$val ) {
108 $chardesc = substr( $val, 0, 1 );
109 # if '&', then not in dictionary but has suggestions
110 # if '#', then not in dictionary and no suggestions
111 # if '*', then it is a delimiter between text inputs
112 # if '@' then version info
113 if( $chardesc ==
'&' || $chardesc ==
'#' ) {
114 $line = explode(
" ", $val, 5 );
116 if( isset( $line[4] )) {
117 $suggs = explode(
", ", $line[4] );
123 }
elseif( $chardesc ==
'*' ) {
127 }
elseif( $chardesc !=
'@' && $chardesc !=
"" ) {
128 # assume this is error output
133 $aspell_err =
"Error executing `$cmd`\\n$aspell_err";
137 error_handler(
"System error: Aspell program execution failed (`$cmd`)" );
140 error_handler(
"System error: Could not open file '$tempfile' for writing" );
143 # close temp file, delete file
151 <meta
http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
152 <link rel=
"stylesheet" type=
"text/css" href=
"<?php echo $spellercss ?>" />
153 <script language=
"javascript" src=
"<?php echo $word_win_src ?>"></script>
154 <script language=
"javascript">
155 var suggs =
new Array();
156 var words =
new Array();
157 var textinputs =
new Array();
167 var wordWindowObj =
new wordWindow();
168 wordWindowObj.originalSpellings = words;
169 wordWindowObj.suggestions = suggs;
170 wordWindowObj.textInputs = textinputs;
172 function init_spell() {
178 if (parent.frames.length) {
179 parent.init_spell( wordWindowObj );
181 alert(
'This page was loaded outside of a frameset. It might not display properly');
191 <!-- <body onLoad=
"init_spell();"> by FredCK -->
192 <body onLoad=
"init_spell();" bgcolor=
"#ffffff">
194 <script type=
"text/javascript">
195 wordWindowObj.writeBody();
print_words_elem($word, $index, $text_input_idx)
This class manages all functions of the open flash chart api.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
print_suggs_elem($suggs, $index, $text_input_idx)
print_textindex_decl($text_input_idx)