Changeset 23590 for branches/version-2_13-dev/data
- Timestamp:
- 2014/08/14 11:37:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/util/SC_Utils.php
r23546 r23590 1795 1795 * この関数は, パスの存在チェックを行なわないため注意すること. 1796 1796 * 1797 * @param string $realpath チェック対象のパス 1797 * use File_Util::isAbsolute 1798 * http://pear.php.net/package/File_Util/ 1799 * 1800 * @param string $path チェック対象のパス 1798 1801 * @return boolean 絶対パスの場合 true 1799 1802 */ 1800 public static function isAbsoluteRealPath($realpath) 1801 { 1802 if (strpos(PHP_OS, 'WIN') === false) { 1803 return substr($realpath, 0, 1) == '/'; 1804 } else { 1805 return preg_match('/^[a-zA-Z]:(\\\|\/)/', $realpath) ? true : false; 1806 } 1803 public static function isAbsoluteRealPath($path) 1804 { 1805 if (preg_match('/(?:\/|\\\)\.\.(?=\/|$)/', $path)) { 1806 return false; 1807 } 1808 if (!strncasecmp(PHP_OS, 'win', 3)) { 1809 return (($path{0} == '/') || preg_match('/^[a-zA-Z]:(\\\|\/)/', $path)); 1810 } 1811 return ($path{0} == '/') || ($path{0} == '~'); 1807 1812 } 1808 1813 1809 1814 /** 1810 1815 * ディレクトリを再帰的に作成する. 1811 *1812 * mkdir 関数の $recursive パラメーターを PHP4 でサポートする.1813 1816 * 1814 1817 * @param string $pathname ディレクトリのパス … … 1817 1820 * @see http://jp.php.net/mkdir 1818 1821 */ 1819 public static function recursiveMkdir($pathname, $mode = 0777) 1820 { 1821 /* 1822 * SC_Utils_Ex への再帰は無限ループやメモリリークの懸念 1823 * 自クラスへ再帰する. 1824 */ 1825 is_dir(dirname($pathname)) || SC_Utils::recursiveMkdir(dirname($pathname), $mode); 1826 1827 return is_dir($pathname) || @mkdir($pathname, $mode); 1822 public static function recursiveMkdir($path, $mode = 0777) 1823 { 1824 // Windows環境ではmodeは効かない 1825 return mkdir($path, $mode, true); 1828 1826 } 1829 1827
Note: See TracChangeset
for help on using the changeset viewer.
