diff --git a/addons/image_name/image_name.addon.php b/addons/image_name/image_name.addon.php index 81f4c2b09..f6a079574 100644 --- a/addons/image_name/image_name.addon.php +++ b/addons/image_name/image_name.addon.php @@ -9,5 +9,10 @@ * 이 addOn은 화면을 출력하는 바로 앞 단계에서 요청이 올때 작동하도록 한다. **/ - debugPrint(Context::get('content')); + // 출력 되기 바로 직전이 아니라면 모두 무시 + if($called_position != "beofre_dispay_content") return; + + // 출력문서중에서
content
를 찾아서 변경 + $oMemberController = &getController('member'); + $output = preg_replace_callback('!]*)member_([0-9]*)([^\>]*)>(.*?)\<\/div\>!is', array($oMemberController, 'transImageName'), $output); ?> diff --git a/addons/naver_search/naver_search.addon.php b/addons/naver_search/naver_search.addon.php index 417059fe7..904c068d7 100644 --- a/addons/naver_search/naver_search.addon.php +++ b/addons/naver_search/naver_search.addon.php @@ -10,8 +10,8 @@ * 즉 별도의 interface가 필요한 것이 아니고 모듈의 일부라고 판단하여 코드를 작성하면 된다. **/ - // addon_position이 before일때만 실행 - if($addon_position != 'after_module_proc') return; + // called_position이 before일때만 실행 + if($called_position != 'after_module_proc') return; // 이 애드온이 동작할 대상 (이 부분은 특별히 정해진 규약이 없다) $effecived_target = array( diff --git a/addons/spamfilter/spamfilter.addon.php b/addons/spamfilter/spamfilter.addon.php index caeceed99..b5b161ab0 100644 --- a/addons/spamfilter/spamfilter.addon.php +++ b/addons/spamfilter/spamfilter.addon.php @@ -10,8 +10,8 @@ * 즉 별도의 interface가 필요한 것이 아니고 모듈의 일부라고 판단하여 코드를 작성하면 된다. **/ - // point가 before일때만 실행 - if($this->point != 'before_module_proc') return; + // called_position가 before일때만 실행 + if($this->called_position != 'before_module_proc') return; // 이 애드온이 동작할 대상 (이 부분은 특별히 정해진 규약이 없다) $effecived_target = array( diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 2e918e1a6..7fc69da07 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -47,6 +47,10 @@ $output = $content; } + // 애드온 실행 + $called_position = 'beofre_dispay_content'; + @include("./files/cache/activated_addons.cache.php"); + $this->content_size = strlen($output); print trim($output); diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 0237a2471..7adddb1bc 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -51,10 +51,8 @@ if(!$document_srl) $this->document_srl = Context::get('document_srl'); else $this->document_srl = $document_srl; - /** - * @brief 애드온 실행 - **/ - $addon_position = 'beofre_module_init'; + // 애드온 실행 + $called_position = 'beofre_module_init'; @include("./files/cache/activated_addons.cache.php"); } @@ -209,12 +207,6 @@ } } - /** - * @brief 애드온 실행 - **/ - $addon_position = 'beofre_dispay_content'; - @include("./files/cache/activated_addons.cache.php"); - // 컨텐츠 출력 $oDisplayHandler = new DisplayHandler(); $oDisplayHandler->printContent($oModule); diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index e40fadea3..bf67c53bd 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -25,8 +25,6 @@ var $stop_proc = false; ///< action 수행중 stop()를 호출하면 ModuleObject::proc()를 수행하지 않음 - var $point = 'before'; ///< 애드온 호출시 모듈의 실행을 before/after로 나누고 이 시점을 기록하는 변수 - /** * @brief 현재 모듈의 이름을 지정 **/ @@ -225,15 +223,15 @@ // 기본 act조차 없으면 return if(!method_exists($this, $this->act)) return false; - // addon 실행(addon_position 를 before_module_proc로 하여 호출) - $addon_position = 'before_module_proc'; + // addon 실행(called_position 를 before_module_proc로 하여 호출) + $called_position = 'before_module_proc'; @include("./files/cache/activated_addons.cache.php"); // this->act값으로 method 실행 if(!$this->stop_proc) $output = call_user_method($this->act, $this); - // addon 실행(addon_position 를 after_module_proc로 하여 호출) - $addon_position = 'after_module_proc'; + // addon 실행(called_position 를 after_module_proc로 하여 호출) + $called_position = 'after_module_proc'; @include("./files/cache/activated_addons.cache.php"); if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) { diff --git a/config/func.inc.php b/config/func.inc.php index b9ac6d861..00356b922 100644 --- a/config/func.inc.php +++ b/config/func.inc.php @@ -177,4 +177,14 @@ debugPrint($output); } + /** + * @brief 주어진 숫자를 주어진 크기로 recursive하게 잘라줌 + * 디렉토리 생성을 위해서 쓰임... + **/ + function getNumberingPath($no, $size=3) { + $mod = pow(10,$size); + $output = sprintf('%0'.$size.'d/', $no%$mod); + if($no >= $mod) $output .= getNumberingPath((int)$no/$mod, $size); + return $output; + } ?> diff --git a/modules/addon/addon.controller.php b/modules/addon/addon.controller.php index 13cf1569b..9de1dec5c 100644 --- a/modules/addon/addon.controller.php +++ b/modules/addon/addon.controller.php @@ -37,7 +37,7 @@ $addon = trim($addon_list[$i]); if(!$addon) continue; - $buff .= sprintf(' if(file_exists("./addons/%s%s.addon.php")) include("./addons/%s/%s.addon.php"); ', $addon, $addon, $addon, $addon); + $buff .= sprintf(' if(file_exists("./addons/%s/%s.addon.php")) include("./addons/%s/%s.addon.php"); ', $addon, $addon, $addon, $addon); } $buff = sprintf('', $buff); diff --git a/modules/board/skins/default/list.html b/modules/board/skins/default/list.html index c92e2fbe3..7fe3b21be 100644 --- a/modules/board/skins/default/list.html +++ b/modules/board/skins/default/list.html @@ -88,7 +88,7 @@ [{$val->trackback_count}] -
{$val->user_name}
+
{$val->user_name}
{$val->readed_count} {$val->voted_count} {zdate($val->regdate,"Y-m-d")} diff --git a/modules/board/skins/default/view_document.html b/modules/board/skins/default/view_document.html index aa13f9340..ac6dcd697 100644 --- a/modules/board/skins/default/view_document.html +++ b/modules/board/skins/default/view_document.html @@ -27,7 +27,7 @@ {$lang->user_name} -
{$document->user_name}
+
{$document->user_name}
{$lang->readed_count} diff --git a/modules/member/member.class.php b/modules/member/member.class.php index 03c682ab1..506fb33d3 100644 --- a/modules/member/member.class.php +++ b/modules/member/member.class.php @@ -11,6 +11,10 @@ * @brief 설치시 추가 작업이 필요할시 구현 **/ function moduleInstall() { + // member 에서 사용할 cache디렉토리 생성 + FileHandler::makeDir('./files/attach/image_name'); + FileHandler::makeDir('./files/attach/image_mark'); + // 멤버 컨트롤러 객체 생성 $oMemberController = &getController('member'); diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 2051e3902..0e0fff208 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -648,5 +648,33 @@ return new Object(); } + /** + * @brief 최종 출력물에서 이미지 이름을 변경 + * imgae_name 애드온에서 요청이 됨 + **/ + function transImageName($matches) { + $member_srl = $matches[2]; + $text = $matches[4]; + if(!$member_srl) return $matches[0]; + + // 전역변수에 미리 설정한 데이터가 있다면 그걸 return + if(!$GLOBALS['_transImageNameList'][$member_srl]) { + // 이미지 이름 체크 + $image_name_file = sprintf('./files/attach/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); + if(file_exists($image_name_file)) { + } + + // 이미지 마크 체크 (가로 길이 20px 이내의 마크만 고려하고 직접 style로 표시를 해 준다, css를 쓸수가 없으므로) + $image_mark_file = sprintf('./files/attach/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); + if(file_exists($image_mark_file)) { + $text = sprintf('%s', $image_mark_file, $text); + } + + $GLOBALS['_transImageNameList'][$member_srl] = $text; + } + + return $GLOBALS['_transImageNameList'][$member_srl]; + } + } ?>