<?php
header('Content-type: text/html; charset=utf-8');
// The following variables values must reflect your installation needs.
$aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows)
//$aspell_prog = 'aspell'; // by FredCK (for Linux)
$lang = 'en_US';
$aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; // by FredCK
$tempfiledir = "./";
$spellercss = '../spellerStyle.css'; // by FredCK
$word_win_src = '../wordWindow.js'; // by FredCK
$textinputs = $_POST['textinputs']; # array
$input_separator = "A";
# set the JavaScript variable to the submitted text.
# textinputs is an array, each element corresponding to the (url-encoded)
# value of the text control submitted for spell-checking
function print_textinputs_var() {
global $textinputs;
foreach( $textinputs as $key=>$val ) {
# $val = str_replace( "'", "%27", $val );
echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n";
}
}
# make declarations for the text input index
function print_textindex_decl( $text_input_idx ) {
echo "words[$text_input_idx] = [];\n";
echo "suggs[$text_input_idx] = [];\n";
}
# set an element of the JavaScript 'words' array to a misspelled word
function print_words_elem( $word, $index, $text_input_idx ) {
echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n";
}
# set an element of the JavaScript 'suggs' array to a list of suggestions
function print_suggs_elem( $suggs, $index, $text_input_idx ) {
echo "suggs[$text_input_idx][$index] = [";
foreach( $suggs as $key=>$val ) {
if( $val ) {
echo "'" . escape_quote( $val ) . "'";
if ( $key+1 < count( $suggs )) {
echo ", ";
}
}
}
echo "];\n";
}
# escape single quote
function escape_quote( $str ) {
return preg_replace ( "/'/", "\\'", $str );
}
# handle a server-side error.
function error_handler( $err ) {
echo "error = '" . escape_quote( $err ) . "';\n";
}
## get the list of misspelled words. Put the results in the javascript words array
## for each misspelled word, get suggestions and put in the javascript suggs array
function print_checker_results() {
global $aspell_prog;
global $aspell_opts;
global $tempfiledir;
global $textinputs;
global $input_separator;
$aspell_err = "";
# create temp file
$tempfile = tempnam( $tempfiledir, 'aspell_data_' );
# open temp file, add the submitted text.
if( $fh = fopen( $tempfile, 'w' )) {
for( $i = 0; $i < count( $textinputs ); $i++ ) {
$text = urldecode( $textinputs[$i] );
$lines = explode( "\n", $text );
fwrite ( $fh, "%\n" ); # exit terse mode
fwrite ( $fh, "^$input_separator\n" );
fwrite ( $fh, "!\n" ); # enter terse mode
foreach( $lines as $key=>$value ) {
# use carat on each line to escape possible aspell commands
fwrite( $fh, "^$value\n" );
}
}
fclose( $fh );
# exec aspell command - redirect STDERR to STDOUT
$cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1";
if( $aspellret = shell_exec( $cmd )) {
$linesout = explode( "\n", $aspellret );
$index = 0;
$text_input_index = -1;
# parse each line of aspell return
foreach( $linesout as $key=>$val ) {
$chardesc = substr( $val, 0, 1 );
# if '&', then not in dictionary but has suggestions
# if '#', then not in dictionary and no suggestions
# if '*', then it is a delimiter between text inputs
# if '@' then version info
if( $chardesc == '&' || $chardesc == '#' ) {
$line = explode( " ", $val, 5 );
print_words_elem( $line[1], $index, $text_input_index );
if( isset( $line[4] )) {
$suggs = explode( ", ", $line[4] );
} else {
$suggs = array();
}
print_suggs_elem( $suggs, $index, $text_input_index );
$index++;
} elseif( $chardesc == '*' ) {
$text_input_index++;
print_textindex_decl( $text_input_index );
$index = 0;
} elseif( $chardesc != '@' && $chardesc != "" ) {
# assume this is error output
$aspell_err .= $val;
}
}
if( $aspell_err ) {
$aspell_err = "Error executing `$cmd`\\n$aspell_err";
error_handler( $aspell_err );
}
} else {
error_handler( "System error: Aspell program execution failed (`$cmd`)" );
}
} else {
error_handler( "System error: Could not open file '$tempfile' for writing" );
}
# close temp file, delete file
unlink( $tempfile );
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="<?php echo $spellercss ?>" />
<script language="javascript" src="<?php echo $word_win_src ?>"></script>
<script language="javascript">
var suggs = new Array();
var words = new Array();
var textinputs = new Array();
var error;
<?php
print_textinputs_var();
print_checker_results();
?>
var wordWindowObj = new wordWindow();
wordWindowObj.originalSpellings = words;
wordWindowObj.suggestions = suggs;
wordWindowObj.textInputs = textinputs;
function init_spell() {
// check if any error occured during server-side processing
if( error ) {
alert( error );
} else {
// call the init_spell() function in the parent frameset
if (parent.frames.length) {
parent.init_spell( wordWindowObj );
} else {
alert('This page was loaded outside of a frameset. It might not display properly');
}
}
}
</script>
</head>
<!-- <body onLoad="init_spell();"> by FredCK -->
<body onLoad="init_spell();" bgcolor="#ffffff">
<script type="text/javascript">
wordWindowObj.writeBody();
</script>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
风讯dotnetcms v1.0 sp4 100331免费版_源码包
共2585个文件
cs:1118个
gif:641个
aspx:417个
需积分: 3 3 下载量 128 浏览量
2010-06-28
09:53:19
上传
评论
收藏 6.65MB RAR 举报
温馨提示
很好用的CMS系统,有源码,可以直接运行, 很有参考价值,尤其是入门者
资源推荐
资源详情
资源评论
收起资源包目录
风讯dotnetcms v1.0 sp4 100331免费版_源码包 (2585个子文件)
Global.asax 1KB
UserPop.ascx 3KB
CollectEditor.ascx 2KB
PageNavigator.ascx 1KB
News_add.aspx 93KB
createLabel_Routine.aspx 90KB
sys_Param.aspx 78KB
createLabel_Member.aspx 43KB
View.aspx 41KB
Friend_List.aspx 39KB
createLabel_List.aspx 33KB
usergroupadd.aspx 30KB
UserGroupEdit.aspx 30KB
reviewGroup.aspx 28KB
Class_add.aspx 26KB
Site_add.aspx 25KB
News_list.aspx 23KB
createLabel_List.aspx 23KB
FreeLabel_Add.aspx 22KB
Ads_add.aspx 22KB
createLabel_Ultimate.aspx 22KB
site.aspx 20KB
ads_edit.aspx 20KB
setTitle.aspx 18KB
info.aspx 18KB
applyads_add.aspx 18KB
setItem.aspx 16KB
admin_GroupAdd.aspx 16KB
admin_GroupEdit.aspx 16KB
createLabel_simpleList.aspx 15KB
unNews_Edit.aspx 15KB
news_page.aspx 15KB
userinfo.aspx 14KB
createLabel_Other.aspx 14KB
siteTask_edit.aspx 14KB
Collect_StepFour.aspx 14KB
JS_Add.aspx 14KB
class_list.aspx 13KB
Special_add.aspx 13KB
Collect_Add.aspx 13KB
add_discussManage.aspx 12KB
step3.aspx 12KB
index.aspx 12KB
dateTime.aspx 12KB
siteTask_add.aspx 12KB
userinfo_update.aspx 12KB
Special_edit.aspx 12KB
Recyle.aspx 12KB
userinfo.aspx 11KB
database.aspx 11KB
icard_adds.aspx 11KB
userinfo_base.aspx 11KB
about.aspx 11KB
up_discussManage.aspx 11KB
Constr.aspx 10KB
CustomForm_Add.aspx 10KB
discussManage_add.aspx 10KB
style_add.aspx 10KB
style_edit.aspx 10KB
Collect_News.aspx 10KB
friend.aspx 10KB
content.aspx 10KB
main.aspx 10KB
Class_ToTemplet.aspx 10KB
setSteps.aspx 9KB
Photoalbum_up.aspx 9KB
News_Manage.aspx 9KB
admin_edit.aspx 9KB
General_Edit_Manage.aspx 9KB
iCardEdit.aspx 9KB
admin_add.aspx 9KB
editor.aspx 9KB
step_End.aspx 9KB
CustomForm_Item_Add.aspx 9KB
Constr_up.aspx 9KB
list.aspx 9KB
icard_add.aspx 9KB
Collect_NewsModify.aspx 9KB
setClass.aspx 9KB
discussPhotoalbum_up.aspx 9KB
createLabel_Browse.aspx 8KB
JS_Templet_Add.aspx 8KB
const.aspx 8KB
photo_add.aspx 8KB
General_Add_Manage.aspx 8KB
createLabel_Class.aspx 8KB
usermycom.aspx 8KB
Txteditor.aspx 8KB
navimenu.aspx 8KB
checkFiles.aspx 8KB
discussacti_up.aspx 8KB
Collect_List.aspx 8KB
FreeLabel_AddEnd.aspx 8KB
discussacti.aspx 8KB
discussacti_up.aspx 8KB
navimenuEdit.aspx 8KB
userinfo_contact.aspx 8KB
Collect_StepTwo.aspx 8KB
userlist.aspx 7KB
admin_POPSet.aspx 7KB
共 2585 条
- 1
- 2
- 3
- 4
- 5
- 6
- 26
资源评论
shangkouai
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功