Changeset 21755


Ignore:
Timestamp:
2012/04/17 15:53:10 (12 years ago)
Author:
shutta
Message:

#515 PHP 5.3.0対応
PHP5.3以降で、非推奨関数となるereg系関数を書き換えた。

Location:
branches/version-2_12-dev/data/class
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/SC_CustomerList.php

    r21608 r21755  
    8585            $this->setWhere('(' . $dbFactory->concatColumn(array('tel01', 'tel02', 'tel03')) . ' LIKE ?)'); 
    8686            $searchTel = $this->addSearchStr($this->arrSql['search_tel']); 
    87             $this->arrVal[] = ereg_replace('-', '', $searchTel); 
     87            $this->arrVal[] = str_replace('-', '', $searchTel); 
    8888        } 
    8989 
  • branches/version-2_12-dev/data/class/SC_Image.php

    r21526 r21755  
    2929    function SC_Image($tmp_dir) { 
    3030        // ヘッダファイル読込 
    31         if (!ereg("/$", $tmp_dir)) { 
    32             $this->tmp_dir = $tmp_dir . '/'; 
    33         } else { 
    34             $this->tmp_dir = $tmp_dir; 
    35         } 
     31        $this->tmp_dir = rtrim($tmp_dir, '/') . '/'; 
    3632    } 
    3733 
     
    4137        $mainname = uniqid('').'.'; 
    4238        // 拡張子以外を置き換える。 
    43         $newFileName = ereg_replace("^.*\.",$mainname, $_FILES[$keyname]['name']); 
     39        $newFileName = preg_replace("/^.*\./", $mainname, $_FILES[$keyname]['name']); 
    4440        $result  = $this->MakeThumb($_FILES[$keyname]['tmp_name'], $this->tmp_dir , $max_width, $max_height, $newFileName); 
    4541        GC_Utils_Ex::gfDebugLog($result); 
  • branches/version-2_12-dev/data/class/SC_UploadFile.php

    r21684 r21755  
    5959    // ファイル管理クラス 
    6060    function SC_UploadFile($temp_dir, $save_dir) { 
    61         $this->temp_dir = (preg_match("|/$|", $temp_dir) == 0) ? $temp_dir. '/' : $temp_dir; 
    62         $this->save_dir = (preg_match("|/$|", $save_dir) == 0) ? $save_dir. '/' : $save_dir; 
     61        $this->temp_dir = rtrim($temp_dir, '/') . '/'; 
     62        $this->save_dir = rtrim($save_dir, '/') . '/'; 
    6363        $this->file_max = 0; 
    6464    } 
     
    117117                            if ($rename) { 
    118118                                $uniqname = date('mdHi') . '_' . uniqid('').'.'; 
    119                                 $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']); 
     119                                $this->temp_file[$cnt] = preg_replace("/^.*\./", $uniqname, $_FILES[$keyname]['name']); 
    120120                            } else { 
    121121                                $this->temp_file[$cnt] = $_FILES[$keyname]['name']; 
     
    155155                        // 一意なファイル名を作成する。 
    156156                        $uniqname = date('mdHi') . '_' . uniqid('').'.'; 
    157                         $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']); 
     157                        $this->temp_file[$cnt] = preg_replace("/^.*\./", $uniqname, $_FILES[$keyname]['name']); 
    158158                        set_time_limit(0); 
    159159                        $result  = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]); 
     
    229229                if (isset($this->save_file[$cnt]) 
    230230                    && $this->save_file[$cnt] != '' 
    231                     && !ereg('^sub/', $this->save_file[$cnt]) 
     231                    && !preg_match('|^sub/|', $this->save_file[$cnt]) 
    232232                ) { 
    233233 
     
    249249                if (isset($this->save_file[$cnt]) 
    250250                    && $this->save_file[$cnt] != '' 
    251                     && !ereg('^sub/', $this->save_file[$cnt]) 
     251                    && !preg_match('|^sub/|', $this->save_file[$cnt]) 
    252252                ) { 
    253253                    $objImage->deleteImage($this->save_file[$cnt], $this->save_dir); 
     
    311311        foreach ($this->keyname as $val) { 
    312312            if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 
    313                 // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 
    314                 if (ereg("/$", $temp_url)) { 
    315                     $arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt]; 
    316                 } else { 
    317                     $arrRet[$val]['filepath'] = $temp_url . '/' . $this->temp_file[$cnt]; 
    318                 } 
     313                // パスのスラッシュ/が連続しないようにする。 
     314                $arrRet[$val]['filepath'] = rtrim($temp_url, '/') . '/' . $this->temp_file[$cnt]; 
     315 
    319316                $arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt]; 
    320317            } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') { 
    321                 // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 
    322                 if (ereg("/$", $save_url)) { 
    323                     $arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt]; 
    324                 } else { 
    325                     $arrRet[$val]['filepath'] = $save_url . '/' . $this->save_file[$cnt]; 
    326                 } 
     318                // パスのスラッシュ/が連続しないようにする。 
     319                $arrRet[$val]['filepath'] = rtrim($save_url, '/') . '/' . $this->save_file[$cnt]; 
     320 
    327321                $arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt]; 
    328322            } 
     
    438432        foreach ($this->keyname as $val) { 
    439433            if ($arrVal[$val] != '') { 
    440                 if ($this->save_file[$cnt] == '' && !ereg('^sub/', $arrVal[$val])) { 
     434                if ($this->save_file[$cnt] == '' && !preg_match('|^sub/|', $arrVal[$val])) { 
    441435                    $objImage->deleteImage($arrVal[$val], $this->save_dir); 
    442436                } 
     
    451445        $cnt = 0; 
    452446        if ($arrVal['down_realfilename'] != '') { 
    453             if ($this->save_file[$cnt] == '' && !ereg('^sub/', $arrVal['down_realfilename'])) { 
     447            if ($this->save_file[$cnt] == '' && !preg_match('|^sub/|', $arrVal['down_realfilename'])) { 
    454448                $objImage->deleteImage($arrVal['down_realfilename'], $this->save_dir); 
    455449            } 
  • branches/version-2_12-dev/data/class/helper/SC_Helper_FileManager.php

    r21684 r21755  
    4646                // 行末の/を取り除く 
    4747                while (($file = readdir($dh)) !== false) $arrDir[] = $file; 
    48                 $dir = ereg_replace("/$", '', $dir); 
     48                $dir = rtrim($dir, '/'); 
    4949                // アルファベットと数字でソート 
    5050                natcasesort($arrDir); 
     
    9898                while ($file = readdir($handle)) { 
    9999                    // 行末の/を取り除く 
    100                     $dir = ereg_replace("/$", '', $dir); 
     100                    $dir = rtrim($dir, '/'); 
    101101                    $path = $dir.'/'.$file; 
    102102                    if ($file != '..' && $file != '.' && !is_dir($path)) { 
     
    173173 
    174174        // 文末の/を取り除く 
    175         $dir = ereg_replace("/$", '', $dir); 
     175        $dir = rtrim($dir, '/'); 
    176176        // 最上位層を格納(user_data/) 
    177177        if ($this->sfDirChildExists($dir)) { 
     
    217217                    if ($item != '.' && $item != '..') { 
    218218                        // 文末の/を取り除く 
    219                         $dir = ereg_replace("/$", '', $dir); 
     219                        $dir = rtrim($dir, '/'); 
    220220                        $path = $dir.'/'.$item; 
    221221                        // ディレクトリのみ取得 
     
    258258                while ($file = readdir($handle)) { 
    259259                    // 行末の/を取り除く 
    260                     $dir = ereg_replace("/$", '', $dir); 
     260                    $dir = rtrim($dir, '/'); 
    261261                    $path = $dir.'/'.$file; 
    262262                    if ($file != '..' && $file != '.' && is_dir($path)) { 
  • branches/version-2_12-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_FileManager.php

    r21743 r21755  
    109109                if (SC_Utils_Ex::isBlank($this->arrErr)) { 
    110110                    if ($this->tryView($objFormParam)) { 
    111                         $file_url = htmlspecialchars(ereg_replace($objFormParam->getValue('top_dir'), '', $objFormParam->getValue('select_file'))); 
     111                        $pattern = '/' . preg_quote($objFormParam->getValue('top_dir'), '/') . '/'; 
     112                        $file_url = htmlspecialchars(preg_replace($pattern, '', $objFormParam->getValue('select_file'))); 
    112113                        $tpl_onload = "win02('./file_view.php?file=". $file_url ."', 'user_data', '600', '400');"; 
    113114                        $this->setTplOnLoad($tpl_onload); 
     
    317318    function tryCreateDir($objFileManager, $objFormParam) { 
    318319        $create_dir_flg = false; 
    319         $create_dir = ereg_replace("/$", '', $objFormParam->getValue('now_dir')); 
     320        $create_dir = rtrim($objFormParam->getValue('now_dir'), '/'); 
    320321        // ファイル作成 
    321322        if ($objFileManager->sfCreateFile($create_dir.'/'.$objFormParam->getValue('create_file'), 0755)) { 
     
    425426    function lfGetParentDir($dir) { 
    426427        $parent_dir = ''; 
    427         $dir = ereg_replace("/$", '', $dir); 
     428        $dir = rtrim($dir, '/'); 
    428429        $arrDir = explode('/', $dir); 
    429430        array_pop($arrDir); 
     
    431432            $parent_dir .= "$val/"; 
    432433        } 
    433         $parent_dir = ereg_replace("/$", '', $parent_dir); 
     434        $parent_dir = rtrim($parent_dir, '/'); 
    434435        return $parent_dir; 
    435436    } 
     
    478479        $is_top_dir = false; 
    479480        // 末尾の/をとる 
    480         $top_dir_check = ereg_replace("/$", '', $objFormParam->getValue('top_dir')); 
    481         $now_dir_check = ereg_replace("/$", '', $objFormParam->getValue('now_dir')); 
     481        $top_dir_check = rtrim($objFormParam->getValue('top_dir'), '/'); 
     482        $now_dir_check = rtrim($objFormParam->getValue('now_dir'), '/'); 
    482483        if ($top_dir_check == $now_dir_check) { 
    483484            $is_top_dir = true; 
  • branches/version-2_12-dev/data/class/pages/admin/total/LC_Page_Admin_Total.php

    r21743 r21755  
    417417 
    418418            foreach (array_keys($arrList) as $val) { 
    419                 $arrKey[] = ereg_replace('~', '-', $val); 
     419                $arrKey[] = mb_ereg_replace('~', '-', $val); 
    420420            } 
    421421 
  • branches/version-2_12-dev/data/class/util/SC_Utils.php

    r21750 r21755  
    503503            } 
    504504            if ($space) { 
    505                 $line = ereg_replace(", $", '', $line); 
     505                $line = preg_replace("/, $/", '', $line); 
    506506            } else { 
    507                 $line = ereg_replace(",$", '', $line); 
     507                $line = preg_replace("/,$/", '', $line); 
    508508            } 
    509509            return $line; 
     
    522522                $line .= '"' .$val. '",'; 
    523523            } 
    524             $line = ereg_replace(",$", "\r\n", $line); 
     524            $line = preg_replace("/,$/", "\r\n", $line); 
    525525        } else { 
    526526            return false; 
     
    714714    /* 文末の「/」をなくす */ 
    715715    function sfTrimURL($url) { 
    716         $ret = ereg_replace("[/]+$", '', $url); 
     716        $ret = rtrim($url, '/'); 
    717717        return $ret; 
    718718    } 
     
    813813    // 二回以上繰り返されているスラッシュ[/]を一つに変換する。 
    814814    function sfRmDupSlash($istr) { 
    815         if (ereg('^http://', $istr)) { 
     815        if (preg_match('|^http://|', $istr)) { 
    816816            $str = substr($istr, 7); 
    817817            $head = 'http://'; 
    818         } else if (ereg('^https://', $istr)) { 
     818        } else if (preg_match('|^https://|', $istr)) { 
    819819            $str = substr($istr, 8); 
    820820            $head = 'https://'; 
     
    822822            $str = $istr; 
    823823        } 
    824         $str = ereg_replace('[/]+', '/', $str); 
     824        $str = preg_replace('|[/]+|', '/', $str); 
    825825        $ret = $head . $str; 
    826826        return $ret; 
     
    985985    // DB取得日時をタイムに変換 
    986986    function sfDBDatetoTime($db_date) { 
    987         $date = ereg_replace("\..*$",'',$db_date); 
     987        $date = preg_replace("|\..*$|",'',$db_date); 
    988988        $time = strtotime($date); 
    989989        return $time; 
     
    10761076        $count++;  // 無限ループ回避 
    10771077        $dir = dirname($path); 
    1078         if (ereg("^[/]$", $dir) || ereg("^[A-Z]:[\\]$", $dir) || $count > 256) { 
     1078        if (preg_match("|^[/]$|", $dir) || preg_match("|^[A-Z]:[\\]$|", $dir) || $count > 256) { 
    10791079            // ルートディレクトリで終了 
    10801080            return; 
     
    11181118            foreach ($fileArray as $key => $data_) { 
    11191119                // CVS管理ファイルはコピーしない 
    1120                 if (ereg('/CVS/Entries', $data_)) { 
     1120                if (strpos($data_, '/CVS/Entries') !== false) { 
    11211121                    break; 
    11221122                } 
    1123                 if (ereg('/CVS/Repository', $data_)) { 
     1123                if (strpos($data_, '/CVS/Repository') !== false) { 
    11241124                    break; 
    11251125                } 
    1126                 if (ereg('/CVS/Root', $data_)) { 
     1126                if (strpos($data_, '/CVS/Root') !== false) { 
    11271127                    break; 
    11281128                } 
     
    12421242                while (!feof($src_fp)) { 
    12431243                    $line = fgets($src_fp); 
    1244                     if (ereg('@version', $line)) { 
     1244                    if (strpos($line, '@version') !== false) { 
    12451245                        $arrLine = explode(' ', $line); 
    12461246                        $version = $arrLine[5]; 
     
    13251325                // 行末の/を取り除く 
    13261326                while (($file = readdir($dh)) !== false) $arrDir[] = $file; 
    1327                 $dir = ereg_replace("/$", '', $dir); 
     1327                $dir = rtrim($dir, '/'); 
    13281328                // アルファベットと数字でソート 
    13291329                natcasesort($arrDir); 
     
    13751375                while ($file = readdir($handle)) { 
    13761376                    // 行末の/を取り除く 
    1377                     $dir = ereg_replace("/$", '', $dir); 
     1377                    $dir = rtrim($dir, '/'); 
    13781378                    $path = $dir.'/'.$file; 
    13791379                    if ($file != '..' && $file != '.' && !is_dir($path)) { 
     
    14101410 
    14111411        // 文末の/を取り除く 
    1412         $dir = ereg_replace("/$", '', $dir); 
     1412        $dir = rtrim($dir, '/'); 
    14131413        // 最上位層を格納(user_data/) 
    14141414        if (sfDirChildExists($dir)) { 
     
    14511451                    if ($item != '.' && $item != '..') { 
    14521452                        // 文末の/を取り除く 
    1453                         $dir = ereg_replace("/$", '', $dir); 
     1453                        $dir = rtrim($dir, '/'); 
    14541454                        $path = $dir.'/'.$item; 
    14551455                        // ディレクトリのみ取得 
     
    14911491                while ($file = readdir($handle)) { 
    14921492                    // 行末の/を取り除く 
    1493                     $dir = ereg_replace("/$", '', $dir); 
     1493                    $dir = rtrim($dir, '/'); 
    14941494                    $path = $dir.'/'.$file; 
    14951495                    if ($file != '..' && $file != '.' && is_dir($path)) { 
Note: See TracChangeset for help on using the changeset viewer.