| 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 | } |