update codes

This commit is contained in:
Amberstone 2024-10-19 08:43:05 +09:00
parent 898b885c54
commit 591fd50a42
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
14 changed files with 1487 additions and 1415 deletions

View file

@ -1,4 +1,4 @@
<? <?php
$g5_path = "../../.."; $g5_path = "../../..";
include_once("$g5_path/common.php"); include_once "{$g5_path}/common.php";
?> include_once "_extend.php";

28
_extend.php Normal file
View file

@ -0,0 +1,28 @@
<?php
$g5['clap_table'] = G5_TABLE_PREFIX . 'clap';
// 랜덤 테이블이 없을 경우 생성
if (!sql_table_exists($g5['clap_table'])) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['clap_table']}` (
`cl_id` int(11) NOT NULL AUTO_INCREMENT,
`cl_ip` varchar(255) NOT NULL default '',
`cl_date` datetime NULL,
`cl_cnt` int(11) NOT NULL default 1,
`cl_val` varchar(255) NOT NULL default '',
PRIMARY KEY (`cl_id`)
) ENGINE = MyISAM DEFAULT CHARSET=utf8;", false);
}
$last = date("Y-m-d", strtotime("today -30 day"));
$be = sql_fetch("SELECT cl_id,cl_date FROM {$g5['clap_table']} WHERE cl_cnt > 1 AND date_format(cl_date, '%Y-%m-%d') <= '{$last}' ORDER BY cl_date LIMIT 1");
if ($be['cl_id']) {
$last = date("Y-m-d", strtotime($be['cl_date']));
}
$sum = sql_fetch("SELECT sum(cl_cnt) as sum FROM {$g5['clap_table']} WHERE date_format(cl_date, '%Y-%m-%d') <= '{$last}'");
if ($sum['sum']) {
$cnt = $sum['sum'];
sql_query("DELETE FROM {$g5['clap_table']} WHERE date_format(cl_date, '%Y-%m-%d') <= '{$last}'");
sql_query("INSERT INTO {$g5['clap_table']} SET cl_cnt = '{$cnt}', cl_date = '" . G5_TIME_YMD . "', cl_val=1");
}

View file

@ -1,72 +1,66 @@
<? <?php
include_once("./_common.php"); include_once "./_common.php";
if (!function_exists('convert_charset')) if (!function_exists('convert_charset')) {
{ /*
/* -----------------------------------------------------------
----------------------------------------------------------- Charset 변환하는 함수
Charset 변환하는 함수 -----------------------------------------------------------
----------------------------------------------------------- iconv 함수가 있으면 iconv 변환하고
iconv 함수가 있으면 iconv 변환하고 없으면 mb_convert_encoding 함수를 사용한다.
없으면 mb_convert_encoding 함수를 사용한다. 둘다 없으면 사용할 없다.
둘다 없으면 사용할 없다. */
*/ function convert_charset($from_charset, $to_charset, $str)
function convert_charset($from_charset, $to_charset, $str) {
{
if (function_exists('iconv'))
if( function_exists('iconv') ) return iconv($from_charset, $to_charset, $str);
return iconv($from_charset, $to_charset, $str); elseif (function_exists('mb_convert_encoding'))
elseif( function_exists('mb_convert_encoding') ) return mb_convert_encoding($str, $to_charset, $from_charset);
return mb_convert_encoding($str, $to_charset, $from_charset); else
else die("Not found 'iconv' or 'mbstring' library in server.");
die("Not found 'iconv' or 'mbstring' library in server."); }
} }
}
header("Content-Type: text/html; charset={$g5['charset']}");
header("Content-Type: text/html; charset={$g5['charset']}");
$subject = strtolower($_POST['subject']);
$subject = strtolower($_POST['subject']); $content = strtolower(strip_tags($_POST['content']));
$content = strtolower(strip_tags($_POST['content']));
//euc-kr 일 경우 $config['cf_filter'] 를 utf-8로 변환한다.
//euc-kr 일 경우 $config['cf_filter'] 를 utf-8로 변환한다. if (strtolower($g5['charset']) == 'euc-kr') {
if (strtolower($g5['charset']) == 'euc-kr') //$subject = convert_charset('utf-8', 'cp949', $subject);
{ //$content = convert_charset('utf-8', 'cp949', $content);
//$subject = convert_charset('utf-8', 'cp949', $subject); $config['cf_filter'] = convert_charset('cp949', 'utf-8', $config['cf_filter']);
//$content = convert_charset('utf-8', 'cp949', $content); }
$config['cf_filter'] = convert_charset('cp949', 'utf-8', $config['cf_filter']);
} //$filter = explode(",", strtolower(trim($config['cf_filter'])));
// strtolower 에 의한 한글 변형으로 아래 코드로 대체 (곱슬최씨님이 알려 주셨습니다.)
//$filter = explode(",", strtolower(trim($config['cf_filter']))); $filter = explode(",", trim($config['cf_filter']));
// strtolower 에 의한 한글 변형으로 아래 코드로 대체 (곱슬최씨님이 알려 주셨습니다.) for ($i = 0; $i < count($filter); $i++) {
$filter = explode(",", trim($config['cf_filter'])); $str = $filter[$i];
for ($i=0; $i<count($filter); $i++)
{ // 제목 필터링 (찾으면 중지)
$str = $filter[$i]; $subj = "";
$pos = strpos($subject, $str);
// 제목 필터링 (찾으면 중지) if ($pos !== false) {
$subj = ""; if (strtolower($g5['charset']) == 'euc-kr')
$pos = strpos($subject, $str); $subj = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환
if ($pos !== false) else
{ $subj = $str;
if (strtolower($g5['charset']) == 'euc-kr') break;
$subj = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환 }
else
$subj = $str; // 내용 필터링 (찾으면 중지)
break; $cont = "";
} $pos = strpos($content, $str);
if ($pos !== false) {
// 내용 필터링 (찾으면 중지) if (strtolower($g5['charset']) == 'euc-kr')
$cont = ""; $cont = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환
$pos = strpos($content, $str); else
if ($pos !== false) $cont = $str;
{ break;
if (strtolower($g5['charset']) == 'euc-kr') }
$cont = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환 }
else
$cont = $str; die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");
break;
}
}
die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");
?>

View file

@ -1,17 +1,20 @@
<? if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 <?php
// 수정, 삭제 링크 if (!defined("_GNUBOARD_"))
$update_href = $delete_href = ""; exit;
// 로그인중이고 자신의 글이라면 또는 관리자라면 패스워드를 묻지 않고 바로 수정, 삭제 가능
if (($member['mb_id'] && ($member['mb_id'] == $write['mb_id'])) || $is_admin) { include_once "_extend.php";
$update_href = "./write.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page".urldecode($qstr)."');"; $update_href = "";
if ($is_admin) $delete_href = "";
{
$delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&token=$token&page=$page".urldecode($qstr)."');"; // 로그인중이고 자신의 글이라면 또는 관리자라면 패스워드를 묻지 않고 바로 수정, 삭제 가능
} if (($member['mb_id'] && ($member['mb_id'] == $write['mb_id'])) || $is_admin) {
} $update_href = "./write.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
else if (!$write['mb_id']) { // 회원이 쓴 글이 아니라면 $delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . urldecode($qstr) . "');";
$update_href = "./password.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr; if ($is_admin) {
$delete_href = "./password.php?w=d&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr; $delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&token=$token&page=$page" . urldecode($qstr) . "');";
} }
?> } else if (!$write['mb_id']) { // 회원이 쓴 글이 아니라면
$update_href = "./password.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$delete_href = "./password.php?w=d&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
}

View file

@ -1,150 +1,181 @@
<? <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
if($is_admin){?> exit; // 개별 페이지 접근 불가
<section id="clap_stat_box">
<a href="#clap_stat_box" onclick="$('#clap_wrap').slideToggle();return false;" class="ui-btn point small"> 통계</a> include_once "_extend.php";
<div id="clap_wrap">
<div class="clap_container"> if ($is_admin) { ?>
<section class="clap_stat_weekly"> <section id="clap_stat_box">
<h3 class="txt-center">지난 <span class="less">10</span><span class="full">14</span> (일별)</h3> <a href="#clap_stat_box" onclick="$('#clap_wrap').slideToggle();return false;" class="ui-btn point small"> 통계</a>
<table> <div id="clap_wrap">
<tbody> <div class="clap_container">
<? $clap_wlist=array(); <section class="clap_stat_weekly">
$h_max=5; <h3 class="txt-center">지난 <span class="less">10</span><span class="full">14</span> (일별)</h3>
$cnt=13; <table>
for($k=0;$k<14;$k++){ <tbody>
$this_day=date("Y-m-d",strtotime("today - {$k} day")); <?php $clap_wlist = array();
$clap_w=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d')='{$this_day}' and cl_val=''"); $h_max = 5;
if($h_max<$clap_w['sum']) $h_max=$clap_w['sum']; $cnt = 13;
$clap_wlist[$cnt]['sum']=$clap_w['sum']; for ($k = 0; $k < 14; $k++) {
$clap_wlist[$cnt]['day']=date("n/j",strtotime($this_day)); $this_day = date("Y-m-d", strtotime("today - {$k} day"));
$cnt--; $clap_w = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d')='{$this_day}' and cl_val=''");
} if ($h_max < $clap_w['sum'])
$c_h=100/$h_max; $h_max = $clap_w['sum'];
for($k=0;$k<14;$k++){ $clap_wlist[$cnt]['sum'] = $clap_w['sum'];
if($k==0) echo "<tr>"; $clap_wlist[$cnt]['day'] = date("n/j", strtotime($this_day));
?> $cnt--;
<td <?if($k<4) echo "class='old'";?>> }
<p class="bar highlight" style="height:<?=$c_h * $clap_wlist[$k]['sum']?>%;"><i class="ui-btn small"><?=$clap_wlist[$k]['sum']?></i></p> $c_h = 100 / $h_max;
<p class="num"><?=$clap_wlist[$k]['day']?></p> for ($k = 0; $k < 14; $k++) {
</td> if ($k == 0)
<? if($k==13) echo "</tr>";} echo "<tr>";
?></tbody> ?>
</table> <td <?php if ($k < 4)
</section> echo "class='old'"; ?>>
<section class="clap_stat_daily"> <p class="bar highlight" style="height:<?= $c_h * $clap_wlist[$k]['sum'] ?>%;"><i
<h3 class="txt-center"><?=G5_TIME_YMD?> (오늘)</h3> class="ui-btn small"><?= $clap_wlist[$k]['sum'] ?></i></p>
<table> <p class="num"><?= $clap_wlist[$k]['day'] ?></p>
<tbody> </td>
<? <?php if ($k == 13)
$h_max=5; echo "</tr>";
$clap_dlist=array(); }
for($k=0;$k<24;$k++){ ?>
$this_hour=G5_TIME_YMD." ".sprintf('%02d',$k); </tbody>
$clap_d=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''"); </table>
if ($h_max<$clap_d['sum']) $h_max=$clap_d['sum']; </section>
$clap_dlist[$k]=$clap_d['sum']; <section class="clap_stat_daily">
} <h3 class="txt-center"><?= G5_TIME_YMD ?> (오늘)</h3>
$c_h=100/$h_max; <table>
for($k=0;$k<24;$k++) { <tbody>
if($k==0) echo "<tr>"; <?php
?> $h_max = 5;
<td> $clap_dlist = array();
<p class="bar highlight" style="height:<?=$c_h * $clap_dlist[$k]?>%;"><i class="ui-btn small"><?=$clap_dlist[$k]?></i></p> for ($k = 0; $k < 24; $k++) {
<p class="num"><?=$k?></p> $this_hour = G5_TIME_YMD . " " . sprintf('%02d', $k);
</td> $clap_d = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''");
<? if ($h_max < $clap_d['sum'])
if($k==11) echo "</tr><tr>"; $h_max = $clap_d['sum'];
if($k==23) echo "</tr>"; $clap_dlist[$k] = $clap_d['sum'];
}?> }
</tbody> $c_h = 100 / $h_max;
</table> for ($k = 0; $k < 24; $k++) {
</section> if ($k == 0)
<section class="clap_stat_daily"> echo "<tr>";
<h3 class="txt-center"><?=date("Y-m-d",strtotime("yesterday"))?> (어제)</h3> ?>
<table> <td>
<tbody> <p class="bar highlight" style="height:<?= $c_h * $clap_dlist[$k] ?>%;"><i
<? class="ui-btn small"><?= $clap_dlist[$k] ?></i></p>
$h_max=5; <p class="num"><?= $k ?></p>
$clap_dlist=array(); </td>
for($k=0;$k<24;$k++){ <?php
$this_hour=date("Y-m-d",strtotime("yesterday"))." ".sprintf('%02d',$k); if ($k == 11)
$clap_d=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''"); echo "</tr><tr>";
if ($h_max<$clap_d['sum']) $h_max=$clap_d['sum']; if ($k == 23)
$clap_dlist[$k]=$clap_d['sum']; echo "</tr>";
} } ?>
$c_h=100/$h_max; </tbody>
for($k=0;$k<24;$k++) { </table>
if($k==0) echo "<tr>"; </section>
?> <section class="clap_stat_daily">
<td> <h3 class="txt-center"><?= date("Y-m-d", strtotime("yesterday")) ?> (어제)</h3>
<p class="bar highlight" style="height:<?=$c_h * $clap_dlist[$k]?>%;"><i class="ui-btn small"><?=$clap_dlist[$k]?></i></p> <table>
<p class="num"><?=$k?></p> <tbody>
</td> <?php
<? $h_max = 5;
if($k==11) echo "</tr><tr>"; $clap_dlist = array();
if($k==23) echo "</tr>"; for ($k = 0; $k < 24; $k++) {
}?> $this_hour = date("Y-m-d", strtotime("yesterday")) . " " . sprintf('%02d', $k);
</tbody> $clap_d = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''");
</table> if ($h_max < $clap_d['sum'])
</section> $h_max = $clap_d['sum'];
<section class="clap_stat_daily"> $clap_dlist[$k] = $clap_d['sum'];
<h3 class="txt-center"><?=date("Y-m-d",strtotime("today -2 day"))?> (2일전)</h3> }
<table> $c_h = 100 / $h_max;
<tbody> for ($k = 0; $k < 24; $k++) {
<? if ($k == 0)
$h_max=5; echo "<tr>";
$clap_dlist=array(); ?>
for($k=0;$k<24;$k++){ <td>
$this_hour=date("Y-m-d",strtotime("today -2 day"))." ".sprintf('%02d',$k); <p class="bar highlight" style="height:<?= $c_h * $clap_dlist[$k] ?>%;"><i
$clap_d=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''"); class="ui-btn small"><?= $clap_dlist[$k] ?></i></p>
if ($h_max<$clap_d['sum']) $h_max=$clap_d['sum']; <p class="num"><?= $k ?></p>
$clap_dlist[$k]=$clap_d['sum']; </td>
} <?php
$c_h=100/$h_max; if ($k == 11)
for($k=0;$k<24;$k++) { echo "</tr><tr>";
if($k==0) echo "<tr>"; if ($k == 23)
?> echo "</tr>";
<td> } ?>
<p class="bar highlight" style="height:<?=$c_h * $clap_dlist[$k]?>%;"><i class="ui-btn small"><?=$clap_dlist[$k]?></i></p> </tbody>
<p class="num"><?=$k?></p> </table>
</td> </section>
<? <section class="clap_stat_daily">
if($k==11) echo "</tr><tr>"; <h3 class="txt-center"><?= date("Y-m-d", strtotime("today -2 day")) ?> (2일전)</h3>
if($k==23) echo "</tr>"; <table>
}?> <tbody>
</tbody> <?php
</table> $h_max = 5;
</section> $clap_dlist = array();
<section class="clap_stat_daily"> for ($k = 0; $k < 24; $k++) {
<h3 class="txt-center"><?=date("Y-m-d",strtotime("today -3 day"))?> (3일전)</h3> $this_hour = date("Y-m-d", strtotime("today -2 day")) . " " . sprintf('%02d', $k);
<table> $clap_d = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''");
<tbody> if ($h_max < $clap_d['sum'])
<? $h_max = $clap_d['sum'];
$h_max=5; $clap_dlist[$k] = $clap_d['sum'];
$clap_dlist=array(); }
for($k=0;$k<24;$k++){ $c_h = 100 / $h_max;
$this_hour=date("Y-m-d",strtotime("today -3 day"))." ".sprintf('%02d',$k); for ($k = 0; $k < 24; $k++) {
$clap_d=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''"); if ($k == 0)
if ($h_max<$clap_d['sum']) $h_max=$clap_d['sum']; echo "<tr>";
$clap_dlist[$k]=$clap_d['sum']; ?>
} <td>
$c_h=100/$h_max; <p class="bar highlight" style="height:<?= $c_h * $clap_dlist[$k] ?>%;"><i
for($k=0;$k<24;$k++) { class="ui-btn small"><?= $clap_dlist[$k] ?></i></p>
if($k==0) echo "<tr>"; <p class="num"><?= $k ?></p>
?> </td>
<td> <?php
<p class="bar highlight" style="height:<?=$c_h * $clap_dlist[$k]?>%;"><i class="ui-btn small"><?=$clap_dlist[$k]?></i></p> if ($k == 11)
<p class="num"><?=$k?></p> echo "</tr><tr>";
</td> if ($k == 23)
<? echo "</tr>";
if($k==11) echo "</tr><tr>"; } ?>
if($k==23) echo "</tr>"; </tbody>
}?> </table>
</tbody> </section>
</table> <section class="clap_stat_daily">
</section> <h3 class="txt-center"><?= date("Y-m-d", strtotime("today -3 day")) ?> (3일전)</h3>
</div> <table>
</div> <tbody>
</section> <?php
<?}?> $h_max = 5;
$clap_dlist = array();
for ($k = 0; $k < 24; $k++) {
$this_hour = date("Y-m-d", strtotime("today -3 day")) . " " . sprintf('%02d', $k);
$clap_d = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d %H')='{$this_hour}' and cl_val=''");
if ($h_max < $clap_d['sum'])
$h_max = $clap_d['sum'];
$clap_dlist[$k] = $clap_d['sum'];
}
$c_h = 100 / $h_max;
for ($k = 0; $k < 24; $k++) {
if ($k == 0)
echo "<tr>";
?>
<td>
<p class="bar highlight" style="height:<?= $c_h * $clap_dlist[$k] ?>%;"><i
class="ui-btn small"><?= $clap_dlist[$k] ?></i></p>
<p class="num"><?= $k ?></p>
</td>
<?php
if ($k == 11)
echo "</tr><tr>";
if ($k == 23)
echo "</tr>";
} ?>
</tbody>
</table>
</section>
</div>
</div>
</section>
<?php } ?>

View file

@ -1,387 +1,398 @@
<? <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
exit; // 개별 페이지 접근 불가
if($is_admin) set_session("ss_delete_token", $token = uniqid(time()));
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0); include_once "_extend.php";
$width=$board['bo_width'] ? $board['bo_width'] : 100; if ($is_admin)
if($width<=100) $width=$width."%"; set_session("ss_delete_token", $token = uniqid(time()));
else $width=$width."px"; add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css">', 0);
$width = $board['bo_width'] ? $board['bo_width'] : 100;
$clap_max=10; if ($width <= 100)
if($board['bo_1']!='') $clap_max=$board['bo_1']; $width = $width . "%";
$clap_t=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date, '%Y-%m-%d')='".G5_TIME_YMD."' and cl_ip='{$_SERVER['REMOTE_ADDR']}'"); else
$cl_cnt=$clap_t['sum']; $width = $width . "px";
?>
$clap_max = 10;
<div id="page_board_content" style="max-width:<?=$width?>;margin:0 auto;"> if ($board['bo_1'] != '')
$clap_max = $board['bo_1'];
<? if($admin_href){?><p class="txt-right"><a href="<?=$admin_href?>" class="ui-btn admin" target="_blank">관리자</a></p><hr class="padding"><?}?> $clap_t = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date, '%Y-%m-%d')='" . G5_TIME_YMD . "' and cl_ip='{$_SERVER['REMOTE_ADDR']}'");
$cl_cnt = $clap_t['sum'];
<?
$no_id=''; ?>
<div id="page_board_content" style="max-width:<?= $width ?>;margin:0 auto;">
$get_notice=sql_fetch("select bo_notice from {$g5['board_table']} where bo_table='{$bo_table}'");
if($get_notice['bo_notice']!=''){ <?php if ($admin_href) { ?>
$notice_id=explode(",",$get_notice['bo_notice']); <p class="txt-right"><a href="<?= $admin_href ?>" class="ui-btn admin" target="_blank">관리자</a></p>
$no_id=$notice_id[0]; <hr class="padding"><?php } ?>
$file=get_file($bo_table,$no_id); <?php
$img_list = array(); $no_id = '';
$cnt=0;
for ($k=0;$k<$board['bo_upload_count'];$k++){
if($file[$k]['file']){ $get_notice = sql_fetch("select bo_notice from {$g5['board_table']} where bo_table='{$bo_table}'");
$img_list[$cnt]=G5_DATA_URL."/file/".$bo_table."/".$file[$k]['file']; if ($get_notice['bo_notice'] != '') {
$cnt++; $notice_id = explode(",", $get_notice['bo_notice']);
} $no_id = $notice_id[0];
}
$file = get_file($bo_table, $no_id);
if(count($img_list)>0 && !$board['bo_3']){ $img_list = array();
shuffle($img_list); $cnt = 0;
?> for ($k = 0; $k < $board['bo_upload_count']; $k++) {
<div class="rand_img txt-center"> if ($file[$k]['file']) {
<img src="<?=$img_list[0]?>"> $img_list[$cnt] = G5_DATA_URL . "/file/" . $bo_table . "/" . $file[$k]['file'];
</div> $cnt++;
<?}?> }
<?}?> }
<br>
<!-- 상단 공지 부분 --> if (count($img_list) > 0 && !$board['bo_3']) {
<? if($board['bo_content_head']) { ?> shuffle($img_list);
<div class="board-notice"> ?>
<?=stripslashes($board['bo_content_head']);?> <div class="rand_img txt-center">
</div> <img src="<?= $img_list[0] ?>">
<hr class="padding" /> </div>
<? } ?> <?php } ?>
<!-- 버튼 링크 --> <?php } ?>
<?if($is_admin || $no_id){?> <br>
<?if($no_id){ <!-- 상단 공지 부분 -->
if(!$is_admin) <?php if ($board['bo_content_head']) { ?>
include_once($board_skin_path.'/update_hit.php'); <div class="board-notice">
?> <?= stripslashes($board['bo_content_head']); ?>
<div class="clap_box txt-center "> </div>
<form name="clap" id="clap" action="<?=$board_skin_url?>/update_hit.php" method="post" enctype="multipart/form-data" onsubmit="return clap_submit(this)" autocomplete="off"> <hr class="padding" />
<input type="hidden" name="bo_table" value="<?=$bo_table?>"> <?php } ?>
<input type="hidden" name="clap_max" value="<?=$clap_max?>"> <!-- 버튼 링크 -->
<input type="hidden" name="cl_cnt" value="<?=$cl_cnt?>"> <?php if ($is_admin || $no_id) { ?>
<input type="hidden" name="return_url" value="<?=G5_BBS_URL?>/board.php?bo_table=<?=$bo_table?>"> <?php if ($no_id) {
<button type="submit" class="ui-btn point clap" >박수!</button> if (!$is_admin)
</form> include_once $board_skin_path . '/update_hit.php';
</div> ?>
<?}?> <div class="clap_box txt-center ">
<hr class="padding" /> <form name="clap" id="clap" action="<?= $board_skin_url ?>/update_hit.php" method="post"
<?if (!$no_id && $is_admin){?> enctype="multipart/form-data" onsubmit="return clap_submit(this)" autocomplete="off">
<p class="txt-center">* 통계 확인 웹박수 랜덤이미지 등록을 위해 아래 공지 체크후 메시지를 작성해주세요.<br>* 랜덤 이미지는 등록 수정(M) 눌러 이미지를 업로드 해주시면 됩니다.<br> <input type="hidden" name="bo_table" value="<?= $bo_table ?>">
* 공지글로 작성한 내용은 노출되지 않습니다.</p> <input type="hidden" name="clap_max" value="<?= $clap_max ?>">
<hr class="padding"> <input type="hidden" name="cl_cnt" value="<?= $cl_cnt ?>">
<? } ?> <input type="hidden" name="return_url" value="<?= G5_BBS_URL ?>/board.php?bo_table=<?= $bo_table ?>">
<? if ($write_href) { ?> <button type="submit" class="ui-btn point clap">박수!</button>
<div class="ui-write-area"> </form>
<? include ($board_skin_path."/write.php"); ?> </div>
</div> <?php } ?>
<hr class="padding"> <hr class="padding" />
<? } ?> <?php if (!$no_id && $is_admin) { ?>
<div class="ui-qna-list"> <p class="txt-center">* 통계 확인 웹박수 랜덤이미지 등록을 위해 아래 공지 체크후 메시지를 작성해주세요.<br>* 랜덤 이미지는 등록 수정(M) 눌러 이미지를 업로드 해주시면
<ul> 됩니다.<br>
<? * 공지글로 작성한 내용은 노출되지 않습니다.</p>
$lists = array(); <hr class="padding">
$cnt = 0; <?php } ?>
for ($i=0; $i<count($list); $i++) { <?php if ($write_href) { ?>
if(!$list[$i]['is_notice'] && !$is_admin && $list[$i]['wr_comment']<1) continue; <div class="ui-write-area">
if($list[$i]['is_notice'] && !$is_admin && strstr($list[$i]['wr_option'],'secret')) continue; <?php include $board_skin_path . "/write.php"; ?>
$lists[$cnt]=$list[$i]; </div>
$cnt++; <hr class="padding">
} <?php } ?>
for ($ii=0; $ii < count($lists); $ii++) { <div class="ui-qna-list">
<ul>
include "$board_skin_path/inc.list_main.php"; <?php
$lists[$ii]['datetime']=date('Y/m/d (H:i:s)', strtotime($lists[$ii]['wr_datetime'])); $lists = array();
$cnt = 0;
$is_open = false; for ($i = 0; $i < count($list); $i++) {
if (!$list[$i]['is_notice'] && !$is_admin && $list[$i]['wr_comment'] < 1)
if(get_cookie('read_'.$lists[$ii]['wr_id']) == $lists[$ii]['wr_password']) { continue;
$is_open = true; if ($list[$i]['is_notice'] && !$is_admin && strstr($list[$i]['wr_option'], 'secret'))
} continue;
$lists[$cnt] = $list[$i];
$lists[$ii]['content'] = conv_content($lists[$ii]['wr_content'], 0, 'wr_content'); $cnt++;
$lists[$ii]['content'] = search_font($stx, $lists[$ii]['content']); }
?> for ($ii = 0; $ii < count($lists); $ii++) {
<li>
<div class="theme-box question"> include "$board_skin_path/inc.list_main.php";
<form name="fboardlist" method="post" action="<?=$board_skin_url?>/password.php" style="margin:0"> $lists[$ii]['datetime'] = date('Y/m/d (H:i:s)', strtotime($lists[$ii]['wr_datetime']));
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sfl" value="<?=$sfl?>"> $is_open = false;
<input type="hidden" name="stx" value="<?=$stx?>">
<input type="hidden" name="spt" value="<?=$spt?>"> if (get_cookie('read_' . $lists[$ii]['wr_id']) == $lists[$ii]['wr_password']) {
<input type="hidden" name="page" value="<?=$page?>"> $is_open = true;
<input type="hidden" name="wr_idx" value="<?=$lists[$ii]['wr_id']?>"> }
<input type="hidden" name="sw" value="">
$lists[$ii]['content'] = conv_content($lists[$ii]['wr_content'], 0, 'wr_content');
<? if($lists[$ii]['is_notice']) { ?> $lists[$ii]['content'] = search_font($stx, $lists[$ii]['content']);
?>
<? $clap_total=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']}"); <li>
$clap_today=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d')='".G5_TIME_YMD."' and cl_val=''"); <div class="theme-box question">
?> <form name="fboardlist" method="post" action="<?= $board_skin_url ?>/password.php" style="margin:0">
<p id="stat_total"><em>오늘: <?=sprintf("%01d",$clap_today['sum'])?></em> / <em>전체: <?=sprintf("%01d",$clap_total['sum'])?></em></p> <input type="hidden" name="bo_table" value="<?= $bo_table ?>">
<?if($is_admin){?> <input type="hidden" name="sfl" value="<?= $sfl ?>">
<p class="notice"> <input type="hidden" name="stx" value="<?= $stx ?>">
<strong> <input type="hidden" name="spt" value="<?= $spt ?>">
<? if(($member['mb_id'] && ($member['mb_id'] == $lists[$ii]['mb_id'])) || $is_admin) { ?> <input type="hidden" name="page" value="<?= $page ?>">
<a href="<?=$delete_href?>">D</a> <input type="hidden" name="wr_idx" value="<?= $lists[$ii]['wr_id'] ?>">
<a href="<?=$update_href?>">M</a> <input type="hidden" name="sw" value="">
<? }?>
<?php if ($lists[$ii]['is_notice']) { ?>
</strong>
</p> <?php $clap_total = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']}");
$clap_today = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date,'%Y-%m-%d')='" . G5_TIME_YMD . "' and cl_val=''");
<? ?>
include_once($board_skin_path.'/inc.stat.php'); <p id="stat_total"><em>오늘: <?= sprintf("%01d", $clap_today['sum']) ?></em> / <em>전체:
if($lists[$ii]['wr_file']>0){?> <?= sprintf("%01d", $clap_total['sum']) ?></em></p>
<a href="#" onclick="$(this).next().slideToggle();return false;" class="ui-btn small"> 랜덤이미지 확인</a> <?php if ($is_admin) { ?>
<p style="display:none;" class="txt-center"> <p class="notice">
<? <strong>
for ($k=0;$k<$board['bo_upload_count'];$k++){ <?php if (($member['mb_id'] && ($member['mb_id'] == $lists[$ii]['mb_id'])) || $is_admin) { ?>
if($file[$k]['file']){ <a href="<?= $delete_href ?>">D</a>
?> <a href="<?= $update_href ?>">M</a>
<img src="<?=G5_DATA_URL."/file/".$bo_table."/".$file[$k]['file']?>"> <?php } ?>
<?}?>
<?}?> </strong>
</p> </p>
<?}else{ if(!$board['bo_3']){?>
<p class="txt-center">* 수정(M) 눌러 웹박수 랜덤이미지를 등록 해주세요.</p> <?php
<?} }?> include_once $board_skin_path . '/inc.stat.php';
<?}?> if ($lists[$ii]['wr_file'] > 0) { ?>
<? } else { ?> <a href="#" onclick="$(this).next().slideToggle();return false;" class="ui-btn small"> 랜덤이미지 확인</a>
<p> <p style="display:none;" class="txt-center">
<span class="date"> <?php
<?=$lists[$ii]['datetime']?> for ($k = 0; $k < $board['bo_upload_count']; $k++) {
</span> if ($file[$k]['file']) {
<?if($is_admin){?><?=$lists[$ii]['wr_ip']?><?}?> ?>
<strong> <img src="<?= G5_DATA_URL . "/file/" . $bo_table . "/" . $file[$k]['file'] ?>">
<? if($is_admin) { ?> <?php } ?>
<a href="<?=$delete_href?>">D</a> <?php } ?>
<a href="javascript:comment_wri('comment_write', '<?=$lists[$ii]['wr_id']?>');">R</a> </p>
<? } ?> <?php } else {
</strong> if (!$board['bo_3']) { ?>
</p> <p class="txt-center">* 수정(M) 눌러 웹박수 랜덤이미지를 등록 해주세요.</p>
<div class="qna-content <?=!$is_admin ? " guest" : "";?>"> <?php }
<?if(!$board['bo_2'] || $is_admin){ } ?>
if(strstr($lists[$ii]['wr_option'], 'secret')) { ?> <?php } ?>
<span class="txt-point">[SECRET]</span><br /> <?php } else { ?>
<? } ?> <p>
<?if((!strstr($lists[$ii]['wr_option'], 'secret')) || $is_admin) { ?> <span class="date">
<?= $lists[$ii]['content'] ?> <?= $lists[$ii]['datetime'] ?>
<? } } ?> </span>
</div> <?php if ($is_admin) { ?> <?= $lists[$ii]['wr_ip'] ?> <?php } ?>
<? } ?> <strong>
</form> <?php if ($is_admin) { ?>
<? <a href="<?= $delete_href ?>">D</a>
$wr_id = $lists[$ii]['wr_id']; <a href="javascript:comment_wri('comment_write', '<?= $lists[$ii]['wr_id'] ?>');">R</a>
include ("$board_skin_path/view_comment.php"); <?php } ?>
?> </strong>
</div> </p>
</li> <div class="qna-content <?= !$is_admin ? " guest" : ""; ?>">
<? } <?php if (!$board['bo_2'] || $is_admin) {
// 필터 if (strstr($lists[$ii]['wr_option'], 'secret')) { ?>
?> <span class="txt-point">[SECRET]</span><br />
</ul> <?php } ?>
<?php if ((!strstr($lists[$ii]['wr_option'], 'secret')) || $is_admin) { ?>
<!-- 페이지 --> <?= $lists[$ii]['content'] ?>
<?php }
<div class="ui-page"> } ?>
<? </div>
$add=""; <?php } ?>
if(!$is_admin) </form>
$add="and wr_comment=1 "; <?php
$total=sql_fetch("select count(distinct wr_id) as cnt from {$write_table} where wr_id=wr_parent {$add}"); $wr_id = $lists[$ii]['wr_id'];
$total_count=$total['cnt']; include "$board_skin_path/view_comment.php";
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 ?>
$from_record = ($page - 1) * $page_rows; // 시작 열을 구함 </div>
$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table='.$bo_table.$qstr.'&amp;page='); </li>
echo $write_pages; <?php }
?> // 필터
</div> ?>
</ul>
</div>
<?}?> <!-- 페이지 -->
</div>
<script> <div class="ui-page">
//if ("<?=$sca?>") document.fcategory.sca.value = "<?=$sca?>"; <?php
if ("<?=$stx?>") { $add = "";
document.fsearch.sfl.value = "<?=$sfl?>"; if (!$is_admin)
document.fsearch.sop.value = "<?=$sop?>"; $add = "and wr_comment=1 ";
} $total = sql_fetch("select count(distinct wr_id) as cnt from {$write_table} where wr_id=wr_parent {$add}");
$total_count = $total['cnt'];
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다. $total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
function resize_image() $from_record = ($page - 1) * $page_rows; // 시작 열을 구함
{ $write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table=' . $bo_table . $qstr . '&amp;page=');
var target = document.getElementsByName('target_resize_image[]'); echo $write_pages;
var image_width = parseInt("<?=$board['bo_image_width']?>"); ?>
var image_height = 0; </div>
for(i=0; i<target.length; i++) { </div>
// 원래 사이즈를 저장해 놓는다 <?php } ?>
target[i].tmp_width = target[i].width; </div>
target[i].tmp_height = target[i].height; <script>
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다 //if ("<?= $sca ?>") document.fcategory.sca.value = "<?= $sca ?>";
if(target[i].width > image_width) { if ("<?= $stx ?>") {
image_height = parseFloat(target[i].width / target[i].height) document.fsearch.sfl.value = "<?= $sfl ?>";
target[i].width = image_width; document.fsearch.sop.value = "<?= $sop ?>";
target[i].height = parseInt(image_width / image_height); }
}
} // HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
} function resize_image() {
window.onload = resize_image; var target = document.getElementsByName('target_resize_image[]');
var image_width = parseInt("<?= $board['bo_image_width'] ?>");
const bg = $(".question.theme-box").css("background-color"); var image_height = 0;
$(".qna-content.guest, .qna-content.guest a").css({"color":bg,"opacity":1,"background-color":bg});
for (i = 0; i < target.length; i++) {
let clap_max=10; // 원래 사이즈를 저장해 놓는다
<? if($board['bo_1']!=''){?> target[i].tmp_width = target[i].width;
clap_max=parseInt('<?=$board['bo_1']?>'); target[i].tmp_height = target[i].height;
<?}?> // 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
let clap_t=parseInt('<?=$clap_t['sum']?>'); if (target[i].width > image_width) {
image_height = parseFloat(target[i].width / target[i].height)
<?if(!$is_admin){?> target[i].width = image_width;
$(document).keydown(function(event){ target[i].height = parseInt(image_width / image_height);
if( (event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) || (event.keyCode == 116)) { }
if(clap_max==0 || (clap_max>0 && clap_t<clap_max)){ }
alert("박수 감사합니다!"); }
}else{ window.onload = resize_image;
event.keyCode = 0;
event.cancelBubble = true; const bg = $(".question.theme-box").css("background-color");
event.returnValue = false; $(".qna-content.guest, .qna-content.guest a").css({ "color": bg, "opacity": 1, "background-color": bg });
alert("박수는 하루에 "+clap_max+"번 까지 칠 수 있습니다.");
return false; let clap_max = 10;
} <?php if ($board['bo_1'] != '') { ?>
} clap_max = parseInt('<?= $board['bo_1'] ?>');
}); <?php } ?>
<?}?> let clap_t = parseInt('<?= $clap_t['sum'] ?>');
function clap_submit(f) <?php if (!$is_admin) { ?>
{ $(document).keydown(function (event) {
if(clap_max>0 && clap_t>=clap_max){ if ((event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) || (event.keyCode == 116)) {
alert("박수는 하루에 "+clap_max+"번 까지 칠 수 있습니다."); if (clap_max == 0 || (clap_max > 0 && clap_t < clap_max)) {
return false; alert("박수 감사합니다!");
} } else {
else return true; event.keyCode = 0;
} event.cancelBubble = true;
event.returnValue = false;
function comment_wri(name, id) { alert("박수는 하루에 " + clap_max + "번 까지 칠 수 있습니다.");
$('.modify_area').hide(); return false;
var layer = document.getElementById(name+id); }
layer.style.display = (layer.style.display == "none")? "block" : "none"; }
} });
function comment_delete(url) <?php } ?>
{
if (confirm("이 코멘트를 삭제하시겠습니까?")) location.href = url; function clap_submit(f) {
} if (clap_max > 0 && clap_t >= clap_max) {
alert("박수는 하루에 " + clap_max + "번 까지 칠 수 있습니다.");
</script> return false;
<? if ($is_checkbox) { ?> }
<script> else return true;
function all_checked(sw) }
{
var f = document.fboardlist; function comment_wri(name, id) {
$('.modify_area').hide();
for (var i=0; i<f.length; i++) { var layer = document.getElementById(name + id);
if (f.elements[i].name == "chk_wr_id[]") layer.style.display = (layer.style.display == "none") ? "block" : "none";
f.elements[i].checked = sw; }
} function comment_delete(url) {
} if (confirm("이 코멘트를 삭제하시겠습니까?")) location.href = url;
}
function check_confirm(str)
{ </script>
var f = document.fboardlist; <?php if ($is_checkbox) { ?>
var chk_count = 0; <script>
function all_checked(sw) {
for (var i=0; i<f.length; i++) { var f = document.fboardlist;
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++; for (var i = 0; i < f.length; i++) {
} if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
if (!chk_count) { }
alert(str + "할 게시물을 하나 이상 선택하세요."); }
return false;
} function check_confirm(str) {
return true; var f = document.fboardlist;
} var chk_count = 0;
// 선택한 게시물 삭제 for (var i = 0; i < f.length; i++) {
function select_delete() if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
{ chk_count++;
var f = document.fboardlist; }
str = "삭제"; if (!chk_count) {
if (!check_confirm(str)) alert(str + "할 게시물을 하나 이상 선택하세요.");
return; return false;
}
if (!confirm("선택한 게시물을 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다")) return true;
return; }
f.action = "./delete_all.php"; // 선택한 게시물 삭제
f.submit(); function select_delete() {
} var f = document.fboardlist;
// 선택한 게시물 복사 및 이동 str = "삭제";
function select_copy(sw) if (!check_confirm(str))
{ return;
var f = document.fboardlist;
if (!confirm("선택한 게시물을 정말 " + str + " 하시겠습니까?\n\n한번 " + str + "한 자료는 복구할 수 없습니다"))
if (sw == "copy") return;
str = "복사";
else f.action = "./delete_all.php";
str = "이동"; f.submit();
}
if (!check_confirm(str))
return; // 선택한 게시물 복사 및 이동
function select_copy(sw) {
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1"); var f = document.fboardlist;
f.sw.value = sw; if (sw == "copy")
f.target = "move"; str = "복사";
f.action = "./move.php"; else
f.submit(); str = "이동";
}
if (!check_confirm(str))
function comment_box(co_id, wr_id) { return;
$('.modify_area').hide();
$('#c_'+co_id).find('.modify_area').show(); var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
$('#c_'+co_id).find('.qna-comment-content').hide();
f.sw.value = sw;
$('#save_co_comment_'+co_id).focus(); f.target = "move";
f.action = "./move.php";
var modify_form = document.getElementById('frm_modify_comment'); f.submit();
modify_form.wr_id.value = wr_id; }
modify_form.comment_id.value = co_id;
} function comment_box(co_id, wr_id) {
$('.modify_area').hide();
function modify_commnet(co_id) { $('#c_' + co_id).find('.modify_area').show();
var modify_form = document.getElementById('frm_modify_comment'); $('#c_' + co_id).find('.qna-comment-content').hide();
var wr_content = $('#save_co_comment_'+co_id).val();
var wr_option = ''; $('#save_co_comment_' + co_id).focus();
modify_form.wr_content.value = wr_content;
modify_form.wr_option.value = wr_option; var modify_form = document.getElementById('frm_modify_comment');
$('#frm_modify_comment').submit(); modify_form.wr_id.value = wr_id;
} modify_form.comment_id.value = co_id;
}
</script>
function modify_commnet(co_id) {
<form name="modify_comment" id="frm_modify_comment" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off"> var modify_form = document.getElementById('frm_modify_comment');
<input type="hidden" name="w" value="cu"> var wr_content = $('#save_co_comment_' + co_id).val();
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> var wr_option = '';
<input type="hidden" name="sca" value="<?php echo $sca ?>"> modify_form.wr_content.value = wr_content;
<input type="hidden" name="sfl" value="<?php echo $sfl ?>"> modify_form.wr_option.value = wr_option;
<input type="hidden" name="stx" value="<?php echo $stx ?>"> $('#frm_modify_comment').submit();
<input type="hidden" name="spt" value="<?php echo $spt ?>"> }
<input type="hidden" name="page" value="<?php echo $page ?>">
</script>
<input type="hidden" name="comment_id" value="">
<input type="hidden" name="wr_id" value=""> <form name="modify_comment" id="frm_modify_comment" action="./write_comment_update.php"
<input type="hidden" name="wr_option" value="" > onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<textarea name="wr_content" style="display: none;"></textarea> <input type="hidden" name="w" value="cu">
<button type="submit" style="display: none;"></button> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
</form> <input type="hidden" name="sca" value="<?php echo $sca ?>">
<? } ?> <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="comment_id" value="">
<input type="hidden" name="wr_id" value="">
<input type="hidden" name="wr_option" value="">
<textarea name="wr_content" style="display: none;"></textarea>
<button type="submit" style="display: none;"></button>
</form>
<?php } ?>

View file

@ -5,6 +5,9 @@
모든 아보카도 버전에 호환됩니다. 모든 아보카도 버전에 호환됩니다.
### 주요 수정 사항
- short open tag 제거
## 설치방법 ## 설치방법
아보카도가 설치된 폴더의 하위 폴더인 `skin/board/``webclap` 라는 폴더를 생성하고 파일을 업로드합니다. 아보카도가 설치된 폴더의 하위 폴더인 `skin/board/``webclap` 라는 폴더를 생성하고 파일을 업로드합니다.

View file

@ -1,13 +1,12 @@
<? <?php
//if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 //if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once('./_common.php'); include_once './_common.php';
if($clap_max==0 || ($clap_max>0 && $cl_cnt<$clap_max)){ if ($clap_max == 0 || ($clap_max > 0 && $cl_cnt < $clap_max)) {
sql_query("insert into {$g5['clap_table']} sql_query("insert into {$g5['clap_table']}
set cl_ip='{$_SERVER['REMOTE_ADDR']}', set cl_ip='{$_SERVER['REMOTE_ADDR']}',
cl_date='".date("Y-m-d H",strtotime(G5_TIME_YMDHIS))."' cl_date='" . date("Y-m-d H", strtotime(G5_TIME_YMDHIS)) . "'
"); ");
} }
if($return_url) if ($return_url)
goto_url($return_url); goto_url($return_url);
?>

View file

@ -1,7 +1,8 @@
<? <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
exit; // 개별 페이지 접근 불가
set_session("ss_delete_token", $token = uniqid(time()));
include_once "_extend.php";
goto_url("./board.php?bo_table=$bo_table" . $qstr);
?> set_session("ss_delete_token", $token = uniqid(time()));
goto_url("./board.php?bo_table=$bo_table" . $qstr);

View file

@ -1,114 +1,105 @@
<?php <?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_'))
exit; // 개별 페이지 접근 불가
$list = array();
include_once "_extend.php";
$is_comment_write = false;
if ($member['mb_level'] >= $board['bo_comment_level']) $list = array();
$is_comment_write = true;
$is_comment_write = false;
// 코멘트 출력 if ($member['mb_level'] >= $board['bo_comment_level'])
$sql = " select * from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 order by wr_comment, wr_comment_reply "; $is_comment_write = true;
$result = sql_query($sql);
for ($i=0; $c_row=sql_fetch_array($result); $i++) // 코멘트 출력
{ $sql = " select * from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
$list[$i] = $c_row; $result = sql_query($sql);
for ($i = 0; $c_row = sql_fetch_array($result); $i++) {
//$list[$i]['name'] = get_sideview($c_row['mb_id'], cut_str($c_row['wr_name'], 20, ''), $c_row['wr_email'], $c_row['wr_homepage']); $list[$i] = $c_row;
$tmp_name = get_text(cut_str($c_row['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력 //$list[$i]['name'] = get_sideview($c_row['mb_id'], cut_str($c_row['wr_name'], 20, ''), $c_row['wr_email'], $c_row['wr_homepage']);
if ($board['bo_use_sideview'])
$list[$i]['name'] = get_sideview($c_row['mb_id'], $tmp_name, $c_row['wr_email'], $c_row['wr_homepage']); $tmp_name = get_text(cut_str($c_row['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력
else if ($board['bo_use_sideview'])
$list[$i]['name'] = '<span class="'.($c_row['mb_id']?'member':'guest').'">'.$tmp_name.'</span>'; $list[$i]['name'] = get_sideview($c_row['mb_id'], $tmp_name, $c_row['wr_email'], $c_row['wr_homepage']);
else
$list[$i]['name'] = '<span class="' . ($c_row['mb_id'] ? 'member' : 'guest') . '">' . $tmp_name . '</span>';
// 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
//$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $c_row['wr_content']);
// 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
$list[$i]['content'] = $list[$i]['content1']= '비밀글 입니다.'; //$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $c_row['wr_content']);
if (!strstr($c_row['wr_option'], 'secret') ||
$is_admin || $list[$i]['content'] = $list[$i]['content1'] = '비밀글 입니다.';
($write['mb_id']==$member['mb_id'] && $member['mb_id']) || if (
($c_row['mb_id']==$member['mb_id'] && $member['mb_id'])) { !strstr($c_row['wr_option'], 'secret') ||
$list[$i]['content1'] = $c_row['wr_content']; $is_admin ||
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content'); ($write['mb_id'] == $member['mb_id'] && $member['mb_id']) ||
$list[$i]['content'] = search_font($stx, $list[$i]['content']); ($c_row['mb_id'] == $member['mb_id'] && $member['mb_id'])
} else { ) {
$ss_name = 'ss_secret_comment_'.$bo_table.'_'.$list[$i]['wr_id']; $list[$i]['content1'] = $c_row['wr_content'];
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
if(!get_session($ss_name)) $list[$i]['content'] = search_font($stx, $list[$i]['content']);
$list[$i]['content'] = '<a href="./password.php?w=sc&amp;bo_table='.$bo_table.'&amp;wr_id='.$list[$i]['wr_id'].$qstr.'" class="s_cmt">댓글내용 확인</a>'; } else {
else { $ss_name = 'ss_secret_comment_' . $bo_table . '_' . $list[$i]['wr_id'];
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']); if (!get_session($ss_name))
} $list[$i]['content'] = '<a href="./password.php?w=sc&amp;bo_table=' . $bo_table . '&amp;wr_id=' . $list[$i]['wr_id'] . $qstr . '" class="s_cmt">댓글내용 확인</a>';
} else {
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['datetime'] = substr($c_row['wr_datetime'],2,14); $list[$i]['content'] = search_font($stx, $list[$i]['content']);
}
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다. }
$list[$i]['ip'] = $c_row['wr_ip'];
if (!$is_admin) $list[$i]['datetime'] = substr($c_row['wr_datetime'], 2, 14);
$list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $c_row['wr_ip']);
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
$list[$i]['is_reply'] = false; $list[$i]['ip'] = $c_row['wr_ip'];
$list[$i]['is_edit'] = false; if (!$is_admin)
$list[$i]['is_del'] = false; $list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $c_row['wr_ip']);
if ($is_comment_write || $is_admin)
{ $list[$i]['is_reply'] = false;
$token = ''; $list[$i]['is_edit'] = false;
$list[$i]['is_del'] = false;
if ($member['mb_id']) if ($is_comment_write || $is_admin) {
{ $token = '';
if ($c_row['mb_id'] == $member['mb_id'] || $is_admin)
{ if ($member['mb_id']) {
set_session('ss_delete_comment_'.$c_row['wr_id'].'_token', $token = uniqid(time())); if ($c_row['mb_id'] == $member['mb_id'] || $is_admin) {
$list[$i]['del_link'] = './delete_comment.php?bo_table='.$bo_table.'&amp;comment_id='.$c_row['wr_id'].'&amp;token='.$token.'&amp;page='.$page.$qstr; set_session('ss_delete_comment_' . $c_row['wr_id'] . '_token', $token = uniqid(time()));
$list[$i]['is_edit'] = true; $list[$i]['del_link'] = './delete_comment.php?bo_table=' . $bo_table . '&amp;comment_id=' . $c_row['wr_id'] . '&amp;token=' . $token . '&amp;page=' . $page . $qstr;
$list[$i]['is_del'] = true; $list[$i]['is_edit'] = true;
} $list[$i]['is_del'] = true;
} }
else } else {
{ if (!$c_row['mb_id']) {
if (!$c_row['mb_id']) { $list[$i]['del_link'] = './password.php?w=x&amp;bo_table=' . $bo_table . '&amp;comment_id=' . $c_row['wr_id'] . '&amp;page=' . $page . $qstr;
$list[$i]['del_link'] = './password.php?w=x&amp;bo_table='.$bo_table.'&amp;comment_id='.$c_row['wr_id'].'&amp;page='.$page.$qstr; $list[$i]['is_del'] = true;
$list[$i]['is_del'] = true; }
} }
}
if (strlen($c_row['wr_comment_reply']) < 5)
if (strlen($c_row['wr_comment_reply']) < 5) $list[$i]['is_reply'] = true;
$list[$i]['is_reply'] = true; }
}
// 05.05.22
// 05.05.22 // 답변있는 코멘트는 수정, 삭제 불가
// 답변있는 코멘트는 수정, 삭제 불가 if ($i > 0 && !$is_admin) {
if ($i > 0 && !$is_admin) if ($c_row['wr_comment_reply']) {
{ $tmp_comment_reply = substr($c_row['wr_comment_reply'], 0, strlen($c_row['wr_comment_reply']) - 1);
if ($c_row['wr_comment_reply']) if ($tmp_comment_reply == $list[$i - 1]['wr_comment_reply']) {
{ $list[$i - 1]['is_edit'] = false;
$tmp_comment_reply = substr($c_row['wr_comment_reply'], 0, strlen($c_row['wr_comment_reply']) - 1); $list[$i - 1]['is_del'] = false;
if ($tmp_comment_reply == $list[$i-1]['wr_comment_reply']) }
{ }
$list[$i-1]['is_edit'] = false; }
$list[$i-1]['is_del'] = false; }
}
} // 코멘트수 제한 설정값
} if ($is_admin) {
} $comment_min = $comment_max = 0;
} else {
// 코멘트수 제한 설정값 $comment_min = (int) $board['bo_comment_min'];
if ($is_admin) $comment_max = (int) $board['bo_comment_max'];
{ }
$comment_min = $comment_max = 0;
} include $board_skin_path . '/view_comment.skin.php';
else
{
$comment_min = (int)$board['bo_comment_min'];
$comment_max = (int)$board['bo_comment_max'];
}
include($board_skin_path.'/view_comment.skin.php');
?>

View file

@ -1,107 +1,108 @@
<? <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
?> exit; // 개별 페이지 접근 불가
<script language="JavaScript"> include_once "_extend.php";
// 글자수 제한 ?>
var char_min = parseInt(<?=$comment_min?>); // 최소 <script language="JavaScript">
var char_max = parseInt(<?=$comment_max?>); // 최대 // 글자수 제한
</script> var char_min = parseInt(<?= $comment_min ?>); // 최소
var char_max = parseInt(<?= $comment_max ?>); // 최대
<!-- 코멘트 리스트 --> </script>
<!-- 코멘트 리스트 -->
<ul> <ul>
<!-- 코멘트 리스트 --> <!-- 코멘트 리스트 -->
<? <?php
for ($i=0; $i<count($list); $i++) { for ($i = 0; $i < count($list); $i++) {
$comment_id = $list[$i]['wr_id']; $comment_id = $list[$i]['wr_id'];
?> ?>
<li id="c_<?=$comment_id?>"> <li id="c_<?= $comment_id ?>">
<a name="c_<?=$comment_id?>"></a> <a name="c_<?= $comment_id ?>"></a>
<a href="#c_<?=$comment_id?>" onclick="$(this).next().slideToggle(); return false;" class="ui-btn small"> 답변<?=$lists[$ii]['wr_comment']>1 ? $i+1:""?></a> <a href="#c_<?= $comment_id ?>" onclick="$(this).next().slideToggle(); return false;" class="ui-btn small">
<div class="qna-comment-content" style="display:none;"> 답변<?= $lists[$ii]['wr_comment'] > 1 ? $i + 1 : "" ?></a>
<!-- 코멘트 출력 --> <div class="qna-comment-content" style="display:none;">
<? <!-- 코멘트 출력 -->
if (strstr($list[$i]['wr_option'], "secret")) echo "<span style='color:#ff6600;'>*</span> "; <?php
$str = $list[$i]['content']; if (strstr($list[$i]['wr_option'], "secret"))
if (strstr($list[$i]['wr_option'], "secret")) echo "<span style='color:#ff6600;'>*</span> ";
$str = "<span class='small' style='color:#ff6600;'>$str</span>"; $str = $list[$i]['content'];
if (strstr($list[$i]['wr_option'], "secret"))
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str); $str = "<span class='small' style='color:#ff6600;'>$str</span>";
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str); $str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str);
echo $str; $str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$query_string = clean_query_string($_SERVER['QUERY_STRING']); $str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
echo $str;
$query_string = clean_query_string($_SERVER['QUERY_STRING']);
if($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$comment_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql); if ($w == 'cu') {
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id']))) $sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$comment_id' and wr_is_comment = '1' ";
$cmt['wr_content'] = ''; $cmt = sql_fetch($sql);
$c_wr_content = $cmt['wr_content']; if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
} $cmt['wr_content'] = '';
$c_wr_content = $cmt['wr_content'];
$c_edit_href = './board.php?'.$query_string.'&amp;comment_id='.$comment_id.'&amp;wr_id='.$wr_id.'w=cu'; }
?> $c_edit_href = './board.php?' . $query_string . '&amp;comment_id=' . $comment_id . '&amp;wr_id=' . $wr_id . 'w=cu';
<? if ($list[$i]['is_edit']||$list[$i]['is_del']) { ?>
<p class="clear"> ?>
<strong> <?php if ($list[$i]['is_edit'] || $list[$i]['is_del']) { ?>
<? if ($list[$i]['is_edit']) { ?><span><a href="javascript:comment_box('<? echo $comment_id ?>', '<?=$list[$ii]['wr_id']?>');">M</a></span><? } ?> <p class="clear">
<? if ($list[$i]['is_del']) { ?><span><a href="javascript:comment_delete('<?=$list[$i]['del_link']?>');">D</a></span><?}?> <strong>
</strong> <?php if ($list[$i]['is_edit']) { ?><span><a
</p> href="javascript:comment_box('<?php echo $comment_id ?>', '<?= $list[$ii]['wr_id'] ?>');">M</a></span><?php } ?>
<?}?> <?php if ($list[$i]['is_del']) { ?><span><a
<span id="edit_<? echo $comment_id ?>"></span><!-- 수정 --> href="javascript:comment_delete('<?= $list[$i]['del_link'] ?>');">D</a></span><?php } ?> </strong>
</p>
<input type="hidden" value="<? echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<? echo $comment_id ?>"> <?php } ?>
<textarea id="save_comment_<? echo $comment_id ?>" style="display:none"><? echo get_text($list[$i]['content1'], 0) ?></textarea> <span id="edit_<?php echo $comment_id ?>"></span><!-- 수정 -->
</div>
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'], "secret") ?>"
<? if ($list[$i]['is_edit']) { ?> id="secret_comment_<?php echo $comment_id ?>">
<div class="modify_area" id="save_comment_<?php echo $comment_id ?>" style="display:none;"> <textarea id="save_comment_<?php echo $comment_id ?>"
<textarea id="save_co_comment_<?php echo $comment_id ?>" rows="4"><?php echo get_text($list[$i]['wr_content'], 0) ?></textarea> style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
</div>
<p class="txt-right"><button type="button" class="mod_comment ui-btn" onclick="modify_commnet('<?php echo $comment_id ?>'); return false;">수정</button></p> <?php if ($list[$i]['is_edit']) { ?>
</div> <div class="modify_area" id="save_comment_<?php echo $comment_id ?>" style="display:none;">
<? } ?> <textarea id="save_co_comment_<?php echo $comment_id ?>"
rows="4"><?php echo get_text($list[$i]['wr_content'], 0) ?></textarea>
</li>
<? } ?> <p class="txt-right"><button type="button" class="mod_comment ui-btn"
</ul> onclick="modify_commnet('<?php echo $comment_id ?>'); return false;">수정</button></p>
<? if ($is_comment_write) { </div>
if($w == '') $w = 'c'; <?php } ?>
?> </li>
<div class="ui-write-area" id="comment_write<?=$lists[$ii]['wr_id']?>" style="display:none;"> <?php } ?>
<!-- 코멘트 입력테이블시작 --> </ul>
<form name="fviewcomment" method="post" action="./write_comment_update.php" autocomplete="off"> <?php if ($is_comment_write) {
<input type="hidden" name="w" value="<? echo $w ?>" > if ($w == '')
<input type="hidden" name="bo_table" value="<? echo $bo_table ?>"> $w = 'c';
<input type="hidden" name="wr_id" value="<? echo $wr_id ?>"> ?>
<input type="hidden" name="sca" value="<? echo $sca ?>"> <div class="ui-write-area" id="comment_write<?= $lists[$ii]['wr_id'] ?>" style="display:none;">
<input type="hidden" name="sfl" value="<? echo $sfl ?>"> <!-- 코멘트 입력테이블시작 -->
<input type="hidden" name="stx" value="<? echo $stx ?>"> <form name="fviewcomment" method="post" action="./write_comment_update.php" autocomplete="off">
<input type="hidden" name="spt" value="<? echo $spt ?>"> <input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="page" value="<? echo $page ?>"> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<textarea id="wr_content<?=$comment_id?>" name="wr_content" rows="4" itemname="내용" required <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<? if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?> style='width:100%; word-break:break-all;' class='tx'><?=$list[$i]['wr_content']?></textarea> <input type="hidden" name="stx" value="<?php echo $stx ?>">
<? if ($comment_min || $comment_max) { ?><script type="text/javascript"> check_byte('wr_content', 'char_count'); </script><?}?> <input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<div class="txt-right" style="padding-bottom:5px;"> <textarea id="wr_content<?= $comment_id ?>" name="wr_content" rows="4" itemname="내용" required <?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');" <?php } ?>
<button type="submit" class="ui-btn" accesskey='s'>입력</button> style='width:100%; word-break:break-all;' class='tx'><?= $list[$i]['wr_content'] ?></textarea>
</div> <?php if ($comment_min || $comment_max) { ?>
<script type="text/javascript"> check_byte('wr_content', 'char_count'); </script><?php } ?>
</form> <div class="txt-right" style="padding-bottom:5px;">
</div> <button type="submit" class="ui-btn" accesskey='s'>입력</button>
<? } ?> </div>
<script language='JavaScript'> </form>
function fviewcomment_submit(f) </div>
{ <?php } ?>
return true; <script language='JavaScript'>
} function fviewcomment_submit(f) {
return true;
</script> }
</script>

824
write.php
View file

@ -1,413 +1,411 @@
<?php <?php
include_once('./_common.php'); include_once './_common.php';
include_once(G5_EDITOR_LIB); include_once G5_EDITOR_LIB;
if (!$board['bo_table']) { if (!$board['bo_table']) {
alert('존재하지 않는 게시판입니다.', G5_URL); alert('존재하지 않는 게시판입니다.', G5_URL);
} }
if (!$bo_table) { if (!$bo_table) {
alert("bo_table 값이 넘어오지 않았습니다.\\nwrite.php?bo_table=code 와 같은 방식으로 넘겨 주세요.", G5_URL); alert("bo_table 값이 넘어오지 않았습니다.\\nwrite.php?bo_table=code 와 같은 방식으로 넘겨 주세요.", G5_URL);
} }
check_device($board['bo_device']); check_device($board['bo_device']);
$notice_array = explode(',', trim($board['bo_notice'])); $notice_array = explode(',', trim($board['bo_notice']));
if (!($w == '' || $w == 'u' || $w == 'r')) { if (!($w == '' || $w == 'u' || $w == 'r')) {
alert('w 값이 제대로 넘어오지 않았습니다.'); alert('w 값이 제대로 넘어오지 않았습니다.');
} }
if ($w == 'u' || $w == 'r') { if ($w == 'u' || $w == 'r') {
if ($write['wr_id']) { if ($write['wr_id']) {
// 가변 변수로 $wr_1 .. $wr_10 까지 만든다. // 가변 변수로 $wr_1 .. $wr_10 까지 만든다.
for ($i=1; $i<=10; $i++) { for ($i = 1; $i <= 10; $i++) {
$vvar = "wr_".$i; $vvar = "wr_" . $i;
$$vvar = $write['wr_'.$i]; $$vvar = $write['wr_' . $i];
} }
} else { } else {
alert("글이 존재하지 않습니다.\\n삭제되었거나 이동된 경우입니다.", G5_URL); alert("글이 존재하지 않습니다.\\n삭제되었거나 이동된 경우입니다.", G5_URL);
} }
} }
if ($w == '') { if ($w == '') {
if ($wr_id) { if ($wr_id) {
alert('글쓰기에는 \$wr_id 값을 사용하지 않습니다.', G5_BBS_URL.'/board.php?bo_table='.$bo_table); alert('글쓰기에는 \$wr_id 값을 사용하지 않습니다.', G5_BBS_URL . '/board.php?bo_table=' . $bo_table);
} }
if ($member['mb_level'] < $board['bo_write_level']) { if ($member['mb_level'] < $board['bo_write_level']) {
if ($member['mb_id']) { if ($member['mb_id']) {
alert('글을 쓸 권한이 없습니다.'); alert('글을 쓸 권한이 없습니다.');
} else { } else {
alert("글을 쓸 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.", './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); alert("글을 쓸 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.", './login.php?' . $qstr . '&amp;url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table));
} }
} }
// 음수도 true 인것을 왜 이제야 알았을까? // 음수도 true 인것을 왜 이제야 알았을까?
if ($is_member) { if ($is_member) {
$tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0; $tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0;
if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) { if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) {
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글쓰기('.number_format($board['bo_write_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글쓰기 해 주십시오.'); alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 글쓰기(' . number_format($board['bo_write_point']) . ')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글쓰기 해 주십시오.');
} }
} }
$title_msg = '글쓰기'; $title_msg = '글쓰기';
} else if ($w == 'u') { } else if ($w == 'u') {
// 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함
//if ($member['mb_level'] < $board['bo_write_level']) { //if ($member['mb_level'] < $board['bo_write_level']) {
if($member['mb_id'] && $write['mb_id'] == $member['mb_id']) { if ($member['mb_id'] && $write['mb_id'] == $member['mb_id']) {
; ;
} else if ($member['mb_level'] < $board['bo_write_level']) { } else if ($member['mb_level'] < $board['bo_write_level']) {
if ($member['mb_id']) { if ($member['mb_id']) {
alert('글을 수정할 권한이 없습니다.'); alert('글을 수정할 권한이 없습니다.');
} else { } else {
alert('글을 수정할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); alert('글을 수정할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?' . $qstr . '&amp;url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table));
} }
} }
$len = strlen($write['wr_reply']); $len = strlen($write['wr_reply']);
if ($len < 0) $len = 0; if ($len < 0)
$reply = substr($write['wr_reply'], 0, $len); $len = 0;
$reply = substr($write['wr_reply'], 0, $len);
// 원글만 구한다.
$sql = " select count(*) as cnt from {$write_table} // 원글만 구한다.
where wr_reply like '{$reply}%' $sql = " select count(*) as cnt from {$write_table}
and wr_id <> '{$write['wr_id']}' where wr_reply like '{$reply}%'
and wr_num = '{$write['wr_num']}' and wr_id <> '{$write['wr_id']}'
and wr_is_comment = 0 "; and wr_num = '{$write['wr_num']}'
$row = sql_fetch($sql); and wr_is_comment = 0 ";
if ($row['cnt'] && !$is_admin) $row = sql_fetch($sql);
alert('이 글과 관련된 답변글이 존재하므로 수정 할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다.'); if ($row['cnt'] && !$is_admin)
alert('이 글과 관련된 답변글이 존재하므로 수정 할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다.');
// 코멘트 달린 원글의 수정 여부
$sql = " select count(*) as cnt from {$write_table} // 코멘트 달린 원글의 수정 여부
where wr_parent = '{$wr_id}' $sql = " select count(*) as cnt from {$write_table}
and mb_id <> '{$member['mb_id']}' where wr_parent = '{$wr_id}'
and wr_is_comment = 1 "; and mb_id <> '{$member['mb_id']}'
$row = sql_fetch($sql); and wr_is_comment = 1 ";
if ($board['bo_count_modify'] && $row['cnt'] >= $board['bo_count_modify'] && !$is_admin) $row = sql_fetch($sql);
alert('이 글과 관련된 댓글이 존재하므로 수정 할 수 없습니다.\\n\\n댓글이 '.$board['bo_count_modify'].'건 이상 달린 원글은 수정할 수 없습니다.'); if ($board['bo_count_modify'] && $row['cnt'] >= $board['bo_count_modify'] && !$is_admin)
alert('이 글과 관련된 댓글이 존재하므로 수정 할 수 없습니다.\\n\\n댓글이 ' . $board['bo_count_modify'] . '건 이상 달린 원글은 수정할 수 없습니다.');
$title_msg = '글수정';
} else if ($w == 'r') { $title_msg = '글수정';
if ($member['mb_level'] < $board['bo_reply_level']) { } else if ($w == 'r') {
if ($member['mb_id']) if ($member['mb_level'] < $board['bo_reply_level']) {
alert('글을 답변할 권한이 없습니다.'); if ($member['mb_id'])
else alert('글을 답변할 권한이 없습니다.');
alert('답변글을 작성할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); else
} alert('답변글을 작성할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?' . $qstr . '&amp;url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table));
}
$tmp_point = isset($member['mb_point']) ? $member['mb_point'] : 0;
if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) $tmp_point = isset($member['mb_point']) ? $member['mb_point'] : 0;
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글답변('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글답변 해 주십시오.'); if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin)
alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 글답변(' . number_format($board['bo_comment_point']) . ')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글답변 해 주십시오.');
//if (preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice']))
if (in_array((int)$wr_id, $notice_array)) //if (preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice']))
alert('공지에는 답변 할 수 없습니다.'); if (in_array((int) $wr_id, $notice_array))
alert('공지에는 답변 할 수 없습니다.');
//----------
// 4.06.13 : 비밀글을 타인이 열람할 수 있는 오류 수정 (헐랭이, 플록님께서 알려주셨습니다.) //----------
// 코멘트에는 원글의 답변이 불가하므로 // 4.06.13 : 비밀글을 타인이 열람할 수 있는 오류 수정 (헐랭이, 플록님께서 알려주셨습니다.)
if ($write['wr_is_comment']) // 코멘트에는 원글의 답변이 불가하므로
alert('정상적인 접근이 아닙니다.'); if ($write['wr_is_comment'])
alert('정상적인 접근이 아닙니다.');
// 비밀글인지를 검사
if (strstr($write['wr_option'], 'secret')) { // 비밀글인지를 검사
if ($write['mb_id']) { if (strstr($write['wr_option'], 'secret')) {
// 회원의 경우는 해당 글쓴 회원 및 관리자 if ($write['mb_id']) {
if (!($write['mb_id'] == $member['mb_id'] || $is_admin)) // 회원의 경우는 해당 글쓴 회원 및 관리자
alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.'); if (!($write['mb_id'] == $member['mb_id'] || $is_admin))
} else { alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.');
// 비회원의 경우는 비밀글에 답변이 불가함 } else {
if (!$is_admin) // 비회원의 경우는 비밀글에 답변이 불가함
alert('비회원의 비밀글에는 답변이 불가합니다.'); if (!$is_admin)
} alert('비회원의 비밀글에는 답변이 불가합니다.');
} }
//---------- }
//----------
// 게시글 배열 참조
$reply_array = &$write; // 게시글 배열 참조
$reply_array = &$write;
// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
if (strlen($reply_array['wr_reply']) == 10) // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.'); if (strlen($reply_array['wr_reply']) == 10)
alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.');
$reply_len = strlen($reply_array['wr_reply']) + 1;
if ($board['bo_reply_order']) { $reply_len = strlen($reply_array['wr_reply']) + 1;
$begin_reply_char = 'A'; if ($board['bo_reply_order']) {
$end_reply_char = 'Z'; $begin_reply_char = 'A';
$reply_number = +1; $end_reply_char = 'Z';
$sql = " select MAX(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; $reply_number = +1;
} else { $sql = " select MAX(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' ";
$begin_reply_char = 'Z'; } else {
$end_reply_char = 'A'; $begin_reply_char = 'Z';
$reply_number = -1; $end_reply_char = 'A';
$sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; $reply_number = -1;
} $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' ";
if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; }
$row = sql_fetch($sql); if ($reply_array['wr_reply'])
$sql .= " and wr_reply like '{$reply_array['wr_reply']}%' ";
if (!$row['reply']) $row = sql_fetch($sql);
$reply_char = $begin_reply_char;
else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다. if (!$row['reply'])
alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.'); $reply_char = $begin_reply_char;
else else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다.
$reply_char = chr(ord($row['reply']) + $reply_number); alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.');
else
$reply = $reply_array['wr_reply'] . $reply_char; $reply_char = chr(ord($row['reply']) + $reply_number);
$title_msg = '글답변'; $reply = $reply_array['wr_reply'] . $reply_char;
$write['wr_subject'] = 'Re: '.$write['wr_subject']; $title_msg = '글답변';
}
$write['wr_subject'] = 'Re: ' . $write['wr_subject'];
// 그룹접근 가능 }
if (!empty($group['gr_use_access'])) {
if ($is_guest) { // 그룹접근 가능
alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", 'login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); if (!empty($group['gr_use_access'])) {
} if ($is_guest) {
alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", 'login.php?' . $qstr . '&amp;url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table));
if ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']) { }
; // 통과
} else { if ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']) {
// 그룹접근 ; // 통과
$sql = " select gr_id from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' "; } else {
$row = sql_fetch($sql); // 그룹접근
if (!$row['gr_id']) $sql = " select gr_id from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' ";
alert('접근 권한이 없으므로 글쓰기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.'); $row = sql_fetch($sql);
} if (!$row['gr_id'])
} alert('접근 권한이 없으므로 글쓰기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.');
}
// 본인확인을 사용한다면 }
if ($config['cf_cert_use'] && !$is_admin) {
// 인증된 회원만 가능 // 본인확인을 사용한다면
if ($board['bo_use_cert'] != '' && $is_guest) { if ($config['cf_cert_use'] && !$is_admin) {
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', 'login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); // 인증된 회원만 가능
} if ($board['bo_use_cert'] != '' && $is_guest) {
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', 'login.php?' . $qstr . '&amp;url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table));
if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { }
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL);
} if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) {
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL);
if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { }
alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글쓰기가 가능합니다.\\n\\n성인인데 글쓰기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL);
} if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) {
alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글쓰기가 가능합니다.\\n\\n성인인데 글쓰기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL);
if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { }
alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL);
} if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') {
alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL);
if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { }
alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL);
} if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) {
} alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL);
}
// 글자수 제한 설정값 }
if ($is_admin || $board['bo_use_dhtml_editor'])
{ // 글자수 제한 설정값
$write_min = $write_max = 0; if ($is_admin || $board['bo_use_dhtml_editor']) {
} $write_min = $write_max = 0;
else } else {
{ $write_min = (int) $board['bo_write_min'];
$write_min = (int)$board['bo_write_min']; $write_max = (int) $board['bo_write_max'];
$write_max = (int)$board['bo_write_max']; }
}
$g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']) . ' ' . $title_msg;
$g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$title_msg;
$is_notice = false;
$is_notice = false; $notice_checked = '';
$notice_checked = ''; if ($is_admin && $w != 'r') {
if ($is_admin && $w != 'r') { $is_notice = true;
$is_notice = true;
if ($w == 'u') {
if ($w == 'u') { // 답변 수정시 공지 체크 없음
// 답변 수정시 공지 체크 없음 if ($write['wr_reply']) {
if ($write['wr_reply']) { $is_notice = false;
$is_notice = false; } else {
} else { if (in_array((int) $wr_id, $notice_array)) {
if (in_array((int)$wr_id, $notice_array)) { $notice_checked = 'checked';
$notice_checked = 'checked'; }
} }
} }
} }
}
$is_html = false;
$is_html = false; if ($member['mb_level'] >= $board['bo_html_level'])
if ($member['mb_level'] >= $board['bo_html_level']) $is_html = true;
$is_html = true;
$is_secret = $board['bo_use_secret'];
$is_secret = $board['bo_use_secret'];
$is_mail = false;
$is_mail = false; if ($config['cf_email_use'] && $board['bo_use_email'])
if ($config['cf_email_use'] && $board['bo_use_email']) $is_mail = true;
$is_mail = true;
$recv_email_checked = '';
$recv_email_checked = ''; if ($w == '' || strstr($write['wr_option'], 'mail'))
if ($w == '' || strstr($write['wr_option'], 'mail')) $recv_email_checked = 'checked';
$recv_email_checked = 'checked';
$is_name = false;
$is_name = false; $is_password = false;
$is_password = false; $is_email = false;
$is_email = false; $is_homepage = false;
$is_homepage = false; if ($is_guest || ($is_admin && $w == 'u' && $member['mb_id'] != $write['mb_id'])) {
if ($is_guest || ($is_admin && $w == 'u' && $member['mb_id'] != $write['mb_id'])) { $is_name = true;
$is_name = true; $is_password = true;
$is_password = true; $is_email = true;
$is_email = true; $is_homepage = true;
$is_homepage = true; }
}
$is_category = false;
$is_category = false; $category_option = '';
$category_option = ''; if ($board['bo_use_category']) {
if ($board['bo_use_category']) { $ca_name = "";
$ca_name = ""; if (isset($write['ca_name']))
if (isset($write['ca_name'])) $ca_name = $write['ca_name'];
$ca_name = $write['ca_name']; $category_option = get_category_option($bo_table, $ca_name);
$category_option = get_category_option($bo_table, $ca_name); $is_category = true;
$is_category = true; }
}
$is_link = false;
$is_link = false; if ($member['mb_level'] >= $board['bo_link_level']) {
if ($member['mb_level'] >= $board['bo_link_level']) { $is_link = true;
$is_link = true; }
}
$is_file = false;
$is_file = false; if ($member['mb_level'] >= $board['bo_upload_level']) {
if ($member['mb_level'] >= $board['bo_upload_level']) { $is_file = true;
$is_file = true; }
}
$is_file_content = false;
$is_file_content = false; if ($board['bo_use_file_content']) {
if ($board['bo_use_file_content']) { $is_file_content = true;
$is_file_content = true; }
}
$file_count = (int) $board['bo_upload_count'];
$file_count = (int)$board['bo_upload_count'];
$name = "";
$name = ""; $email = "";
$email = ""; $homepage = "";
$homepage = ""; if ($w == "" || $w == "r") {
if ($w == "" || $w == "r") { if ($is_member) {
if ($is_member) { if (isset($write['wr_name'])) {
if (isset($write['wr_name'])) { $name = get_text(cut_str(stripslashes($write['wr_name']), 20));
$name = get_text(cut_str(stripslashes($write['wr_name']),20)); }
} $email = get_email_address($member['mb_email']);
$email = get_email_address($member['mb_email']); $homepage = get_text(stripslashes($member['mb_homepage']));
$homepage = get_text(stripslashes($member['mb_homepage'])); }
} }
}
$html_checked = "";
$html_checked = ""; $html_value = "";
$html_value = ""; $secret_checked = "";
$secret_checked = "";
if ($w == '') {
if ($w == '') { $password_required = 'required';
$password_required = 'required'; } else if ($w == 'u') {
} else if ($w == 'u') { $password_required = '';
$password_required = '';
if (!$is_admin) {
if (!$is_admin) { if (!($is_member && $member['mb_id'] == $write['mb_id'])) {
if (!($is_member && $member['mb_id'] == $write['mb_id'])) { if (!check_password($wr_password, $write['wr_password'])) {
if (!check_password($wr_password, $write['wr_password'])) { alert('비밀번호가 틀립니다.');
alert('비밀번호가 틀립니다.'); }
} }
} }
}
$name = get_text(cut_str(stripslashes($write['wr_name']), 20));
$name = get_text(cut_str(stripslashes($write['wr_name']),20)); $email = get_email_address($write['wr_email']);
$email = get_email_address($write['wr_email']); $homepage = get_text(stripslashes($write['wr_homepage']));
$homepage = get_text(stripslashes($write['wr_homepage']));
for ($i = 1; $i <= G5_LINK_COUNT; $i++) {
for ($i=1; $i<=G5_LINK_COUNT; $i++) { $write['wr_link' . $i] = get_text($write['wr_link' . $i]);
$write['wr_link'.$i] = get_text($write['wr_link'.$i]); $link[$i] = $write['wr_link' . $i];
$link[$i] = $write['wr_link'.$i]; }
}
if (strstr($write['wr_option'], 'html1')) {
if (strstr($write['wr_option'], 'html1')) { $html_checked = 'checked';
$html_checked = 'checked'; $html_value = 'html1';
$html_value = 'html1'; } else if (strstr($write['wr_option'], 'html2')) {
} else if (strstr($write['wr_option'], 'html2')) { $html_checked = 'checked';
$html_checked = 'checked'; $html_value = 'html2';
$html_value = 'html2'; }
}
if (strstr($write['wr_option'], 'secret')) {
if (strstr($write['wr_option'], 'secret')) { $secret_checked = 'checked';
$secret_checked = 'checked'; }
}
$file = get_file($bo_table, $wr_id);
$file = get_file($bo_table, $wr_id); if ($file_count < $file['count'])
if($file_count < $file['count']) $file_count = $file['count'];
$file_count = $file['count']; } else if ($w == 'r') {
} else if ($w == 'r') { if (strstr($write['wr_option'], 'secret')) {
if (strstr($write['wr_option'], 'secret')) { $is_secret = true;
$is_secret = true; $secret_checked = 'checked';
$secret_checked = 'checked'; }
}
$password_required = "required";
$password_required = "required";
for ($i = 1; $i <= G5_LINK_COUNT; $i++) {
for ($i=1; $i<=G5_LINK_COUNT; $i++) { $write['wr_link' . $i] = get_text($write['wr_link' . $i]);
$write['wr_link'.$i] = get_text($write['wr_link'.$i]); }
} }
}
set_session('ss_bo_table', $_REQUEST['bo_table']);
set_session('ss_bo_table', $_REQUEST['bo_table']); set_session('ss_wr_id', $_REQUEST['wr_id']);
set_session('ss_wr_id', $_REQUEST['wr_id']);
$subject = "";
$subject = ""; if (isset($write['wr_subject'])) {
if (isset($write['wr_subject'])) { $subject = str_replace("\"", "&#034;", get_text(cut_str($write['wr_subject'], 255), 0));
$subject = str_replace("\"", "&#034;", get_text(cut_str($write['wr_subject'], 255), 0)); }
}
$content = '';
$content = ''; if ($w == '') {
if ($w == '') { $content = $board['bo_insert_content'];
$content = $board['bo_insert_content']; } else if ($w == 'r') {
} else if ($w == 'r') { if (!strstr($write['wr_option'], 'html')) {
if (!strstr($write['wr_option'], 'html')) { $content = "\n\n\n &gt; "
$content = "\n\n\n &gt; " . "\n &gt; "
."\n &gt; " . "\n &gt; " . str_replace("\n", "\n> ", get_text($write['wr_content'], 0))
."\n &gt; ".str_replace("\n", "\n> ", get_text($write['wr_content'], 0)) . "\n &gt; "
."\n &gt; " . "\n &gt; ";
."\n &gt; ";
}
} } else {
} else { $content = get_text($write['wr_content'], 0);
$content = get_text($write['wr_content'], 0); }
}
$upload_max_filesize = number_format($board['bo_upload_size']) . ' 바이트';
$upload_max_filesize = number_format($board['bo_upload_size']) . ' 바이트';
$width = $board['bo_table_width'];
$width = $board['bo_table_width']; if ($width <= 100)
if ($width <= 100) $width .= '%';
$width .= '%'; else
else $width .= 'px';
$width .= 'px';
$is_dhtml_editor = false;
$is_dhtml_editor = false; $is_dhtml_editor_use = false;
$is_dhtml_editor_use = false; $editor_content_js = '';
$editor_content_js = ''; if (!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)
if(!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE) $is_dhtml_editor_use = true;
$is_dhtml_editor_use = true;
// 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용
// 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용 if ($config['cf_editor'] && $is_dhtml_editor_use && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) {
if ($config['cf_editor'] && $is_dhtml_editor_use && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) { $is_dhtml_editor = true;
$is_dhtml_editor = true;
if (is_file(G5_EDITOR_PATH . '/' . $config['cf_editor'] . '/autosave.editor.js'))
if(is_file(G5_EDITOR_PATH.'/'.$config['cf_editor'].'/autosave.editor.js')) $editor_content_js = '<script src="' . G5_EDITOR_URL . '/' . $config['cf_editor'] . '/autosave.editor.js"></script>' . PHP_EOL;
$editor_content_js = '<script src="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/autosave.editor.js"></script>'.PHP_EOL; }
} $editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor); $editor_js = '';
$editor_js = ''; $editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor); $editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);
// 임시 저장된 글 수
// 임시 저장된 글 수 $autosave_count = autosave_count($member['mb_id']);
$autosave_count = autosave_count($member['mb_id']);
$action_url = https_url(G5_BBS_DIR) . "/write_update.php";
$action_url = https_url(G5_BBS_DIR)."/write_update.php";
echo '<!-- skin : ' . (G5_IS_MOBILE ? $board['bo_mobile_skin'] : $board['bo_skin']) . ' -->';
echo '<!-- skin : '.(G5_IS_MOBILE ? $board['bo_mobile_skin'] : $board['bo_skin']).' -->';
include_once ($board_skin_path.'/write.skin.php'); include_once $board_skin_path . '/write.skin.php';
?>

View file

@ -1,122 +1,132 @@
<? <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
exit; // 개별 페이지 접근 불가
$option = '';
$option_hidden = ''; include_once "_extend.php";
if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = ''; $option = '';
if ($is_notice && !$no_id) { $option_hidden = '';
$option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>'; if ($is_notice || $is_html || $is_secret || $is_mail) {
} $option = '';
if ($is_notice && !$no_id) {
if ($is_html) { $option .= "\n" . '<input type="checkbox" id="notice" name="notice" value="1" ' . $notice_checked . '>' . "\n" . '<label for="notice">공지</label>';
if ($is_dhtml_editor) { }
$option_hidden .= '<input type="hidden" value="html1" name="html">';
} else { if ($is_html) {
//$option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>'; if ($is_dhtml_editor) {
} $option_hidden .= '<input type="hidden" value="html1" name="html">';
} } else {
//$option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>';
if ($is_secret) { }
if ($is_secret==1) { }
$option .= "\n".'<input type="checkbox" id="secret" name="secret" value="secret" '.$secret_checked.'>'."\n".'<label for="secret">비밀글</label>';
} else { if ($is_secret) {
$option_hidden .= '<input type="hidden" name="secret" value="secret">'; if ($is_secret == 1) {
} $option .= "\n" . '<input type="checkbox" id="secret" name="secret" value="secret" ' . $secret_checked . '>' . "\n" . '<label for="secret">비밀글</label>';
} } else {
if ($is_mail) { $option_hidden .= '<input type="hidden" name="secret" value="secret">';
$option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>'; }
} }
} if ($is_mail) {
$option .= "\n" . '<input type="checkbox" id="mail" name="mail" value="mail" ' . $recv_email_checked . '>' . "\n" . '<label for="mail">답변메일받기</label>';
echo $option_hidden; }
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0); }
$clap_o=sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date, '%Y-%m-%d')='".G5_TIME_YMD."' and cl_ip='{$_SERVER['REMOTE_ADDR']}'");
?> echo $option_hidden;
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off"> add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css">', 0);
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>"> $clap_o = sql_fetch("select sum(cl_cnt) as sum from {$g5['clap_table']} where date_format(cl_date, '%Y-%m-%d')='" . G5_TIME_YMD . "' and cl_ip='{$_SERVER['REMOTE_ADDR']}'");
<input type="hidden" name="w" value="<?php echo $w ?>"> ?>
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> <form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post"
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>"> enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="sca" value="<?php echo $sca ?>"> <input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>"> <input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>"> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>"> <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>"> <input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>"> <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="page" value="<?php echo $page ?>"> <input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="wr_subject" value="박수"> <input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="text" name="wr_dum" value="" style="display:none;"> <input type="hidden" name="sst" value="<?php echo $sst ?>">
<?= $option_hidden ?> <input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<div class="ui-write-box"> <input type="hidden" name="wr_subject" value="박수">
<textarea id="content" name="wr_content" rows=6 itemname="내용" required><?=$content?></textarea> <input type="text" name="wr_dum" value="" style="display:none;">
<button type="submit" id="btn_submit" class="ui-btn point" accesskey='s'>메세지<br>남기기</button> <?= $option_hidden ?>
<div class="ui-control">
<?php echo $option ?>&nbsp;&nbsp; <div class="ui-write-box">
<? if(!$is_member){ ?> <textarea id="content" name="wr_content" rows=6 itemname="내용" required><?= $content ?></textarea>
<input type="hidden" maxlength="20" name="wr_name" id="wr_name" placeholder="NAME" itemname="이름" required value="익명" /> <button type="submit" id="btn_submit" class="ui-btn point" accesskey='s'>메세지<br>남기기</button>
<input type="hidden" maxlength="20" id="wr_password" name="wr_password" placeholder="PASSWORD" itemname="패스워드" value="<?=time();?>" <?=$password_required?> /> <div class="ui-control">
<? } ?> <?php echo $option ?>&nbsp;&nbsp;
<?if($is_admin && $w=='u') {?> <?php if (!$is_member) { ?>
<?for($k=0;$k<$board['bo_upload_count'];$k++){?> <input type="hidden" maxlength="20" name="wr_name" id="wr_name" placeholder="NAME" itemname="이름" required
<dl class="files"> value="익명" />
<dt> <input type="hidden" maxlength="20" id="wr_password" name="wr_password" placeholder="PASSWORD" itemname="패스워드"
<?php if($file[$k]['file']) { ?> value="<?= time(); ?>" <?= $password_required ?> />
<a href="<?=G5_DATA_URL."/file/".$bo_table."/".$file[$k]['file']?>" target="_blank"> <?php } ?>
<img src="<?=G5_DATA_URL."/file/".$bo_table."/".$file[$k]['file']?>"></a> <?php if ($is_admin && $w == 'u') { ?>
<?}?> <?php for ($k = 0; $k < $board['bo_upload_count']; $k++) { ?>
</dt> <dl class="files">
<dd> <dt>
<input type="file" name="bf_file[]" title="파일첨부 <?php echo $k+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input full"> <?php if ($file[$k]['file']) { ?>
<?php if ($is_file_content) { ?> <a href="<?= G5_DATA_URL . "/file/" . $bo_table . "/" . $file[$k]['file'] ?>" target="_blank">
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$k]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50"> <img src="<?= G5_DATA_URL . "/file/" . $bo_table . "/" . $file[$k]['file'] ?>"></a>
<?php } ?> <?php } ?>
<?php if($file[$k]['file']) { ?> </dt>
<input type="checkbox" id="bf_file_del<?php echo $k ?>" name="bf_file_del[<?php echo $k; ?>]" value="1"> <label for="bf_file_del<?php echo $k ?>"><?php echo $file[$k]['source'].'('.$file[$k]['size'].')'; ?> 파일 삭제</label> <dd>
<?php } ?> <input type="file" name="bf_file[]"
</dd> title="파일첨부 <?php echo $k + 1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능"
</dl> class="frm_file frm_input full">
<?}?> <?php if ($is_file_content) { ?>
<?}?> <input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$k]['bf_content'] : ''; ?>"
</div> title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
</div> <?php } ?>
</form> <?php if ($file[$k]['file']) { ?>
<input type="checkbox" id="bf_file_del<?php echo $k ?>" name="bf_file_del[<?php echo $k; ?>]" value="1">
<script> <label for="bf_file_del<?php echo $k ?>"><?php echo $file[$k]['source'] . '(' . $file[$k]['size'] . ')'; ?> 파일
<?php if($write_min || $write_max) { ?> 삭제</label>
// 글자수 제한 <?php } ?>
var char_min = parseInt(<?php echo $write_min; ?>); // 최소 </dd>
var char_max = parseInt(<?php echo $write_max; ?>); // 최대 </dl>
check_byte("wr_content", "char_count"); <?php } ?>
<?php } ?>
$(function() { </div>
$("#wr_content").on("keyup", function() { </div>
check_byte("wr_content", "char_count"); </form>
});
}); <script>
<?php if ($write_min || $write_max) { ?>
<?php } ?> // 글자수 제한
function fwrite_submit(f) var char_min = parseInt(<?php echo $write_min; ?>); // 최소
{ var char_max = parseInt(<?php echo $write_max; ?>); // 최대
<?if(!$is_admin){?> check_byte("wr_content", "char_count");
let clap_max=10;
<? if($board['bo_1']!=''){?> $(function () {
clap_max=parseInt('<?=$board['bo_1']?>'); $("#wr_content").on("keyup", function () {
<?}?> check_byte("wr_content", "char_count");
let clap_t=parseInt('<?=$clap_o['sum']?>'); });
if(clap_max>0 && clap_t>=clap_max){ });
alert("박수는 하루에 "+clap_max+"번 까지 칠 수 있습니다.");
return false; <?php } ?>
} function fwrite_submit(f) {
<?}?> <?php if (!$is_admin) { ?>
if(f.wr_dum.value!=''){ let clap_max = 10;
alert("스팸방지"); <?php if ($board['bo_1'] != '') { ?>
return false; clap_max = parseInt('<?= $board['bo_1'] ?>');
}else{ <?php } ?>
if(f.w!=u) let clap_t = parseInt('<?= $clap_o['sum'] ?>');
alert("메시지 감사합니다!"); if (clap_max > 0 && clap_t >= clap_max) {
return true; alert("박수는 하루에 " + clap_max + "번 까지 칠 수 있습니다.");
} return false;
} }
</script> <?php } ?>
if (f.wr_dum.value != '') {
alert("스팸방지");
return false;
} else {
if (f.w != u)
alert("메시지 감사합니다!");
return true;
}
}
</script>

View file

@ -1,9 +1,11 @@
<? <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
exit; // 개별 페이지 접근 불가
if($w!=u && $notice!=1)
include_once($board_skin_path.'/update_hit.php'); include_once "_extend.php";
// 자신만의 코드를 넣어주세요. if ($w != "u" && $notice != 1)
goto_url("./board.php?bo_table=$bo_table"); include_once $board_skin_path . '/update_hit.php';
?>
// 자신만의 코드를 넣어주세요.
goto_url("./board.php?bo_table=$bo_table");