그누보드5에서 관리자 iframe 허용하는 방법을 좀 알려주세요

2019-10-30 (수) 23:28:52 5,516

그누보드5에서 관리자는 글을 쓸대 iframe 허용하는 방법을 좀 알려주세요^^

미리 감사합니다. (* *)(_ _)

|

답변 1개 / 댓글 1개

/lib/common.lib.php 파일에 

html_purifier($html) 함수에서 차단하는데요.

여기에 if(!is_admin()) {} 조건을 추가해주면 됩니다.

Copy
function html_purifier($html)

{

if(!is_admin()) {

    $f = file(G5_PLUGIN_PATH.'/htmlpurifier/safeiframe.txt');

    $domains = array();

    foreach($f as $domain){

        // 첫행이 # 이면 주석 처리

        if (!preg_match("/^#/", $domain)) {

            $domain = trim($domain);

            if ($domain)

                array_push($domains, $domain);

        }

    }

    // 내 도메인도 추가

    array_push($domains, $_SERVER['HTTP_HOST'].'/');

    $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');

    $config->set('HTML.SafeEmbed', false);

    $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);

} else {

  return $html;

}

}

답변에 대한 댓글 1개

그대로 썼는데 안되는군요..

답변을 작성하려면 로그인이 필요합니다.