Merge branch 'master' of github.com:gnuboard/g5

This commit is contained in:
thisgun
2020-08-12 17:44:51 +09:00
11 changed files with 93 additions and 20 deletions

View File

@ -80,6 +80,12 @@ if (!isset($board['bo_use_captcha'])) {
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_captcha` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_sns` "); 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 = ""; $required = "";
$readonly = ""; $readonly = "";
$sound_only = ""; $sound_only = "";
@ -482,6 +488,27 @@ $pg_anchor = '<ul class="anchor">
<label for="chk_all_use_dhtml_editor">전체적용</label> <label for="chk_all_use_dhtml_editor">전체적용</label>
</td> </td>
</tr> </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> <tr>
<th scope="row"><label for="bo_use_rss_view">RSS 보이기 사용</label></th> <th scope="row"><label for="bo_use_rss_view">RSS 보이기 사용</label></th>
<td> <td>

View File

@ -114,6 +114,7 @@ $sql_common = " gr_id = '{$gr_id}',
bo_use_file_content = '{$_POST['bo_use_file_content']}', bo_use_file_content = '{$_POST['bo_use_file_content']}',
bo_use_secret = '{$_POST['bo_use_secret']}', bo_use_secret = '{$_POST['bo_use_secret']}',
bo_use_dhtml_editor = '{$_POST['bo_use_dhtml_editor']}', 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_rss_view = '{$_POST['bo_use_rss_view']}',
bo_use_good = '{$_POST['bo_use_good']}', bo_use_good = '{$_POST['bo_use_good']}',
bo_use_nogood = '{$_POST['bo_use_nogood']}', bo_use_nogood = '{$_POST['bo_use_nogood']}',
@ -301,6 +302,7 @@ if (is_checked('chk_grp_use_sideview')) $grp_fields .= " , bo_use_sidevi
if (is_checked('chk_grp_use_file_content')) $grp_fields .= " , bo_use_file_content = '{$bo_use_file_content}' "; 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_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_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_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_good')) $grp_fields .= " , bo_use_good = '{$bo_use_good}' ";
if (is_checked('chk_grp_use_nogood')) $grp_fields .= " , bo_use_nogood = '{$bo_use_nogood}' "; if (is_checked('chk_grp_use_nogood')) $grp_fields .= " , bo_use_nogood = '{$bo_use_nogood}' ";
@ -390,6 +392,7 @@ if (is_checked('chk_all_use_sideview')) $all_fields .= " , bo_use_sidevi
if (is_checked('chk_all_use_file_content')) $all_fields .= " , bo_use_file_content = '{$bo_use_file_content}' "; 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_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_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_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_good')) $all_fields .= " , bo_use_good = '{$bo_use_good}' ";
if (is_checked('chk_all_use_nogood')) $all_fields .= " , bo_use_nogood = '{$bo_use_nogood}' "; if (is_checked('chk_all_use_nogood')) $all_fields .= " , bo_use_nogood = '{$bo_use_nogood}' ";

View File

@ -13,12 +13,12 @@ $g5['title'] = "휴대폰번호 관리";
if ($page < 1) $page = 1; 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) : ''; $st = isset($st) ? preg_replace('/[^a-z0-9]/i', '', $st) : '';
$sql_korean = $sql_group = $sql_search = $sql_no_hp = ''; $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' "; $sql_group = " and bg_no='$bg_no' ";
else else
$sql_group = ""; $sql_group = "";

View File

@ -20,7 +20,7 @@ run_event('memo_form_update_before', $recv_list);
for ($i=0; $i<count($recv_list); $i++) { 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]}' "); $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 ($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['id'][] = $row['mb_id'];
$member_list['nick'][] = $row['mb_nick']; $member_list['nick'][] = $row['mb_nick'];
} else { } else {

View File

@ -27,6 +27,8 @@ $sql = " select distinct wr_num from $write_table where wr_id in ({$wr_id_list})
$result = sql_query($sql); $result = sql_query($sql);
while ($row = sql_fetch_array($result)) while ($row = sql_fetch_array($result))
{ {
$save[$cnt]['wr_contents'] = array();
$wr_num = $row['wr_num']; $wr_num = $row['wr_num'];
for ($i=0; $i<count($_POST['chk_bo_table']); $i++) for ($i=0; $i<count($_POST['chk_bo_table']); $i++)
{ {
@ -52,6 +54,8 @@ while ($row = sql_fetch_array($result))
$result2 = sql_query($sql2); $result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2)) while ($row2 = sql_fetch_array($result2))
{ {
$save[$cnt]['wr_contents'][] = $row2['wr_content'];
$nick = cut_str($member['mb_nick'], $config['cf_cut_name']); $nick = cut_str($member['mb_nick'], $config['cf_cut_name']);
if (!$row2['wr_is_comment'] && $config['cf_use_copy_log']) { if (!$row2['wr_is_comment'] && $config['cf_use_copy_log']) {
if(strstr($row2['wr_option'], 'html')) { if(strstr($row2['wr_option'], 'html')) {
@ -210,16 +214,20 @@ if ($sw == 'move')
{ {
if( isset($save[$i]['bf_file']) && $save[$i]['bf_file'] ){ if( isset($save[$i]['bf_file']) && $save[$i]['bf_file'] ){
for ($k=0; $k<count($save[$i]['bf_file']); $k++) { 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) ){ if ( is_file($del_file) && file_exists($del_file) ){
@unlink($del_file); @unlink($del_file);
} }
// 썸네일 파일 삭제, 먼지손 님 코드 제안 // 썸네일 파일 삭제, 먼지손 님 코드 제안
delete_board_thumbnail($bo_table, basename($save[$i]['bf_file'][$k])); 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 $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']}' "); sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_id = '{$save[$i]['wr_id']}' ");

View File

@ -70,7 +70,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
<item> <item>
<title><?php echo specialchars_replace($row['wr_subject']); ?></title> <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> <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> <dc:creator><?php echo specialchars_replace($row['wr_name']) ?></dc:creator>
<?php <?php

View File

@ -336,10 +336,6 @@ if( $config['cf_cert_use'] || (defined('G5_YOUNGCART_VER') && G5_YOUNGCART_VER)
define('G5_HTTP_BBS_URL', https_url(G5_BBS_DIR, false)); define('G5_HTTP_BBS_URL', https_url(G5_BBS_DIR, false));
define('G5_HTTPS_BBS_URL', https_url(G5_BBS_DIR, true)); 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_DIR', !empty($config['cf_captcha']) ? $config['cf_captcha'] : 'kcaptcha');
define('G5_CAPTCHA_URL', G5_PLUGIN_URL.'/'.G5_CAPTCHA_DIR); define('G5_CAPTCHA_URL', G5_PLUGIN_URL.'/'.G5_CAPTCHA_DIR);
@ -537,12 +533,22 @@ if ($bo_table) {
} }
} }
} }
// 게시판에서
if (isset($board['bo_select_editor']) && $board['bo_select_editor']){
$config['cf_editor'] = $board['bo_select_editor'];
}
} }
if ($gr_id && !is_array($gr_id)) { if ($gr_id && !is_array($gr_id)) {
$group = get_group($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; $is_member = $is_guest = false;
@ -736,7 +742,6 @@ include_once(G5_BBS_PATH.'/visit_insert.inc.php');
// 일정 기간이 지난 DB 데이터 삭제 및 최적화 // 일정 기간이 지난 DB 데이터 삭제 및 최적화
include_once(G5_BBS_PATH.'/db_table.optimize.php'); include_once(G5_BBS_PATH.'/db_table.optimize.php');
// common.php 파일을 수정할 필요가 없도록 확장합니다. // common.php 파일을 수정할 필요가 없도록 확장합니다.
$extend_file = array(); $extend_file = array();
$tmp = dir(G5_EXTEND_PATH); $tmp = dir(G5_EXTEND_PATH);

View File

@ -47,6 +47,7 @@ CREATE TABLE IF NOT EXISTS `g5_board` (
`bo_use_file_content` tinyint(4) NOT NULL DEFAULT '0', `bo_use_file_content` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_secret` 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_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_rss_view` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_good` tinyint(4) NOT NULL DEFAULT '0', `bo_use_good` tinyint(4) NOT NULL DEFAULT '0',
`bo_use_nogood` tinyint(4) NOT NULL DEFAULT '0', `bo_use_nogood` tinyint(4) NOT NULL DEFAULT '0',

View File

@ -611,7 +611,7 @@ function html_purifier($html)
//유튜브, 비메오 전체화면 가능하게 하기 //유튜브, 비메오 전체화면 가능하게 하기
$config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo())); $config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo()));
$purifier = new HTMLPurifier($config); $purifier = new HTMLPurifier($config);
return $purifier->purify($html); return run_replace('html_purifier_result', $purifier->purify($html), $purifier, $html);
} }
@ -773,7 +773,8 @@ function get_member($mb_id, $fields='*', $is_cache=false)
{ {
global $g5; 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(); static $cache = array();
@ -2317,6 +2318,8 @@ function delete_editor_thumbnail($contents)
{ {
if(!$contents) if(!$contents)
return; return;
run_event('delete_editor_thumbnail_before', $contents);
// $contents 중 img 태그 추출 // $contents 중 img 태그 추출
$matchs = get_editor_image($contents); $matchs = get_editor_image($contents);
@ -2337,6 +2340,8 @@ function delete_editor_thumbnail($contents)
unlink($filename); unlink($filename);
} }
} }
run_event('delete_editor_thumbnail_after', $contents, $matchs);
} }
// 1:1문의 첨부파일 썸네일 삭제 // 1:1문의 첨부파일 썸네일 삭제

View File

@ -237,6 +237,7 @@ class SMS {
fclose($fp); fclose($fp);
} }
$this->Data=array(); $this->Data=array();
return true;
} }
} }
?> ?>

View File

@ -110,6 +110,8 @@ function get_view_thumbnail($contents, $thumb_width=0)
for($i=0; $i<count($matches[1]); $i++) { for($i=0; $i<count($matches[1]); $i++) {
$img = $matches[1][$i]; $img = $matches[1][$i];
$img_tag = isset($matches[0][$i]) ? $matches[0][$i] : '';
preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m); preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m);
$src = $m[1]; $src = $m[1];
preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m); preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m);
@ -161,16 +163,22 @@ function get_view_thumbnail($contents, $thumb_width=0)
} }
} }
// 원본 width가 thumb_width보다 작다면
if($size[0] <= $thumb_width)
continue;
// Animated GIF 체크 // Animated GIF 체크
$is_animated = false; $is_animated = false;
if($size[2] == 1) { if($size[2] == 1) {
$is_animated = is_animated_gif($srcfile); $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]); $thumb_height = round(($thumb_width * $size[1]) / $size[0]);
$filename = basename($srcfile); $filename = basename($srcfile);
@ -192,7 +200,6 @@ function get_view_thumbnail($contents, $thumb_width=0)
} }
// $img_tag에 editor 경로가 있으면 원본보기 링크 추가 // $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)) { if(strpos($img_tag, G5_DATA_DIR.'/'.G5_EDITOR_DIR) && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) {
$imgurl = str_replace(G5_URL, "", $src); $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>'; $thumb_tag = '<a href="'.G5_BBS_URL.'/view_image.php?fn='.urlencode($imgurl).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';
@ -687,8 +694,19 @@ and the roundoff errors in the Gaussian blur process, are welcome.
} }
function is_animated_gif($filename) { 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; return false;
}
$count = 0; $count = 0;
// 출처 : http://www.php.net/manual/en/function.imagecreatefromgif.php#104473 // 출처 : http://www.php.net/manual/en/function.imagecreatefromgif.php#104473
// an animated gif contains multiple "frames", with each frame having a // an animated gif contains multiple "frames", with each frame having a
@ -705,6 +723,11 @@ function is_animated_gif($filename) {
} }
fclose($fh); fclose($fh);
return $count > 1;
$cache[$key] = ($count > 1) ? true : false;
run_event('is_animated_gif_after', $filename, $cache[$key]);
return $cache[$key];
} }
?> ?>