diff --git a/config.php b/config.php
index 9253fe2c8..f4e7bece2 100644
--- a/config.php
+++ b/config.php
@@ -5,8 +5,12 @@
********************/
define('G5_VERSION', '그누보드5');
+<<<<<<< HEAD
define('G5_GNUBOARD_VER', '5.2.9.6');
define('G5_YOUNGCART_VER', '5.2.9.6');
+=======
+define('G5_GNUBOARD_VER', '5.2.9.7');
+>>>>>>> 82279c376ba339fe814ec478da83ac8c24e7240f
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true);
diff --git a/lib/common.lib.php b/lib/common.lib.php
index 92bb2f779..c205eaf8d 100644
--- a/lib/common.lib.php
+++ b/lib/common.lib.php
@@ -216,11 +216,12 @@ function url_auto_link($str)
// 140326 유창화님 제안코드로 수정
// http://sir.kr/pg_lecture/461
// http://sir.kr/pg_lecture/463
+ $attr_nofollow = (function_exists('check_html_link_nofollow') && check_html_link_nofollow('url_auto_link')) ? ' rel="nofollow"' : '';
$str = str_replace(array("<", ">", "&", """, " ", "'"), array("\t_lt_\t", "\t_gt_\t", "&", "\"", "\t_nbsp_\t", "'"), $str);
//$str = preg_replace("`(?:(?:(?:href|src)\s*=\s*(?:\"|'|)){0})((http|https|ftp|telnet|news|mms)://[^\"'\s()]+)`", "\\1", $str);
- $str = preg_replace("/([^(href=\"?'?)|(src=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[가-힣\xA1-\xFEa-zA-Z0-9\.:!=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1\\2", $str);
- $str = preg_replace("/(^|[\"'\s(])(www\.[^\"'\s()]+)/i", "\\1\\2", $str);
- $str = preg_replace("/[0-9a-z_-]+@[a-z0-9._-]{4,}/i", "\\0", $str);
+ $str = preg_replace("/([^(href=\"?'?)|(src=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[가-힣\xA1-\xFEa-zA-Z0-9\.:!=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1\\2", $str);
+ $str = preg_replace("/(^|[\"'\s(])(www\.[^\"'\s()]+)/i", "\\1\\2", $str);
+ $str = preg_replace("/[0-9a-z_-]+@[a-z0-9._-]{4,}/i", "\\0", $str);
$str = str_replace(array("\t_nbsp_\t", "\t_lt_\t", "\t_gt_\t", "'"), array(" ", "<", ">", "'"), $str);
/*
@@ -538,6 +539,9 @@ function conv_content($content, $html, $filter=true)
return $content;
}
+function check_html_link_nofollow($type=''){
+ return true;
+}
// http://htmlpurifier.org/
// Standards-Compliant HTML Filtering
@@ -561,6 +565,7 @@ function html_purifier($html)
$safeiframe = implode('|', $domains);
include_once(G5_PLUGIN_PATH.'/htmlpurifier/HTMLPurifier.standalone.php');
+ include_once(G5_PLUGIN_PATH.'/htmlpurifier/extend.video.php');
$config = HTMLPurifier_Config::createDefault();
// data/cache 디렉토리에 CSS, HTML, URI 디렉토리 등을 만든다.
$config->set('Cache.SerializerPath', G5_DATA_PATH.'/cache');
@@ -568,8 +573,13 @@ function html_purifier($html)
$config->set('HTML.SafeObject', false);
$config->set('Output.FlashCompat', false);
$config->set('HTML.SafeIframe', true);
+ if( (function_exists('check_html_link_nofollow') && check_html_link_nofollow('html_purifier')) ){
+ $config->set('HTML.Nofollow', true); // rel=nofollow 으로 스팸유입을 줄임
+ }
$config->set('URI.SafeIframeRegexp','%^(https?:)?//('.$safeiframe.')%');
$config->set('Attr.AllowedFrameTargets', array('_blank'));
+ //유튜브, 비메오 전체화면 가능하게 하기
+ $config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo()));
$purifier = new HTMLPurifier($config);
return $purifier->purify($html);
}
@@ -1213,8 +1223,8 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
$tmp_name = "";
if ($mb_id) {
- //$tmp_name = "$name";
- $tmp_name = '';
+ //$tmp_name = "$name";
+ $tmp_name = '';
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
@@ -1241,7 +1251,7 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
if(!$bo_table)
return $name;
- $tmp_name = ''.$name.'';
+ $tmp_name = ''.$name.'';
$title_mb_id = '[비회원]';
}
diff --git a/plugin/htmlpurifier/extend.video.php b/plugin/htmlpurifier/extend.video.php
new file mode 100644
index 000000000..df9f2367e
--- /dev/null
+++ b/plugin/htmlpurifier/extend.video.php
@@ -0,0 +1,66 @@
+#i', '', $html);
+ return $html;
+ }
+
+ /**
+ *
+ * @param string $html
+ * @param HTMLPurifier_Config $config
+ * @param HTMLPurifier_Context $context
+ * @return string
+ */
+ public function postFilter($html, $config, $context)
+ {
+ $post_regex = '#
]+?)>#';
+ return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
+ }
+
+ /**
+ *
+ * @param array $matches
+ * @return string
+ */
+ protected function postFilterCallback($matches)
+ {
+ // Domain Whitelist
+ $youTubeMatch = preg_match('#src="https?://www.youtube(-nocookie)?.com/#i', $matches[1]);
+ $vimeoMatch = preg_match('#src="http://player.vimeo.com/#i', $matches[1]);
+ if ($youTubeMatch || $vimeoMatch) {
+ $extra = ' frameborder="0"';
+ if ($youTubeMatch) {
+ $extra .= ' allowfullscreen';
+ } elseif ($vimeoMatch) {
+ $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
+ }
+ return '';
+ } else {
+ return '';
+ }
+ }
+ }
+}
+?>
\ No newline at end of file