今天用DedeCMS,在个人中心文章中添加了一些自定字段,结果发现修改文章的时候提示“数据校验不对,程序返回”。
今天用DedeCMS,在个人中心文章中添加了一些自定字段,结果发现修改文章的时候提示 数据校验不对,程序返回 。
1、修改 member\inc\inc_archives_functions.php 文件
找到这段,红色部分是增加的两行
/**
* 载入自定表单(用于编辑)
* @bug 修正编辑时候没有输出dede_fieldshash输入框 by
* @param string $fieldset
* @param string $fieldValues
* @param string $loadtype
* @return string
*/
function PrintAutoFieldsEdit( $fieldset, $fieldValues, $loadtype='all')
{
global $cfg_cookie_encode;
$dtp = new DedeTagParse();
$dtp- SetNameSpace( field , ,
$dtp- LoadSource($fieldset);
$dede_addonfields =
if(is_array($dtp- CTags))
{
foreach($dtp- CTags as $tid= $ctag)
{
if($loadtype!='autofield'
|| ($loadtype=='autofield' $ctag- GetAtt('autofield')==1) )
{
$dede_addonfields .= ( $dede_addonfields=='' ? $ctag- GetName(). , .$ctag- GetAtt('type') : .$ctag- GetName(). , .$ctag- GetAtt('type') );
echo GetFormItemValueA($ctag,$fieldValues[$ctag- GetName()]);
}
}
}
echo input type='hidden' name='dede_addonfields' value=\ .$dede_addonfields. \ \r\n
echo input type=\ hidden\ name=\ dede_fieldshash\ value=\ .md5($dede_addonfields.$cfg_cookie_encode). \ /
}
2、找到如下几行,删除或者注释掉
// 这里对前台提交的附加数据进行一次校验
$fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE);
if ($fontiterm != $inadd_f)
{
ShowMsg( 表单提交同系统设置不相符,请重新提交! , -1
exit();
}
再次编辑提交就一切正常了。
关键字:DedeCMS