Changeset 6776

Show
Ignore:
Timestamp:
10/06/08 20:56:41 (3 months ago)
Author:
inureyes
Message:

refs #1045

  • 공지 슬로건의 백업 루틴 추가
Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/interface/owner/data/export/index.php

    r6474 r6776  
    151151        } 
    152152        $writer->write('</post>'); 
     153        $writer->write(CRLF); 
    153154    } while ($post->shift()); 
    154155    $post->close(); 
     
    157158if ($notice->open()) { 
    158159    do { 
    159         $writer->write('<notice' . $newlineStyle . '>' .  
     160        $writer->write('<notice' . ' slogan="' . htmlspecialchars($notice->slogan) . '"' . $newlineStyle . '>' .  
    160161            '<id>' . $notice->id . '</id>' .  
    161162            '<visibility>' . $notice->visibility . '</visibility>' .  
  • trunk/interface/owner/data/import/index.php

    r6474 r6776  
    425425            $notice = new Notice(); 
    426426            $notice->id = $node['id'][0]['.value']; 
     427            $notice->slogan = @$node['.attributes']['slogan']; 
    427428            $notice->visibility = $node['visibility'][0]['.value']; 
    428429            if(isset($node['starred'][0]['.value']))  
  • trunk/library/components/Textcube.Data.Notice.php

    r6473 r6776  
    1515        $this->starred = 
    1616        $this->title = 
     17        $this->slogan = 
    1718        $this->content = 
    1819        $this->contentFormatter = 
     
    103104            $query->setAttribute('userid',getUserId()); 
    104105        } 
     106        $this->saveSlogan(); 
    105107        if (!$query->insert()) 
    106108            return $this->_error('insert'); 
     
    128130        if (!isset($this->modified)) 
    129131            $query->setAttribute('modified', 'UNIX_TIMESTAMP()'); 
    130          
     132        if (isset($this->slogan)) 
     133            $this->saveSlogan(); 
     134                     
    131135        if (!$query->update()) 
    132136            return $this->_error('update'); 
     
    151155        if ($attachment->open('parent = ' . $this->id)) 
    152156            return $attachment; 
     157    } 
     158 
     159    function saveSlogan($slogan = null) { 
     160        global $database; 
     161        $this->init(); 
     162        if (!Validator::number($this->id, 1)) 
     163            return $this->_error('id'); 
     164        if (!Validator::number($this->userid, 1)) 
     165            return $this->_error('userid'); 
     166        if (isset($slogan)) 
     167            $this->slogan = $slogan; 
     168 
     169        $query = new TableQuery($database['prefix'] . 'Entries'); 
     170        $query->setQualifier('blogid',$this->blogid); 
     171        if(isset($this->userid)) $query->setQualifier('userid', $this->userid); 
     172        $query->setQualifier('id', $this->id); 
     173        if (!$query->doesExist()) 
     174            return $this->_error('id'); 
     175 
     176        if (isset($this->slogan) && $this->validateSlogan($this->slogan)) 
     177            $slogan0 = $this->slogan; 
     178        else 
     179            $slogan0 = $this->slogan = $this->makeSlogan($this->title); 
     180             
     181        $slogan0 = UTF8::lessenAsEncoding($slogan0, 255); 
     182 
     183        for ($i = 1; $i < 1000; $i++) { 
     184            $checkSlogan = POD::escapeString($this->slogan); 
     185            $query->setAttribute('slogan', $checkSlogan, false); 
     186            if (!POD::queryExistence( 
     187                "SELECT id FROM {$database['prefix']}Entries "  
     188                . "WHERE blogid = ".$this->blogid." AND id <> {$this->id} AND slogan ='{$checkSlogan}'") 
     189                )  
     190            { 
     191                if (!$query->update()) 
     192                    return $this->_error('update'); 
     193                return true; 
     194            } 
     195            $this->slogan = UTF8::lessenAsEncoding($slogan0, 245) . '-' . $i; 
     196        } 
     197        // if try saveSlogan again, slogan string has more $i 
     198        return $this->_error('limit'); 
    153199    } 
    154200 
  • trunk/library/piece/owner/header.php

    r6750 r6776  
    356356<?php 
    357357}*/ 
    358 if(($service['interface'] == 'simple') || ($service['effect'])) { 
     358if($service['interface'] == 'simple') { 
    359359    if(!in_array($blogMenu['contentMenu'],array('post','edit'))) { 
    360360?>