Changeset 20418


Ignore:
Timestamp:
2011/02/26 18:59:06 (13 years ago)
Author:
shutta
Message:

refs #1047 #1016
ファイル管理で、拡張子のないファイルを表示しようとするとエラーになっていたのを修正。
#1016r20209 にて、リファクタリング後に元実装と挙動が変わってしまっていたのを修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_FileView.php

    r20417 r20418  
    114114        $file = $objFormParam->getValue('file'); 
    115115 
    116         // ソースとして表示するファイルを定義(直接実行しないファイル) 
    117         $arrViewFile = array( 
    118             'html', 
    119             'htm', 
    120             'tpl', 
    121             'php', 
    122             'css', 
    123             'js', 
    124         ); 
    125  
    126         $extension = pathinfo($objFormParam->getValue('file'), PATHINFO_EXTENSION); 
    127  
    128         if (!preg_match('|\./|', $file) && in_array($extension, $arrViewFile)) { 
     116        if (!preg_match('|\./|', $file)) { 
    129117            $file_check_flg = true; 
    130118        } 
     
    139127     */ 
    140128    function execFileView($objFormParam) { 
    141         $objFileManager = new SC_Helper_FileManager_Ex(); 
    142         // ファイルを読み込んで表示 
    143         header("Content-type: text/plain\n\n"); 
    144         print($objFileManager->sfReadFile(USER_REALDIR . $objFormParam->getValue('file'))); 
     129        $file = $objFormParam->getValue('file'); 
     130 
     131        // ソースとして表示するファイルを定義(直接実行しないファイル) 
     132        $arrViewFile = array( 
     133            'html', 
     134            'htm', 
     135            'tpl', 
     136            'php', 
     137            'css', 
     138            'js', 
     139        ); 
     140 
     141        $extension = pathinfo($file, PATHINFO_EXTENSION); 
     142 
     143        if (in_array($extension, $arrViewFile)) { 
     144            $objFileManager = new SC_Helper_FileManager_Ex(); 
     145            // ファイルを読み込んで表示 
     146            header("Content-type: text/plain\n\n"); 
     147            print($objFileManager->sfReadFile(USER_REALDIR . $file)); 
     148        } else { 
     149            SC_Response_Ex::sendRedirect(USER_URL . $file); 
     150        } 
    145151    } 
    146152} 
Note: See TracChangeset for help on using the changeset viewer.