コード例 #1
0
	function _doExecute()
	{
		if ($this->mActionForm->mFormFile != null) {
			if (!$this->mActionForm->mFormFile->saveAs(XOOPS_UPLOAD_PATH)) {
				return false;
			}
			
			if ($this->mActionForm->mOldFileName != null && $this->mActionForm->mOldFileName != "blank.gif") {
				@unlink(XOOPS_UPLOAD_PATH . "/" . $this->mActionForm->mOldFileName);
				
				//
				// Change user_avatar of all users who are setting this avatar.
				//
				if (!$this->mObject->isNew()) {
					$linkHandler =& xoops_getmodulehandler('avatar_user_link');
					$criteria =new Criteria('avatar_id', $this->mObject->get('avatar_id'));
					$linkArr =& $linkHandler->getObjects($criteria);

					$userHandler =& xoops_gethandler('user');
					foreach ($linkArr as $link) {
						$user =& $userHandler->get($link->get('user_id'));

						if (is_object($user)) {
							$user->set('user_avatar', $this->mObject->get('avatar_file'));
							$userHandler->insert($user);
						}
						unset($user);
					}
				}
			}
		}
		
		return parent::_doExecute();
	}
コード例 #2
0
 function _doExecute()
 {
     if ($this->mActionForm->mFormFile != null) {
         @unlink(XOOPS_UPLOAD_PATH . "/" . $this->mActionForm->mOldFileName);
         if (!$this->mActionForm->mFormFile->SaveAs(XOOPS_UPLOAD_PATH)) {
             return USER_FRAME_VIEW_ERROR;
         }
     }
     return parent::_doExecute();
 }
コード例 #3
0
	function _doExecute()
	{
		$ret = parent::_doExecute();
		if($ret===true){
			XCube_DelegateUtils::call('Legacy_Profile.SaveProfile', new XCube_Ref($ret), $this->mActionForm);
		}
		return $ret;
	}
コード例 #4
0
	function _doExecute()
	{
		if ($this->mActionForm->mFormFile != null) {
			if (!$this->mActionForm->mFormFile->saveAs(XOOPS_UPLOAD_PATH)) {
				return false;
			}
		}
	
		$this->_resize();
		
		if ($this->mActionForm->mOldAvatarFilename != null && $this->mActionForm->mOldAvatarFilename != "blank.gif") {
			$avatarHandler =& xoops_getmodulehandler('avatar', 'user');
			$criteria =new Criteria('avatar_file', $this->mActionForm->mOldAvatarFilename);
			$avatarArr =& $avatarHandler->getObjects($criteria);
			if (count($avatarArr) > 0 && is_object($avatarArr[0]) && $avatarArr[0]->get('avatar_type') == 'C') {
				$avatarHandler->delete($avatarArr[0]);
			}
		}
		
		if (parent::_doExecute()) {
			$avatar =& $this->mActionForm->createAvatar();
			if ($avatar != null) {
				$avatar->set('avatar_name', $this->mObject->get('uname'));
				$avatarHandler =& xoops_getmodulehandler('avatar', 'user');
				$avatarHandler->insert($avatar);
				
				$linkHandler =& xoops_getmodulehandler('avatar_user_link', 'user');
				$linkHandler->deleteAllByUser($this->mObject);
				
				$link =& $linkHandler->create();
				$link->set('user_id', $this->mObject->get('uid'));
				$link->set('avatar_id', $avatar->get('avatar_id'));
				
				$linkHandler->insert($link);
			}
			
			return true;
		}
		else {
			return false;
		}
	}