コード例 #1
0
ファイル: Send.php プロジェクト: sinfocol/gwf3
 private function sanitize()
 {
     if (!GWF_User::isLoggedIn() && !$this->module->cfgGuestPMs()) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     $this->user = GWF_User::getStaticOrGuest();
     if ($this->user->isBot()) {
         return $this->module->error('err_bot');
     }
     if (false !== ($uname = Common::getGet('to'))) {
         if (false === ($this->rec = GWF_User::getByName($uname)) || $this->rec->isDeleted()) {
             return GWF_HTML::err('ERR_UNKNOWN_USER');
         }
     }
     if (false !== ($pmid = Common::getGetString('reply', false))) {
         if (false === ($pm = GWF_PM::getByID($pmid))) {
             return $this->module->error('err_pm');
         }
         $this->rec = $pm->getSender();
     }
     if (false !== ($pmid = Common::getGetString('quote', false))) {
         if (false === ($pm = GWF_PM::getByID($pmid))) {
             return $this->module->error('err_pm');
         }
         $this->rec = $pm->getSender();
     }
     if ($this->rec === false) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false !== ($error = $this->module->validate_limits($this->user, $this->rec))) {
         return GWF_HTML::error('PM', $error);
     }
     if ($this->rec === false) {
         $pmid = max(Common::getGetInt('reply'), Common::getGetInt('quote'));
         if (false !== ($error = $this->sanitizePM($pmid))) {
             return $error;
         }
     }
     return false;
 }