fetch1("select plface from {$dbtbpre}enewspl_set limit 1");
if(strstr($r[plface],'||'.$faceword.'##'))
{
printerror("HavePlface","history.go(-1)");
}
if(empty($r[plface]))
{
$r[plface]='||';
}
$newplface=$r[plface].$faceword."##".$facefile."||";
$newplface=hRepPostStr($newplface,1);
$sql=$empire->query("update {$dbtbpre}enewspl_set set plface='$newplface' limit 1");
if($sql)
{
GetPlfaceJs();
GetConfig();//更新缓存
//操作日志
insert_dolog("$faceword");
printerror("AddPlfaceSuccess","plface.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//----------------修改表情
function EditPlface($add,$userid,$username){
global $empire,$dbtbpre;
$facefile=$add[facefile];
$faceword=$add[faceword];
$count=count($faceword);
$plface='||';
for($i=0;$i<$count;$i++)
{
$facefile[$i]=DoRepPlface($facefile[$i]);
$faceword[$i]=DoRepPlface($faceword[$i]);
if($faceword[$i])
{
$plface.=$faceword[$i]."##".$facefile[$i]."||";
}
}
$plface=hRepPostStr($plface,1);
$sql=$empire->query("update {$dbtbpre}enewspl_set set plface='$plface' limit 1");
if($sql)
{
GetPlfaceJs();
GetConfig();//更新缓存
//操作日志
insert_dolog("");
printerror("EditPlfaceSuccess","plface.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//----------------生成表情JS
function GetPlfaceJs(){
global $empire,$dbtbpre,$public_r;
$r=$empire->fetch1("select plface,plfacenum from {$dbtbpre}enewspl_set limit 1");
if(empty($r['plfacenum']))
{
return '';
}
$filename="../../../d/js/js/plface.js";
$facer=explode('||',$r['plface']);
$count=count($facer);
for($i=1;$i<$count-1;$i++)
{
if($i%$r['plfacenum']==0)
{
$br="
";
}
else
{
$br=" ";
}
$face=explode('##',$facer[$i]);
$allface.="
".$br;
}
$allface="document.write(\"\");document.write(\"".$allface."\");";
WriteFiletext_n($filename,$allface);
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
include('../../class/hplfun.php');
}
//增加
if($enews=="AddPlface")
{
AddPlface($_POST,$logininid,$loginin);
}
//修改
elseif($enews=="EditPlface")
{
EditPlface($_POST,$logininid,$loginin);
}
$r=$empire->fetch1("select plface from {$dbtbpre}enewspl_set limit 1");
db_close();
$empire=null;
?>
管理评论表情