Show
Ignore:
Timestamp:
05/25/08 00:34:19 (8 months ago)
Author:
coolengineer
Message:
  • #960
  • 두 개 이상의 첨부파일에 대해 모두 올라오도록 추가
  • 디버그 코드 지움
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/CL_Moblog/index.php

    r6025 r6026  
    123123 
    124124    function _getDecoratedContent( & $mail, $docid ) { 
    125             $alt = htmlentities($mail['attachments'][0]['filename'],ENT_QUOTES,'utf-8'); 
    126             $content = '$TEXT<p>[##_1C|$FILENAME|width="$WIDTH" height="$HEIGHT" alt="'.$alt.'"|_##]</p>'; 
    127125            $text = "<h3 id=\"$docid\">$docid</h3>\r\n"; 
    128126            $text .= empty($mail['subject']) ? '' : ("<p>".$mail['subject']."</p>\r\n"); 
    129127            $text .= isset($mail['text']) ? (!stristr($mail['text'],'table')? "<p>{$mail['text']}</p>" : '') : ''; 
    130             return str_replace( '$TEXT', $text , $content ); 
     128            return $text; 
    131129    } 
    132130 
     
    194192        //unset($post->slogan); 
    195193 
    196         $this->log( _t("첨부")." : {$mail['attachments'][0]['filename']}" ); 
    197         requireModel( "blog.api" ); 
    198         $att = api_addAttachment( getBlogId(), $post->id,  
    199                     array(  
    200                             'name' => $mail['attachments'][0]['filename'],  
    201                             'content' => $mail['attachments'][0]['decoded_content'],  
    202                             'size' => $mail['attachments'][0]['length'] 
    203                     )  
    204             ); 
    205         if( !$att ) { 
    206             $this->log( "* "._t("메일").": " . $mail['subject'] . " [ERROR]" ); 
    207             $this->log( _t("실패: 첨부파일을 추가하지 못하였습니다")." : " . $post->error ); 
    208             return false; 
    209         } 
    210         $post->content = str_replace( '$FILENAME', $att['name'], $post->content ); 
    211         $post->content = str_replace( '$WIDTH', $att['width'], $post->content ); 
    212         $post->content = str_replace( '$HEIGHT', $att['height'], $post->content ); 
    213         if( !$post->update() ) { 
    214             $this->log( "* "._t("메일").": " . $mail['subject'] . " [ERROR]" ); 
    215             $this->log( _t("실패: 글을 추가하지 못하였습니다").". : " . $post->error ); 
    216             return false; 
     194        if( count($mail['attachments']) ) { 
     195            requireModel( "blog.api" ); 
     196            foreach( $mail['attachments'] as $mail_att ) { 
     197                $this->log( "* ". _t("첨부")." : {$mail_att['filename']}" ); 
     198                $att = api_addAttachment( getBlogId(), $post->id,  
     199                            array(  
     200                                    'name' => $mail_att['filename'],  
     201                                    'content' => $mail_att['decoded_content'],  
     202                                    'size' => $mail_att['length'] 
     203                            )  
     204                    ); 
     205                if( !$att ) { 
     206                    $this->log( "* "._t("메일").": " . $mail['subject'] . " [ERROR]" ); 
     207                    $this->log( _t("실패: 첨부파일을 추가하지 못하였습니다")." : " . $post->error ); 
     208                    return false; 
     209                } 
     210                $alt = htmlentities($mail_att['filename'],ENT_QUOTES,'utf-8'); 
     211                $content ='<p>[##_1C|$FILENAME|width="$WIDTH" height="$HEIGHT" alt="'.$alt.'"|_##]</p>'; 
     212                $content = str_replace( '$FILENAME', $att['name'], $content ); 
     213                $content = str_replace( '$WIDTH', $att['width'], $content ); 
     214                $content = str_replace( '$HEIGHT', $att['height'], $content ); 
     215                $post->content .= $content; 
     216            } 
     217            if( !$post->update() ) { 
     218                $this->log( "* "._t("메일").": " . $mail['subject'] . " [ERROR]" ); 
     219                $this->log( _t("실패: 첨부파일을 본문에 연결하지 못하였습니다").". : " . $post->error ); 
     220                return false; 
     221            } 
    217222        } 
    218223        $this->log( "* "._t("메일").": " . $mail['subject'] . " [OK]" );