Пример #1
0
 protected function prepareParams()
 {
     if (!array_key_exists("USE_CAPTCHA", $this->arParams)) {
         $this->arParams["USE_CAPTCHA"] = $this->forum["USE_CAPTCHA"];
     }
     if ($this->arParams["USE_CAPTCHA"] == "Y" && !$this->getUser()->IsAuthorized()) {
         include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
         $this->captcha = new CCaptcha();
         $captchaPass = COption::GetOptionString("main", "captcha_password", "");
         if (strlen($captchaPass) <= 0) {
             $captchaPass = randString(10);
             COption::SetOptionString("main", "captcha_password", $captchaPass);
         }
     }
     if ($this->arParams["SUBSCRIBE_AUTHOR_ELEMENT"] == "Y" && $this->getUser()->IsAuthorized()) {
         AddEventHandler("forum", "OnAfterCommentTopicAdd", array(&$this, "subscribeAuthor"));
     }
     if (in_array($this->arParams["ALLOW_UPLOAD"], array("A", "Y", "F", "N", "I"))) {
         $this->feed->expandForum(array("ALLOW_UPLOAD" => $this->arParams["ALLOW_UPLOAD"] == "I" ? "Y" : $this->arParams["ALLOW_UPLOAD"], "ALLOW_UPLOAD_EXT" => $this->arParams["ALLOW_UPLOAD_EXT"]));
     }
     $this->arResult["ERROR_MESSAGE"] = "";
     $this->arResult["OK_MESSAGE"] = "";
     if ($this->request["result"] == "reply") {
         $this->arResult["OK_MESSAGE"] = Loc::getMessage("COMM_COMMENT_OK");
     } else {
         if ($this->request["result"] == "not_approved") {
             $this->arResult["OK_MESSAGE"] = Loc::getMessage("COMM_COMMENT_OK_AND_NOT_APPROVED");
         }
     }
     unset($_GET["result"]);
     unset($GLOBALS["HTTP_GET_VARS"]["result"]);
     return $this;
 }