Changeset 5953
- Timestamp:
- 05/15/08 07:18:59 (8 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
components/Needlworks.Mail.Pop3.php (modified) (1 diff)
-
plugins/CL_Moblog/index.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/Needlworks.Mail.Pop3.php
r5950 r5953 73 73 return false; 74 74 } 75 if( $this->retr_callback && count($this->results)>100) {75 if( $this->retr_callback ) { 76 76 call_user_func( $this->retr_callback, $this->results, $this->uids[$nr] ); 77 77 } -
trunk/plugins/CL_Moblog/index.php
r5950 r5953 109 109 } 110 110 111 function _getDecoratedContent( & $mail ) { 112 $alt = htmlentities($mail['attachments'][0]['filename'],ENT_QUOTES,'utf-8'); 113 $content = '<p>$TEXT</p><p>[##_1C|$FILENAME|width="$WIDTH" height="$HEIGHT" alt="'.$alt.'"|_##]</p>'; 114 $text = "<h3>".$mail['subject']."</h3>\r\n".(isset($mail['text'])?$mail['text']:''); 115 return str_replace( '$TEXT', $text , $content ); 116 } 117 111 118 function retrieveCallback( $lines, $uid ) 112 119 { 113 120 $this->appendUid( $uid ); 114 121 $mail = $this->pop3->parse( $lines ); 122 if( in_array( $mail['subject'], array( '제목없음' ) ) ) { 123 $mail['subject'] = ''; 124 } 115 125 $this->log( "Subject: " . $mail['subject'] ); 116 126 if( !$this->isMms($mail) ) { … … 126 136 127 137 $post = new Post(); 128 $post->userid = $this->userid; 129 $post->content = '$TEXT<br/>[##_1C|$FILENAME|width="$WIDTH" height="$HEIGHT" alt=""|_##]'; 130 $post->content = str_replace( '$TEXT', isset($mail['text'])?$mail['text']:'', $post->content ); 131 $post->contentFormatter = getDefaultFormatter(); 132 $post->contentEditor = getDefaultEditor(); 133 $post->title = $mail['subject']; 134 if( empty($post->title) ) { 135 $post->title = $post->$mail['attachments'][0]['filename']; 136 } 137 $post->created = time(); 138 $post->modified = time(); 139 $post->acceptComment = true; 140 $post->acceptTrackback = true; 141 $post->visibility = "public"; 142 $post->published = time(); 143 $post->add(); 138 $slogan = date( "Y-m-d" ); 139 140 if( $post->open( "slogan = '$slogan'" ) ) { 141 $post->content .= $this->_getDecoratedContent( $mail ); 142 $post->modified = time(); 143 } else { 144 $post->title = $mail['subject']; 145 $post->userid = $this->userid; 146 $post->content = $this->_getDecoratedContent( $mail ); 147 $post->contentFormatter = getDefaultFormatter(); 148 $post->contentEditor = getDefaultEditor(); 149 $post->created = time(); 150 $post->acceptComment = true; 151 $post->acceptTrackback = true; 152 $post->visibility = "public"; 153 $post->published = time(); 154 $post->modified = time(); 155 $post->slogan = $slogan; 156 if( !$post->add() ) { 157 $this->log( "Failed: there is a problem in adding post" ); 158 return false; 159 } 160 } 144 161 145 162 $this->log( "Attachment: {$mail['attachments'][0]['filename']}" ); … … 152 169 ) 153 170 ); 171 if( !$att ) { 172 $this->log( "Failed: there is a problem in attaching file" ); 173 return false; 174 } 154 175 $post->content = str_replace( '$FILENAME', $att['name'], $post->content ); 155 176 $post->content = str_replace( '$WIDTH', $att['width'], $post->content ); 156 177 $post->content = str_replace( '$HEIGHT', $att['height'], $post->content ); 157 $post->update(); 178 if( !$post->update() ) { 179 $this->log( "Failed: there is a problem in adding post." ); 180 return false; 181 } 158 182 return true; 159 183 }
