Changeset 6681

Show
Ignore:
Timestamp:
09/17/08 10:43:39 (4 months ago)
Author:
inureyes
Message:

refs #1085

Location:
branches/1.7
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/1.7/doc/requirements.txt

    r6630 r6681  
    29292. For Microsoft Windows : 
    3030 
    31  Currently supports IIS7 only : 
    32   * Windows Vista / Windows Server 2008 
    33   * IIS 7.0 or above 
    34     * with URL Rewrite module 
     31  * IIS 5.0 or above 
     32    * with ISAPI Rewrite Filter 
    3533  * PHP 5.2 or above 
    3634    * with iconv / gd module 
  • branches/1.7/rewrite.php

    r6630 r6681  
    1010    } 
    1111    if (!empty($_SERVER['PRELOAD_CONFIG']) && file_exists('config.php')) require_once ROOT."/config.php"; 
    12     if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) 
     12    // IIS 7.0 and URL Rewrite Module CTP, but non-ASCII URLs are NOT supported. 
     13    if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 
    1314        $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 
     15    } // IIS 5.x/6.0/7.0 and Ionics ISAPI Rewrite Filter 
     16    else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 
     17        $_SERVER['REQUEST_URI'] = urldecode($_SERVER['HTTP_X_REWRITE_URL']); 
     18    } 
    1419    /* Retrieve Access Parameter Information. */ 
    1520    $accessInfo = array( 
  • branches/1.7/setup.php

    r6630 r6681  
    3030    $path = stripPath(substr($_SERVER['PHP_SELF'], 0, strlen($_SERVER['PHP_SELF']) - 12)); 
    3131} 
    32  
    33 define ('ROOT', $root); 
     32$_SERVER['PHP_SELF'] = rtrim($_SERVER['PHP_SELF'], '/'); 
     33 
     34if (!defined('ROOT')) 
     35    define ('ROOT', $root); 
    3436 
    3537$__requireBasics = array( 
     
    382384                } 
    383385            } 
    384             if (!empty($_POST['checked'])) 
     386            if (!empty($_POST['checked']) && $_POST['checked'] == 'yes') 
    385387                return true; 
    386388        } 
     
    767769        if ($step == 33) { 
    768770            $error = 16; 
     771            if (checkIIS()) { 
     772?> 
     773    <h3><?php echo _t('IIS Rewrite Module');?></h3> 
     774    <ul style="color:red"> 
     775        <li><?php echo _t('현재 IIS에서의 설치는 실험적으로만 지원하고 있으며 별도의 Rewrite 모듈을 사용해야 합니다.').' '._t('만약 이 페이지를 보고 계시다면 Apache mod_rewrite와 호환되지 않는 모듈을 사용 중이거나 아예 모듈이 없는 경우입니다.'); ?></li> 
     776        <li><?php echo _t('텍스트큐브와 호환되는 IIS용 Rewrite 모듈을 설치하려면, 오픈스소 무료 모듈을 제공하고 있는 <a href="http://www.codeplex.com/IIRF" target="_blank">Ionics Isapi Rewrite Filter 홈페이지</a>를 방문하십시오.'); ?></li> 
     777        <li><?php echo _t('여기서 계속 진행하여 설치를 완료한 후, 생성된 <b>.htaccess</b> 파일의 내용을 위 모듈의 설정파일(<b>IsapiRewrite4.ini</b>)에 복사하시기 바랍니다.'); ?></li> 
     778        <input type="hidden" name="rewriteIIS" value="yes" /> 
     779    </ul> 
     780<?php 
     781                $error = 0; 
     782            } else { 
    769783?> 
    770784    <h3><?php echo _t('Apache Rewrite Engine');?></h3> 
     
    796810    </ul> 
    797811<?php 
     812            } 
    798813        } 
    799814?> 
     
    804819  </div> 
    805820  </div> 
    806   <input type="hidden" name="checked" value="<?php echo ($error ? '' : 'checked');?>" /> 
     821  <input type="hidden" name="checked" value="<?php echo ($error > 0 ? 'no' : 'yes');?>" /> 
    807822<?php 
    808823    } 
     
    813828        } 
    814829        // mod_rewrite routine. 
    815         if(empty($_POST['disableRewrite'])) { 
     830        if(empty($_POST['disableRewrite']) && empty($_POST['rewriteIIS'])) { 
    816831            $filename = $root . '/.htaccess'; 
    817832            $fp = fopen($filename, 'w+'); 
     
    841856            } 
    842857            @unlink($filename); 
     858        } else if (!empty($_POST['rewriteIIS'])) { 
     859            $rewrite = -1; 
    843860        } else { 
    844861            $rewrite = 0; 
     
    855872  <input type="hidden" name="checked" value="<?php echo (isset($_POST['checked']) ? $_POST['checked'] : '');?>" /> 
    856873  <input type="hidden" name="domain" value="<?php echo $domain;?>" /> 
    857   <input type="hidden" name="disableRewrite" value="<?php echo (isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : false);?>" /> 
     874  <input type="hidden" name="disableRewrite" value="<?php echo (isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : '');?>" /> 
     875  <input type="hidden" name="rewriteMode" value="<?php echo ($rewrite == -1) ? 'ISAPI' : 'mod_rewrite';?>" /> 
    858876  <div id="inner"> 
    859877  <h2><span class="step"><?php echo _f('%1단계', $step);?></span> : <?php echo _t('사용 가능한 운영 방법은 다음과 같습니다. 선택하여 주십시오.');?></h2> 
     
    861879    <table class="inputs"> 
    862880<?php 
    863         if ($rewrite >= 1) { 
     881        if ($rewrite != 0) { 
    864882?> 
    865883      <tr> 
     
    875893            } 
    876894?> 
    877         <label for="type2"><input type="radio" id="type2" name="type" value="path"<?php echo ($rewrite == 1 ? ' checked="checked"' : '');?> onclick="show('typePath');" /> 
     895        <label for="type2"><input type="radio" id="type2" name="type" value="path"<?php echo (($rewrite == 1 || $rewrite == -1) ? ' checked="checked"' : '');?> onclick="show('typePath');" /> 
    878896        <?php echo _t('하위 경로(Path)로 블로그 식별');?></label></td> 
    879897      </tr> 
     
    949967  <input type="hidden" name="checked" value="<?php echo (isset($_POST['checked']) ? $_POST['checked'] : '');?>" /> 
    950968  <input type="hidden" name="domain" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : '');?>" /> 
    951   <input type="hidden" name="disableRewrite" value="<?php echo (isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : false);?>" /> 
     969  <input type="hidden" name="disableRewrite" value="<?php echo (isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : '');?>" /> 
     970  <input type="hidden" name="rewriteMode" value="<?php echo (isset($_POST['rewriteMode']) ? $_POST['rewriteMode'] : '');?>" /> 
    952971  <input type="hidden" name="type" value="<?php echo (isset($_POST['type']) ? $_POST['type'] : '');?>" /> 
    953972  <div id="inner"> 
     
    10291048  <input type="hidden" name="domain" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : '');?>" /> 
    10301049  <input type="hidden" name="disableRewrite" value="<?php echo (isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : false);?>" /> 
     1050  <input type="hidden" name="rewriteMode" value="<?php echo (isset($_POST['rewriteMode']) ? $_POST['rewriteMode'] : '');?>" /> 
    10311051  <input type="hidden" name="type" value="<?php echo (isset($_POST['type']) ? $_POST['type'] : '');?>" /> 
    10321052  <input type="hidden" name="blog" value="<?php echo (isset($_POST['blog']) ? $_POST['blog'] : '');?>" /> 
     
    16011621            @chmod($filename, 0666); 
    16021622        } 
    1603         if(!isset($_POST['disableRewrite']) || !$_POST['disableRewrite']) {  
     1623        if(!isset($_POST['disableRewrite']) || !$_POST['disableRewrite']) { 
    16041624            $filename = $root . '/.htaccess'; 
    16051625            $fp = fopen($filename, 'w+'); 
    16061626         
    1607         $htaccessContent =  
     1627            switch ($_POST['rewriteMode']) { 
     1628            case 'ISAPI': 
     1629                // Users must copy these rules to IsapiRewrite4.ini 
     1630                $htaccessContent =  
     1631"RewriteCond %{REQUEST_FILENAME} -f 
     1632RewriteRule ^$path/(cache)+/+(.+[^/])\.(cache|xml|txt|log)$ - [NC,F,L,U] 
     1633RewriteCond %{REQUEST_FILENAME} -d 
     1634RewriteRule ^$path/([^?]+[^/])$ $path/$1/ [L,U] 
     1635RewriteCond %{REQUEST_FILENAME} !-f 
     1636RewriteRule ^$path/(thumbnail)/([0-9]+/.+)$ $path/cache/$1/$2 [L,U] 
     1637RewriteCond %{QUERY_STRING} ^$ 
     1638RewriteRule ^$path/(.*)$ $path/rewrite.php [L,U] 
     1639RewriteRule ^$path/(.*)$ $path/rewrite.php?%{QUERY_STRING} [L,U] 
     1640"; 
     1641                break; 
     1642            case 'mod_rewrite': 
     1643            default: 
     1644                $htaccessContent =  
    16081645"#<IfModule mod_url.c> 
    16091646#CheckURL Off 
     
    16121649RewriteEngine On 
    16131650RewriteBase $path/ 
    1614 RewriteRule ^(thumbnail)/([0-9]+/.+)$ cache/$1/$2 [L] 
    16151651RewriteCond %{REQUEST_FILENAME} -f 
    16161652RewriteRule ^(cache)+/+(.+[^/])\.(cache|xml|txt|log)$ - [NC,F,L] 
     
    16181654RewriteRule ^(.+[^/])$ $1/ [L] 
    16191655RewriteCond %{REQUEST_FILENAME} !-f 
     1656RewriteRule ^(thumbnail)/([0-9]+/.+)$ cache/$1/$2 [L] 
    16201657RewriteRule ^(.*)$ rewrite.php [L,QSA] 
    16211658"; 
     1659            } 
    16221660 
    16231661            if ($fp) { 
     
    16541692      </ul> 
    16551693      <p> 
     1694        <?php if (checkIIS()) echo _t('새로 IIS용 Rewrite 모듈을 설치하셨다면 <b>ISAPI Rewrite Filter 설정</b>을 해주십시오.<br />'); ?> 
    16561695        <?php echo _t('텍스트큐브 관리 툴로 로그인 하신 후 필요사항을 수정해 주십시오.');?><br /> 
    16571696        <?php echo _t('텍스트큐브를 이용해 주셔서 감사합니다.');?> 
     
    18911930        return testMyself_socket($host,$path,$port); 
    18921931    } 
     1932    return false; 
     1933} 
     1934 
     1935function checkIIS() { 
     1936    if (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) 
     1937        return true; 
    18931938    return false; 
    18941939}