Minahito
minah****@users*****
2007年 2月 16日 (金) 15:07:21 JST
Index: xoops2jp/html/core/XCube_FormFile.class.php diff -u xoops2jp/html/core/XCube_FormFile.class.php:1.1.2.4 xoops2jp/html/core/XCube_FormFile.class.php:1.1.2.4.2.1 --- xoops2jp/html/core/XCube_FormFile.class.php:1.1.2.4 Thu Dec 28 23:17:48 2006 +++ xoops2jp/html/core/XCube_FormFile.class.php Fri Feb 16 15:07:21 2007 @@ -2,12 +2,15 @@ /** * * @package XCube - * @version $Id: XCube_FormFile.class.php,v 1.1.2.4 2006/12/28 14:17:48 nobunobu Exp $ + * @version $Id: XCube_FormFile.class.php,v 1.1.2.4.2.1 2007/02/16 06:07:21 minahito Exp $ * @copyright Copyright 2005, 2006 XOOPS Cube Project <http://xoopscube.org/> * @license http://xoopscube.sourceforge.net/bsd_licenses.txt Modified BSD license * */ +define("XCUBE_FORMFILE_PREVMASK", "0022"); +define("XCUBE_FORMFILE_CHMOD", "0644"); + /** * WARNING: * This class is simple wrapper class for proccessing the file uploaded. @@ -220,15 +223,25 @@ */ function saveAs($file) { + + $destFile = ""; if(preg_match("#\/$#",$file)) { - return move_uploaded_file($this->_mTmpFileName,$file.$this->getFileName()); + $destFile = $file . $this->getFileName(); } elseif(is_dir($file)) { - return move_uploaded_file($this->_mTmpFileName,$file."/".$this->getFileName()); + $destFile = $file . "/" . $this->getFileName(); } else { - return move_uploaded_file($this->_mTmpFileName,$file); + $destFile = $file; } + + $ret = move_uploaded_file($this->_mTmpFileName, $destFile); + + $prevMask = @umask(XCUBE_FORMFILE_PREVMASK); + @umask($prevMask); + @chmod($destFile, XCUBE_FORMFILE_CHMOD); + + return $ret; } /**