';
}
else {
$incPhoto .= '
';
}
}
getDbUpdate($table['s_numinfo'],'upload=upload+1',"date='".$date['today']."' and site=".$s);
if ($up_gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
}
if ($uid && $upfiles)
{
$_uploadtmp = getArrayString($upfiles);
foreach($_uploadtmp['data'] as $_val)
{
$U = getUidData($table['s_upload'],$_val);
if ($U['type'] == 2)
{
if ($fserver)
{
$incPhoto .= '
';
}
else {
$incPhoto .= '
';
}
}
}
}
if ($incPhoto)
{
if ($insert_photo == 'top')
{
$content = $incPhoto.nl2br($content);
}
if ($insert_photo == 'bottom')
{
$content = nl2br($content).'
'.$incPhoto;
}
$html = 'HTML';
}
if ($fserver)
{
ftp_close($FTP_CONNECT);
}
}
if (!$uid || $reply == 'Y')
{
if(!getDbRows($table[$m.'day'],"date='".$date['today']."' and site=".$s.' and bbs='.$bbsuid))
getDbInsert($table[$m.'day'],'date,site,bbs,num',"'".$date['today']."','".$s."','".$bbsuid."','0'");
if(!getDbRows($table[$m.'month'],"date='".$date['month']."' and site=".$s.' and bbs='.$bbsuid))
getDbInsert($table[$m.'month'],'date,site,bbs,num',"'".$date['month']."','".$s."','".$bbsuid."','0'");
}
if ($uid)
{
$R = getUidData($table[$m.'data'],$uid);
if (!$R['uid']) getLink('','','존재하지 않는 게시물입니다.','');
if ($reply == 'Y')
{
if (!$my['admin'] && !strstr(','.($d['bbs']['admin']?$d['bbs']['admin']:'.').',',','.$my['id'].','))
{
if ($d['bbs']['perm_l_write'] > $my['level'] || strstr($d['bbs']['perm_g_write'],'['.$my['sosok'].']'))
{
getLink('','','정상적인 접근이 아닙니다.','');
}
}
$RNUM = getDbRows($table[$m.'idx'],'gid >= '.$R['gid'].' and gid < '.(intval($R['gid'])+1));
if ($RNUM > 98) getLink('','','죄송합니다. 더이상 답글을 달 수 없습니다.','');
getDbUpdate($table[$m.'idx'],'gid=gid+0.01','gid > '.$R['gid'].' and gid < '.(intval($R['gid'])+1));
getDbUpdate($table[$m.'data'],'gid=gid+0.01','gid > '.$R['gid'].' and gid < '.(intval($R['gid'])+1));
if ($R['hidden'] && $hidden)
{
if ($R['mbruid'])
{
$pw = $R['mbruid'];
}
else {
$pw = $my['uid'] ? $R['pw'] : ($pw == $R['pw'] ? $R['pw'] : md5($pw));
}
}
else {
$pw = $pw ? md5($pw) : '';
}
$gid = $R['gid']+0.01;
$depth = $R['depth']+1;
$parentmbr = $R['mbruid'];
$QKEY = "site,gid,bbs,bbsid,depth,parentmbr,display,hidden,notice,name,nic,mbruid,id,pw,category,subject,content,html,tag,";
$QKEY.= "hit,down,comment,oneline,trackback,score1,score2,singo,point1,point2,point3,point4,d_regis,d_modify,d_comment,d_trackback,upload,ip,agent,sns,adddata";
$QVAL = "'$s','$gid','$bbsuid','$bbsid','$depth','$parentmbr','$display','$hidden','$notice','$name','$nic','$mbruid','$id','$pw','$category','$subject','$content','$html','$tag',";
$QVAL.= "'0','0','0','0','0','0','0','0','$point1','$point2','$point3','$point4','$d_regis','','','','$upload','$ip','$agent','','$adddata'";
getDbInsert($table[$m.'data'],$QKEY,$QVAL);
getDbInsert($table[$m.'idx'],'site,notice,bbs,gid',"'$s','$notice','$bbsuid','$gid'");
getDbUpdate($table[$m.'list'],"num_r=num_r+1,d_last='".$d_regis."'",'uid='.$bbsuid);
getDbUpdate($table[$m.'month'],'num=num+1',"date='".$date['month']."' and site=".$s.' and bbs='.$bbsuid);
getDbUpdate($table[$m.'day'],'num=num+1',"date='".$date['today']."' and site=".$s.' and bbs='.$bbsuid);
$LASTUID = getDbCnt($table[$m.'data'],'max(uid)','');
if ($cuid) getDbUpdate($table['s_menu'],"num='".getDbCnt($table[$m.'month'],'sum(num)','site='.$s.' and bbs='.$bbsuid)."',d_last='".$d_regis."'",'uid='.$cuid);
if ($point1&&$my['uid'])
{
getDbInsert($table['s_point'],'my_mbruid,by_mbruid,price,content,d_regis',"'".$my['uid']."','0','".$point1."','게시물(".getStrCut($subject,15,'').")포인트','".$date['totime']."'");
getDbUpdate($table['s_mbrdata'],'point=point+'.$point1,'memberuid='.$my['uid']);
}
}
else
{
if ($my['uid'] != $R['mbruid'] && !$my['admin'] && !strstr(','.($d['bbs']['admin']?$d['bbs']['admin']:'.').',',','.$my['id'].','))
{
if (!strstr($_SESSION['module_'.$m.'_pwcheck'],$R['uid'])) getLink('','','정상적인 접근이 아닙니다.','');
}
$pw = !$R['pw'] && !$R['hidden'] && $hidden && $R['mbruid'] ? $R['mbruid'] : $R['pw'];
$QVAL = "display='$display',hidden='$hidden',notice='$notice',pw='$pw',category='$category',subject='$subject',content='$content',html='$html',tag='$tag',point3='$point3',point4='$point4',d_modify='$d_regis',upload='$upload',adddata='$adddata'";
getDbUpdate($table[$m.'data'],$QVAL,'uid='.$R['uid']);
getDbUpdate($table[$m.'idx'],'notice='.$notice,'gid='.$R['gid']);
if ($cuid) getDbUpdate($table['s_menu'],"num='".getDbCnt($table[$m.'month'],'sum(num)','site='.$R['site'].' and bbs='.$R['bbs'])."'",'uid='.$cuid);
}
}
else
{
##################################################################################
// 비회원인 경우 접근거부 루틴 제거 (2012.1.23 by 케르)
/* if (!$my['admin'] && !strstr(','.($d['bbs']['admin']?$d['bbs']['admin']:'.').',',','.$my['id'].','))
{
if ($d['bbs']['perm_l_write'] > $my['level'] || strstr($d['bbs']['perm_g_write'],'['.$my['sosok'].']'))
{
getLink('','','정상적인 접근이 아닙니다.','');
}
}
*/
###################################################################################
$pw = $hidden && $my['uid'] ? $my['uid'] : ($pw ? md5($pw) : '');
$mingid = getDbCnt($table[$m.'data'],'min(gid)','');
$gid = $mingid ? $mingid-1 : 100000000.00;
$QKEY = "site,gid,bbs,bbsid,depth,parentmbr,display,hidden,notice,name,nic,mbruid,id,pw,category,subject,content,html,tag,";
$QKEY.= "hit,down,comment,oneline,trackback,score1,score2,singo,point1,point2,point3,point4,d_regis,d_modify,d_comment,d_trackback,upload,ip,agent,sns,adddata";
$QVAL = "'$s','$gid','$bbsuid','$bbsid','$depth','$parentmbr','$display','$hidden','$notice','$name','$nic','$mbruid','$id','$pw','$category','$subject','$content','$html','$tag',";
$QVAL.= "'0','0','0','0','0','0','0','0','$point1','$point2','$point3','$point4','$d_regis','','','','$upload','$ip','$agent','','$adddata'";
getDbInsert($table[$m.'data'],$QKEY,$QVAL);
getDbInsert($table[$m.'idx'],'site,notice,bbs,gid',"'$s','$notice','$bbsuid','$gid'");
getDbUpdate($table[$m.'list'],"num_r=num_r+1,d_last='".$d_regis."'",'uid='.$bbsuid);
getDbUpdate($table[$m.'month'],'num=num+1',"date='".$date['month']."' and site=".$s.' and bbs='.$bbsuid);
getDbUpdate($table[$m.'day'],'num=num+1',"date='".$date['today']."' and site=".$s.' and bbs='.$bbsuid);
$LASTUID = getDbCnt($table[$m.'data'],'max(uid)','');
if ($cuid) getDbUpdate($table['s_menu'],"num='".getDbCnt($table[$m.'month'],'sum(num)','site='.$s.' and bbs='.$bbsuid)."',d_last='".$d_regis."'",'uid='.$cuid);
if ($point1&&$my['uid'])
{
getDbInsert($table['s_point'],'my_mbruid,by_mbruid,price,content,d_regis',"'".$my['uid']."','0','".$point1."','게시물(".getStrCut($subject,15,'').")포인트','".$date['totime']."'");
getDbUpdate($table['s_mbrdata'],'point=point+'.$point1,'memberuid='.$my['uid']);
}
if ($gid == 100000000.00)
{
db_query("OPTIMIZE TABLE ".$table[$m.'idx'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table[$m.'data'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table[$m.'month'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table[$m.'day'],$DB_CONNECT);
}
}
$NOWUID = $LASTUID ? $LASTUID : $R['uid'];
if ($trackback)
{
$trackback = trim($trackback);
$compaurl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'/'.$m.'/'.$NOWUID;
if ($trackback != $compaurl)
{
include_once $g['path_core'].'function/trackback.func.php';
$orignurl = 'http://'.$_SERVER['HTTP_HOST'].str_replace('index.php','?m=',$_SERVER['SCRIPT_NAME']).$m.'&bid='.$bbsid.'&uid='.$NOWUID;
$result = putTrackback($trackback,$orignurl,getUTFtoKR(strip_tags($subject)),getUTFtoKR(${$_HS['nametype']}),getUTFtoKR(strip_tags($content)),0);
if ($result)
{
$minuid = getDbCnt($table['s_trackback'],'min(uid)','');
$trackuid = $minuid ? $minuid-1 : 100000000;
$cync = '['.$m.']['.$NOWUID.'][m:'.$m.',bid:'.$bbsid.',uid:'.$NOWUID.']';
$QKEY = "uid,site,type,parent,parentmbr,url,name,subject,content,d_regis,d_modify,cync";
$QVAL = "'$trackuid','$s','2','".$m.$NOWUID."','$mbruid','$trackback','','','','$d_regis','','$cync'";
getDbInsert($table['s_trackback'],$QKEY,$QVAL);
getDbUpdate($table['s_numinfo'],'sndtrack=sndtrack+1',"date='".$date['today']."' and site=".$s);
if ($trackuid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_trackback'],$DB_CONNECT);
}
}
}
if ($tag || $R['tag'])
{
$_tagarr1 = array();
$_tagarr2 = explode(',',$tag);
$_tagdate = $date['today'];
if ($R['uid'] && $reply != 'Y')
{
$_tagdate = substr($R['d_regis'],0,8);
$_tagarr1 = explode(',',$R['tag']);
foreach($_tagarr1 as $_t)
{
if(!$_t || in_array($_t,$_tagarr2)) continue;
$_TAG = getDbData($table['s_tag'],"site=".$R['site']." and date='".$_tagdate."' and keyword='".$_t."'",'*');
if($_TAG['uid'])
{
if($_TAG['hit']>1) getDbUpdate($table['s_tag'],'hit=hit-1','uid='.$_TAG['uid']);
else getDbDelete($table['s_tag'],'uid='.$_TAG['uid']);
}
}
}
foreach($_tagarr2 as $_t)
{
if(!$_t || in_array($_t,$_tagarr1)) continue;
$_TAG = getDbData($table['s_tag'],'site='.$s." and date='".$_tagdate."' and keyword='".$_t."'",'*');
if($_TAG['uid']) getDbUpdate($table['s_tag'],'hit=hit+1','uid='.$_TAG['uid']);
else getDbInsert($table['s_tag'],'site,date,keyword,hit',"'".$s."','".$_tagdate."','".$_t."','1'");
}
}
if ((!$uid||$reply=='Y') && $snsCallBack && is_file($g['path_module'].$snsCallBack))
{
$xcync = "[][][][][][m:".$m.",bid:".$bbsid.",uid:".$NOWUID."]";
$orignSubject = strip_tags($subject);
$orignContent = getStrCut($orignSubject,60,'..');
$orignUrl = 'http://'.$_SERVER['SERVER_NAME'].str_replace('./','/',getCyncUrl($xcync)).'#CMT';
include_once $g['path_module'].$snsCallBack;
if ($snsSendResult)
{
getDbUpdate($table[$m.'data'],"sns='".$snsSendResult."'",'uid='.$LASTUID);
}
}
include_once $g['dir_module'].'theme/_pc/'.$bid.'/_var.php';
// 메일 발송
if($d['theme']['email_send'] && !$my['admin'])
{
$AD = getDbData($table['s_mbrdata'],"nic='관리자'",'*');
$email=$AD['email'];
$to=$AD['name'];
include_once $g['path_core'].'function/email.func.php';
include_once $g['path_module'].'member/var/var.join.php';
getSendMail($email.'|'. $to, $d['member']['join_email'].'|'.$_HS['name'], '['.$_HS['name'].']의 ['.$B['name'].']게시판에 ['.$name.']님께서 아래와 같은 내용의 글을 등록하셨습니다. ', $content, 'HTML');
}
$_SESSION['bbsback'] = $backtype;
if ($backtype == 'list')
{
getLink($nlist,'parent.','','');
}
else if ($backtype == 'view')
{
if ($_HS['rewrite']&&!strstr($nlist,'&'))
{
getLink($nlist.'/'.$NOWUID,'parent.','','');
}
else {
getLink($nlist.'&mod=view&uid='.$NOWUID,'parent.','','');
}
}
else {
getLink('reload','parent.','','');
}
?>