本文整理汇总了PHP中CBlogComment::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogComment::GetList方法的具体用法?PHP CBlogComment::GetList怎么用?PHP CBlogComment::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogComment
的用法示例。
在下文中一共展示了CBlogComment::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Get
public function Get()
{
if (!$this->IsAvailable()) {
return false;
}
return CBlogComment::GetList(array(), array("ID" => $this->CommentId))->Fetch();
}
示例2: rewritePreviousHistoryComment
protected static function rewritePreviousHistoryComment(array $file)
{
if (!CModule::IncludeModule('blog')) {
return;
}
$dbComments = CBlogComment::GetList(array('ID' => 'DESC'), array('POST_ID' => static::getPostIdForComment(), 'UF_BLOG_COMMENT_FH' => static::getStringForLike($file[0])), false, false, array('ID', 'POST_ID', 'BLOG_ID', 'UF_BLOG_COMMENT_FH'));
if ($dbComments && ($lastComment = $dbComments->Fetch())) {
$entityType = static::getEntityType($file[0]['ib_code']);
$documentId = static::getEntityIdDocumentData($entityType, array('ELEMENT_ID' => $file[0]['id']));
$filter = array("DOCUMENT_ID" => $documentId);
$historyDoc = static::getIdHistoryDocument($filter);
if (!empty($historyDoc['ID'])) {
$newFileData = static::getDataFromValue($lastComment['UF_BLOG_COMMENT_FH']);
$newFileData[0]['v'] = $historyDoc['ID'];
CBlogComment::Update($lastComment['ID'], array('UF_BLOG_COMMENT_FH' => static::genData($newFileData[0], $newFileData[1]), 'HAS_PROPS' => 'Y'));
}
}
}
示例3: _getBlogPostCommentFiles
function _getBlogPostCommentFiles($postID)
{
$arCommentID = array();
$dbComments = CBlogComment::GetList(array(), array("POST_ID" => intval($postID)), false, false, array("ID"));
if ($dbComments) {
while ($arComment = $dbComments->Fetch()) {
$arCommentID[] = $arComment['ID'];
}
}
$arFiles = array();
foreach ($arCommentID as $commentID) {
$entity_type = static::$UF_TYPE_BLOG_COMMENT;
$entity_id = static::$UF_EID_BLOG_COMMENT;
$arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields($entity_type, $commentID);
if (isset($arUF[$entity_id]) && is_array($arUF[$entity_id]['VALUE']) && sizeof($arUF[$entity_id]['VALUE']) > 0) {
$arFiles = array_merge($arFiles, $arUF[$entity_id]['VALUE']);
}
}
return array_unique($arFiles);
}
示例4: OnSearchReindex
function OnSearchReindex($NS = array(), $oCallback = NULL, $callback_method = "")
{
global $DB;
$arResult = array();
//CBlogSearch::Trace('OnSearchReindex', 'NS', $NS);
if ($NS["MODULE"] == "blog" && strlen($NS["ID"]) > 0) {
$category = substr($NS["ID"], 0, 1);
$id = intval(substr($NS["ID"], 1));
} else {
$category = 'B';
//start with blogs
$id = 0;
//very first id
}
//CBlogSearch::Trace('OnSearchReindex', 'category+id', array("CATEGORY"=>$category,"ID"=>$id));
//Reindex blogs
if ($category == 'B') {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tb.ID\n\t\t\t\t\t,bg.SITE_ID\n\t\t\t\t\t,b.REAL_URL\n\t\t\t\t\t,b.URL\n\t\t\t\t\t," . $DB->DateToCharFunction("b.DATE_UPDATE") . " as DATE_UPDATE\n\t\t\t\t\t,b.NAME\n\t\t\t\t\t,b.DESCRIPTION\n\t\t\t\t\t,b.OWNER_ID\n\t\t\t\t\t,b.SOCNET_GROUP_ID\n\t\t\t\t\t,b.USE_SOCNET\n\t\t\t\t\t,b.SEARCH_INDEX\n\t\t\t\tFROM\n\t\t\t\t\tb_blog b\n\t\t\t\t\tINNER JOIN b_blog_group bg ON (b.GROUP_ID = bg.ID)\n\t\t\t\tWHERE\n\t\t\t\t\tb.ACTIVE = 'Y'\n\t\t\t\t\tAND b.SEARCH_INDEX = 'Y'\n\t\t\t\t\t" . ($NS["SITE_ID"] != "" ? "AND bg.SITE_ID='" . $DB->ForSQL($NS["SITE_ID"]) . "'" : "") . "\n\t\t\t\t\tAND b.ID > " . $id . "\n\t\t\t\tORDER BY\n\t\t\t\t\tb.ID\n\t\t\t";
//CBlogSearch::Trace('OnSearchReindex', 'strSql', $strSql);
$rs = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($ar = $rs->Fetch()) {
if ($ar["USE_SOCNET"] == "Y") {
$Result = array("ID" => "B" . $ar["ID"], "BODY" => "", "TITLE" => "");
} else {
//CBlogSearch::Trace('OnSearchReindex', 'ar', $ar);
$arSite = array($ar["SITE_ID"] => CBlog::PreparePath($ar["URL"], $ar["SITE_ID"], false, $ar["OWNER_ID"], $ar["SOCNET_GROUP_ID"]));
//CBlogSearch::Trace('OnSearchReindex', 'arSite', $arSite);
$Result = array("ID" => "B" . $ar["ID"], "LAST_MODIFIED" => $ar["DATE_UPDATE"], "TITLE" => $ar["NAME"], "BODY" => blogTextParser::killAllTags($ar["DESCRIPTION"]), "SITE_ID" => $arSite, "PARAM1" => "BLOG", "PARAM2" => $ar["OWNER_ID"], "PERMISSIONS" => array(2));
//CBlogSearch::Trace('OnSearchReindex', 'Result', $Result);
}
if ($oCallback) {
$res = call_user_func(array($oCallback, $callback_method), $Result);
if (!$res) {
return $Result["ID"];
}
} else {
$arResult[] = $Result;
}
}
//all blogs indexed so let's start index posts
$category = 'P';
$id = 0;
}
if ($category == 'P') {
$arUser2Blog = array();
if (COption::GetOptionString("blog", "socNetNewPerms", "N") == "N") {
$dbB = CBlog::GetList(array(), array("USE_SOCNET" => "Y", "!OWNER_ID" => false), false, false, array("ID", "OWNER_ID", "USE_SOCNET", "GROUP_ID"));
while ($arB = $dbB->Fetch()) {
$arUser2Blog[$arB["OWNER_ID"]][$arB["GROUP_ID"]] = $arB["ID"];
}
}
$bSonet = false;
if (IsModuleInstalled("socialnetwork")) {
$bSonet = true;
}
$parserBlog = new blogTextParser(false, "/bitrix/images/blog/smile/");
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tbp.ID\n\t\t\t\t\t,bg.SITE_ID\n\t\t\t\t\t,b.REAL_URL\n\t\t\t\t\t,b.URL\n\t\t\t\t\t," . $DB->DateToCharFunction("bp.DATE_PUBLISH") . " as DATE_PUBLISH\n\t\t\t\t\t,bp.TITLE\n\t\t\t\t\t,bp.DETAIL_TEXT\n\t\t\t\t\t,bp.BLOG_ID\n\t\t\t\t\t,b.OWNER_ID\n\t\t\t\t\t,bp.CATEGORY_ID\n\t\t\t\t\t,b.SOCNET_GROUP_ID\n\t\t\t\t\t,b.USE_SOCNET\n\t\t\t\t\t,b.SEARCH_INDEX\n\t\t\t\t\t,b.GROUP_ID\n\t\t\t\t\t,bp.PATH\n\t\t\t\t\t,bp.MICRO\n\t\t\t\t\t,bp.PUBLISH_STATUS\n\t\t\t\t\t,bp.AUTHOR_ID " . ($bSonet ? ", BSL.ID as SLID" : "") . " FROM\n\t\t\t\t\tb_blog_post bp\n\t\t\t\t\tINNER JOIN b_blog b ON (bp.BLOG_ID = b.ID)\n\t\t\t\t\tINNER JOIN b_blog_group bg ON (b.GROUP_ID = bg.ID) " . ($bSonet ? "LEFT JOIN b_sonet_log BSL ON (BSL.EVENT_ID in ('blog_post', 'blog_post_micro') AND BSL.SOURCE_ID = bp.ID) " : "") . " WHERE\n\t\t\t\t\tbp.DATE_PUBLISH <= " . $DB->CurrentTimeFunction() . "\n\t\t\t\t\tAND b.ACTIVE = 'Y'\n\t\t\t\t\t" . ($NS["SITE_ID"] != "" ? "AND bg.SITE_ID='" . $DB->ForSQL($NS["SITE_ID"]) . "'" : "") . "\n\t\t\t\t\tAND bp.ID > " . $id . "\n\t\t\t\t\t\n\t\t\t\tORDER BY\n\t\t\t\t\tbp.ID\n\t\t\t";
/* AND bp.PUBLISH_STATUS = '".$DB->ForSQL(BLOG_PUBLISH_STATUS_PUBLISH)."'*/
//AND b.SEARCH_INDEX = 'Y'
//CBlogSearch::Trace('OnSearchReindex', 'strSql', $strSql);
$rs = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($ar = $rs->Fetch()) {
//Check permissions
$tag = "";
if ($ar["USE_SOCNET"] != "Y") {
$PostPerms = CBlogUserGroup::GetGroupPerms(1, $ar["BLOG_ID"], $ar["ID"], BLOG_PERMS_POST);
if ($PostPerms < BLOG_PERMS_READ) {
continue;
}
}
//CBlogSearch::Trace('OnSearchReindex', 'ar', $ar);
if (strlen($ar["PATH"]) > 0) {
$arSite = array($ar["SITE_ID"] => str_replace("#post_id#", $ar["ID"], $ar["PATH"]));
} else {
$arSite = array($ar["SITE_ID"] => CBlogPost::PreparePath($ar["URL"], $ar["ID"], $ar["SITE_ID"], false, $ar["OWNER_ID"], $ar["SOCNET_GROUP_ID"]));
}
if (strlen($ar["CATEGORY_ID"]) > 0) {
$arC = explode(",", $ar["CATEGORY_ID"]);
$tag = "";
$arTag = array();
foreach ($arC as $v) {
$arCategory = CBlogCategory::GetByID($v);
$arTag[] = $arCategory["NAME"];
}
$tag = implode(",", $arTag);
}
//CBlogSearch::Trace('OnSearchReindex', 'arSite', $arSite);
$Result = array("ID" => "P" . $ar["ID"], "LAST_MODIFIED" => $ar["DATE_PUBLISH"], "TITLE" => blogTextParser::killAllTags($ar["TITLE"]), "BODY" => blogTextParser::killAllTags($ar["DETAIL_TEXT"]), "SITE_ID" => $arSite, "PARAM1" => "POST", "PARAM2" => $ar["BLOG_ID"], "PERMISSIONS" => array(2), "TAGS" => $tag, "USER_ID" => $ar["AUTHOR_ID"], "ENTITY_TYPE_ID" => "BLOG_POST", "ENTITY_ID" => $ar["ID"]);
if ($ar["USE_SOCNET"] == "Y" && CModule::IncludeModule("socialnetwork")) {
$arF = array();
if (COption::GetOptionString("blog", "socNetNewPerms", "N") == "N") {
if (IntVal($ar["SOCNET_GROUP_ID"]) > 0) {
$newBlogId = 0;
if (IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]) > 0) {
$newBlogId = IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]);
} else {
$arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => $ar["GROUP_ID"], "ACTIVE" => "Y", "ENABLE_COMMENTS" => "Y", "ENABLE_IMG_VERIF" => "Y", "EMAIL_NOTIFY" => "Y", "ENABLE_RSS" => "Y", "ALLOW_HTML" => "N", "ENABLE_TRACKBACK" => "N", "SEARCH_INDEX" => "Y", "USE_SOCNET" => "Y", "=DATE_CREATE" => $DB->CurrentTimeFunction(), "PERMS_POST" => array(1 => "I", 2 => "I"), "PERMS_COMMENT" => array(1 => "P", 2 => "P"));
$bRights = false;
$rsUser = CUser::GetByID($ar["AUTHOR_ID"]);
$arUser = $rsUser->Fetch();
//.........这里部分代码省略.........
示例5: RemoveMessage
private function RemoveMessage($MessageId = false)
{
$arNotification = $this->Notify->getNotification();
//Remove comments
$oComment = CBlogComment::GetList(
array(),
array(
"POST_ID" => $MessageId?$MessageId:$arNotification["ID"],
),
false,
false,
array("ID")
);
while ($arComment = $oComment->Fetch())
$this->RemoveComment($arComment["ID"]);
//Remove message
$oLogMessage = CSocNetLog::GetList(
array("ID" => "DESC"),
array("SOURCE_ID" => $MessageId?$MessageId:$arNotification["ID"]),
false,
false,
array("ID")
);
while($arLogMessage = $oLogMessage->Fetch())
CSocNetLog::Delete($arLogMessage["ID"]);
}
示例6: array
}
}
$arResult["Assets"] = array("CSS" => array(), "JS" => array());
$arResult["Images"] = array();
$arResult["CommentsResult"] = array();
$arResult["IDS"] = array();
$arOrder = array("DATE_CREATE" => "ASC", "ID" => "ASC");
$arFilter = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arPost["BLOG_ID"]);
if ($arResult["is_ajax_post"] == "Y" && IntVal($arResult["ajax_comment"]) > 0) {
$arFilter["ID"] = $arResult["ajax_comment"];
}
$arSelectedFields = array("ID", "BLOG_ID", "POST_ID", "AUTHOR_ID", "AUTHOR_NAME", "AUTHOR_EMAIL", "POST_TEXT", "DATE_CREATE", "PUBLISH_STATUS", "HAS_PROPS", "SHARE_DEST");
if ($GLOBALS["DB"]->type == "MYSQL") {
$arSelectedFields[] = "DATE_CREATE_TS";
}
$dbComment = CBlogComment::GetList($arOrder, $arFilter, false, false, $arSelectedFields);
$resComments = array();
$arCommentsAll = array();
$arIdToGet = array();
while ($arComment = $dbComment->Fetch()) {
if (IntVal($arComment["AUTHOR_ID"]) > 0) {
$arIdToGet[] = $arComment["AUTHOR_ID"];
}
$arCommentsAll[] = $arComment;
}
if (!empty($arIdToGet)) {
$arResult["userCache"] = CBlogUser::GetUserInfoArray($arIdToGet, $arParams["PATH_TO_USER"], array("AVATAR_SIZE" => isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"], "AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]));
foreach ($arResult["userCache"] as $userId => $arUserCache) {
$arTmpUser = array("NAME" => $arUserCache["~NAME"], "LAST_NAME" => $arUserCache["~LAST_NAME"], "SECOND_NAME" => $arUserCache["~SECOND_NAME"], "LOGIN" => $arUserCache["~LOGIN"], "NAME_LIST_FORMATTED" => "");
$arResult["userCache"][$userId]["NAME_FORMATED"] = CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $arParams["SHOW_LOGIN"] != "N" ? true : false);
}
示例7: OnAfterPhotoCommentAddBlog
public function OnAfterPhotoCommentAddBlog($ID, $arFields)
{
if (!CModule::IncludeModule('iblock')) {
return;
}
if (!$this->IsSocnet) {
return;
}
if (intval($this->PhotoElementID) > 0) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "photo_photo", "SOURCE_ID" => $this->PhotoElementID), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID", "TITLE", "URL", "USER_ID", "PARAMS"));
$bSocNetLogRecordExists = false;
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["ID"];
$entity_type = $arRes["ENTITY_TYPE"];
$entity_id = $arRes["ENTITY_ID"];
$log_title = $arRes["TITLE"];
$log_url = $arRes["URL"];
$log_user_id = $arRes["USER_ID"];
$bSocNetLogRecordExists = true;
if (strlen($arRes["PARAMS"]) > 0) {
$arTmp = unserialize($arRes["PARAMS"]);
if ($arTmp) {
if (array_key_exists("SECTION_NAME", $arTmp) && strlen($arTmp["SECTION_NAME"]) > 0) {
$log_section_name = $arTmp["SECTION_NAME"];
}
if (array_key_exists("SECTION_URL", $arTmp) && strlen($arTmp["SECTION_URL"]) > 0) {
$log_section_url = $arTmp["SECTION_URL"];
}
}
}
} else {
$rsElement = CIBlockElement::GetByID($this->PhotoElementID);
if ($arElement = $rsElement->Fetch()) {
$url = $this->arPath["DETAIL_URL"];
$sAuthorName = GetMessage("SONET_PHOTO_LOG_GUEST");
if (intval($arElement["CREATED_BY"]) > 0) {
$rsUser = CUser::GetByID($arElement["CREATED_BY"]);
if ($arUser = $rsUser->Fetch()) {
$sAuthorName = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
}
}
if (in_array($this->entity_type, array(SONET_ENTITY_USER, SONET_ENTITY_GROUP)) && intval($this->entity_id) > 0) {
$entity_type = $this->entity_type;
$entity_id = $this->entity_id;
$alias = ($this->entity_type == SONET_ENTITY_GROUP ? "group" : "user") . "_" . $this->entity_id;
}
$arLogParams = array("BLOG_ID" => intval($this->BlogID));
$rsIBlock = CIBlock::GetByID($arElement["IBLOCK_ID"]);
if ($arIBlock = $rsIBlock->Fetch()) {
$arLogParams["IBLOCK_ID"] = $arIBlock["ID"];
$arLogParams["IBLOCK_TYPE"] = $arIBlock["IBLOCK_TYPE_ID"];
}
$rsSection = CIBlockSection::GetByID($arElement["IBLOCK_SECTION_ID"]);
if ($arSection = $rsSection->Fetch()) {
$arLogParams["SECTION_ID"] = $arSection["ID"];
$arLogParams["SECTION_NAME"] = $arSection["NAME"];
$arLogParams["SECTION_URL"] = str_replace("#SECTION_ID#", $arSection["ID"], $this->arPath["SECTION_URL"]);
$arSectionPath = array();
$bPassword = false;
$dbSectionPath = CIBlockSection::GetList(array("LEFT_MARGIN" => "ASC"), array("IBLOCK_ID" => intval($arLogParams["IBLOCK_ID"]), "<=LEFT_BORDER" => intval($arSection["LEFT_MARGIN"]), ">=RIGHT_BORDER" => intval($arSection["RIGHT_MARGIN"]), "<=DEPTH_LEVEL" => intval($arSection["DEPTH_LEVEL"])), false, array("ID", "IBLOCK_ID", "NAME", "CREATED_BY", "DEPTH_LEVEL", "LEFT_MARGIN", "RIGHT_MARGIN", "UF_PASSWORD"));
while ($arPath = $dbSectionPath->Fetch()) {
$arSectionPath[] = $arPath;
if (strlen(trim($arPath["UF_PASSWORD"])) > 0) {
$bPassword = true;
break;
}
}
if (!$alias) {
$entity_type = SONET_ENTITY_USER;
$entity_id = $arSectionPath[0]["CREATED_BY"];
$alias = $arSectionPath[0]["CODE"];
}
}
$arLogParams["ALIAS"] = $alias;
$arSonetFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_photo", "LOG_DATE" => $arElement["TIMESTAMP_X"], "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $sAuthorName, GetMessage("SONET_PHOTOPHOTO_LOG_1")), "TITLE" => $arElement["NAME"], "MESSAGE" => "", "TEXT_MESSAGE" => "", "URL" => CComponentEngine::MakePathFromTemplate($url, array("ELEMENT_ID" => $arElement["ID"], "element_id" => $arElement["ID"], "SECTION_ID" => $arElement["IBLOCK_SECTION_ID"], "section_id" => $arElement["IBLOCK_SECTION_ID"])), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arElement["ID"], "PARAMS" => serialize($arLogParams), "RATING_TYPE_ID" => "IBLOCK_ELEMENT", "RATING_ENTITY_ID" => $arElement["ID"]);
if (intval($arElement["CREATED_BY"]) > 0) {
$arSonetFields["USER_ID"] = $arElement["CREATED_BY"];
}
$log_id = CSocNetLog::Add($arSonetFields, false);
if (intval($log_id) > 0) {
$log_title = $arSonetFields["TITLE"];
$log_url = $arSonetFields["URL"];
$log_section_name = $arLogParams["SECTION_NAME"];
$log_section_url = $arLogParams["SECTION_URL"];
$log_user_id = $arSonetFields["USER_ID"];
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
if ($bPassword) {
CSocNetLogRights::DeleteByLogID($log_id);
CSocNetLogRights::Add($log_id, array("U" . $GLOBALS["USER"]->GetID(), "SA"));
} else {
CSocNetLogRights::SetForSonet($log_id, $entity_type, $entity_id, "photo", "view", true);
}
}
}
}
if (intval($log_id) > 0) {
$parserBlog = new blogTextParser(false, $this->arPath["PATH_TO_SMILE"]);
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
if ($bSocNetLogRecordExists) {
$text4message = $parserBlog->convert($arFields["POST_TEXT"], true, array(), $arAllow);
//.........这里部分代码省略.........
示例8: OnAfterPhotoCommentAddBlog
function OnAfterPhotoCommentAddBlog($ID, $arFields)
{
if (!CModule::IncludeModule('iblock'))
return;
if (!$this->IsSocnet)
return;
if (intval($this->PhotoElementID) > 0)
{
$dbRes = CSocNetLog::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => "photo_photo",
"SOURCE_ID" => $this->PhotoElementID
),
false,
false,
array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID")
);
$bSocNetLogRecordExists = false;
if ($arRes = $dbRes->Fetch())
{
$log_id = $arRes["ID"];
$entity_type = $arRes["ENTITY_TYPE"];
$entity_id = $arRes["ENTITY_ID"];
$bSocNetLogRecordExists = true;
}
else
{
$rsElement = CIBlockElement::GetByID($this->PhotoElementID);
if ($arElement = $rsElement->Fetch())
{
$url = $this->arPath["DETAIL_URL"];
$sAuthorName = GetMessage("SONET_LOG_GUEST");
if (intval($arElement["CREATED_BY"]) > 0)
{
$rsUser = CUser::GetByID($arElement["CREATED_BY"]);
if ($arUser = $rsUser->Fetch())
$sAuthorName = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
}
if (
in_array($this->entity_type, array(SONET_ENTITY_USER, SONET_ENTITY_GROUP))
&& intval($this->entity_id) > 0
)
{
$entity_type = $this->entity_type;
$entity_id = $this->entity_id;
$alias = ($this->entity_type == SONET_ENTITY_GROUP ? "group" : "user")."_".$this->entity_id;
}
$arLogParams = array(
"BLOG_ID" => intval($this->BlogID)
);
$rsIBlock = CIBlock::GetByID($arElement["IBLOCK_ID"]);
if($arIBlock = $rsIBlock->Fetch())
{
$arLogParams["IBLOCK_ID"] = $arIBlock["ID"];
$arLogParams["IBLOCK_TYPE"] = $arIBlock["IBLOCK_TYPE_ID"];
}
$rsSection = CIBlockSection::GetByID($arElement["IBLOCK_SECTION_ID"]);
if ($arSection = $rsSection->Fetch())
{
$arLogParams["SECTION_ID"] = $arSection["ID"];
$arLogParams["SECTION_NAME"] = $arSection["NAME"];
$arLogParams["SECTION_URL"] = str_replace("#SECTION_ID#", $arSection["ID"], $this->arPath["SECTION_URL"]);
if (!$alias)
{
$arSectionPath = array();
$rsPath = CIBlockSection::GetNavChain($arLogParams["IBLOCK_ID"], intval($arLogParams["SECTION_ID"]));
if($arPath = $rsPath->Fetch())
{
$entity_type = SONET_ENTITY_USER;
$entity_id = $arPath["CREATED_BY"];
$alias = $arPath["CODE"];
}
}
}
$arLogParams["ALIAS"] = $alias;
$arSonetFields = array(
"ENTITY_TYPE" => $entity_type,
"ENTITY_ID" => $entity_id,
"EVENT_ID" => "photo_photo",
"LOG_DATE" => $arElement["TIMESTAMP_X"],
"TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $sAuthorName, GetMessage("SONET_PHOTOPHOTO_LOG_1")),
"TITLE" => $arElement["NAME"],
"MESSAGE" => "",
"TEXT_MESSAGE" => "",
"URL" => CComponentEngine::MakePathFromTemplate($url, array(
"ELEMENT_ID" => $arElement["ID"],
"element_id" => $arElement["ID"],
"SECTION_ID" => $arElement["IBLOCK_SECTION_ID"],
//.........这里部分代码省略.........
示例9: _IndexPostComments
public static function _IndexPostComments($arParams = Array())
{
if(IntVal($arParams["BLOG_ID"]) <= 0 || IntVal($arParams["POST_ID"]) <= 0 || !CModule::IncludeModule("search"))
return false;
if($arParams["USE_SOCNET"] == "Y")
$arSp = CBlogComment::GetSocNetCommentPerms($arParams["POST_ID"]);
$dbComment = CBlogComment::GetList(Array(), Array("BLOG_ID" => $arParams["BLOG_ID"], "POST_ID" => $arParams["POST_ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH), false, false, Array("ID", "POST_ID", "BLOG_ID", "PUBLISH_STATUS", "PATH", "DATE_CREATE", "POST_TEXT", "TITLE", "AUTHOR_ID"));
while($arComment = $dbComment->Fetch())
{
if(strlen($arComment["PATH"]) > 0)
$arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arComment["PATH"]);
elseif(strlen($arParams["PATH"]) > 0)
$arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arParams["PATH"]);
else
{
$arComment["PATH"] = CBlogPost::PreparePath(
$arParams["BLOG_URL"],
$arComment["POST_ID"],
$arParams["SITE_ID"],
false,
$arParams["OWNER_ID"],
$arParams["SOCNET_GROUP_ID"]
);
}
$arSearchIndex = array(
"SITE_ID" => array($arParams["SITE_ID"] => $arComment["PATH"]),
"LAST_MODIFIED" => $arComment["DATE_CREATE"],
"PARAM1" => "COMMENT",
"PARAM2" => $arComment["BLOG_ID"]."|".$arComment["POST_ID"],
"PERMISSIONS" => array(2),
"TITLE" => $arComment["TITLE"],
"BODY" => blogTextParser::killAllTags($arComment["POST_TEXT"]),
"INDEX_TITLE" => false,
"USER_ID" => (IntVal($arComment["AUTHOR_ID"]) > 0) ? $arComment["AUTHOR_ID"] : false,
"ENTITY_TYPE_ID" => "BLOG_COMMENT",
"ENTITY_ID" => $arComment["ID"],
);
if($arParams["USE_SOCNET"] == "Y")
{
$arSearchIndex["PERMISSIONS"] = $arSp;
if(!in_array("U".$arComment["AUTHOR_ID"], $arSearchIndex["PERMISSIONS"]))
$arSearchIndex["PERMISSIONS"][] = "U".$arComment["AUTHOR_ID"];
if(is_array($arSp))
{
$sgId = array();
foreach($arSp as $perm)
{
if(strpos($perm, "SG") !== false)
{
$sgIdTmp = str_replace("SG", "", substr($perm, 0, strpos($perm, "_")));
if(!in_array($sgIdTmp, $sgId) && IntVal($sgIdTmp) > 0)
$sgId[] = $sgIdTmp;
}
}
if(!empty($sgId))
{
$arSearchIndex["PARAMS"] = array(
"socnet_group" => $sgId,
"entity" => "socnet_group",
);
}
}
}
if(strlen($arComment["TITLE"]) <= 0)
$arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);
CSearch::Index("blog", "C".$arComment["ID"], $arSearchIndex, True);
}
}
示例10: AddComment_Review_UpdateElement_Blog
function AddComment_Review_UpdateElement_Blog($arElement, $postID, $blogID, $bNewPost)
{
if (!CModule::IncludeModule("blog")) {
return false;
}
if ($bNewPost) {
CIBlockElement::SetPropertyValues($arElement["ID"], $arElement["IBLOCK_ID"], intVal($postID), "BLOG_POST_ID");
$BLOG_COMMENT_CNT = 1;
} else {
$BLOG_COMMENT_CNT = CBlogComment::GetList(array(), array("POST_ID" => $postID), array());
}
CIBlockElement::SetPropertyValues($arElement["ID"], $arElement["IBLOCK_ID"], intVal($BLOG_COMMENT_CNT), "BLOG_COMMENT_CNT");
$arBlog = CBlog::GetByID($blogID);
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/comment/" . $postID . "/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/post/" . $postID . "/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/blog/last_comments/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/rss_out/" . $postID . "/C/");
BXClearCache(True, "/" . SITE_ID . "/blog/last_messages/");
BXClearCache(True, "/" . SITE_ID . "/blog/commented_posts/");
BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
}
示例11: implode
CBlogPostCategory::Add(array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID, "CATEGORY_ID" => $v));
$arCopyCat[] = $v;
}
if (!empty($arCopyCat)) {
$arCopyPostUpdate["CATEGORY_ID"] = implode(",", $arCopyCat);
}
if ($_POST["move2blogcopy"] == "Y") {
$arCopyPostUpdate["NUM_COMMENTS"] = 0;
}
if (!empty($arCopyPostUpdate)) {
$copyID = CBlogPost::Update($copyID, $arCopyPostUpdate);
$arCopyPost = CBlogPost::GetByID($copyID);
}
if ($_POST["move2blogcopy"] != "Y") {
if (CBlogPost::CanUserDeletePost($arParams["ID"], $user_id)) {
$dbC = CBlogComment::GetList(array("ID" => "ASC"), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arParams["ID"]), false, false, array("PATH", "PUBLISH_STATUS", "POST_TEXT", "TITLE", "DATE_CREATE", "AUTHOR_IP1", "AUTHOR_IP", "AUTHOR_EMAIL", "AUTHOR_NAME", "AUTHOR_ID", "PARENT_ID", "POST_ID", "BLOG_ID", "ID"));
while ($arC = $dbC->Fetch()) {
$arCTmp = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
CBlogComment::Update($arC["ID"], $arCTmp);
}
$arFilter = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y");
$res = CBlogImage::GetList(array("ID" => "ASC"), $arFilter);
while ($arImg = $res->GetNext()) {
$arNewImg = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
CBlogImage::Update($arImg["ID"], $arNewImg);
}
if (!CBlogPost::Delete($arParams["ID"])) {
$arResult["ERROR_MESSAGE"] = GetMessage("BPE_COPY_DELETE_ERROR");
} else {
CBlogPost::DeleteLog($arParams["ID"], $arParams["MICROBLOG"]);
}
示例12: BXClearCache
BXClearCache(True, "/" . $site . "/blog/commented_posts/");
BXClearCache(True, "/" . $site . "/blog/popular_posts/");
}
}
}
$arHeaders = array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "PUBLISH_STATUS", "content" => GetMessage("BLB_PUBLISH_STATUS"), "sort" => "PUBLISH_STATUS", "default" => true), array("id" => "DATE_CREATE", "content" => GetMessage('BLB_DATE_CREATE'), "sort" => "DATE_CREATE", "default" => true), array("id" => "AUTHOR_ID", "content" => GetMessage('BLB_AUTHOR_ID'), "sort" => "", "default" => true, "sort" => "AUTHOR_ID"), array("id" => "POST_TEXT", "content" => GetMessage("BLB_COMMENT"), "sort" => "POST_TEXT", "default" => true), array("id" => "POST_TITLE", "content" => GetMessage("BLB_POST_ID"), "sort" => "POST_TITLE", "default" => true), array("id" => "BLOG_ID", "content" => GetMessage("BLB_BLOG_ID"), "sort" => "BLOG_ID", "default" => true), array("id" => "AUTHOR_IP", "content" => "IP", "sort" => "AUTHOR_IP", "default" => true));
$USER_FIELD_MANAGER->AdminListAddHeaders("BLOG_COMMENT", $arHeaders);
$lAdmin->AddHeaders($arHeaders);
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
$arSelectedFields = array("ID", "BLOG_ID", "POST_ID", "PARENT_ID", "AUTHOR_ID", "AUTHOR_NAME", "AUTHOR_EMAIL", "AUTHOR_IP", "AUTHOR_IP1", "DATE_CREATE", "POST_TEXT", "PUBLISH_STATUS", "PATH", "USER_LOGIN", "USER_NAME", "USER_LAST_NAME", "BLOG_URL", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_ACTIVE", "BLOG_GROUP_ID", "BLOG_GROUP_SITE_ID", "BLOG_NAME", "POST_TITLE");
foreach ($arVisibleColumns as $val) {
if (!in_array($val, $arSelectedFields)) {
$arSelectedFields[] = $val;
}
}
$dbResultList = CBlogComment::GetList(array($by => $order), $arFilter, false, array("nPageSize" => CAdminResult::GetNavSize($sTableID)), $arSelectedFields);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("BLB_GROUP_NAV")));
$arServerName = array();
$dbSite = CSite::GetList($b = "SORT", $o = "ASC");
while ($arSite = $dbSite->Fetch()) {
$serverName = $arSite["SERVER_NAME"];
if (strLen($serverName) <= 0) {
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$serverName = SITE_SERVER_NAME;
} else {
$serverName = COption::GetOptionString("main", "server_name", "");
}
if (strlen($serverName) <= 0) {
$serverName = $_SERVER["SERVER_NAME"];
示例13: array
$arResult["FILE_INFO"] = array();
$user_id = IntVal($USER->GetID());
$arError = array();
if (intVal($arParams["FILE_ID"]) > 0) {
if ($res = CBlogImage::GetByID($arParams["FILE_ID"])) {
$arResult["FILE_INFO"] = $res;
$arResult["FILE"] = CFile::GetFileArray($arResult["FILE_INFO"]["FILE_ID"]);
}
} elseif (intVal($arParams["BP_FILE_ID"]) > 0) {
$arResult["FILE"] = CFile::GetFileArray(intVal($arParams['BP_FILE_ID']));
if (!empty($arResult["FILE"])) {
$dbPost = CBlogPost::GetList(array(), array('UF_BLOG_POST_DOC' => intVal($arParams['BP_FILE_ID'])));
if ($dbPost && ($arPost = $dbPost->Fetch())) {
$arResult["FILE_INFO"] = array('POST_ID' => $arPost['ID'], 'BLOG_ID' => $arPost['BLOG_ID']);
} else {
$dbPost = CBlogComment::GetList(array(), array('UF_BLOG_COMMENT_DOC' => intVal($arParams['BP_FILE_ID'])));
if ($dbPost && ($arPost = $dbPost->Fetch())) {
$arResult["FILE_INFO"] = array('POST_ID' => $arPost['POST_ID'], 'BLOG_ID' => $arPost['BLOG_ID']);
}
}
}
}
if (empty($arResult["FILE"])) {
$arError = array("code" => "EMPTY FILE", "title" => GetMessage("F_EMPTY_FID"));
} else {
if (intVal($arResult["FILE_INFO"]["POST_ID"]) > 0) {
if (empty($arResult['POST'])) {
$dbPost = CBlogPost::GetList(array(), array("ID" => $arResult["FILE_INFO"]["POST_ID"], "BLOG_ID" => $arResult["FILE_INFO"]["BLOG_ID"]), false, false, array("ID", "BLOG_ID", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_USE_SOCNET", "AUTHOR_ID"));
$arResult["POST"] = $dbPost->Fetch();
}
if (!empty($arResult['POST'])) {
示例14: array
$res = CBlogSmile::GetList(array("SORT" => "ASC", "ID" => "DESC"), array("SMILE_TYPE" => "S", "LANG_LID" => LANGUAGE_ID), false, false, $arSelectFields);
while ($arr = $res->GetNext()) {
list($type) = explode(" ", $arr["TYPING"]);
$arr["TYPE"] = str_replace("'", "\\'", $type);
$arr["TYPE"] = str_replace("\\", "\\\\", $arr["TYPE"]);
$arSmiles[] = $arr;
}
$arResult["Smiles"] = $arSmiles;
if (IntVal($arParams["ID"]) > 0) {
$arOrder = array("ID" => "ASC", "DATE_CREATE" => "ASC");
$arFilter = array("POST_ID" => $arParams["ID"]);
if ($arResult["Perm"] < BLOG_PERMS_MODERATE || !$arResult["IDEA_MODERATOR"]) {
$arFilter["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_PUBLISH;
}
$arSelectedFields = array("ID", "BLOG_ID", "POST_ID", "PARENT_ID", "AUTHOR_ID", "AUTHOR_NAME", "AUTHOR_EMAIL", "AUTHOR_IP", "AUTHOR_IP1", "TITLE", "POST_TEXT", "DATE_CREATE", "PUBLISH_STATUS");
$dbComment = CBlogComment::GetList($arOrder, array_merge($extFilter, $arFilter), false, false, $arSelectedFields);
$resComments = array();
$arResult["firstLevel"] = 0;
if ($arComment = $dbComment->GetNext()) {
$p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
do {
$arResult["Comments"][$arComment["ID"]] = array("ID" => $arComment["ID"], "PARENT_ID" => $arComment["PARENT_ID"]);
$arComment["ShowIP"] = $arResult["ShowIP"];
if (empty($resComments[IntVal($arComment["PARENT_ID"])])) {
$resComments[IntVal($arComment["PARENT_ID"])] = array();
if (strlen($arResult["firstLevel"]) <= 0) {
$arResult["firstLevel"] = IntVal($arComment["PARENT_ID"]);
}
}
if (IntVal($arComment["AUTHOR_ID"]) > 0) {
示例15: OnBeforeCommentAddHandler
/**
* Checking blog comment for spam
* @param &array Comment fields to check
* @return null|boolean NULL when success or FALSE when spam detected
*/
function OnBeforeCommentAddHandler(&$arFields)
{
global $APPLICATION, $USER;
$ct_status = COption::GetOptionString('cleantalk.antispam', 'status', '0');
$ct_comment_blog = COption::GetOptionString('cleantalk.antispam', 'form_comment_blog', '0');
if ($ct_status == 1 && $ct_comment_blog == 1) {
if ($USER->IsAdmin()) {
return;
}
// Skip authorized user with more than 5 approved comments
if ($USER->IsAuthorized()) {
$approved_comments = CBlogComment::GetList(array('ID' => 'ASC'), array('AUTHOR_ID' => $arFields['AUTHOR_ID'], 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH), array());
if (intval($approved_comments) > 5) {
return;
}
}
$aComment = array();
$aComment['type'] = 'comment';
$aComment['sender_email'] = isset($arFields['AUTHOR_EMAIL']) ? $arFields['AUTHOR_EMAIL'] : '';
$aComment['sender_nickname'] = isset($arFields['AUTHOR_NAME']) ? $arFields['AUTHOR_NAME'] : '';
$aComment['message_title'] = '';
$aComment['message_body'] = isset($arFields['POST_TEXT']) ? $arFields['POST_TEXT'] : '';
$aComment['example_title'] = '';
$aComment['example_body'] = '';
$aComment['example_comments'] = '';
if (COption::GetOptionString('cleantalk.antispam', 'form_send_example', '0') == 1) {
$arPost = CBlogPost::GetByID($arFields['POST_ID']);
if (is_array($arPost)) {
$aComment['example_title'] = $arPost['TITLE'];
$aComment['example_body'] = $arPost['DETAIL_TEXT'];
// Find last 10 approved comments
$db_res = CBlogComment::GetList(array('DATE_CREATE' => 'DESC'), array('POST_ID' => $arFields['POST_ID'], 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH), false, array('nTopCount' => 10), array('POST_TEXT'));
while ($ar_res = $db_res->Fetch()) {
$aComment['example_comments'] .= $ar_res['TITLE'] . "\n\n" . $ar_res['POST_TEXT'] . "\n\n";
}
}
}
$aResult = self::CheckAllBefore($aComment, TRUE);
if (isset($aResult) && is_array($aResult)) {
if ($aResult['errno'] == 0) {
if ($aResult['allow'] == 1) {
// Not spammer - just return;
return;
} else {
if ($aResult['stop_queue'] == 1) {
// Spammer and stop_queue - return false and throw
if (preg_match('//u', $aResult['ct_result_comment'])) {
$err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/iu', '', $aResult['ct_result_comment']);
$err_str = preg_replace('/<[^<>]*>/iu', '', $err_str);
} else {
$err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/i', '', $aResult['ct_result_comment']);
$err_str = preg_replace('/<[^<>]*>/i', '', $err_str);
}
$APPLICATION->ThrowException($err_str);
return FALSE;
} else {
// Spammer and NOT stop_queue - to manual approvement
// BLOG_PUBLISH_STATUS_READY
// It doesn't work
// values below results in endless 'Loading' AJAX message :(
//$arFields['PUBLISH_STATUS'] = BLOG_PUBLISH_STATUS_READY;
//$arFields['PUBLISH_STATUS'] = BLOG_PUBLISH_STATUS_DRAFT;
//return;
// It doesn't work too
// Status setting in OnCommentAddHandler still results in endless 'Loading' AJAX message :(
//$GLOBALS['ct_after_CommentAdd_status'] = BLOG_PUBLISH_STATUS_READY;
//return;
if (preg_match('//u', $aResult['ct_result_comment'])) {
$err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/iu', '', $aResult['ct_result_comment']);
$err_str = preg_replace('/<[^<>]*>/iu', '', $err_str);
} else {
$err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/i', '', $aResult['ct_result_comment']);
$err_str = preg_replace('/<[^<>]*>/i', '', $err_str);
}
$APPLICATION->ThrowException($err_str);
return FALSE;
}
}
}
}
}
}