Esempio n. 1
0
 private function onPost($nickname, $target, $message)
 {
     # Validate the crap!
     if (false !== ($error = GWF_ChatValidator::validate_yournick($this->module, $nickname))) {
         return $error;
     }
     if (false !== ($error = GWF_ChatValidator::validate_target($this->module, $target))) {
         $error;
     }
     if (false !== ($error = GWF_ChatValidator::validate_message($this->module, $message))) {
         return $error;
     }
     # Post it!
     $oldnick = $this->module->getNickname();
     $sender = Common::getPost('yournick', $oldnick);
     $target = trim($target);
     $message = str_replace("\n", '<br/>', Common::getPost('message'));
     if ($oldnick === false) {
         $sender = $this->module->getGuestPrefixed($sender);
         $this->module->setGuestNick($sender);
     } else {
         $sender = $oldnick;
     }
     if (false === GWF_ChatMsg::newMessage($sender, $target, $message)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return '1';
 }
Esempio n. 2
0
 public function validate_message(Module_Chat $module, $arg)
 {
     return GWF_ChatValidator::validate_message($this->module, $arg);
 }