Minahito
minah****@users*****
2006年 1月 26日 (木) 20:11:37 JST
Index: xoops2jp/html/modules/user/admin/forms/AvatarAdminEditForm.class.php diff -u xoops2jp/html/modules/user/admin/forms/AvatarAdminEditForm.class.php:1.1.2.1 xoops2jp/html/modules/user/admin/forms/AvatarAdminEditForm.class.php:1.1.2.2 --- xoops2jp/html/modules/user/admin/forms/AvatarAdminEditForm.class.php:1.1.2.1 Thu Jan 19 21:07:26 2006 +++ xoops2jp/html/modules/user/admin/forms/AvatarAdminEditForm.class.php Thu Jan 26 20:11:37 2006 @@ -35,8 +35,7 @@ $this->mFieldProperties['avatar_id']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_AVATAR_ID); $this->mFieldProperties['avatar_file'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['avatar_file']->setDependsByArray(array('required','extension')); - $this->mFieldProperties['avatar_file']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_AVATAR_FILE); + $this->mFieldProperties['avatar_file']->setDependsByArray(array('extension')); $this->mFieldProperties['avatar_file']->addMessage('extension', _AD_USER_ERROR_AVATAR_EXTENSION, _AD_USER_LANG_AVATAR_FILE); $this->mFieldProperties['avatar_file']->addVar('extension', "gif,png,jpg"); @@ -51,7 +50,7 @@ $this->mFieldProperties['avatar_weight']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_AVATAR_WEIGHT); } - function validateRank_image() + function validateAvatar_file() { if ($this->_mIsNew && $this->get('avatar_file') == null) { $this->addErrorMessage(_AD_USER_ERROR_IMAGE_REQUIRED); @@ -66,7 +65,7 @@ $this->set('avatar_weight', $obj->get('avatar_weight')); $this->_mIsNew = $obj->isNew(); - $this->mOldFileName = $obj->get('rank_image'); + $this->mOldFileName = $obj->get('avatar_file'); } function update(&$obj) @@ -79,6 +78,9 @@ $this->mFormFile = $this->get('avatar_file'); if ($this->mFormFile != null) { $this->mFormFile->setRandomToBodyName('savt'); + $filename = $this->mFormFile->getBodyName(); + $this->mFormFile->setBodyName(substr($filename, 0, 24)); + $obj->setVar('avatar_file', $this->mFormFile->getFileName()); $obj->setVar('avatar_mimetype', $this->mFormFile->getContentType()); }