Changeset 19760


Ignore:
Timestamp:
2010/12/25 14:31:06 (13 years ago)
Author:
Seasoft
Message:

#771(magic_quotes_gpc が有効な環境を考慮する)実装

Location:
branches/version-2_5-dev
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/SC_Initial.php

    r19738 r19760  
    5959        $this->mbstringInit(); 
    6060        $this->createCacheDir(); 
     61        $this->stripslashesDeepGpc(); 
    6162        $this->resetSuperglobalsRequest(); 
    6263    } 
     
    319320 
    320321    /** 
     322     * クォートされた文字列のクォート部分を再帰的に取り除く 
     323     * 
     324     * {@link http://jp2.php.net/manual/ja/function.get-magic-quotes-gpc.php PHP Manual} の記事を参考に実装。 
     325     * $_REQUEST は後続の処理で再構成されるため、本処理では外している。 
     326     * @return void 
     327     */ 
     328    function stripslashesDeepGpc() { 
     329        // Strip magic quotes from request data. 
     330        if (get_magic_quotes_gpc()) { 
     331            // Create lamba style unescaping function (for portability) 
     332            $quotes_sybase = strtolower(ini_get('magic_quotes_sybase')); 
     333            $unescape_function = (empty($quotes_sybase) || $quotes_sybase === 'off') ? 'stripslashes($value)' : 'str_replace("\'\'","\'",$value)'; 
     334            $stripslashes_deep = create_function('&$value, $fn', ' 
     335                if (is_string($value)) { 
     336                    $value = ' . $unescape_function . '; 
     337                } else if (is_array($value)) { 
     338                    foreach ($value as &$v) $fn($v, $fn); 
     339                } 
     340            '); 
     341 
     342            // Unescape data 
     343            $stripslashes_deep($_POST, $stripslashes_deep); 
     344            $stripslashes_deep($_GET, $stripslashes_deep); 
     345            $stripslashes_deep($_COOKIE, $stripslashes_deep); 
     346        } 
     347    } 
     348 
     349    /** 
    321350     * スーパーグローバル変数「$_REQUEST」を再セット 
    322351     * 
  • branches/version-2_5-dev/html/install/index.php

    r19754 r19760  
    434434    if (ini_get('safe_mode')) { 
    435435        $mess .= ">> ×:PHPのセーフモードが有効になっています。<br>"; 
     436        $hasErr = true; 
     437    } 
     438 
     439    if (get_magic_quotes_gpc()) { 
     440        $mess .= ">> ×:PHPの設定ディレクティブ「magic_quotes_gpc」が有効になっています。<br>"; 
    436441        $hasErr = true; 
    437442    } 
Note: See TracChangeset for help on using the changeset viewer.