本文整理汇总了PHP中blogTextParser::killAllTags方法的典型用法代码示例。如果您正苦于以下问题:PHP blogTextParser::killAllTags方法的具体用法?PHP blogTextParser::killAllTags怎么用?PHP blogTextParser::killAllTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blogTextParser
的用法示例。
在下文中一共展示了blogTextParser::killAllTags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute()
{
global $DB;
if (!CModule::IncludeModule("socialnetwork") || !CModule::IncludeModule("blog")) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$siteId = $this->PostSite ? $this->PostSite : SITE_ID;
$ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
$pathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
$pathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
$blogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
$blog = CBlog::GetByOwnerID($ownerId);
if (!$blog) {
$blog = $this->createBlog($ownerId, $blogGroupID, $siteId);
}
$micro = 'N';
$title = trim($this->PostTitle);
if (!$title) {
$micro = 'Y';
$title = trim(preg_replace(array("/\n+/is" . BX_UTF_PCRE_MODIFIER, '/\\s+/is' . BX_UTF_PCRE_MODIFIER), " ", blogTextParser::killAllTags($this->PostMessage)));
}
try {
$postFields = array('TITLE' => $title, 'DETAIL_TEXT' => $this->PostMessage, 'DETAIL_TEXT_TYPE' => $this->PostMessageType == 'html' ? 'html' : 'text', '=DATE_PUBLISH' => $DB->CurrentTimeFunction(), 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH, 'CATEGORY_ID' => '', 'PATH' => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => "#post_id#", "user_id" => $ownerId)), 'URL' => $blog['URL'], 'PERMS_POST' => array(), 'PERMS_COMMENT' => array(), 'MICRO' => $micro, 'SOCNET_RIGHTS' => $this->getSocnetRights($this->UsersTo), '=DATE_CREATE' => $DB->CurrentTimeFunction(), 'AUTHOR_ID' => $ownerId, 'BLOG_ID' => $blog['ID'], "HAS_IMAGES" => "N", "HAS_TAGS" => "N", "HAS_PROPS" => "N", "HAS_SOCNET_ALL" => "N");
if (!empty($postFields["SOCNET_RIGHTS"]) && count($postFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $postFields["SOCNET_RIGHTS"])) {
$postFields['HAS_SOCNET_ALL'] = 'Y';
}
$newId = CBlogPost::add($postFields);
$postFields["ID"] = $newId;
$arParamsNotify = array("bSoNet" => true, "UserID" => $ownerId, "allowVideo" => COption::GetOptionString("blog", "allow_video", "Y"), "PATH_TO_SMILE" => $pathToSmile, "PATH_TO_POST" => $pathToPost, "SOCNET_GROUP_ID" => $blogGroupID, "user_id" => $ownerId, "NAME_TEMPLATE" => CSite::GetNameFormat(false));
CBlogPost::Notify($postFields, $blog, $arParamsNotify);
BXClearCache(true, "/" . $siteId . "/blog/last_messages_list/");
$arFieldsIM = array("TYPE" => "POST", "TITLE" => $postFields["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => $newId, "user_id" => $ownerId)), "ID" => $newId, "FROM_USER_ID" => $ownerId, "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $postFields["SOCNET_RIGHTS"], "TO_SOCNET_RIGHTS_OLD" => array());
CBlogPost::NotifyIm($arFieldsIM);
} catch (Exception $e) {
$this->WriteToTrackingService($e->getMessage());
}
return CBPActivityExecutionStatus::Closed;
}
示例2: Update
//.........这里部分代码省略.........
if ($bSearchIndex && CModule::IncludeModule("search"))
{
$newPostPerms = CBlogUserGroup::GetGroupPerms(1, $arComment["BLOG_ID"], $arComment["POST_ID"], BLOG_PERMS_POST);
if ($arBlog["SEARCH_INDEX"] != "Y" || $arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH)
{
CSearch::Index("blog", "C".$ID,
array(
"TITLE" => "",
"BODY" => ""
)
);
}
else
{
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if(strlen($arFields["PATH"]) > 0)
{
$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
$arPostSite = array($arGroup["SITE_ID"] => $arFields["PATH"]);
}
elseif(strlen($arComment["PATH"]) > 0)
{
$arComment["PATH"] = str_replace("#comment_id#", $ID, $arComment["PATH"]);
$arPostSite = array($arGroup["SITE_ID"] => $arComment["PATH"]);
}
else
{
$arPostSite = array(
$arGroup["SITE_ID"] => CBlogPost::PreparePath(
$arBlog["URL"],
$arComment["POST_ID"],
$arGroup["SITE_ID"],
false,
$arBlog["OWNER_ID"],
$arBlog["SOCNET_GROUP_ID"]
)
);
}
$searchContent = blogTextParser::killAllTags($arComment["POST_TEXT"]);
$searchContent .= "\r\n" . $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("BLOG_COMMENT", $arComment["ID"]);
$arSearchIndex = array(
"SITE_ID" => $arPostSite,
"LAST_MODIFIED" => $arComment["DATE_CREATE"],
"PARAM1" => "COMMENT",
"PARAM2" => $arComment["BLOG_ID"]."|".$arComment["POST_ID"],
"PERMISSIONS" => array(2),
"TITLE" => $arComment["TITLE"],
"BODY" => $searchContent,
"USER_ID" => (IntVal($arComment["AUTHOR_ID"]) > 0) ? $arComment["AUTHOR_ID"] : false,
"ENTITY_TYPE_ID" => "BLOG_COMMENT",
"ENTITY_ID" => $arComment["ID"],
);
if($arBlog["USE_SOCNET"] == "Y")
{
if(is_array($arFields["SC_PERM"]))
{
$arSearchIndex["PERMISSIONS"] = $arFields["SC_PERM"];
$sgId = array();
foreach($arFields["SC_PERM"] 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(!in_array("U".$arComment["AUTHOR_ID"], $arSearchIndex["PERMISSIONS"]))
$arSearchIndex["PERMISSIONS"][] = "U".$arComment["AUTHOR_ID"];
}
}
if(strlen($arComment["TITLE"]) <= 0)
{
//$arPost = CBlogPost::GetByID($arComment["POST_ID"]);
$arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);
}
CSearch::Index("blog", "C".$ID, $arSearchIndex, True);
}
}
return $ID;
}
return False;
}
示例3: _IndexPostComments
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 (strlen($arComment["TITLE"]) <= 0) {
$arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);
}
CSearch::Index("blog", "C" . $arComment["ID"], $arSearchIndex, True);
}
}
示例4: PostIntoBuzzAsBlog
public static function PostIntoBuzzAsBlog($userTwit, $arSiteId = array(), $userLogin = '')
{
global $DB;
if (!CModule::IncludeModule("blog")) {
return;
}
$arParams = array();
if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME') && $userLogin != '') {
if ($arUserTwit = unserialize(base64_decode($userTwit))) {
$userTwit = $arUserTwit;
}
if ($arSiteIdCheck = unserialize(base64_decode($arSiteId))) {
$arSiteId = $arSiteIdCheck;
}
$dbUser = CUser::GetByLogin($userLogin);
if ($arUser = $dbUser->Fetch()) {
$arParams["USER_ID"] = $arUser["ID"];
}
} else {
$arParams["USER_ID"] = $userTwit['kp_user_id'];
}
if (isset($arSiteId[$userTwit['kp_user_id']])) {
$siteId = $arSiteId[$userTwit['kp_user_id']];
}
if (strlen($siteId) <= 0) {
$siteId = SITE_ID;
}
if (isset($userTwit['text'])) {
$arParams["GROUP_ID"] = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
$arParams["PATH_TO_BLOG"] = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
$arParams["PATH_TO_SMILE"] = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
$arParams["NAME_TEMPLATE"] = COption::GetOptionString("main", "TOOLTIP_NAME_TEMPLATE", false, $siteId);
$arParams["SHOW_LOGIN"] = 'Y';
$arParams["PATH_TO_POST"] = $arParams["PATH_TO_BLOG"];
$arFilterblg = array("ACTIVE" => "Y", "USE_SOCNET" => "Y", "GROUP_ID" => $arParams["GROUP_ID"], "GROUP_SITE_ID" => $siteId, "OWNER_ID" => $arParams["USER_ID"]);
$groupId = is_array($arParams["GROUP_ID"]) ? IntVal($arParams["GROUP_ID"][0]) : IntVal($arParams["GROUP_ID"]);
if (isset($GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]]) && !empty($GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]])) {
$arBlog = $GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]];
} else {
$dbBl = CBlog::GetList(array(), $arFilterblg);
$arBlog = $dbBl->Fetch();
if (!$arBlog && IsModuleInstalled("intranet")) {
$arBlog = CBlog::GetByOwnerID($arParams["USER_ID"]);
}
$GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]] = $arBlog;
}
$arResult["Blog"] = $arBlog;
if (empty($arBlog)) {
if (!empty($arParams["GROUP_ID"])) {
$arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => is_array($arParams["GROUP_ID"]) ? IntVal($arParams["GROUP_ID"][0]) : IntVal($arParams["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($arParams["USER_ID"]);
$arUser = $rsUser->Fetch();
if (strlen($arUser["NAME"] . "" . $arUser["LAST_NAME"]) <= 0) {
$arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["LOGIN"];
} else {
$arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"];
}
$arFields["URL"] = str_replace(" ", "_", $arUser["LOGIN"]) . "-blog-" . SITE_ID;
$arFields["OWNER_ID"] = $arParams["USER_ID"];
$urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
if ($urlCheck != $arFields["URL"]) {
$arFields["URL"] = "u" . $arParams["USER_ID"] . "-blog-" . SITE_ID;
}
if (CBlog::GetByUrl($arFields["URL"])) {
$uind = 0;
do {
$uind++;
$arFields["URL"] = $arFields["URL"] . $uind;
} while (CBlog::GetByUrl($arFields["URL"]));
}
$featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $arFields["OWNER_ID"], "blog", "view_post");
if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
$bRights = true;
}
$arFields["PATH"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arFields["URL"], "user_id" => $arFields["OWNER_ID"], "group_id" => $arFields["SOCNET_GROUP_ID"]));
$blogID = CBlog::Add($arFields);
if ($bRights) {
CBlog::AddSocnetRead($blogID);
}
$arBlog = CBlog::GetByID($blogID, $arParams["GROUP_ID"]);
}
}
// $DATE_PUBLISH = "";
// if(strlen($_POST["DATE_PUBLISH_DEF"]) > 0)
// $DATE_PUBLISH = $_POST["DATE_PUBLISH_DEF"];
// elseif (strlen($_POST["DATE_PUBLISH"])<=0)
$DATE_PUBLISH = ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL");
// else
// $DATE_PUBLISH = $_POST["DATE_PUBLISH"];
$arFields = array("DETAIL_TEXT" => $userTwit['text'], "DETAIL_TEXT_TYPE" => "text", "DATE_PUBLISH" => $DATE_PUBLISH, "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "PATH" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => "#post_id#", "user_id" => $arBlog["OWNER_ID"])), "URL" => $arBlog["URL"], "SOURCE_TYPE" => "twitter");
$arFields["PERMS_POST"] = array();
$arFields["PERMS_COMMENT"] = array();
$arFields["MICRO"] = "N";
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["MICRO"] = "Y";
$arFields["TITLE"] = trim(blogTextParser::killAllTags($arFields["DETAIL_TEXT"]));
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["TITLE"] = GetMessage("BLOG_EMPTY_TITLE_PLACEHOLDER");
}
//.........这里部分代码省略.........
示例5: foreach
/* update socnet groupd activity*/
foreach ($arNewRights as $v) {
if (substr($v, 0, 2) == "SG") {
$group_id_tmp = substr($v, 2);
if (IntVal($group_id_tmp) > 0) {
CSocNetGroup::SetLastActivity(IntVal($group_id_tmp));
}
}
}
}
}
die;
}
/* end share */
if (!$arResult["bFromList"]) {
$strTitle = $arPost["MICRO"] != "Y" ? $arPost["TITLE"] : blogTextParser::killAllTags($arPost["DETAIL_TEXT"]);
if (IsModuleInstalled("intranet")) {
$APPLICATION->SetPageProperty("title", $strTitle);
} else {
$APPLICATION->SetTitle($strTitle);
}
}
if ($arParams["SET_NAV_CHAIN"] == "Y") {
$APPLICATION->AddChainItem($arBlog["NAME"], CComponentEngine::MakePathFromTemplate(htmlspecialcharsback($arParams["PATH_TO_BLOG"]), array("blog" => $arBlog["URL"], "user_id" => $arPost["AUTHOR_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"])));
}
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("MOBILE", "USE_CUT", "PATH_TO_SMILE", "ATTACHED_IMAGE_MAX_WIDTH_SMALL", "ATTACHED_IMAGE_MAX_HEIGHT_SMALL", "ATTACHED_IMAGE_MAX_WIDTH_FULL", "ATTACHED_IMAGE_MAX_HEIGHT_FULL", "POST_PROPERTY", "PATH_TO_USER", "PATH_TO_POST", "PATH_TO_GROUP", "PATH_TO_SEARCH_TAG", "IMAGE_MAX_WIDTH", "IMAGE_MAX_HEIGHT", "DATE_TIME_FORMAT", "DATE_TIME_FORMAT_S", "ALLOW_POST_CODE", "AVATAR_SIZE_COMMENT", "NAME_TEMPLATE", "SHOW_LOGIN");
foreach ($arKeys as $param_key) {
$arCacheID[$param_key] = array_key_exists($param_key, $arParams) ? $arParams[$param_key] : false;
}
示例6: 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();
//.........这里部分代码省略.........
示例7: Update
function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
if (strlen($arFields["PATH"]) > 0) {
$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
}
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CBlogComment::CheckFields("UPDATE", $arFields, $ID)) {
return false;
} elseif (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_COMMENT", $ID, $arFields)) {
return false;
}
$db_events = GetModuleEvents("blog", "OnBeforeCommentUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
$strUpdate = $DB->PrepareUpdate("b_blog_comment", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
if (is_set($arFields["PUBLISH_STATUS"]) && strlen($arFields["PUBLISH_STATUS"]) > 0) {
$arComment = CBlogComment::GetByID($ID);
if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS - 1"));
} elseif ($arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS + 1"));
}
}
$strSql = "UPDATE b_blog_comment SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
unset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_" . $ID]);
$GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_COMMENT", $ID, $arFields);
$arComment = CBlogComment::GetByID($ID);
$arBlog = CBlog::GetByID($arComment["BLOG_ID"]);
if ($arBlog["USE_SOCNET"] == "Y") {
$arFields["SC_PERM"] = CBlogComment::GetSocNetCommentPerms($arComment["POST_ID"]);
}
$db_events = GetModuleEvents("blog", "OnCommentUpdate");
while ($arEvent = $db_events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
}
if (CModule::IncludeModule("search")) {
$newPostPerms = CBlogUserGroup::GetGroupPerms(1, $arComment["BLOG_ID"], $arComment["POST_ID"], BLOG_PERMS_POST);
if ($arBlog["SEARCH_INDEX"] != "Y" || $arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
CSearch::Index("blog", "C" . $ID, array("TITLE" => "", "BODY" => ""));
} else {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if (strlen($arFields["PATH"]) > 0) {
$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
$arPostSite = array($arGroup["SITE_ID"] => $arFields["PATH"]);
} elseif (strlen($arComment["PATH"]) > 0) {
$arComment["PATH"] = str_replace("#comment_id#", $ID, $arComment["PATH"]);
$arPostSite = array($arGroup["SITE_ID"] => $arComment["PATH"]);
} else {
$arPostSite = array($arGroup["SITE_ID"] => CBlogPost::PreparePath($arBlog["URL"], $arComment["POST_ID"], $arGroup["SITE_ID"], false, $arBlog["OWNER_ID"], $arBlog["SOCNET_GROUP_ID"]));
}
$searchContent = blogTextParser::killAllTags($arComment["POST_TEXT"]);
$searchContent .= "\r\n" . $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("BLOG_COMMENT", $arComment["ID"]);
$authorName = "";
if (IntVal($arComment["AUTHOR_ID"]) > 0) {
$dbUser = CUser::GetByID($arComment["AUTHOR_ID"]);
if ($arUser = $dbUser->Fetch()) {
$arTmpUser = array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"]);
$authorName = CUser::FormatName(CSite::GetNameFormat(), $arTmpUser, false, false);
}
} elseif (strlen($arComment["AUTHOR_NAME"]) > 0) {
$authorName = $arComment["AUTHOR_NAME"];
}
if (strlen($authorName) > 0) {
$searchContent .= "\r\n" . $authorName;
}
$arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arComment["DATE_CREATE"], "PARAM1" => "COMMENT", "PARAM2" => $arComment["BLOG_ID"] . "|" . $arComment["POST_ID"], "PERMISSIONS" => array(2), "TITLE" => $arComment["TITLE"], "BODY" => $searchContent, "USER_ID" => IntVal($arComment["AUTHOR_ID"]) > 0 ? $arComment["AUTHOR_ID"] : false, "ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $arComment["ID"]);
if ($arBlog["USE_SOCNET"] == "Y") {
if (is_array($arFields["SC_PERM"])) {
$arSearchIndex["PERMISSIONS"] = $arFields["SC_PERM"];
}
}
if (strlen($arComment["TITLE"]) <= 0) {
//$arPost = CBlogPost::GetByID($arComment["POST_ID"]);
$arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);
}
CSearch::Index("blog", "C" . $ID, $arSearchIndex, True);
}
}
return $ID;
}
return False;
//.........这里部分代码省略.........
示例8: array
$arResult["BlogUser"]["Avatar_resized"] = CFile::ResizeImageGet($arResult["BlogUser"]["AVATAR_file"], array("width" => 100, "height" => 100), BX_RESIZE_IMAGE_EXACT, false);
$arResult["BlogUser"]["AVATAR_img"] = CFile::ShowImage($arResult["BlogUser"]["Avatar_resized"]["src"], 100, 100, "border=0 align='right'");
}
if (strlen($arPost["CATEGORY_ID"]) > 0) {
$arCategory = explode(",", $arPost["CATEGORY_ID"]);
foreach ($arCategory as $v) {
if (IntVal($v) > 0) {
$arCatTmp = CBlogTools::htmlspecialcharsExArray(CBlogCategory::GetByID($v));
$arCatTmp["urlToCategory"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_CATEGORY"], array("blog" => $arBlog["URL"], "category_id" => $v, "user_id" => $arParams["USER_ID"]));
$arResult["Category"][] = $arCatTmp;
}
}
}
if ($arParams["SEO_USE"] == "D") {
$arResult["Post"]["SEO_TITLE"] = $arPost["TITLE"];
$arResult["Post"]["SEO_DESCRIPTION"] = $p->killAllTags($arPost["~DETAIL_TEXT"]);
$arResult["Post"]["SEO_TAGS"] = "";
if (!empty($arResult["Category"])) {
foreach ($arResult["Category"] as $v) {
$arResult["Post"]["SEO_TAGS"] .= $v["NAME"] . ", ";
}
}
}
if ($arParams["CACHE_TIME"] > 0) {
$cache->EndDataCache(array("templateCachedData" => $this->GetTemplateCachedData(), "arResult" => $arResult));
}
}
if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["Post"])) {
$arResult['RATING'] = CRatings::GetRatingVoteResult('BLOG_POST', $arResult["Post"]["ID"]);
}
if ($arParams["SEO_USE"] != "N") {
示例9: ProcessLogEventEditPOST
//.........这里部分代码省略.........
}
if ($message === '') {
$errors[] = GetMessage('CRM_SL_EVENT_EDIT_EMPTY_MESSAGE');
}
if (empty($errors)) {
$fields = array('ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_ID' => $entityID, 'USER_ID' => $arResult['USER_ID'], 'TITLE' => $title, 'MESSAGE' => $message, 'RIGHTS' => $arSocnetRights);
$parents = array();
CCrmOwnerType::TryGetOwnerInfos($entityTypeID, $entityID, $parents, array('ENABLE_MAPPING' => true));
foreach ($arEntityData as $entityData) {
$curEntityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($entityData['ENTITY_TYPE']);
$curEntityID = $entityData['ENTITY_ID'];
$entityKey = "{$curEntityTypeID}_{$curEntityID}";
if (!isset($parents[$entityKey]) && !($curEntityTypeID === $entityTypeID && $curEntityID === $entityID)) {
$parents[$entityKey] = array('ENTITY_TYPE_ID' => $curEntityTypeID, 'ENTITY_ID' => $curEntityID);
}
}
if (!empty($parents)) {
$fields['PARENTS'] = array_values($parents);
}
if (!empty($attachedFiles)) {
$fields['WEB_DAV_FILES'] = array($webDavFileFieldName => $attachedFiles);
}
$messageID = CCrmLiveFeed::CreateLogMessage($fields);
if (!(is_int($messageID) && $messageID > 0)) {
$errors[] = isset($fields['ERROR']) ? $fields['ERROR'] : 'UNKNOWN ERROR';
} else {
preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/is" . BX_UTF_PCRE_MODIFIER, $message, $arMention);
if (!empty($arMention) && !empty($arMention[1]) && CModule::IncludeModule("im")) {
$arMention = $arMention[1];
$arMention = array_unique($arMention);
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => "", "FROM_USER_ID" => $arResult['USER_ID'], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "NOTIFY_EVENT" => "mention");
$genderSuffix = "";
$dbUser = CUser::GetByID($arResult['USER_ID']);
if ($arUser = $dbUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$genderSuffix = "_M";
break;
case "F":
$genderSuffix = "_F";
break;
default:
$genderSuffix = "";
}
}
$strIMMessageTitle = str_replace(array("\r\n", "\n"), " ", strlen($title) > 0 ? $title : $message);
if (CModule::IncludeModule("blog")) {
$strIMMessageTitle = trim(blogTextParser::killAllTags($strIMMessageTitle));
}
$strIMMessageTitle = TruncateText($strIMMessageTitle, 100);
$strIMMessageTitleOut = TruncateText($strIMMessageTitle, 255);
$strLogEntryURL = COption::GetOptionString("socialnetwork", "log_entry_page", SITE_DIR . "company/personal/log/#log_id#/", SITE_ID);
$strLogEntryURL = CComponentEngine::MakePathFromTemplate($strLogEntryURL, array("log_id" => $messageID));
$strLogEntryCrmURL = CComponentEngine::MakePathFromTemplate(SITE_DIR . "crm/stream/?log_id=#log_id#", array("log_id" => $messageID));
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
foreach ($arMention as $val) {
$val = IntVal($val);
if ($val > 0 && $val != $arResult['USER_ID']) {
$bHasAccess = false;
if (in_array('U' . $val, $arSocnetRights)) {
$url = $strLogEntryURL;
$bHasAccess = true;
}
if (!$bHasAccess) {
$arAccessCodes = array();
$dbAccess = CAccess::GetUserCodes($val);
while ($arAccess = $dbAccess->Fetch()) {
$arAccessCodes[] = $arAccess["ACCESS_CODE"];
}
$arTmp = array_intersect($arAccess, $arSocnetRights);
if (!empty($arTmp)) {
$url = $strLogEntryURL;
$bHasAccess = true;
}
}
if (!$bHasAccess) {
$userPermissions = CCrmPerms::GetUserPermissions($val);
foreach ($arEntityData as $arEntity) {
if (CCrmAuthorizationHelper::CheckReadPermission(CCrmOwnerType::ResolveName(CCrmLiveFeedEntity::ResolveEntityTypeID($arEntity['ENTITY_TYPE'])), $arEntity['ENTITY_ID'], $userPermissions)) {
$url = $strLogEntryCrmURL;
$bHasAccess = true;
break;
}
}
}
if ($bHasAccess) {
$arMessageFields["TO_USER_ID"] = $val;
$arMessageFields["NOTIFY_TAG"] = "CRM|MESSAGE_MENTION|" . $messageID;
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("CRM_SL_EVENT_IM_MENTION_POST" . $genderSuffix, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($strIMMessageTitle) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("CRM_SL_EVENT_IM_MENTION_POST" . $genderSuffix, array("#title#" => htmlspecialcharsbx($strIMMessageTitleOut))) . " (" . $serverName . $url . ")";
CIMNotify::Add($arMessageFields);
}
}
}
}
return $messageID;
}
}
return $errors;
}
示例10: array
if ($db->Fetch()) {
$uind = 0;
do {
$uind++;
$arFields["CODE"] = $arFields["CODE"] . $uind;
$arPCFilter["CODE"] = $arFields["CODE"];
$db = CBlogPost::GetList(array(), $arPCFilter, false, array("nTopCount" => 1), array("ID", "CODE", "BLOG_ID"));
} while ($db->Fetch());
}
}
$arFields["PERMS_POST"] = array();
$arFields["PERMS_COMMENT"] = array();
$arFields["MICRO"] = "N";
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["MICRO"] = "Y";
$arFields["TITLE"] = trim(blogTextParser::killAllTags($arFields["DETAIL_TEXT"]));
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["TITLE"] = GetMessage("BLOG_EMPTY_TITLE_PLACEHOLDER");
}
}
$arFields["SOCNET_RIGHTS"] = array();
if (!empty($_POST["SPERM"])) {
$bOne = true;
foreach ($_POST["SPERM"] as $v => $k) {
if (strlen($v) > 0 && is_array($k) && !empty($k)) {
foreach ($k as $vv) {
if (strlen($vv) > 0) {
$arFields["SOCNET_RIGHTS"][] = $vv;
if ($v != "SG") {
$bOne = false;
}
示例11: array
$uind++;
$arFields["CODE"] = $arFields["CODE"] . $uind;
$arPCFilter["CODE"] = $arFields["CODE"];
$db = CBlogPost::GetList(array(), $arPCFilter, false, array("nTopCount" => 1), array("ID", "CODE", "BLOG_ID"));
} while ($db->Fetch());
}
}
$arFields["PERMS_POST"] = array();
$arFields["PERMS_COMMENT"] = array();
$arFields["MICRO"] = "N";
if ($_POST["ACTION"] == "EDIT_POST" && isset($_POST["MOBILE"]) && $_POST["MOBILE"] == "Y" && isset($arPost) && isset($arPost["TITLE"])) {
$arFields["TITLE"] = $arPost["~TITLE"];
$arFields["MICRO"] = $arPost["MICRO"];
} elseif (strlen($arFields["TITLE"]) <= 0 || $_POST["show_title"] == "N") {
$arFields["MICRO"] = "Y";
$arFields["TITLE"] = trim(preg_replace(array("/\n+/is" . BX_UTF_PCRE_MODIFIER, "/\\s+/is" . BX_UTF_PCRE_MODIFIER), " ", blogTextParser::killAllTags($arFields["DETAIL_TEXT"])));
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["TITLE"] = GetMessage("BLOG_EMPTY_TITLE_PLACEHOLDER");
}
}
$arFields["SOCNET_RIGHTS"] = array();
if (empty($_POST["SPERM"]) && $arParams["IS_REST"] == "Y" && $bAllowToAll) {
$_POST["SPERM"] = array("UA" => array("UA"));
}
if (!empty($_POST["SPERM"])) {
$bOne = true;
foreach ($_POST["SPERM"] as $v => $k) {
if (strlen($v) > 0 && is_array($k) && !empty($k)) {
foreach ($k as $vv) {
if (strlen($vv) > 0) {
$arFields["SOCNET_RIGHTS"][] = $vv;
示例12: array
if ($db->Fetch()) {
$uind = 0;
do {
$uind++;
$arFields["CODE"] = $arFields["CODE"] . $uind;
$arPCFilter["CODE"] = $arFields["CODE"];
$db = CBlogPost::GetList(array(), $arPCFilter, false, array("nTopCount" => 1), array("ID", "CODE", "BLOG_ID"));
} while ($db->Fetch());
}
}
$arFields["PERMS_POST"] = array();
$arFields["PERMS_COMMENT"] = array();
$arFields["MICRO"] = "N";
if (strlen($arFields["TITLE"]) <= 0 || $_POST["show_title"] == "N") {
$arFields["MICRO"] = "Y";
$arFields["TITLE"] = trim(preg_replace(array("/\n+/is", "/\\s+/is"), " ", blogTextParser::killAllTags($arFields["DETAIL_TEXT"])));
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["TITLE"] = GetMessage("BLOG_EMPTY_TITLE_PLACEHOLDER");
}
}
$arFields["SOCNET_RIGHTS"] = array();
if (empty($_POST["SPERM"]) && $arParams["IS_REST"] == "Y" && $bAllowToAll) {
$_POST["SPERM"] = array("UA" => array("UA"));
}
if (!empty($_POST["SPERM"])) {
$bOne = true;
foreach ($_POST["SPERM"] as $v => $k) {
if (strlen($v) > 0 && is_array($k) && !empty($k)) {
foreach ($k as $vv) {
if (strlen($vv) > 0) {
$arFields["SOCNET_RIGHTS"][] = $vv;
示例13: _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);
}
}
示例14: Update
//.........这里部分代码省略.........
}
if (
$arBlog["USE_SOCNET"] == "Y"
&& CModule::IncludeModule("extranet")
)
{
$arPostSiteExt = CExtranet::GetSitesByLogDestinations($arFields["SC_PERM"]);
foreach($arPostSiteExt as $lid)
{
if (!array_key_exists($lid, $arPostSite))
{
$arPostSite[$lid] = str_replace(
array("#user_id#", "#post_id#"),
array($arBlog["OWNER_ID"], $arNewPost["ID"]),
COption::GetOptionString("socialnetwork", "userblogpost_page", false, $lid)
);
}
}
}
if(strlen($arNewPost["CATEGORY_ID"])>0)
{
$arC = explode(",", $arNewPost["CATEGORY_ID"]);
$arTag = Array();
foreach($arC as $v)
{
$arCategory = CBlogCategory::GetByID($v);
$arTag[] = $arCategory["NAME"];
}
$tag = implode(",", $arTag);
}
$searchContent = blogTextParser::killAllTags($arNewPost["DETAIL_TEXT"]);
$searchContent .= "\r\n" . $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("BLOG_POST", $arNewPost["ID"]);
$authorName = "";
if(IntVal($arNewPost["AUTHOR_ID"]) > 0)
{
$dbUser = CUser::GetByID($arNewPost["AUTHOR_ID"]);
if($arUser = $dbUser->Fetch())
{
$arTmpUser = array(
"NAME" => $arUser["NAME"],
"LAST_NAME" => $arUser["LAST_NAME"],
"SECOND_NAME" => $arUser["SECOND_NAME"],
"LOGIN" => $arUser["LOGIN"],
);
$authorName = CUser::FormatName(CSite::GetNameFormat(), $arTmpUser, false, false);
if(strlen($authorName) > 0)
$searchContent .= "\r\n".$authorName;
}
}
$arSearchIndex = array(
"SITE_ID" => $arPostSite,
"LAST_MODIFIED" => $arNewPost["DATE_PUBLISH"],
"PARAM1" => "POST",
"PARAM2" => $arNewPost["BLOG_ID"],
"PARAM3" => $arNewPost["ID"],
"PERMISSIONS" => array(2),
"TITLE" => $arNewPost["TITLE"],
"BODY" => $searchContent,
"TAGS" => $tag,
"USER_ID" => $arNewPost["AUTHOR_ID"],
"ENTITY_TYPE_ID" => "BLOG_POST",
示例15: preg_replace
$text = preg_replace("#\\[url(.+?)\\](.*?)\\[/url\\]#is", "\\2", $text);
$text = preg_replace("#\\[video(.+?)\\](.+?)\\[/video\\]#ie", "", $text);
$text = preg_replace("#^(.+?)<cut[\\s]*(/>|>).*?\$#is", "\\1", $text);
$text = preg_replace("#^(.+?)\\[cut[\\s]*(/\\]|\\]).*?\$#is", "\\1", $text);
$text = preg_replace("#(\\[|<)(/?)(b|u|i|list|code|quote|url|img|color|font|right|left|center|justify|/*)(.*?)(\\]|>)#is", "", $text);
$text1 = $text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text = $p->convert($text, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N"));
$text = CBlogTools::DeleteDoubleBR($text);
$arTmp["TEXT_FORMATED"] = $text;
$arTmp["DATE_PUBLISH_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arTmp["DATE_PUBLISH"], CSite::GetDateFormat("FULL")));
if ($arTmp["MICRO"] == "Y") {
$text1 = TruncateText($text1, $arParams["MESSAGE_LENGTH"]);
$text1 = $p->convert($text1, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N"));
$text1 = CBlogTools::DeleteDoubleBR($text1);
$arTmp["TITLE"] = str_replace(array("<br />", "<br>"), "", $text1);
$arTmp["TITLE"] = trim(blogTextParser::killAllTags($arTmp["TITLE"]));
$arTmp["~TITLE"] = htmlspecialcharsback($arTmp["TITLE"]);
if (strlen($arTmp["TITLE"]) <= 0) {
$arTmp["TITLE"] = $arPost["TITLE"];
$arTmp["~TITLE"] = $arPost["~TITLE"];
}
}
} else {
$arTmp["TITLE"] = TruncateText($arTmp["TITLE"], $arParams["MESSAGE_LENGTH"]);
}
if ($arParams["USE_SOCNET"] == "Y") {
$arTmp["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("user_id" => $arPost["AUTHOR_ID"]));
$arTmp["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"]));
} else {
if ($arTmp["AUTHOR_ID"] == $arTmp["BLOG_OWNER_ID"]) {
$arTmp["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arPost["BLOG_URL"]));