Changeset 4898

Show
Ignore:
Timestamp:
12/28/07 03:26:02 (11 months ago)
Author:
inureyes
Message:

#774

  • 댓글 RSS 지원 추가.
  • 스킨 치환자로 article_rep_rp_rss_url 추가.
    • article_rep 구역 내에서 작동하는 치환자입니다.
Location:
trunk
Files:
3 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/components/Needlworks.Cache.PageCache.php

    r4799 r4898  
    55 
    66class pageCache { 
    7     var $name; 
     7/*  var $name; 
    88    var $realName; 
    99    var $realNameOwner; 
     
    1818    var $absoluteFilePathOwner; 
    1919    var $absoluteFilePathGuest; 
    20     var $error; 
     20    var $error;*/ 
    2121 
    2222    function reset() { 
     
    259259            FROM {$database['prefix']}PageCacheLog 
    260260            WHERE blogid = ".getBlogId()." 
    261             AND name like 'entry\\_".$entryId."%'"); 
     261            AND (name like 'entry\\_".$entryId."%' OR name = commentRSS_'.$entryId.')"); 
    262262        foreach($Entries as $EntryName){ 
    263263            $cache->reset(); 
     
    266266        } 
    267267        unset($cache); 
     268        return true; 
     269    } 
     270 
     271    function flushCommentRSS($entryId = null) { 
     272        global $database; 
     273 
     274        if(empty($entryId)) $entryId = ''; 
     275        $cache = new pageCache; 
     276        $cache->name = 'commentRSS_'.$entryId; 
     277        $cache->purge(); 
    268278        return true; 
    269279    } 
     
    306316 
    307317class MMCache{ 
    308     var $variable; 
     318    /*var $variable;*/ 
    309319     
    310320    //Variable must be the table form. (2-dimensional recursive structure) 
  • trunk/lib/model/blog.comment.php

    r4820 r4898  
    402402    if ($result) { 
    403403        $id = $insertId; 
     404        CacheControl::flushCommentRSS($comment['entry']); 
    404405        if ($parent != 'null' && $comment['secret'] < 1) { 
    405406            $insertId = getCommentsNotifiedQueueMaxId() + 1; 
     
    493494                WHERE blogid = $blogid  
    494495                    AND id = {$comment['id']} $wherePassword"); 
    495     return $result ? true : false; 
     496    if($result) { 
     497        CacheControl::flushCommentRSS($comment['entry']); // Assume blogid = current blogid. 
     498        return true; 
     499    } else return false; 
    496500} 
    497501 
     
    526530    } 
    527531    if(POD::query($sql . $wherePassword)) { 
     532        CacheControl::flushCommentRSS($entry); 
    528533        updateCommentsOfEntry($blogid, $entry); 
    529534        return true; 
     
    552557    $affectedChildren = POD::queryCount($sql); 
    553558    if ($affected + $affectedChildren > 0) { 
     559        CacheControl::flushCommentRSS($entry); 
    554560        updateCommentsOfEntry($blogid, $entry); 
    555561        return true; 
     
    573579            AND entry = $entry"; 
    574580    if(POD::query($sql)) { 
     581        CacheControl::flushCommentRSS($entry); 
    575582        updateCommentsOfEntry($blogid, $entry); 
    576583        return true; 
     
    676683    if(POD::queryCount("DELETE FROM {$database['prefix']}Comments WHERE blogid = $blogid AND id = $id") == 1) { 
    677684        if (POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = $blogid AND parent = $id")) { 
     685            CacheControl::flushCommentRSS($entryId); 
    678686            updateCommentsOfEntry($blogid, $entryId); 
    679687            return true; 
     
    691699    if(POD::query("UPDATE {$database['prefix']}Comments SET isFiltered = UNIX_TIMESTAMP() WHERE blogid = $blogid AND id = $id")) { 
    692700        if (POD::query("UPDATE {$database['prefix']}Comments SET isFiltered = UNIX_TIMESTAMP() WHERE blogid = $blogid AND parent = $id")) { 
     701            CacheControl::flushCommentRSS($entryId); 
    693702            updateCommentsOfEntry($blogid, $entryId); 
    694703            return true; 
     
    705714    if(POD::queryCount("UPDATE {$database['prefix']}Comments SET isFiltered = 0 WHERE blogid = $blogid AND id = $id") == 1) { 
    706715        if (is_null($parent) || POD::query("UPDATE {$database['prefix']}Comments SET isFiltered = 0 WHERE blogid = $blogid AND id = $parent")) { 
     716            CacheControl::flushCommentRSS($entryId); 
    707717            updateCommentsOfEntry($blogid, $entryId); 
    708718            return true; 
  • trunk/lib/model/blog.rss.php

    r4799 r4898  
    6767            'author' => '('.$row['author'].')',  
    6868            'pubDate' => Timestamp::getRFC1123($row['published']), 
    69             'comments' => $entryURL . '#entry' . $row['id'] . 'comment', 
     69            'comments' => $entryURL . '#rp', 
    7070            'guid' => "$defaultURL/" . $row['id'] 
    7171        ); 
     
    115115    fclose($fileHandle); 
    116116    return false; 
     117} 
     118 
     119function getCommentRSSByEntryId($blogid, $entryId) { 
     120    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     121 
     122    if(empty($blogid)) $blogid = getBlogId(); 
     123    $entry = POD::queryRow("SELECT slogan, visibility, category FROM {$database['prefix']}Entries WHERE blogid = $blogid AND id = $entryId"); 
     124    if(empty($entry)) return false; 
     125    if($entry['visibility'] < 2) return false; 
     126    if(in_array($entry['category'], getCategoryVisibilityList($blogid, 'private'))) return false; 
     127    $channel = array(); 
     128    $channel['title'] = $blog['title']. ': '._f('%1 에 달린 댓글',$entry['slogan']); 
     129    if($blog['useSlogan']) { 
     130        $channel['link'] = $defaultURL."/entry/".URL::encode($entry['slogan'],true); 
     131    } else { 
     132        $channel['link'] = $defaultURL."/".$entryId; 
     133    } 
     134    $channel['description'] = $blog['description']; 
     135    $channel['language'] = $blog['language']; 
     136    $channel['pubDate'] = Timestamp::getRFC1123(); 
     137    $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION; 
     138 
     139    if (!empty($blog['logo']) && file_exists(ROOT."/attach/$blogid/{$blog['logo']}")) { 
     140        $logoInfo = getimagesize(ROOT."/attach/$blogid/{$blog['logo']}"); 
     141        $channel['url'] = $serviceURL."/attach/".$blogid."/".$blog['logo']; 
     142        $channel['width'] = $logoInfo[0]; 
     143        $channel['height'] = $logoInfo[1]; 
     144    } 
     145    $result = POD::queryAll("SELECT * 
     146        FROM {$database['prefix']}Comments 
     147        WHERE blogid = ".$blogid."  
     148            AND entry = ".$entryId." 
     149            AND isFiltered = 0"); 
     150    if (!$result) 
     151        $result = array(); 
     152 
     153    $channel['items'] = array(); 
     154    foreach($result as $row) { 
     155        $commentURL = $channel['link']."#comment".$row['id']; 
     156        $content = $row['comment']; 
     157        $item = array( 
     158            'id' => $row['id'],  
     159            'title' => $row['title'],  
     160            'link' => $commentURL,  
     161            'categories' => array(), 'description' => $content,  
     162            'author' => '('.$row['name'].')',  
     163            'pubDate' => Timestamp::getRFC1123($row['written']), 
     164            'guid' => $commentURL 
     165        ); 
     166        if($row['secret']) $item['description'] = _t('비밀 댓글입니다'); 
     167        array_push($channel['items'], $item); 
     168    } 
     169    $rss = array('channel' => $channel); 
     170    return publishRSS($blogid, $rss); 
    117171} 
    118172 
  • trunk/lib/piece/blog/entries.php

    r4679 r4898  
    8989            dress('article_rep_id', $entry['id'], $entryView); 
    9090            dress('article_rep_link', $permalink, $entryView); 
     91            dress('article_rep_rp_rssurl', $defaultURL.'/comment/rss/'.$entry['id'], $entryView); 
    9192            dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView); 
    9293            // 사용자가 작성한 본문은 lib/piece/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치. 
  • trunk/lib/view/view.php

    r4894 r4898  
    13241324        return ''; 
    13251325    $file = "<script type=\"text/javascript\">//<![CDATA[" . CRLF 
    1326         . "var servicePath=\"$hostURL{$service['path']}\"; var blogURL=\"$hostURL$blogURL/\";$file"; 
     1326        . "var servicePath=\"".$hostURL.$service['path']."\"; var blogURL=\"".$hostURL.$blogURL."/\";".$file; 
    13271327    if ($obfuscate) { 
    13281328    } 
  • trunk/skin/coolant/skin.html

    r4894 r4898  
    310310                                </s_rp_count> 
    311311                            </a> 
     312                        </dd> 
     313                        <dd> 
     314                            Comment RSS : [##_article_rep_rp_rssurl_##] 
    312315                        </dd> 
    313316                    </dl>