Changeset 5970

Show
Ignore:
Timestamp:
05/18/08 21:53:12 (8 months ago)
Author:
coolengineer
Message:
  • #960
  • 올라온 포스트의 공개설정 속성 추가
Location:
trunk/plugins/CL_Moblog
Files:
2 modified

Legend:

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

    r5969 r5970  
    55{ 
    66    function Moblog( $username, $password, $host, $port = 110, $ssl = 0,  
    7         $userid = 1, $minsize = 10240 ) 
     7        $userid = 1, $minsize = 10240, $visibility = 2 ) 
    88    { 
    99        global $pop3logs; 
     
    1919        $this->minsize = $minsize; 
    2020        $this->recentCount = 100; 
     21        $this->visibility = array( "private", "protected", "public", "syndicated" ); 
     22        $this->visibility = $this->visibility[$visibility]; 
    2123 
    2224        $this->pop3 = new Pop3(); 
     
    122124            $alt = htmlentities($mail['attachments'][0]['filename'],ENT_QUOTES,'utf-8'); 
    123125            $content = '<p>$TEXT</p><p>[##_1C|$FILENAME|width="$WIDTH" height="$HEIGHT" alt="'.$alt.'"|_##]</p>'; 
    124             $text = "<h3 id=\"$docid\">".$mail['subject']."</h3>\r\n".(isset($mail['text'])?$mail['text']:''); 
     126            $text = "<h3 id=\"$docid\">".(empty($mail['subject']) ? $docid : $mail['subject'])."</h3>\r\n"; 
     127            $text .= isset($mail['text']) ? $mail['text'] : ''; 
    125128            return str_replace( '$TEXT', $text , $content ); 
    126129    } 
     
    146149        $mail = $this->pop3->parse( $lines ); 
    147150        if( in_array( $mail['subject'], array( '제목없음' ) ) ) { 
    148             $mail['subject'] = $slogan; 
     151            $mail['subject'] = ''; 
    149152        } 
    150153        if( !$this->isMms($mail) ) { 
     
    163166            $post->content .= $this->_getDecoratedContent( $mail, $docid ); 
    164167            $post->modified = time(); 
     168            $post->visibility = $this->visibility; 
    165169        } else { 
    166             $post->title = $mail['subject']; 
     170            $post->title = empty($mail['subject']) ? $slogan : $mail['subject']; 
    167171            $post->userid = $this->userid; 
    168172            $post->content = $this->_getDecoratedContent( $mail, $docid ); 
     
    172176            $post->acceptComment = true; 
    173177            $post->acceptTrackback = true; 
    174             $post->visibility = "public"; 
     178            $post->visibility = $this->visibility; 
    175179            $post->published = time(); 
    176180            $post->modified = time(); 
     
    213217{ 
    214218    if( isset($_GET['check']) && $_GET['check'] == 1 ) { 
    215         echo "<style>.emplog{color:red}</style>"; 
     219        echo "<style>.emplog{color:red}.oklog{color:blue}</style>"; 
    216220        echo "<ul>"; 
    217221        echo join( "",  
    218222            array_map( 
    219                 create_function( '$li', 'return preg_match( "/^\S+\s+\S+\s+\*/", $li ) ? "<li class=\"emplog\">$li</li>" : "<li>$li</li>";'),  
     223                create_function( '$li', 'return preg_match( "/^\S+\s+\S+\s+\*/", $li ) ?  
     224                        (preg_match( "/\[OK\]$/", $li ) ? "<li class=\"oklog\">$li</li>" : "<li class=\"emplog\">$li</li>")  
     225                        : "<li>$li</li>";'),  
    220226                split( "\n",file_get_contents(ROOT.DS."cache".DS."moblog.txt")) 
    221227            ) 
     
    233239    $pop3minsize *= 1024; 
    234240    $pop3fallbackuserid = getBlogSetting( 'MmsPop3Fallbackuserid', 1 ); 
    235  
    236     header( "Content-type: text/html" ); 
    237     echo "<ul><li>"; 
    238     $moblog = new Moblog( $pop3username, $pop3password, $pop3host, $pop3port, $pop3ssl, $pop3fallbackuserid, $pop3minsize ); 
     241    $pop3visibility = getBlogSetting( 'MmsPop3Visibility', '2' ); 
     242 
     243    header( "Content-type: text/html; charset:utf-8" ); 
     244    echo "<html><body><ul><li>"; 
     245    $moblog = new Moblog( $pop3username, $pop3password, $pop3host, $pop3port, $pop3ssl, $pop3fallbackuserid, $pop3minsize, $pop3visibility ); 
    239246    $moblog->log( "--BEGIN--" ); 
    240247    $moblog->check(); 
     
    244251        print join("</li><li>",$pop3logs); 
    245252    } 
    246     echo "</li></ul>"; 
     253    echo "</li></ul></body></html>"; 
    247254    return true; 
    248255} 
     
    259266        setBlogSetting( 'MmsPop3Username', $_POST['pop3username'] ); 
    260267        setBlogSetting( 'MmsPop3Password', $_POST['pop3password'] ); 
     268        setBlogSetting( 'MmsPop3Visibility', $_POST['pop3visibility'] ); 
    261269        setBlogSetting( 'MmsPop3Fallbackuserid', getUserId() ); 
    262270        setBlogSetting( 'MmsPop3MinSize', 0 ); 
     
    270278    $pop3minsize = getBlogSetting( 'MmsPop3MinSize', 0 ); 
    271279    $pop3fallheadercharset = getBlogSetting( 'MmsPop3Fallbackcharset', 'euc-kr' ); 
     280    $pop3visibility = getBlogSetting( 'MmsPop3Visibility', '2' ); 
    272281?> 
    273282                        <hr class="hidden" /> 
     
    331340                                            <dd> 
    332341                                                <input type="password" style="width:14em" class="input-text" name="pop3password" value="<?php echo $pop3password;?>" /> 
     342                                            </dd> 
     343                                        </dl> 
     344                                        <dl id="editor-line" class="line"> 
     345                                            <dt><span class="label"><?php echo _t('공개여부');?></span></dt> 
     346                                            <dd> 
     347                                                    <span id="status-private" class="status-private"><input type="radio" id="visibility_private" class="radio" name="pop3visibility" value="0"<?php echo ($pop3visibility == 0 ? ' checked="checked"' : '');?> /><label for="visibility_private"><?php echo _t('비공개');?></label></span> 
     348                                                    <span id="status-protected" class="status-protected"><input type="radio" id="visibility_protected" class="radio" name="pop3visibility" value="1"<?php echo ($pop3visibility == 1 ? ' checked="checked"' : '');?> /><label for="visibility_protected"><?php echo _t('보호');?></label></span> 
     349                                                    <span id="status-public" class="status-public"><input type="radio" id="visibility_public" class="radio" name="pop3visibility" value="2"<?php echo ($pop3visibility == 2 ? ' checked="checked"' : '');?> /><label for="visibility_public"><?php echo _t('공개');?></label></span> 
     350                                                    <span id="status-syndicated" class="status-syndicated"><input type="radio" id="visibility_syndicated" class="radio" name="pop3visibility" value="3"<?php echo ($pop3visibility == 3 ? ' checked="checked"' : '');?> /><label for="visibility_syndicated"><?php echo _t('발행');?></label></span> 
    333351                                            </dd> 
    334352                                        </dl> 
  • trunk/plugins/CL_Moblog/index.xml

    r5963 r5970  
    4848              </param> 
    4949              <param> 
     50                  <name>pop3visibility</name><type>int</type><mandatory>0</mandatory> 
     51              </param> 
     52              <param> 
    5053                  <name>check</name><type>int</type><mandatory>0</mandatory> 
    5154              </param>