📄 postmodify.php
字号:
<?php
!function_exists('readover') && exit('Forbidden');
require_once(R_P.'require/updateforum.php');
$t_typedb=array();
$t_per=0;$t_exits=0;
$t_db=$foruminfo['t_type'];
if($t_db){
$t_typedb=explode("\t",$t_db);
$t_typedb = array_unique ($t_typedb);
$t_per=$t_typedb[0];unset($t_typedb[0]);
}
if($article==0){
$tpcdb=$db->get_one("SELECT tm.aid,tm.ifsign,t.tid,t.fid AS tfid,t.author,t.authorid,t.icon,t.locked,t.postdate,t.subject,t.type,t.ifcheck,t.pollid,tm.content FROM pw_threads t LEFT JOIN pw_tmsgs tm ON tm.tid=t.tid WHERE t.tid='$tid'");
!$tpcdb['tid'] && Showmsg('illegal_tid');
@extract($tpcdb);
} else{
!is_numeric($pid) && Showmsg('illegal_tid');
$atcdb=$db->get_one("SELECT aid,ifsign,tid,fid AS tfid,author,authorid,icon,postdate,subject,content FROM pw_posts WHERE pid='$pid'");
!$atcdb['tid'] && Showmsg('illegal_tid');
@extract($atcdb);
$ifcheck=1;
}
if($tfid!=$fid){
Showmsg('illegal_tid');
}
$page=floor($article/$db_readperpage)+1;//修改的帖子所在的页数
if(!$admincheck && (!$SYSTEM['deltpcs'] || $groupid==5)){
if($groupid=='guest' || $authorid!=$winduid){
Showmsg('modify_noper');
}elseif($locked>0){
Showmsg('modify_locked');
}
}
if($winduid!=$authorid && $groupid!=3 && $groupid!=4){//改进性能 $windid!=$authorid
$authordb=$db->get_one("SELECT groupid FROM pw_members WHERE uid='$authorid'");
if(($authordb['groupid']==3 || $authordb['groupid']==4)){
Showmsg('modify_admin');
}
}
/**
* 编辑帖子时间限制
*/
if ($gp_edittime && ($timestamp-$postdate)>$gp_edittime*60){
Showmsg('modify_timelimit');
}
if($article==0){
@extract($db->get_one("SELECT voteopts FROM pw_polls WHERE pollid='$pollid'"));
$votearray = unserialize($voteopts);
} else{
$hideemail="disabled";
}
if (!$_POST['step']){
$attach=array();
if($aid){
$attachs= unserialize(stripslashes($aid));
if(is_array($attachs)){
$attach=$attachs;
}
}
if($article==0){
##主题分类
if($foruminfo['cms']){
include_once(R_P.'require/c_search.php');
list($tids,$kname)=search_tid($tid);
}
foreach($t_typedb as $value){
if($value) $t_exits=1;
}
$t_checked[$type]='selected';
if(is_array($votearray)){
if($votearray['multiple'][0])$multi='checked';
$mostnum=$votearray['multiple'][1];
}
}
empty($subject) && $subject=' ';
$htmcheck=$ifsign<2 ? '' : 'checked';
$atc_title=$subject;
$atc_content=$content;
//
if(strpos($atc_content,$db_bbsurl)!==false){
$atc_content=str_replace('p_w_picpath',$picpath,$atc_content);
$atc_content=str_replace('p_w_upload',$attachpath,$atc_content);
}
//
$atc_content = str_replace("<","<",$atc_content);
$atc_content = str_replace(">",">",$atc_content);
require_once('./header.php');
$guidename=forumindex($foruminfo['fup']);
if(trim($subject)){
$guidename[$subject]="read.php?tid=$tid";
}
$msg_guide=headguide($guidename);
require_once PrintEot('post');footer();
}elseif($_POST['step']==1){
/**
* 用户组权限
*/
if(!$admincheck && $gp_allowdelatc==0){
Showmsg('modify_group_right');
}
$rs=$db->get_one("SELECT replies FROM pw_threads WHERE tid='$tid'");
$count=$rs['replies'];
$count++;//加主题数
/**
* 已经被回复的帖子只有管理员,版主,父版块版主才能删除
*/
if($article==0 && !$admincheck && $count>1){
Showmsg('modify_replied');
}
if($f_score!=''){
list($P_Prvrc,$P_Rrvrc,$P_Pmoney,$P_Rmoney,$P_Drvrc,$P_Dmoney,$P_DRrvrc)=explode("|",$f_score);
is_numeric($P_Drvrc) && $db_dtdelrvrc=$P_Drvrc;
is_numeric($P_Dmoney) && $db_dtdelmoney=$P_Dmoney;
is_numeric($P_DRrvrc) && $db_dtdelrprvrc=$P_DRrvrc;
}
if(!$db_recycle || $fid==$db_recycle){
if($aid){
$attachs= unserialize(stripslashes($aid));
foreach($attachs as $key=>$value){
@unlink("$attachpath/$value[attachurl]");
$db->update("DELETE FROM pw_attachs WHERE aid='$key'");
}
}
}
$topic='';
if($article==0){
$deltype='Del topic';
$msg_delrvrc=$db_dtdelrvrc;
if($count==1){
$topic=1;
if(!$db_recycle || $fid==$db_recycle){
$db->update("DELETE FROM pw_tmsgs WHERE tid='$tid'");
$db->update("DELETE FROM pw_threads WHERE tid='$tid'");
@unlink("htm_data/$fid/".date('ym',$postdate)."/$tid.html");
} else{
$db->update("UPDATE pw_threads SET fid='$db_recycle',topped=0 WHERE tid='$tid'");
@unlink("htm_data/$fid/".date('ym',$postdate)."/$tid.html");
$db->update("UPDATE pw_forums SET topic=topic+1,article=article+1 WHERE fid='$db_recycle'");
}
} else{
@extract($db->get_one("SELECT * FROM pw_posts WHERE tid='$tid' ORDER BY postdate LIMIT 1"));
$db->update("DELETE FROM pw_posts WHERE pid='$pid'");
$subject && $subject="subject='$subject',";
$ifupload=getattachtype($tid);
$db->update("UPDATE pw_threads SET icon='$icon',$subject author='$author ',authorid='$authorid',postdate='$postdate',ifupload='$ifupload' WHERE tid='$tid'");
$db->update("UPDATE pw_tmsgs SET aid='$aid',userip='$userip',ifsign='$ifsign',ipfrom='$ipfrom' ,alterinfo='$alterinfo',ifconvert='$ifconvert',content='$content' WHERE tid='$tid'");
}
} else{
$deltype='Del reply';
$msg_delrvrc=$db_dtdelrprvrc;
$db->update("DELETE FROM pw_posts WHERE pid='$pid'");
}
if(!$topic){
if($count==2){
$lastinfo=$db->get_one("SELECT subject,postdate,author FROM pw_threads WHERE tid='$tid' ");
} else{
$lastinfo=$db->get_one("SELECT subject,postdate,author FROM pw_posts WHERE tid='$tid' ORDER BY postdate DESC LIMIT 1");
}
$sqladd = $count > 1 ? "replies=replies-1," : '';
$db->update("UPDATE pw_threads SET $sqladd lastpost='$lastinfo[postdate]',lastposter='$lastinfo[author]' WHERE tid='$tid'");
}
@unlink(R_P.'data/bbscache/c_cache.php');
updateforum($fid);
$lastpost=explode("\t",$foruminfo['lastpost']);
if($lastpost[2] == $postdate){
lastinfo($fid,$foruminfo['allowhtm'],'',$foruminfo['cms'].$foruminfo['cms'].'B');
}
/**
* 删回复贴后扣积分发贴数
*/
dtchange($authorid,-$msg_delrvrc,-1,-$db_dtdelmoney);
$msg_delrvrc=floor($msg_delrvrc/10);
$newlog_forum="<?die;?>|$deltype|$fid|$tid|$tpc_title|$tpc_author|无意义的回复贴|-$msg_delrvrc|-$db_dtdelmoney|$timestamp|$windid|$onlineip|\n";
writeover(R_P."data/bbscache/log_forum.php",$newlog_forum,"ab");
if(!$topic && $foruminfo['allowhtm'] && $article<=$db_readperpage ){
include_once R_P.'require/template.php';
refreshto("read.php?tid=$tid",'enter_thread');
} else{
refreshto("thread.php?fid=$fid",'enter_thread');
}
} elseif($_POST['step']==2){
list($atc_title,$atc_content)=check_data();
if($article==0 && is_array($votearray)){
foreach($vt_selarray as $key=>$voteoption){
$voteoption = trim(Char_cv($voteoption));
if($voteoption){
$votearray['options'][$key] = array($voteoption, $votearray['options'][$key][1],$votearray['options'][$key][2]);
}
}
if($mostvotes && is_numeric($mostvotes)){
$mostvotes>count($vt_selarray)?$mostvotes=count($vt_selarray):'';
} else{
$mostvotes=count($vt_selarray);
}
$votearray['multiple'] = array($multiplevote,$mostvotes);
$voteopts =addslashes(serialize($votearray));
$voteopts="voteopts='$voteopts'";
$db->update("UPDATE pw_polls SET $voteopts WHERE pollid='$pollid'");
}
/**
* 附件修改
*/
$oldattach=array();
if($aid){
$oldattach=unserialize(stripslashes($aid));
foreach($oldattach as $key=>$value){
if(!@in_array($key,$keep)){
@unlink("$attachpath/$value[attachurl]");
$db->update("DELETE FROM pw_attachs WHERE aid='$key'");
unset($oldattach[$key]);
}
}
}
require_once(R_P.'require/postupload.php');
if($attachs){
$attachs=unserialize(stripslashes($attachs));
foreach($attachs as $key=>$value){
$oldattach[$key]=$value;
}
$db->update("UPDATE pw_memberdata SET uploadtime='$winddb[uploadtime]',uploadnum='$winddb[uploadnum]' WHERE uid='$winduid'");
}
if($oldattach){
$oldattach=addslashes(serialize($oldattach));
} else{
$oldattach='';
}
$atc_iconid=(is_numeric($atc_iconid)) ? $atc_iconid : $icon;
$timeofedit=get_date($timestamp);
if($windid!=$manager &&$groupid!=3 && $postdate+300<$timestamp){
require_once GetLang('post');
$alterinfo=$lang['edit_post'];
} else{
$alterinfo='';
}
if($windid==$manager){
/**
* 管理员编辑帖子的安全日记
*/
$newlog_forum="<?die;?>|Edit Article|$fid|$tid|$tpc_title|$tpc_author|AminOperate|0|0|$timestamp|$windid|$onlineip|\n";
writeover(R_P."data/bbscache/log_forum.php",$newlog_forum,"ab");
}
if($_POST['atc_convert']=="1"){
$_POST['atc_autourl'] && $atc_content=autourl($atc_content);
$atc_content = html_check($atc_content);
/*
* [post]、[hide、[sell=位置不能换
*/
if(!$foruminfo['allowhide'] || !$gp_allowhidden){
$atc_content=str_replace("[post]","[\tpost]",$atc_content);
} elseif($atc_hide=='1'){
$atc_content=str_replace("[post]","",$atc_content);
$atc_content=str_replace("[/post]","",$atc_content);
$atc_content="[post]".$atc_content."[/post]";
}
if(!$foruminfo['allowencode'] || !$gp_allowencode){
$atc_content=str_replace("[hide=","[\thide=",$atc_content);
} elseif($atc_requirervrc=='1' ){
$atc_content=preg_replace("/\[hide=(.+?)\]/eis","",$atc_content);
$atc_content=str_replace("[/hide]","",$atc_content);
$atc_content="[hide=".$atc_rvrc."]".$atc_content."[/hide]";
}
if($authorid==$winduid && (!$foruminfo['allowsell'] || !$gp_allowsell || $article!=0)){
$atc_content=str_replace("[sell=","[\tsell=",$atc_content);
} elseif($atc_requiresell=='1'){
$atc_content=preg_replace("/\[sell=(.+?)\]/eis","",$atc_content);
$atc_content=str_replace("[/sell]","",$atc_content);
$atc_content="[sell=".$atc_money."]".$atc_content."[/sell]";
}
$lxcontent=convert($atc_content,$db_windpost);
$ifconvert=$lxcontent==$atc_content ? 1:2;
}else{
$ifconvert=1;
}
$atc_content=trim($atc_content);
if($authorid==$winduid){
$ipdata="userip='$onlineip',ipfrom='$ipfrom',";
} else{
$ipdata='';
}
if($article==0){
if($foruminfo['cms']){
$db->update("DELETE FROM pw_ks WHERE tid='$tid'");
include_once(R_P.'require/c_search.php');
insert_key($tid,$keyword);
}
$db->update("UPDATE pw_tmsgs SET aid='$oldattach',$ipdata ifsign='$atc_usesign',alterinfo='$alterinfo',ifconvert='$ifconvert',content='$atc_content' WHERE tid='$tid'");
} else{
$db->update("UPDATE pw_posts SET aid='$oldattach',$ipdata icon='$atc_iconid',subject='$atc_title',ifsign='$atc_usesign',alterinfo='$alterinfo',ifconvert='$ifconvert',content='$atc_content'WHERE pid='$pid'");
}
$ifupload=getattachtype($tid);
if($article==0){
##主题分类
if(!$p_type || empty($t_typedb[$p_type]) || ($t_per==0 && !$admincheck)){
$w_type=0;
}else{
$w_type=$p_type;
}
$db->update("UPDATE pw_threads SET icon='$atc_iconid',subject='$atc_title',type='$w_type',ifupload='$ifupload' WHERE tid='$tid'");
} else{
$db->update("UPDATE pw_threads SET ifupload='$ifupload' WHERE tid='$tid'");
}
if($foruminfo['allowhtm'] && $article<$db_readperpage){
include_once R_P.'require/template.php';
}
$lastpost=explode("\t",$foruminfo['lastpost']);
if($lastpost[2] == $postdate){
lastinfo($fid,$foruminfo['allowhtm'],'',$foruminfo['cms'].'B');
}
refreshto("read.php?tid=$tid&page=$page&toread=1",'enter_thread');
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -