겸손한 개발을 위한 자양분

첨부된 레지스트리를 설치하면,
마우스 오른버튼 기능에 다음과 같이
"Delete .SVN Folders" 라는 메뉴가 추가된다.

사용자 삽입 이미지


선택하면, 하위 모든 디렉토리의 .svn 폴더가 삭제되어
Checkout 하지 않은 디렉토리로 사용할 수 있다.


SVN 기능 정리

MYDN2008. 5. 21. 17:27
기본기능
SVN Commit : Checkout 된 파일들에 대하여 수정사항을 Repository로 등록하는 명령

용어가 헷갈리는 기능
SVN Update : missing 된 파일에 대해서 다시 Checkout 해주는 명령
Revert : 현재 있는 파일들에 대하여 수정사항을 무시하고 Repository 의 원본으로 바꿔 주는 명령

어려운 이븐텀 셋팅

MYDN2008. 5. 21. 16:50
이븐텀에서 밖으로 메일이 나가질 않는다.

여기저기 찾아보니
\nclude\pear\mail\mime.php 를 수정해줘야한단다
        $this->_build_params = array(
                                     'head_encoding' => 'quoted-printable',
                                     'text_encoding' => '7bit',
                                     'html_encoding' => 'quoted-printable',
                                     '7bit_wrap'     => 998,
                                     'html_charset'  => 'ISO-8859-1',
                                     'text_charset'  => 'ISO-8859-1',
                                     'head_charset'  => 'ISO-8859-1'
                                    );

부분을 아래로 바꿨다
$this->_build_params = array(
                                     'head_encoding' => 'base64',
                                     'text_encoding' => 'base64',
                                     'html_encoding' => 'base64',
                                     '7bit_wrap'     => 998,
                                     'html_charset'  => 'UTF-8',
                                     'text_charset'  => 'UTF-8',
                                     'head_charset'  => 'UTF-8'
                                    );

안된다...


소스들을 뒤져보기로했다.

찾아보니,
이슈의 draft항목에 등록했다가 send하는 사항들은
include\class.support.php 소스의
function sendEmail($parent_sup_id = FALSE) 을 거치게 된다.
함수가 거쳐가는 부분들을 따라가봤다.

\nclude\class.support.php
...
         if (!empty($_POST['issue_id'])) {

// 이부분이 메일을 보낼때 진행되는 부분
                // send direct emails only to the unknown addresses, and leave the rest to be
                // catched by the notification list
                $from = Notification::getFixedFromHeader($_POST['issue_id'], $_POST['from'], 'issue');
                // build the list of unknown recipients
                if (!empty($_POST['to'])) {
                    $recipients = array($_POST['to']);
                    $recipients = array_merge($recipients, Support::getRecipientsCC($_POST['cc']));
                } else {
                    $recipients = Support::getRecipientsCC($_POST['cc']);
                }
                $unknowns = array();
                for ($i = 0; $i < count($recipients); $i++) {
                    if (!Notification::isSubscribedToEmails($_POST['issue_id'], $recipients[$i])) {
                        $unknowns[] = $recipients[$i];
                    }
                }

                if (count($unknowns) > 0) {
                    $to = array_shift($unknowns);
                    $cc = implode('; ', $unknowns);
                    // send direct emails
// 이부분은 등록되지 않은 이메일로 보내는 경우 들어오는 듯
                            Support::sendDirectEmail($_POST['issue_id'], $from, $to, $cc,
                            $_POST['subject'], $_POST['message'], $message_id, $sender_usr_id);
                }
            } else {

    function sendDirectEmail($issue_id, $from, $to, $cc, $subject, $body, $message_id, $sender_usr_id = false)
    {
        $subject = Mail_API::formatSubject($issue_id, $subject);
        $recipients = Support::getRecipientsCC($cc);
        $recipients[] = $to;
        // send the emails now, one at a time
        foreach ($recipients as $recipient) {
            $mail = new Mail_API;
            if (!empty($issue_id)) {
                // add the warning message to the current message' body, if needed
                $fixed_body = Mail_API::addWarningMessage($issue_id, $recipient, $body, array());
                $mail->setHeaders(array(
                    "Message-Id" => $message_id
                ));
                // skip users who don't have access to this issue
                $recipient_usr_id = User::getUserIDByEmail(Mail_API::getEmailAddress($recipient));
                if (((!empty($recipient_usr_id)) && (!Issue::canAccess($issue_id, $recipient_usr_id))) ||
                        (empty($recipient_usr_id)) && (Issue::isPrivate($issue_id))) {
                    continue;
                }
            } else {
                $fixed_body = $body;
            }
            if (User::getRoleByUser(User::getUserIDByEmail(Mail_API::getEmailAddress($from)), Issue::getProjectID($issue_id)) == User::getRoleID("Customer")) {
                $type = 'customer_email';
            } else {
                $type = 'other_email';
            }
            $mail->setTextBody($fixed_body);
            $mail->send($from, $recipient, $subject, TRUE, $issue_id, $type, $sender_usr_id);
        }
    }

\include\class.mail.php
   function send($from, $to, $subject, $save_email_copy = 0, $issue_id = false, $type = '', $sender_usr_id = false, $type_id = false)
    {
        static $support_levels;
        // encode the addresses
        $from = MIME_Helper::encodeAddress($from);
        $to = MIME_Helper::encodeAddress($to);
        $subject = MIME_Helper::encode($subject);
        $body = $this->mime->get(array('text_charset' => APP_CHARSET, 'head_charset' => APP_CHARSET, 'text_encoding' => APP_EMAIL_ENCODING));
        $headers = array(
            'From'    => $from,
            'To'      => Mail_API::fixAddressQuoting($to),
            'Subject' => $subject
        );
        $this->setHeaders($headers);
        $hdrs = $this->mime->headers($this->headers);
        $res = Mail_Queue::add($to, $hdrs, $body, $save_email_copy, $issue_id, $type, $sender_usr_id, $type_id);
        if ((PEAR::isError($res)) || ($res == false)) {
            return $res;
        } else {
            // RFC 822 formatted date
            $header = 'Date: ' . date('D, j M Y H:i:s O') . "\r\n";
            // return the full dump of the email
            foreach ($hdrs as $name => $value) {
                $header .= "$name: $value\r\n";
            }
            $header .= "\r\n";
            return $header . $body;
        }
    }

\include\class.mail_queue.php
    function add($recipient, $headers, $body, $save_email_copy = 0, $issue_id = false, $type = '', $sender_usr_id = false, $type_id = false)
    {
        // avoid sending emails out to users with inactive status
        $recipient_email = Mail_API::getEmailAddress($recipient);
        $usr_id = User::getUserIDByEmail($recipient_email);
        if (!empty($usr_id)) {
            $user_status = User::getStatusByEmail($recipient_email);
            // if user is not set to an active status, then silently ignore
            if ((!User::isActiveStatus($user_status)) && (!User::isPendingStatus($user_status))) {
                return false;
            }
        }
        $to_usr_id = User::getUserIDByEmail($recipient_email);
        $recipient = Mail_API::fixAddressQuoting($recipient);
        $reminder_addresses = Reminder::_getReminderAlertAddresses();
        // add specialized headers
        if ((!empty($issue_id)) && ((!empty($to_usr_id)) && (User::getRoleByUser($to_usr_id, Issue::getProjectID($issue_id)) > User::getRoleID("Customer"))) ||
                (@in_array(Mail_API::getEmailAddress($to), $reminder_addresses))) {
            $headers += Mail_API::getSpecializedHeaders($issue_id, $type, $headers, $sender_usr_id);
        }
        if (empty($issue_id)) {
            $issue_id = 'null';
        }
        // if the Date: header is missing, add it.
        if (!in_array('Date', array_keys($headers))) {
            $headers['Date'] = MIME_Helper::encode(date('D, j M Y H:i:s O'));
        }
        if (!empty($headers['To'])) {
            $headers['To'] = Mail_API::fixAddressQuoting($headers['To']);
        }
        $res = Mail_API::prepareHeaders($headers);
        if (PEAR::isError($res)) {
            Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
            return $res;
        }
        list(,$text_headers) = $res;
        $stmt = "INSERT INTO
                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "mail_queue
                 (
                    maq_save_copy,
                    maq_queued_date,
                    maq_sender_ip_address,
                    maq_recipient,
                    maq_headers,
                    maq_body,
                    maq_iss_id,
                    maq_subject,
                    maq_type";
        if ($sender_usr_id != false) {
            $stmt .= ",\nmaq_usr_id";
        }
        if ($type_id != false) {
            $stmt .= ",\nmaq_type_id";
        }
        $stmt .= ") VALUES (
                    $save_email_copy,
                    '" . Date_API::getCurrentDateGMT() . "',
                    '" . @$_SERVER['REMOTE_ADDR'] . "',
                    '" . Misc::escapeString($recipient) . "',
                    '" . Misc::escapeString($text_headers) . "',
                    '" . Misc::escapeString($body) . "',
                    " . Misc::escapeInteger($issue_id) . ",
                    '" . Misc::escapeString($headers["Subject"]) . "',
                    '$type'";
        if ($sender_usr_id != false) {
            $stmt .= ",\n" . $sender_usr_id;
        }
        if ($type_id != false) {
            $stmt .= ",\n" . $type_id;
        }
        $stmt .= ")";
        $res = $GLOBALS["db_api"]->dbh->query($stmt);
        if (PEAR::isError($res)) {
            Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
            return $res;
        } else {
            return true;
        }
    }

mail_queue라는 DB에 메일의 내용을 적는것을 볼수 있다.
아.. 메일 보내는 코드가 없다.

DB를 살펴봤다

사용자 삽입 이미지


mail_queue라는 테이블에
쌓여있는 테스트 데이터들...

내용을 살펴보니
status가 모두 pending이다

아... 설정해준적도 없는
독단적인 프로시저라도 돌고 있는건가... 큐 관리하는...
대체...

내 실력으로 쉽게 확인할 수 없는 작업에 말려들었다.

제로보드XE 1.0.2를 설치하여 사용중인데,

태그리스트를 생성하여 클릭 했을때
한글 태그명인경우 검색이 안된다.
태그 선택시 URL을 보니,
인코딩이 문제된것으로 판단

태그의 인코딩과 관련된 소스를 찾는다.

\widgets\tag_list\skins\blog_tag_list\tags.html
            <span <!--@if($tag_class)-->class="{$tag_class}"<!--@end--> >
                <!--@if($layout_info->mid)-->
                    <a href="{getUrl('','mid',$widget_info->module_name?$widget_info->module_name:$layout_info->mid,'search_target','tag','search_keyword',urlencode($val->tag))}">{htmlspecialchars($val->tag)}</a>
                <!--@else-->
                    <a href="{getUrl('','mid',$widget_info->module_name?$widget_info->module_name:$layout_info->mid,'search_target','tag','search_keyword',urlencode($val->tag))}">{htmlspecialchars($val->tag)}</a>
                <!--@end-->
            </span>

의심되는 코드를 발견

            <span <!--@if($tag_class)-->class="{$tag_class}"<!--@end--> >
                <!--@if($layout_info->mid)-->
                    <a href="{getUrl('','mid',$widget_info->module_name?$widget_info->module_name:$layout_info->mid,'search_target','tag','search_keyword',$val->tag)}">{htmlspecialchars($val->tag)}</a>
                <!--@else-->
                    <a href="{getUrl('','mid',$widget_info->module_name?$widget_info->module_name:$layout_info->mid,'search_target','tag','search_keyword',$val->tag)}">{htmlspecialchars($val->tag)}</a>
                <!--@end-->
            </span>

수정후 태그 테스트 결과 이상 없이 동작하는것을 확인

끝~!