Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gnuboard/g5
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Aug 13, 2020
2 parents 84dd9f0 + 5ba1e37 commit 5353f75
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 26 deletions.
27 changes: 27 additions & 0 deletions adm/board_form.php
Expand Up @@ -80,6 +80,12 @@
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_captcha` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_sns` ");
}

if (!isset($board['bo_select_editor'])) {
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_select_editor` VARCHAR(50) NOT NULL DEFAULT '' AFTER `bo_use_dhtml_editor` ");
}

run_event('adm_board_form_before', $board, $w);

$required = "";
$readonly = "";
$sound_only = "";
Expand Down Expand Up @@ -482,6 +488,27 @@
<label for="chk_all_use_dhtml_editor">전체적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bo_select_editor">게시판 에디터 선택</label></th>
<td>
<?php echo help('게시판에 사용할 에디터를 설정합니다. 스킨에 따라 적용되지 않을 수 있습니다.') ?>
<select name="bo_select_editor" id="bo_select_editor">
<?php
$arr = get_skin_dir('', G5_EDITOR_PATH);
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">기본환경설정의 에디터 사용</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($board['bo_select_editor'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
</td>
<td class="td_grpset">
<input type="checkbox" name="chk_grp_select_editor" value="1" id="chk_grp_select_editor">
<label for="chk_grp_select_editor">그룹적용</label>
<input type="checkbox" name="chk_all_select_editor" value="1" id="chk_all_select_editor">
<label for="chk_all_select_editor">전체적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bo_use_rss_view">RSS 보이기 사용</label></th>
<td>
Expand Down
3 changes: 3 additions & 0 deletions adm/board_form_update.php
Expand Up @@ -114,6 +114,7 @@
bo_use_file_content = '{$_POST['bo_use_file_content']}',
bo_use_secret = '{$_POST['bo_use_secret']}',
bo_use_dhtml_editor = '{$_POST['bo_use_dhtml_editor']}',
bo_select_editor = '{$_POST['bo_select_editor']}',
bo_use_rss_view = '{$_POST['bo_use_rss_view']}',
bo_use_good = '{$_POST['bo_use_good']}',
bo_use_nogood = '{$_POST['bo_use_nogood']}',
Expand Down Expand Up @@ -301,6 +302,7 @@
if (is_checked('chk_grp_use_file_content')) $grp_fields .= " , bo_use_file_content = '{$bo_use_file_content}' ";
if (is_checked('chk_grp_use_secret')) $grp_fields .= " , bo_use_secret = '{$bo_use_secret}' ";
if (is_checked('chk_grp_use_dhtml_editor')) $grp_fields .= " , bo_use_dhtml_editor = '{$bo_use_dhtml_editor}' ";
if (is_checked('chk_grp_select_editor')) $grp_fields .= " , bo_select_editor = '{$bo_select_editor}' ";
if (is_checked('chk_grp_use_rss_view')) $grp_fields .= " , bo_use_rss_view = '{$bo_use_rss_view}' ";
if (is_checked('chk_grp_use_good')) $grp_fields .= " , bo_use_good = '{$bo_use_good}' ";
if (is_checked('chk_grp_use_nogood')) $grp_fields .= " , bo_use_nogood = '{$bo_use_nogood}' ";
Expand Down Expand Up @@ -390,6 +392,7 @@
if (is_checked('chk_all_use_file_content')) $all_fields .= " , bo_use_file_content = '{$bo_use_file_content}' ";
if (is_checked('chk_all_use_secret')) $all_fields .= " , bo_use_secret = '{$bo_use_secret}' ";
if (is_checked('chk_all_use_dhtml_editor')) $all_fields .= " , bo_use_dhtml_editor = '{$bo_use_dhtml_editor}' ";
if (is_checked('chk_all_select_editor')) $all_fields .= " , bo_select_editor = '{$bo_select_editor}' ";
if (is_checked('chk_all_use_rss_view')) $all_fields .= " , bo_use_rss_view = '{$bo_use_rss_view}' ";
if (is_checked('chk_all_use_good')) $all_fields .= " , bo_use_good = '{$bo_use_good}' ";
if (is_checked('chk_all_use_nogood')) $all_fields .= " , bo_use_nogood = '{$bo_use_nogood}' ";
Expand Down
4 changes: 2 additions & 2 deletions adm/sms_admin/num_book.php
Expand Up @@ -13,12 +13,12 @@

if ($page < 1) $page = 1;

$bg_no = isset($bg_no) ? (int) $bg_no : 0;
$bg_no = isset($bg_no) ? preg_replace('/[^0-9]/i', '', $bg_no) : '';
$st = isset($st) ? preg_replace('/[^a-z0-9]/i', '', $st) : '';

$sql_korean = $sql_group = $sql_search = $sql_no_hp = '';

if (is_numeric($bg_no))
if (is_numeric($bg_no) && $bg_no)
$sql_group = " and bg_no='$bg_no' ";
else
$sql_group = "";
Expand Down
2 changes: 1 addition & 1 deletion bbs/memo_form_update.php
Expand Up @@ -20,7 +20,7 @@
for ($i=0; $i<count($recv_list); $i++) {
$row = sql_fetch(" select mb_id, mb_nick, mb_open, mb_leave_date, mb_intercept_date from {$g5['member_table']} where mb_id = '{$recv_list[$i]}' ");
if ($row) {
if ($is_admin || ($row['mb_open'] && (!$row['mb_leave_date'] || !$row['mb_intercept_date']))) {
if ($is_admin || ($row['mb_open'] && (!$row['mb_leave_date'] && !$row['mb_intercept_date']))) {
$member_list['id'][] = $row['mb_id'];
$member_list['nick'][] = $row['mb_nick'];
} else {
Expand Down
12 changes: 10 additions & 2 deletions bbs/move_update.php
Expand Up @@ -27,6 +27,8 @@
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$save[$cnt]['wr_contents'] = array();

$wr_num = $row['wr_num'];
for ($i=0; $i<count($_POST['chk_bo_table']); $i++)
{
Expand All @@ -52,6 +54,8 @@
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$save[$cnt]['wr_contents'][] = $row2['wr_content'];

$nick = cut_str($member['mb_nick'], $config['cf_cut_name']);
if (!$row2['wr_is_comment'] && $config['cf_use_copy_log']) {
if(strstr($row2['wr_option'], 'html')) {
Expand Down Expand Up @@ -210,16 +214,20 @@
{
if( isset($save[$i]['bf_file']) && $save[$i]['bf_file'] ){
for ($k=0; $k<count($save[$i]['bf_file']); $k++) {
$del_file = $save[$i]['bf_file'][$k];
$del_file = run_replace('delete_file_path', clean_relative_paths($save[$i]['bf_file'][$k]), $save[$i]);

if ( is_file($del_file) && file_exists($del_file) ){
@unlink($del_file);
}

// 썸네일 파일 삭제, 먼지손 님 코드 제안
delete_board_thumbnail($bo_table, basename($save[$i]['bf_file'][$k]));
}
}

for ($k=0; $k<count($save[$i]['wr_contents']); $k++){
delete_editor_thumbnail($save[$i]['wr_contents'][$k]);
}

sql_query(" delete from $write_table where wr_parent = '{$save[$i]['wr_id']}' ");
sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_id = '{$save[$i]['wr_id']}' ");
Expand Down
2 changes: 1 addition & 1 deletion bbs/rss.php
Expand Up @@ -70,7 +70,7 @@ function specialchars_replace($str, $len=0) {

<item>
<title><?php echo specialchars_replace($row['wr_subject']); ?></title>
<link><?php echo specialchars_replace(get_pretty_url($bo_table, $wr_id)); ?></link>
<link><?php echo specialchars_replace(get_pretty_url($bo_table, $row['wr_id'])); ?></link>
<description><![CDATA[<?php echo $file ?><?php echo conv_content($row['wr_content'], $html) ?>]]></description>
<dc:creator><?php echo specialchars_replace($row['wr_name']) ?></dc:creator>
<?php
Expand Down
15 changes: 10 additions & 5 deletions common.php
Expand Up @@ -260,10 +260,6 @@ function session_start_samesite($options = array())

define('G5_HTTP_BBS_URL', https_url(G5_BBS_DIR, false));
define('G5_HTTPS_BBS_URL', https_url(G5_BBS_DIR, true));
if ($config['cf_editor'])
define('G5_EDITOR_LIB', G5_EDITOR_PATH."/{$config['cf_editor']}/editor.lib.php");
else
define('G5_EDITOR_LIB', G5_LIB_PATH."/editor.lib.php");

define('G5_CAPTCHA_DIR', !empty($config['cf_captcha']) ? $config['cf_captcha'] : 'kcaptcha');
define('G5_CAPTCHA_URL', G5_PLUGIN_URL.'/'.G5_CAPTCHA_DIR);
Expand Down Expand Up @@ -461,12 +457,22 @@ function session_start_samesite($options = array())
}
}
}

// 게시판에서
if (isset($board['bo_select_editor']) && $board['bo_select_editor']){
$config['cf_editor'] = $board['bo_select_editor'];
}
}

if ($gr_id && !is_array($gr_id)) {
$group = get_group($gr_id);
}

if ($config['cf_editor']) {
define('G5_EDITOR_LIB', G5_EDITOR_PATH."/{$config['cf_editor']}/editor.lib.php");
} else {
define('G5_EDITOR_LIB', G5_LIB_PATH."/editor.lib.php");
}

// 회원, 비회원 구분
$is_member = $is_guest = false;
Expand Down Expand Up @@ -655,7 +661,6 @@ function session_start_samesite($options = array())
// 일정 기간이 지난 DB 데이터 삭제 및 최적화
include_once(G5_BBS_PATH.'/db_table.optimize.php');


// common.php 파일을 수정할 필요가 없도록 확장합니다.
$extend_file = array();
$tmp = dir(G5_EXTEND_PATH);
Expand Down
2 changes: 1 addition & 1 deletion config.php
Expand Up @@ -5,7 +5,7 @@
********************/

define('G5_VERSION', '그누보드5');
define('G5_GNUBOARD_VER', '5.4.2.7');
define('G5_GNUBOARD_VER', '5.4.2.8');

// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true);
Expand Down
1 change: 1 addition & 0 deletions install/gnuboard5.sql
Expand Up @@ -47,6 +47,7 @@ CREATE TABLE IF NOT EXISTS `g5_board` (
`bo_use_file_content` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_secret` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_dhtml_editor` tinyint(4) NOT NULL DEFAULT '0',
`bo_select_editor` varchar(50) NOT NULL DEFAULT '',
`bo_use_rss_view` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_good` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_nogood` tinyint(4) NOT NULL DEFAULT '0',
Expand Down
9 changes: 7 additions & 2 deletions lib/common.lib.php
Expand Up @@ -611,7 +611,7 @@ function html_purifier($html)
//유튜브, 비메오 전체화면 가능하게 하기
$config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo()));
$purifier = new HTMLPurifier($config);
return $purifier->purify($html);
return run_replace('html_purifier_result', $purifier->purify($html), $purifier, $html);
}


Expand Down Expand Up @@ -773,7 +773,8 @@ function get_member($mb_id, $fields='*', $is_cache=false)
{
global $g5;

$mb_id = preg_replace("/[^0-9a-z_]+/i", "", $mb_id);
if (preg_match("/[^0-9a-z_]+/i", $mb_id))
return array();

static $cache = array();

Expand Down Expand Up @@ -2317,6 +2318,8 @@ function delete_editor_thumbnail($contents)
{
if(!$contents)
return;

run_event('delete_editor_thumbnail_before', $contents);

// $contents 중 img 태그 추출
$matchs = get_editor_image($contents);
Expand All @@ -2337,6 +2340,8 @@ function delete_editor_thumbnail($contents)
unlink($filename);
}
}

run_event('delete_editor_thumbnail_after', $contents, $matchs);
}

// 1:1문의 첨부파일 썸네일 삭제
Expand Down
1 change: 1 addition & 0 deletions lib/icode.sms.lib.php
Expand Up @@ -237,6 +237,7 @@ function Send() {
fclose($fp);
}
$this->Data=array();
return true;
}
}
?>
2 changes: 1 addition & 1 deletion lib/register.lib.php
Expand Up @@ -86,7 +86,7 @@ function exist_mb_nick($reg_mb_nick, $reg_mb_id)
function reserve_mb_nick($reg_mb_nick)
{
global $config;
if (preg_match("/[\,]?{$reg_mb_nick}/i", $config['cf_prohibit_id']))
if (preg_match("/[\,]?".preg_quote($reg_mb_nick)."/i", $config['cf_prohibit_id']))
return "이미 예약된 단어로 사용할 수 없는 닉네임 입니다.";
else
return "";
Expand Down
37 changes: 30 additions & 7 deletions lib/thumbnail.lib.php
Expand Up @@ -110,6 +110,8 @@ function get_view_thumbnail($contents, $thumb_width=0)
for($i=0; $i<count($matches[1]); $i++) {

$img = $matches[1][$i];
$img_tag = isset($matches[0][$i]) ? $matches[0][$i] : '';

preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m);
$src = $m[1];
preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m);
Expand Down Expand Up @@ -161,16 +163,22 @@ function get_view_thumbnail($contents, $thumb_width=0)
}
}

// 원본 width가 thumb_width보다 작다면
if($size[0] <= $thumb_width)
continue;

// Animated GIF 체크
$is_animated = false;
if($size[2] == 1) {
$is_animated = is_animated_gif($srcfile);

if($replace_content = run_replace('thumbnail_is_animated_gif_content', '', $contents, $srcfile, $is_animated, $img_tag, $data_path, $size)){

$contents = $replace_content;
continue;
}
}

// 원본 width가 thumb_width보다 작다면
if($size[0] <= $thumb_width)
continue;

// 썸네일 높이
$thumb_height = round(($thumb_width * $size[1]) / $size[0]);
$filename = basename($srcfile);
Expand All @@ -192,7 +200,6 @@ function get_view_thumbnail($contents, $thumb_width=0)
}

// $img_tag에 editor 경로가 있으면 원본보기 링크 추가
$img_tag = $matches[0][$i];
if(strpos($img_tag, G5_DATA_DIR.'/'.G5_EDITOR_DIR) && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) {
$imgurl = str_replace(G5_URL, "", $src);
$thumb_tag = '<a href="'.G5_BBS_URL.'/view_image.php?fn='.urlencode($imgurl).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';
Expand Down Expand Up @@ -687,8 +694,19 @@ function UnsharpMask($img, $amount, $radius, $threshold) {
}

function is_animated_gif($filename) {
if(!($fh = @fopen($filename, 'rb')))

static $cache = array();
$key = md5($filename);

if( isset($cache[$key]) ){
return $cache[$key];
}

if(!($fh = @fopen($filename, 'rb'))){
$cache[$key] = false;
return false;
}

$count = 0;
// 출처 : http://www.php.net/manual/en/function.imagecreatefromgif.php#104473
// an animated gif contains multiple "frames", with each frame having a
Expand All @@ -705,6 +723,11 @@ function is_animated_gif($filename) {
}

fclose($fh);
return $count > 1;

$cache[$key] = ($count > 1) ? true : false;

run_event('is_animated_gif_after', $filename, $cache[$key]);

return $cache[$key];
}
?>
4 changes: 0 additions & 4 deletions plugin/editor/cheditor5/imageUpload/config.php
@@ -1,10 +1,6 @@
<?php
include_once("_common.php");

if( strpos($config['cf_editor'], 'cheditor5') === false ){
exit;
}

define("CHE_UPLOAD_IMG_CHECK", 1); // 이미지 파일을 썸네일 할수 있는지 여부를 체크합니다. ( 해당 파일이 이미지 파일인지 체크합니다. 1이면 사용, 0이면 사용 안함 )

// ---------------------------------------------------------------------------
Expand Down

0 comments on commit 5353f75

Please sign in to comment.