コード例 #1
0
ファイル: PwWordFilter.php プロジェクト: chendong0444/phpwind
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
ファイル: MyspaceController.php プロジェクト: healthguo/PHP
	/**
	 * 空间基本信息处理
	 * Enter description here ...
	 */
	public function doEditSpaceAction() {
		$spaceName = $this->getInput('spacename','post');
		$descrip = $this->getInput('descrip','post');
		
		//个性域名
		list($domain, $spaceroot) = $this->getInput(array('domain', 'spaceroot'));
		if ($spaceroot) {
			if (!$domain) {
				$this->_spaceDomainDs()->delDomain($this->loginUser->uid);
			}
			else {
				$uid = $this->_spaceDomainDs()->getUidByDomain($domain);
				if ($uid && $uid != $this->loginUser->uid) $this->showError('REWRITE:domain.exist');
				$r = $this->_spaceDomainDs()->getDomainByUid($this->loginUser->uid);
				if (!$r) $this->_spaceDomainDs()->addDomain($this->loginUser->uid, $domain);
				else $this->_spaceDomainDs()->updateDomain($this->loginUser->uid, $domain);
			}
		}
		
		Wind::import('SRV:word.srv.PwWordFilter');
		$word = PwWordFilter::getInstance();
		if ($word->filter($spaceName))$this->showError("SPACE:spacename.filter.fail");
		if ($word->filter($descrip)) $this->showError("SPACE:descrip.filter.fail");
		
		Wind::import('SRV:space.dm.PwSpaceDm');
 		$dm = new PwSpaceDm($this->loginUser->uid);
 		$dm->setSpaceName($spaceName)
			->setSpaceDescrip($descrip)
			->setSpaceDomain($domain);
		$resource = $this->_getSpaceDs()->updateInfo($dm);
		if ($resource instanceof PwError) $this->showError($resource->getError());
		$this->showMessage("MEDAL:success");
	}