Ejemplo n.º 1
0
     $comment_text = $_REQUEST["message"];
     CUtil::decodeURIComponent($comment_text);
     $comment_text = trim($comment_text);
 }
 if (!isset($arResult["strMessage"])) {
     if (strlen($comment_text) <= 0) {
         $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_EMPTY");
     }
 }
 if (!isset($arResult["strMessage"])) {
     $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "LOG_ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => "N", "SMILES" => "N");
     if ($editCommentID > 0 && $arComment) {
         $bHasEditCallback = is_array($arCommentEvent) && isset($arCommentEvent["UPDATE_CALLBACK"]) && ($arCommentEvent["UPDATE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["UPDATE_CALLBACK"]));
         if ($bHasEditCallback && $arComment["USER_ID"] == $GLOBALS["USER"]->GetId()) {
             $arFields = array("MESSAGE" => $comment_text, "TEXT_MESSAGE" => $comment_text, "EVENT_ID" => $arComment["EVENT_ID"]);
             CSocNetLogComponent::checkEmptyUFValue('UF_SONET_COM_DOC');
             $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arFields);
             if (!empty($_POST["attachedFilesRaw"]) && is_array($_POST["attachedFilesRaw"])) {
                 CSocNetLogComponent::saveRawFilesToUF($_POST["attachedFilesRaw"], IsModuleInstalled("webdav") || IsModuleInstalled("disk") ? "UF_SONET_COM_DOC" : "UF_SONET_COM_FILE", $arFields);
             }
             $comment = CSocNetLogComments::Update($editCommentID, $arFields, true);
         }
     } else {
         $arFields = array("ENTITY_TYPE" => $arLog["ENTITY_TYPE"], "ENTITY_ID" => $arLog["ENTITY_ID"], "EVENT_ID" => $arCommentEvent["EVENT_ID"], "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $comment_text, "TEXT_MESSAGE" => $comment_text, "URL" => $source_url, "MODULE_ID" => false, "LOG_ID" => $arLog["ID"], "USER_ID" => $GLOBALS["USER"]->GetID(), "PATH_TO_USER_BLOG_POST" => $arParams["PATH_TO_USER_BLOG_POST"], "PATH_TO_GROUP_BLOG_POST" => $arParams["PATH_TO_GROUP_BLOG_POST"], "PATH_TO_USER_MICROBLOG_POST" => $arParams["PATH_TO_USER_MICROBLOG_POST"], "PATH_TO_GROUP_MICROBLOG_POST" => $arParams["PATH_TO_GROUP_MICROBLOG_POST"], "BLOG_ALLOW_POST_CODE" => $arParams["BLOG_ALLOW_POST_CODE"]);
         if ($arSaveResult) {
             $arFields[$ufCode] = array(isset($arFileStorage["DISC_FOLDER"]) ? "n" . $arSaveResult["ID"] : $arSaveResult["ID"]);
         }
         $GLOBALS[$ufCode] = $arFields[$ufCode];
         $comment = CSocNetLogComments::Add($arFields, true, false);
         unset($GLOBALS[$ufCode]);
         CSocNetLog::CounterIncrement($comment, false, false, "LC");
Ejemplo n.º 2
0
         $arFile = CFile::GetFileArray($fileID);
         if (CFile::CheckImageFile(CFile::MakeFileArray($fileID)) === null) {
             $arImgFields = array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arPost["ID"], "USER_ID" => IntVal($user_id), "COMMENT_ID" => $commentID, "=TIMESTAMP_X" => $DB->GetNowFunction(), "TITLE" => $arFile["FILE_NAME"], "IMAGE_SIZE" => $arFile["FILE_SIZE"], "FILE_ID" => $fileID, "IS_COMMENT" => "Y", "URL" => $arBlog["URL"], "IMAGE_SIZE_CHECK" => "N");
             $imgID = CBlogImage::Add($arImgFields);
             if (intval($imgID) <= 0) {
                 $GLOBALS["APPLICATION"]->ThrowException("Error Adding file by CBlogImage::Add");
             } else {
                 $arFields["POST_TEXT"] = str_replace("[IMG ID=" . $fileID . "file", "[IMG ID=" . $imgID . "", $arFields["POST_TEXT"]);
             }
         } else {
             $arAttachedFiles[] = $fileID;
         }
     }
     $GLOBALS[$fieldName] = $arAttachedFiles;
 }
 CSocNetLogComponent::checkEmptyUFValue('UF_BLOG_COMMENT_FILE');
 if (count($arParams["COMMENT_PROPERTY"]) > 0) {
     $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("BLOG_COMMENT", $arFields);
 }
 $commentUrl = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"]));
 $arFields["PATH"] = $commentUrl;
 $arFields["PATH"] .= strpos($arFields["PATH"], "?") !== false ? "&" : "?";
 $arFields["PATH"] .= $arParams["COMMENT_ID_VAR"] . "=" . $commentID . "#" . $commentID;
 $dbComment = CBlogComment::GetList(array(), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], ">ID" => $commentID));
 if ($dbComment->Fetch() && $arResult["Perm"] < BLOG_PERMS_FULL && !$bIntranetInstalled) {
     $arResult["COMMENT_ERROR"] = "<b>" . GetMessage("B_B_PC_COM_ERROR_EDIT") . "</b><br />" . GetMessage("B_B_PC_EDIT_ALREADY_COMMENTED");
 } else {
     if (!empty($_POST["attachedFilesRaw"]) && is_array($_POST["attachedFilesRaw"])) {
         CSocNetLogComponent::saveRawFilesToUF($_POST["attachedFilesRaw"], IsModuleInstalled("webdav") || IsModuleInstalled("disk") ? "UF_BLOG_COMMENT_FILE" : "UF_BLOG_COMMENT_DOC", $arFields);
     }
     if ($commentID = CBlogComment::Update($commentID, $arFields)) {