Changeset 7020

Show
Ignore:
Timestamp:
11/20/08 17:02:05 (7 weeks ago)
Author:
inureyes
Message:

refs #777

  • suri 루틴 통합.
  • 관련해서 하부 구조를 다시 쓰는 중.
Location:
trunk
Files:
1 removed
41 modified

Legend:

Unmodified
Added
Removed
  • trunk/dispatcher.php

    r7015 r7020  
    8484//   loads its necessary libraries, models and components. 
    8585// before actual execution. 
     86$gCacheStorage = new globalCacheStorage; 
    8687require(ROOT.'/'.$context->accessInfo['interfacePath']); 
    8788 
  • trunk/interface/index.php

    r7005 r7020  
    4747 
    4848// Redirect for ipod touch / iPhone 
    49 if(setting::getBlogSettingGlobal('useiPhoneUI',true) && (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'],'iPod') || strpos($_SERVER['HTTP_USER_AGENT'],'iPhone')))){ 
     49if(Setting::getBlogSettingGlobal('useiPhoneUI',true) && (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'],'iPod') || strpos($_SERVER['HTTP_USER_AGENT'],'iPhone')))){ 
    5050    header("Location: $blogURL/i"); exit; 
    5151} 
  • trunk/interface/owner/control/user/detail/index.php

    r6958 r7020  
    1616$usersetting= POD::queryRow("SELECT * FROM `{$database['prefix']}Users` WHERE userid = " . $uid); 
    1717$usersetting['owner']= POD::queryCell("SELECT userid FROM `{$database['prefix']}Teamblog` WHERE acl & ".BITWISE_OWNER." != 0 AND blogid = " . $blogid); 
    18 $AuthToken = setting::getUserSettingGlobal('AuthToken',null,$uid); 
     18$AuthToken = Setting::getUserSettingGlobal('AuthToken',null,$uid); 
    1919?> 
    2020                        <script type="text/javascript">  
  • trunk/interface/owner/control/user/index.php

    r6993 r7020  
    6969                        <td><?php echo $row['name']?></td> 
    7070                        <td><?php echo ($row['lastLogin']?date("Y/m/d H:i:s T",$row['lastLogin']):'<span class="warning">'._t('아직 로그인하지 않았습니다.').'</span>');?></td> 
    71                         <td><?php if(empty($row['lastLogin']) || null !== setting::getUserSettingGlobal('AuthToken',null,$row['userid'])) echo setting::getUserSettingGlobal('AuthToken',null,$row['userid']);?></td> 
     71                        <td><?php if(empty($row['lastLogin']) || null !== Setting::getUserSettingGlobal('AuthToken',null,$row['userid'])) echo Setting::getUserSettingGlobal('AuthToken',null,$row['userid']);?></td> 
    7272                    </tr> 
    7373<?php 
  • trunk/interface/owner/data/index.php

    r7012 r7020  
    266266                                <p><?php echo _f('서버에 %1에 백업한 파일이 존재합니다.',$fileTime);?></p> 
    267267<?php 
    268         $apikey = setting::getUserSettingGlobal('APIKey',null,getUserId()); 
     268        $apikey = Setting::getUserSettingGlobal('APIKey',null,getUserId()); 
    269269        if($apikey!=null) { 
    270270?> 
  • trunk/interface/owner/setting/account/index.php

    r6958 r7020  
    378378                                            <dt><span class="label"><?php echo _t('API 용 비밀번호');?></span></dt> 
    379379                                            <dd> 
    380                                             <input type="text" style="width:14em" class="input-text" id="TCApiPassword" name="TCApiPassword" value="<?php echo setting::getUserSettingGlobal('APIKey',null,getUserId());?>" /> 
     380                                            <input type="text" style="width:14em" class="input-text" id="TCApiPassword" name="TCApiPassword" value="<?php echo Setting::getUserSettingGlobal('APIKey',null,getUserId());?>" /> 
    381381                                                <input type="button" class="input-button" value="<?php echo _t('임의로 생성')?>" onclick="chooseBlogPassword()" /> 
    382382                                                <input type="button" class="input-button" value="<?php echo _t('관리자 비밀번호를 그대로 사용')?>" onclick="clearBlogPassword()" /> 
     
    554554                                            <dd> 
    555555<?php 
    556         $currentDelegate = setting::getBlogSettingGlobal( 'OpenIDDelegate', '' ); 
     556        $currentDelegate = Setting::getBlogSettingGlobal( 'OpenIDDelegate', '' ); 
    557557?> 
    558558                                                <select id="openid_for_delegation"> 
  • trunk/interface/owner/setting/blog/index.php

    r6958 r7020  
    692692                                        </dl> 
    693693<?php 
    694 $openidonlycomment = setting::getBlogSettingGlobal( "AddCommentMode", "" ); 
     694$openidonlycomment = Setting::getBlogSettingGlobal( "AddCommentMode", "" ); 
    695695if( $openidonlycomment == 'openid' ) { 
    696696    $openidonlycomment = "checked='checked'"; 
     
    699699} 
    700700 
    701 $openidlogodisplay = setting::getBlogSettingGlobal( "OpenIDLogoDisplay", 0 ); 
     701$openidlogodisplay = Setting::getBlogSettingGlobal( "OpenIDLogoDisplay", 0 ); 
    702702if( $openidlogodisplay ) { 
    703703    $openidlogodisplay = "checked='checked'"; 
  • trunk/interface/owner/skin/sidebar/initialize/index.php

    r7012 r7020  
    1313else $_REQUEST['viewMode'] = '?' . $_REQUEST['viewMode']; 
    1414 
    15 setting::removeBlogSettingGlobal('sidebarOrder'); 
     15Setting::removeBlogSettingGlobal('sidebarOrder'); 
    1616Skin::purgeCache(); 
    1717if($ajaxcall == false) header('Location: '. $blogURL . '/owner/skin/sidebar' . $_REQUEST['viewMode']); 
  • trunk/interface/owner/skin/sidebar/setPlugin/index.php

    r7012 r7020  
    7171 
    7272$sidebarOrderData[$sidebarNumber][$modulePos]['parameters'] = $newParameter; 
    73 setting::setBlogSettingGlobal("sidebarOrder", serialize($sidebarOrderData)); 
     73Setting::setBlogSettingGlobal("sidebarOrder", serialize($sidebarOrderData)); 
    7474Skin::purgeCache(); 
    7575if ($ajaxcall == false) { 
  • trunk/library/auth.php

    r6537 r7020  
    6868function getBlogId() { 
    6969    global $blogid; 
    70     return $blogid; 
     70    return Context::$blogid; 
     71//  return $blogid; 
    7172} 
    7273 
     
    127128    $userid = User::getUserIdByEmail($loginid); 
    128129    if( $userid === false ) { return false; } 
    129     $currentAPIKey = setting::getUserSettingGlobal('APIKey',null,$userid); 
     130    $currentAPIKey = Setting::getUserSettingGlobal('APIKey',null,$userid); 
    130131    if($currentAPIKey == null) { 
    131132        if(!User::confirmPassword($userid, $key)) { 
  • trunk/library/context.php

    r7017 r7020  
    88final class Context extends Singleton 
    99{ 
    10     public $accessInfo; 
     10    public $accessInfo, $suri; 
     11    public static $blogid; 
    1112 
    1213    public static function getInstance() { 
     
    1516 
    1617    protected function __construct() { 
     18        self::__URIInterpreter(); 
     19//      self::__URIParser(); 
     20//      self::__GValParser(); 
     21    } 
     22     
     23    private function __URIInterpreter() { 
    1724        $config = Config::getInstance(); 
    1825 
     
    119126        $this->accessInfo = $accessInfo; 
    120127    } 
    121  
     128     
     129    private function __URIParser() { 
     130        if(!isset($this->accessInfo)) self::__URIInterpreter(); 
     131        $config = Config::getInstance(); 
     132        $url = $this->accessInfo['fullpath']; 
     133        $defaultblogid = Setting::getServiceSetting("defaultBlogId",1); 
     134        $suri            = array('url' => $url, 'value' => ''); 
     135        $this->blogid          = null; 
     136        $isStrictBlogURL = true; 
     137        $depth           = substr_count($config->service['path'], '/'); 
     138 
     139        if ($depth > 0) { 
     140            if (preg_match('@^((/+[^/]+){' . $depth . '})(.*)$@', $url, $matches)) 
     141                $url = $matches[3]; 
     142            else 
     143                Respond::NotFoundPage(); 
     144        } 
     145        if ($config->service['type'] == 'single') { 
     146            $this->blogid = $defaultblogid; 
     147        } else { 
     148            if ($config->service['type'] == 'domain') { 
     149                if ($_SERVER['HTTP_HOST'] == $config->service['domain']) { 
     150                    $this->blogid = $defaultblogid; 
     151                } else { 
     152                    $domain = explode('.', $_SERVER['HTTP_HOST'], 2); 
     153                    if ($domain[1] == $service['domain']) { 
     154                        $this->blogid = self::__getBlogidByName($domain[0]); 
     155                        if ($this->blogid === null)  
     156                            $this->blogid = self::__getBlogidBySecondaryDomain($_SERVER['HTTP_HOST']); 
     157                        } else { 
     158                            $this->blogid = self::__getBlogidBySecondaryDomain($_SERVER['HTTP_HOST']); 
     159                        } 
     160                } 
     161            } else { 
     162                if ($url == '/') { 
     163                    $this->blogid = $defaultblogid; 
     164                } else if (preg_match('@^/+([^/]+)(.*)$@', $url, $matches)) { 
     165                    $this->blogid = self::__getBlogidByName(strtok($matches[1],'?')); 
     166                    if ($this->blogid === null) { 
     167                        $this->blogid = $defaultblogid; 
     168                        $isStrictBlogURL = false; 
     169                    } 
     170                    $url = $matches[2]; 
     171                } else { 
     172                    Respond::NotFoundPage(); 
     173                } 
     174            } 
     175            if ($this->blogid === null) 
     176                Respond::NotFoundPage(); 
     177        } 
     178 
     179 
     180        $blog = Setting::getBlogSettingsGlobal($this->blogid); 
     181        $skinSetting = getSkinSetting($blogid); 
     182         
     183        if(isset($context->accessInfo['interfacePath'])) { 
     184            $depth = substr_count($context->accessInfo['interfacePath'], '/') - 1; 
     185        } else { 
     186            $depth = substr_count(ROOT, '/'); 
     187        } 
     188        if ($depth > 0) { 
     189            if($config->service['fancyURL'] === 0 || $config->service['fancyURL'] === 1) $url = '/'.$self->accessInfo['input']; // Exclude /blog path. 
     190            if (preg_match('@^((/+[^/]+){' . $depth . '})/*(.*)$@', $url, $matches)) { 
     191                $suri['directive'] = $matches[1]; 
     192                if ($matches[3] !== false) { 
     193                    $suri['value'] = $matches[3]; 
     194                } 
     195            } else { 
     196                Respond::NotFoundPage(); 
     197            } 
     198        } else { 
     199            $suri['directive'] = '/'; 
     200            $suri['value'] = ltrim($url, '/'); 
     201        } 
     202        if(strpos($suri['value'],'?') === 0) $suri['value'] = ''; 
     203        else $suri['value'] = strtok($suri['value'], '?'); 
     204        $suri['directive'] = strtok($suri['directive'], '?'); 
     205        if (is_numeric($suri['value'])) { 
     206            $suri['id'] = $suri['value']; 
     207        } else { 
     208            $suri['value'] = URL::decode(str_replace('index.php','',$suri['value'])); 
     209            if(is_numeric($isValue = strtok($suri['value'],'&'))) $suri['id'] = $isValue; 
     210            unset($isValue); 
     211        } 
     212        /* 
     213        if( function_exists( 'mb_detect_encoding' ) && function_exists('iconv') ) { 
     214            $encoding = mb_detect_encoding($suri['value'], 'UTF-8,EUC-KR,SHIFT_JIS,EUC-JP,BIG5,EUC-CN,EUC-TW,GBK'); 
     215            $suri['value'] = @iconv( $encoding, 'UTF-8', $suri['value'] ); 
     216        }*/ 
     217 
     218        // Parse page. 
     219        $suri['page'] = empty($_POST['page']) ? (empty($_GET['page']) ? true : $_GET['page']) : $_POST['page']; 
     220        $this->suri = $suri; 
     221    } 
     222     
     223    private function __GValParser() { 
     224        global $serviceURL, $pathURL, $defaultURL, $baseURL, $pathURL, $blog, $hostURL, $folderURL, $suri; 
     225        $config = Config::getInstance(); 
     226        $suri = $self->suri; 
     227        if (!isset($serviceURL)) 
     228            $serviceURL = 'http://' . $config->service['domain'] . (isset($config->service['port']) ? ':' . $config->service['port'] : '') . $service['path']; 
     229        switch ($config->service['type']) { 
     230            case 'domain': 
     231                $pathURL = $config->service['path']; 
     232                $blog['primaryBlogURL'] = 'http://' . $blog['name'] . '.' . $config->service['domain'] . (isset($config->service['port']) ? ':' . $config->service['port'] : '') . $pathURL; 
     233                if( !empty($blog['secondaryDomain']) ) 
     234                    $blog['secondaryBlogURL'] = 'http://' . $blog['secondaryDomain'] . (isset($config->service['port']) ? ':' . $config->service['port'] : '') . $pathURL; 
     235                else 
     236                    $blog['secondaryBlogURL'] = null; 
     237                if ($blog['defaultDomain']) { 
     238                    $defaultURL = $blog['secondaryBlogURL']; 
     239                    if ($_SERVER['HTTP_HOST'] == $blog['secondaryDomain']) 
     240                        $baseURL = $config->service['path']; 
     241                    else 
     242                        $baseURL = $defaultURL; 
     243                } else { 
     244                    $defaultURL = $blog['primaryBlogURL']; 
     245                    if ($_SERVER['HTTP_HOST'] == ($blog['name'] . '.' . $config->service['domain'])) 
     246                        $baseURL = $config->service['path']; 
     247                    else 
     248                        $baseURL = $defaultURL; 
     249                } 
     250                break; 
     251            case 'path': 
     252                $pathURL = $config->service['path'] . '/' . $blog['name']; 
     253                $blog['primaryBlogURL'] = 'http://' . $config->service['domain'] . (isset($config->service['port']) ? ':' . $config->service['port'] : '') . $pathURL; 
     254                $blog['secondaryBlogURL'] = null; 
     255                $defaultURL = $blog['primaryBlogURL']; 
     256                if ($_SERVER['HTTP_HOST'] == $config->service['domain']) 
     257                    $baseURL = $config->service['path'] . '/' . $blog['name']; 
     258                else 
     259                    $baseURL = $defaultURL; 
     260                break; 
     261            case 'single': 
     262            default: 
     263                $pathURL = $config->service['path']; 
     264                $blog['primaryBlogURL'] = 'http://' . $config->service['domain'] . (isset($config->service['port']) ? ':' . $config->service['port'] : '') . $pathURL; 
     265                $blog['secondaryBlogURL'] = null; 
     266                $defaultURL = $blog['primaryBlogURL'].getFancyURLpostfix(); 
     267                if ($_SERVER['HTTP_HOST'] == $config->service['domain']) 
     268                    $baseURL = $config->service['path']; 
     269                else 
     270                    $baseURL = $defaultURL; 
     271                break; 
     272        } 
     273        $hostURL = 'http://' . $_SERVER['HTTP_HOST'] . (isset($config->service['port']) ? ':' . $config->service['port'] : ''); 
     274        $blogURL = $pathURL.getFancyURLpostfix(); 
     275        $folderURL = rtrim($blogURL . $suri['directive'], '/'); 
     276        if (defined('__TEXTCUBE_MOBILE__')) { 
     277            $blogURL .= '/m'; 
     278        }else if (defined('__TEXTCUBE_IPHONE__')) { 
     279            $blogURL .= '/i'; 
     280        } 
     281    } 
     282     
     283    private function __getBlogIdByName($name) { 
     284        global $database; 
     285        $query = new TableQuery($database['prefix'] . 'BlogSettings'); 
     286        $query->setQualifier('name','name',true); 
     287        $query->setQualifier('value', $name, true); 
     288        return $query->getCell('blogid'); 
     289        return false;    
     290    } 
     291    private function __getBlogIdBySecondaryDomain($name) { 
     292        global $database; 
     293        return POD::queryCell("SELECT blogid FROM {$database['prefix']}BlogSettings WHERE name = 'secondaryDomain' AND (value = '$domain' OR  value = '" . (substr($domain, 0, 4) == 'www.' ? substr($domain, 4) : 'www.' . $domain) ."')");     
     294    } 
     295     
    122296    function __destruct() { 
    123297        // Nothing to do: destruction of this class means the end of execution 
  • trunk/library/data/Core.php

    r6997 r7020  
    100100        if (!isset($userid))  
    101101            $userid = getUserId(); 
    102         $info = unserialize(setting::getUserSettingGlobal('userLinkInfo','',$userid)); 
     102        $info = unserialize(Setting::getUserSettingGlobal('userLinkInfo','',$userid)); 
    103103        if(!empty($info)) $type = $info['type']; 
    104104        if (empty($type)) { 
     
    112112        if (!isset($userid) || empty($userid))  
    113113            $userid = getUserId(); 
    114         $info = unserialize(setting::getUserSettingGlobal('userLinkInfo','',$userid)); 
     114        $info = unserialize(Setting::getUserSettingGlobal('userLinkInfo','',$userid)); 
    115115        if(is_null($info)) $info = array('type' => 'default');  
    116116        switch ($info['type']) { 
     
    156156        } 
    157157        $homepage = serialize($info); 
    158         if (setting::setUserSettingGlobal("userLinkInfo",$homepage, $userid)) { 
     158        if (Setting::setUserSettingGlobal("userLinkInfo",$homepage, $userid)) { 
    159159            return true; 
    160160        } 
     
    193193        $changeBlogView = str_repeat(TAB,6)."<select id=\"blog-list\" onchange=\"location.href='{$blogURL}/owner/network/teamblog/changeBlog/?blogid='+this.value\">".CRLF; 
    194194        foreach($blogList as $info){ 
    195             $title = UTF8::lessen(setting::getBlogSettingGlobal("title",null,$info,true), 30); 
     195            $title = UTF8::lessen(Setting::getBlogSettingGlobal("title",null,$info,true), 30); 
    196196            $title = ($title ? $title : _f('%1 님의 블로그',User::getBlogOwnerName($info))); 
    197197            $changeBlogView .= str_repeat(TAB,7).'<option value="' . $info . '"'; 
  • trunk/library/data/Setting.php

    r6990 r7020  
    55 
    66global $__gCacheBlogSettings; // share blog.service.php 
    7 class setting { 
     7class Setting { 
    88    function fetchConfigVal( $DATA ){ 
    99        if (is_null($DATA)) return null; // Compartibility. If data is stored as array (new method), return it. 
     
    5252        global $database, $service, $__gCacheBlogSettings, $gCacheStorage; 
    5353 
    54         if(is_null($blogid)) $blogid = getBlogId(); 
     54        if(is_null($blogid)) $blogid = Context::$blogid; 
    5555        if (array_key_exists($blogid, $__gCacheBlogSettings)) { 
    5656            return $__gCacheBlogSettings[$blogid]; 
    5757        } 
    58         if($blogid == getBlogId()) { 
     58        if($blogid == Context::$blogid) { 
    5959            $result = $gCacheStorage->getContent('BlogSettings'); 
    6060            if(!empty($result)) {  
  • trunk/library/includeForBlog.php

    r7012 r7020  
    5959 
    6060if(!defined('__TEXTCUBE_LOGIN__')) { 
    61     $blogVisibility = setting::getBlogSettingGlobal('visibility',2); 
     61    $blogVisibility = Setting::getBlogSettingGlobal('visibility',2); 
    6262    if($blogVisibility == 0) requireOwnership(); 
    6363    else if($blogVisibility == 1) requireMembership(); 
  • trunk/library/initialize.php

    r7014 r7020  
    2929   ---------------------------------- 
    3030**/ 
    31 require ROOT.'/library/suri.php'; 
     31//require ROOT.'/library/suri.php'; 
    3232 
    3333/* Session initializing */ 
  • trunk/library/loader.php

    r7016 r7020  
    88    private static $classInfo = array( 
    99        'auth'        => array('Auth','OpenID',array('Privilege'=>'Auth','Acl'=>'Auth')), 
    10         'cache'       => array('PageCache','ICache'), 
     10        'cache'       => array('PageCache','ICache',array('globalCacheStorage','PageCache'), 
    1111        'data'        => array('BlogSetting','BlogStatistics','DailyStatistics', 
    1212            'DataMaintenance','Filter','Image','POD','RSS', 
  • trunk/library/model/blog.blogSetting.php

    r7004 r7020  
    483483 
    484484function changeAPIKey($userid, $key) { 
    485     if($key) return setting::setUserSettingGlobal('APIKey',$key,$userid); 
    486     else return setting::removeUserSettingGlobal('APIKey',$userid); 
     485    if($key) return Setting::setUserSettingGlobal('APIKey',$key,$userid); 
     486    else return Setting::removeUserSettingGlobal('APIKey',$userid); 
    487487} 
    488488 
  • trunk/library/model/blog.service.php

    r6476 r7020  
    77$__gCacheBlogSettings = array(); 
    88 
    9 function getBlogidByName($name) { 
    10     global $database; 
    11     $query = new TableQuery($database['prefix'] . 'BlogSettings'); 
    12     $query->setQualifier('name','name',true); 
    13     $query->setQualifier('value', $name, true); 
    14     return $query->getCell('blogid'); 
    15     return false; 
    16 } 
    17  
    18 function getBlogidBySecondaryDomain($domain) { 
    19     global $database; 
    20     return POD::queryCell("SELECT blogid FROM {$database['prefix']}BlogSettings WHERE name = 'secondaryDomain' AND (value = '$domain' OR  value = '" . (substr($domain, 0, 4) == 'www.' ? substr($domain, 4) : 'www.' . $domain) . "')"); 
    21 } 
    22  
    239function getBlogSettings($blogid) { 
    24     return setting::getBlogSettingsGlobal($blogid); 
     10    return Setting::getBlogSettingsGlobal($blogid); 
    2511} 
    2612 
  • trunk/library/model/common.plugin.php

    r6476 r7020  
    502502 
    503503function fetchConfigVal($DATA) { 
    504     return setting::fetchConfigVal($DATA); 
     504    return Setting::fetchConfigVal($DATA); 
    505505} 
    506506 
     
    518518    $CDSPval = ''; 
    519519    $i=0; 
    520     $dfVal =  setting::fetchConfigVal(getCurrentSetting($plugin)); 
     520    $dfVal =  Setting::fetchConfigVal(getCurrentSetting($plugin)); 
    521521    $name = ''; 
    522522    $clientData ='['; 
  • trunk/library/model/common.setting.php

    r6965 r7020  
    5555 
    5656function getBlogSetting($name, $default = null, $blogid = null) { 
    57     return setting::getBlogSettingGlobal($name, $default); 
     57    return Setting::getBlogSettingGlobal($name, $default); 
    5858} 
    5959 
    6060function setBlogSetting($name, $value, $blogid = null) { 
    61     return setting::setBlogSettingGlobal($name, $value, $blogid); 
     61    return Setting::setBlogSettingGlobal($name, $value, $blogid); 
    6262} 
    6363 
    6464function setBlogSettingDefault($name, $value, $blogid = null) { 
    65     return setting::setBlogSettingDefault($name, $value, $blogid); 
     65    return Setting::setBlogSettingDefault($name, $value, $blogid); 
    6666} 
    6767 
    6868function removeBlogSetting($name, $blogid = null) { 
    69     return setting::removeBlogSettingGlobal($name, $blogid); 
     69    return Setting::removeBlogSettingGlobal($name, $blogid); 
    7070} 
    7171 
    7272function getUserSetting($name, $default = null, $userid = null) { 
    73     return setting::getUserSettingGlobal($name, $default, $userid); 
     73    return Setting::getUserSettingGlobal($name, $default, $userid); 
    7474} 
    7575 
    7676function setUserSetting($name, $value, $userid = null) { 
    77     return setting::setUserSettingGlobal($name, $value, $userid); 
     77    return Setting::setUserSettingGlobal($name, $value, $userid); 
    7878} 
    7979 
    8080