사이트에서 외부링크를 못사용하게 하고 십습니다.
회원이 글쓸대 링크를 넣을을대 클릭 html혹은 직접 사이트주소를 입력햇슬대 클릭하면 입력혹은 링크를 건 사이트주소로 이동하는데 이동 못하게 하고 십습니다.
링크를 넣거나 사이트 주소를 넣어도 링크는 걸리지 않게 하고 십습니다.
답변 1개 / 댓글 1개
채택된 답변
+20 포인트
PIREE
10년 전
/lib/common.lib.php 파일안에
대략 209줄쯤에
function url_auto_link($str)
이 함수
이걸 아래처럼 바꿔보세요.
Copy
function url_auto_link($str){ /* global $g5; global $config;
// 140326 유창화님 제안코드로 수정 // http://sir.co.kr/bbs/board.php?bo_table=pg_lecture&wr_id=461 // http://sir.co.kr/bbs/board.php?bo_table=pg_lecture&wr_id=463 $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()]+)`", "<A HREF=\"\\1\" TARGET='{$config['cf_link_target']}'>\\1</A>", $str); $str = preg_replace("/([^(href=\"?'?)|(src=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[가-힣\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1<A HREF=\"\\2\" TARGET=\"{$config['cf_link_target']}\">\\2</A>", $str); $str = preg_replace("/(^|[\"'\s(])(www\.[^\"'\s()]+)/i", "\\1<A HREF=\"http://\\2\" TARGET=\"{$config['cf_link_target']}\">\\2</A>", $str); $str = preg_replace("/[0-9a-z_-]+@[a-z0-9._-]{4,}/i", "<a href=\"mailto:\\0\">\\0</a>", $str); $str = str_replace(array("\t_nbsp_\t", "\t_lt_\t", "\t_gt_\t", "'"), array(" ", "<", ">", "'"), $str); */
/* // 속도 향상 031011 $str = preg_replace("/</", "\t_lt_\t", $str); $str = preg_replace("/>/", "\t_gt_\t", $str); $str = preg_replace("/&/", "&", $str); $str = preg_replace("/"/", "\"", $str); $str = preg_replace("/ /", "\t_nbsp_\t", $str); $str = preg_replace("/([^(http:\/\/)]|\(|^)(www\.[^[:space:]]+)/i", "\\1<A HREF=\"http://\\2\" TARGET='{$config['cf_link_target']}'>\\2</A>", $str); //$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,]+)/i", "\\1<A HREF=\"\\2\" TARGET='$config['cf_link_target']'>\\2</A>", $str); // 100825 : () 추가 // 120315 : CHARSET 에 따라 링크시 글자 잘림 현상이 있어 수정 $str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[가-힣\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1<A HREF=\"\\2\" TARGET='{$config['cf_link_target']}'>\\2</A>", $str);
// 이메일 정규표현식 수정 061004 //$str = preg_replace("/(([a-z0-9_]|\-|\.)+@([^[:space:]]*)([[:alnum:]-]))/i", "<a href='mailto:\\1'>\\1</a>", $str); $str = preg_replace("/([0-9a-z]([-_\.]?[0-9a-z])*@[0-9a-z]([-_\.]?[0-9a-z])*\.[a-z]{2,4})/i", "<a href='mailto:\\1'>\\1</a>", $str); $str = preg_replace("/\t_nbsp_\t/", " " , $str); $str = preg_replace("/\t_lt_\t/", "<", $str); $str = preg_replace("/\t_gt_\t/", ">", $str); */
return $str;}
이렇게 return $str; 이거 빼고 몽땅 주석처리 하고 다시 페이지를 목놓아 불러보세요~~^^
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.