/** * @throws AnwBadCommentException */ function __construct($nType, $oPage, $nTime, $sComment, $sInfo = "", $sPageName = "", $sPageLang = "") { if (!self::isValidComment($sComment)) { throw new AnwBadCommentException(); } $this->nType = $nType; $this->nTime = $nTime; $this->sComment = $sComment; if ($oPage) { if ($oPage->exists()) { $this->nPageId = $oPage->getId(); } $this->oPage = $oPage; } $this->sInfo = $sInfo; $this->sPageName = $sPageName ? $sPageName : ($oPage ? $oPage->getName() : ""); $this->sPageLang = $sPageLang ? $sPageLang : ($oPage ? $oPage->getLang() : ""); $this->oUser = AnwCurrentSession::getUser(); $this->sIp = AnwCurrentSession::getIp(); }