本文整理汇总了PHP中blogTextParser类的典型用法代码示例。如果您正苦于以下问题:PHP blogTextParser类的具体用法?PHP blogTextParser怎么用?PHP blogTextParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了blogTextParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: socialnetworkBlogPostCommentMobile
function socialnetworkBlogPostCommentMobile(array $comment, array $arParams, array $arResult, SocialnetworkBlogPostComment $component)
{
global $APPLICATION;
$arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]) ?: 58;
$arAvatarSizes = array("AVATAR_SIZE" => intval(array_key_exists("AVATAR_SIZE_COMMON", $arParams) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"]), "AVATAR_SIZE_COMMENT" => intval($arParams["AVATAR_SIZE_COMMENT"]));
$arAvatarSizes["AVATAR_SIZE"] = $arAvatarSizes["AVATAR_SIZE"] > 0 ? $arAvatarSizes["AVATAR_SIZE"] : 42;
// reference to CBlogUser::GetUserInfoArray
$arAvatarSizes["AVATAR_SIZE_COMMENT"] = $arAvatarSizes["AVATAR_SIZE_COMMENT"] > 0 ? $arAvatarSizes["AVATAR_SIZE_COMMENT"] : 42;
// reference to CBlogUser::GetUserInfoArray
$avatarKey = "PERSONAL_PHOTO_RESIZED";
if ($arAvatarSizes["AVATAR_SIZE"] == $arParams["AVATAR_SIZE"]) {
$avatarKey = "PERSONAL_PHOTO_resized";
} else {
if ($arAvatarSizes["AVATAR_SIZE_COMMENT"] == $arParams["AVATAR_SIZE"]) {
$avatarKey = "PERSONAL_PHOTO_resized_30";
}
}
$arUser = $arResult["userCache"][$comment["AUTHOR_ID"]];
if (!array_key_exists($avatarKey, $arUser) && intval($arUser["PERSONAL_PHOTO"]) > 0) {
$arResult["userCache"][$comment["AUTHOR_ID"]][$avatarKey] = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT);
$arUser = $arResult["userCache"][$comment["AUTHOR_ID"]];
}
$text = $comment["TextFormated"];
if ($component->isWeb()) {
static $parser = null;
if ($parser == null) {
$parser = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$parser->bMobile = true;
$parser->LAZYLOAD = isset($arParams["LAZYLOAD"]) && $arParams["LAZYLOAD"] == "Y" ? "Y" : "N";
}
if (is_array($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"])) {
$parser->arUserfields = array("UF_BLOG_COMMENT_FILE" => array_merge($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"], array("TAG" => "DOCUMENT ID")));
}
$text = $parser->convert($comment["POST_TEXT"], false, $comment["showedImages"], array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => COption::GetOptionString("blog", "allow_video", "Y") != "Y" || $arParams["ALLOW_VIDEO"] != "Y" ? "N" : "Y", "SHORT_ANCHOR" => "Y"), array("pathToUser" => "/mobile/users/?user_id=#user_id#"));
}
$res = array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => !empty($comment["DATE_CREATE_TS"]) ? $comment["DATE_CREATE_TS"] + $arResult["TZ_OFFSET"] : MakeTimeStamp($comment["DATE_CREATE"]) - $arResult["TZ_OFFSET"], "AUTHOR" => array("ID" => $arUser["ID"], "NAME" => $arUser["~NAME"], "LAST_NAME" => $arUser["~LAST_NAME"], "SECOND_NAME" => $arUser["~SECOND_NAME"], "AVATAR" => array_key_exists($avatarKey, $arUser) ? $arUser[$avatarKey]["src"] : ''), "FILES" => false, "UF" => false, "POST_MESSAGE_TEXT" => $text, "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "CLASSNAME" => "", "BEFORE_HEADER" => "", "BEFORE_ACTIONS" => "", "AFTER_ACTIONS" => "", "AFTER_HEADER" => "", "BEFORE" => "", "AFTER" => "", "BEFORE_RECORD" => "", "AFTER_RECORD" => "");
if (!empty($arResult["arImages"][$comment["ID"]])) {
$res["FILES"] = array();
foreach ($arResult["arImages"][$comment["ID"]] as $i => $val) {
$t = $arResult["Images"][$i];
$res["FILES"][] = array("THUMBNAIL" => $val["small"], "SRC" => $val["full"], "FILE_SIZE" => $t["source"]["size"], "CONTENT_TYPE" => "image/xyz", "ORIGINAL_NAME" => $t["fileName"], "FILE_NAME" => $t["fileName"]);
}
}
if ($comment["COMMENT_PROPERTIES"]["SHOW"] == "Y") {
$res["UF"] = $comment["COMMENT_PROPERTIES"]["DATA"];
foreach ($res["UF"] as $key => $arPostField) {
if (!empty($arPostField["VALUE"])) {
$res["UF"][$key]['POST_ID'] = $arParams['POST_DATA']['ID'];
$res["UF"][$key]['URL_TO_POST'] = str_replace('#source_post_id#', $arPostField['POST_ID'], $arResult['urlToPost']);
}
}
}
return $res;
}
开发者ID:Satariall,项目名称:izurit,代码行数:54,代码来源:functions.php
示例2: 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;
}
开发者ID:webgksupport,项目名称:alpina,代码行数:40,代码来源:socnetblogpostactivity.php
示例3: socialnetworkBlogPostCommentWeb
function socialnetworkBlogPostCommentWeb(array $comment, array $arParams, array $arResult, SocialnetworkBlogPostComment $component)
{
global $APPLICATION;
$arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]) ?: 58;
$arAvatarSizes = array("AVATAR_SIZE" => intval(array_key_exists("AVATAR_SIZE_COMMON", $arParams) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"]), "AVATAR_SIZE_COMMENT" => intval($arParams["AVATAR_SIZE_COMMENT"]));
$arAvatarSizes["AVATAR_SIZE"] = $arAvatarSizes["AVATAR_SIZE"] > 0 ? $arAvatarSizes["AVATAR_SIZE"] : 42;
// reference to CBlogUser::GetUserInfoArray
$arAvatarSizes["AVATAR_SIZE_COMMENT"] = $arAvatarSizes["AVATAR_SIZE_COMMENT"] > 0 ? $arAvatarSizes["AVATAR_SIZE_COMMENT"] : 42;
// reference to CBlogUser::GetUserInfoArray
$avatarKey = "PERSONAL_PHOTO_RESIZED";
if ($arAvatarSizes["AVATAR_SIZE"] == $arParams["AVATAR_SIZE"]) {
$avatarKey = "PERSONAL_PHOTO_resized";
} else {
if ($arAvatarSizes["AVATAR_SIZE_COMMENT"] == $arParams["AVATAR_SIZE"]) {
$avatarKey = "PERSONAL_PHOTO_resized_30";
}
}
$arUser = $arResult["userCache"][$comment["AUTHOR_ID"]];
if (is_array($arUser) && !array_key_exists($avatarKey, $arUser) && intval($arUser["PERSONAL_PHOTO"]) > 0) {
$arResult["userCache"][$comment["AUTHOR_ID"]][$avatarKey] = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT);
$arUser = $arResult["userCache"][$comment["AUTHOR_ID"]];
}
$text = $comment["TextFormated"];
if (!$component->isWeb()) {
static $parser = null;
if ($parser == null) {
$parser = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$parser->bMobile = false;
$parser->LAZYLOAD = isset($arParams["LAZYLOAD"]) && $arParams["LAZYLOAD"] == "Y" ? "Y" : "N";
}
if (is_array($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"])) {
$parser->arUserfields = array("UF_BLOG_COMMENT_FILE" => array_merge($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"], array("TAG" => "DOCUMENT ID")));
}
$text = $parser->convert($comment["POST_TEXT"], false, $comment["showedImages"], array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => COption::GetOptionString("blog", "allow_video", "Y") != "Y" || $arParams["ALLOW_VIDEO"] != "Y" ? "N" : "Y", "SHORT_ANCHOR" => "Y"), array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]));
}
$res = array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => !empty($comment["DATE_CREATE_TS"]) ? $comment["DATE_CREATE_TS"] + $arResult["TZ_OFFSET"] : MakeTimeStamp($comment["DATE_CREATE"]) - $arResult["TZ_OFFSET"], "AUTHOR" => array("ID" => is_array($arUser) ? $arUser["ID"] : false, "NAME" => is_array($arUser) ? $arUser["~NAME"] : '', "LAST_NAME" => is_array($arUser) ? $arUser["~LAST_NAME"] : '', "SECOND_NAME" => is_array($arUser) ? $arUser["~SECOND_NAME"] : '', "AVATAR" => is_array($arUser) && array_key_exists($avatarKey, $arUser) ? $arUser[$avatarKey]["src"] : ''), "FILES" => false, "UF" => false, "POST_MESSAGE_TEXT" => $text, "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "CLASSNAME" => "", "BEFORE_HEADER" => "", "BEFORE_ACTIONS" => "", "AFTER_ACTIONS" => "", "AFTER_HEADER" => "", "BEFORE" => "", "AFTER" => "", "BEFORE_RECORD" => "", "AFTER_RECORD" => "");
$aditStyle = ($comment["AuthorIsAdmin"] == "Y" ? "blog-comment-admin" : "") . ($comment["AuthorIsPostAuthor"] == "Y" ? "blog-comment-author" : "");
if ($aditStyle) {
$res["BEFORE_RECORD"] = "<div class='" . $aditStyle . "'>";
$res["AFTER_RECORD"] = "</div>";
}
if (!empty($arResult["arImages"][$comment["ID"]])) {
$res["FILES"] = array();
foreach ($arResult["arImages"][$comment["ID"]] as $i => $val) {
$t = $arResult["Images"][$i];
$res["FILES"][] = array("THUMBNAIL" => $val["small"], "SRC" => $val["full"], "FILE_SIZE" => $t["source"]["size"], "CONTENT_TYPE" => "image/xyz", "ORIGINAL_NAME" => $t["fileName"], "FILE_NAME" => $t["fileName"]);
}
}
if ($comment["COMMENT_PROPERTIES"]["SHOW"] == "Y") {
$res["UF"] = $comment["COMMENT_PROPERTIES"]["DATA"];
foreach ($res["UF"] as $key => $arPostField) {
if (!empty($arPostField["VALUE"])) {
$res["UF"][$key]['POST_ID'] = $arParams['POST_DATA']['ID'];
$res["UF"][$key]['URL_TO_POST'] = str_replace('#source_post_id#', $arPostField['POST_ID'], $arResult['urlToPost']);
}
}
}
ob_start();
?>
<script>
top.text<?php
echo $comment["ID"];
?>
= text<?php
echo $comment["ID"];
?>
= '<?php
echo CUtil::JSEscape($comment["POST_TEXT"]);
?>
';
top.title<?php
echo $comment["ID"];
?>
= title<?php
echo $comment["ID"];
?>
= '<?php
echo CUtil::JSEscape($comment["TITLE"]);
?>
';
top.arComFiles<?php
echo $comment["ID"];
?>
= [];<?php
if ($comment["COMMENT_PROPERTIES"]["DATA"]) {
foreach ($comment["COMMENT_PROPERTIES"]["DATA"] as $userField) {
if (empty($userField["VALUE"])) {
continue;
} else {
if ($userField["USER_TYPE_ID"] == "disk_file") {
?>
top.arComDFiles<?php
echo $comment["ID"];
?>
= BX.util.array_merge((top.arComDFiles<?php
echo $comment["ID"];
?>
|| []), <?php
echo CUtil::PhpToJSObject($userField["VALUE"]);
?>
//.........这里部分代码省略.........
开发者ID:webgksupport,项目名称:alpina,代码行数:101,代码来源:functions.php
示例4: GetMessage
if ($arBlogUser) {
if ($USER->IsAuthorized() && $USER->GetID() == $arBlogUser["USER_ID"]) {
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(GetMessage("B_B_FR_TITLES"));
}
} else {
$dbUser = CUser::GetByID($arBlogUser["USER_ID"]);
$arUser = $dbUser->GetNext();
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(str_replace("#NAME#", CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]), GetMessage("B_B_FR_TITLE_OF")));
}
}
$dbList = CBlogUser::GetUserFriendsList($arParams["ID"], $USER->GetID(), $USER->IsAuthorized(), $arParams["MESSAGE_COUNT"], $arParams["GROUP_ID"]);
$arResult["FRIENDS_POSTS"] = array();
$arResult["IDS"] = array();
$p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
while ($arList = $dbList->Fetch()) {
$arResult["IDS"][] = $arList["ID"];
$arPost = CBlogPost::GetByID($arList["ID"]);
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
$arPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"])));
$arPost["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arPost["AUTHOR_ID"]));
if ($arPost["AUTHOR_ID"] == $arBlog["OWNER_ID"]) {
$arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"]));
} else {
if ($arOwnerBlog = CBlog::GetByOwnerID($arPost["AUTHOR_ID"], $arParams["GROUP_ID"])) {
$arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"]));
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例5: intval
$arResult["images"] = $Vars["images"];
$arResult["Category"] = $Vars["Category"];
$arResult["GRATITUDE"] = $Vars["GRATITUDE"];
$arResult["POST_PROPERTIES"] = $Vars["POST_PROPERTIES"];
$arResult["arUser"] = $Vars["arUser"];
CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]);
$cache->Output();
} else {
if ($arParams["CACHE_TIME"] > 0) {
$cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arPost["AUTHOR_ID"]));
}
}
$p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$p->bMobile = isset($arParams["MOBILE"]) && $arParams["MOBILE"] == "Y";
$arResult["POST_PROPERTIES"] = array("SHOW" => "N");
$bHasImg = false;
$bHasTag = false;
$bHasProps = false;
$bHasOnlyAll = false;
if (!empty($arParams["POST_PROPERTY"])) {
if ($arPost["HAS_PROPS"] != "N") {
$arPostFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_POST", $arPost["ID"], LANGUAGE_ID);
if (count($arParams["POST_PROPERTY"]) > 0) {
foreach ($arPostFields as $FIELD_NAME => $arPostField) {
if (!in_array($FIELD_NAME, $arParams["POST_PROPERTY"])) {
continue;
} elseif ($FIELD_NAME == "UF_GRATITUDE" && array_key_exists("VALUE", $arPostField) && intval($arPostField["VALUE"]) > 0) {
$bHasProps = true;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例6: 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",
开发者ID:akniyev,项目名称:arteva.ru,代码行数:67,代码来源:blog_post.php
示例7: 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;
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:blog_comment.php
示例8: 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");
}
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:authmanager.php
示例9: 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;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php
示例10: addLiveComment
/**
* Use component main.post.list to work with LiveFeed
* @param int $commentId Comment ID which needs to send.
* @param array $arParams Array of settings (DATE_TIME_FORMAT, SHOW_RATING, PATH_TO_USER, AVATAR_SIZE, NAME_TEMPLATE, SHOW_LOGIN)
* @return string
*/
public static function addLiveComment($commentId = 0, $arParams = array())
{
$res = "";
if ($commentId > 0 && CModule::IncludeModule("pull") && \CPullOptions::GetNginxStatus() && ($comment = CBlogComment::GetByID($commentId)) && ($arPost = CBlogPost::GetByID($comment["POST_ID"]))) {
global $DB, $APPLICATION;
$arParams["DATE_TIME_FORMAT"] = isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : $DB->DateFormatToPHP(CSite::GetDateFormat("FULL"));
$arParams["SHOW_RATING"] = $arParams["SHOW_RATING"] == "N" ? "N" : "Y";
$arParams["PATH_TO_USER"] = isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '';
$arParams["AVATAR_SIZE_COMMENT"] = $arParams["AVATAR_SIZE_COMMENT"] > 0 ? $arParams["AVATAR_SIZE_COMMENT"] : ($arParams["AVATAR_SIZE"] > $arParams["AVATAR_SIZE"] ? $arParams["AVATAR_SIZE"] : 58);
$arParams["NAME_TEMPLATE"] = isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat();
$arParams["SHOW_LOGIN"] = $arParams["SHOW_LOGIN"] == "N" ? "N" : "Y";
$comment["DateFormated"] = FormatDateFromDB($comment["DATE_CREATE"], $arParams["DATE_TIME_FORMAT"], true);
$timestamp = MakeTimeStamp($comment["DATE_CREATE"]);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$comment["DateFormated"] = ToLower($comment["DateFormated"]);
}
$comment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
$arAuthor = CBlogUser::GetUserInfo($comment["AUTHOR_ID"], $arParams["PATH_TO_USER"], array("AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]));
if (intval($arAuthor["PERSONAL_PHOTO"]) > 0) {
$image_resize = CFile::ResizeImageGet($arAuthor["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE_COMMENT"], "height" => $arParams["AVATAR_SIZE_COMMENT"]), BX_RESIZE_IMAGE_EXACT);
$arAuthor["PERSONAL_PHOTO_RESIZED"] = array("src" => $image_resize["src"]);
}
$p = new blogTextParser(false, '');
$ufCode = "UF_BLOG_COMMENT_FILE";
if (is_array($comment["UF"][$ufCode])) {
$p->arUserfields = array($ufCode => array_merge($comment["UF"][$ufCode], array("TAG" => "DOCUMENT ID")));
}
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "SHORT_ANCHOR" => "Y");
$arParserParams = array("imageWidth" => 800, "imageHeight" => 800);
$comment["TextFormated"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
$p->bMobile = true;
$comment["TextFormatedMobile"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
$comment["TextFormatedJS"] = CUtil::JSEscape(htmlspecialcharsBack($comment["POST_TEXT"]));
$comment["TITLE"] = CUtil::JSEscape(htmlspecialcharsBack($comment["TITLE"]));
$eventHandlerID = AddEventHandler("main", "system.field.view.file", array("CSocNetLogTools", "logUFfileShow"));
$res = $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("TEMPLATE_ID" => 'BLOG_COMMENT_BG_', "RATING_TYPE_ID" => $arParams["SHOW_RATING"] == "Y" ? "BLOG_COMMENT" : "", "ENTITY_XML_ID" => "BLOG_" . $arPost["ID"], "RECORDS" => array($commentId => array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => $timestamp, "POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "AUTHOR" => array("ID" => $arAuthor["ID"], "NAME" => $arAuthor["~NAME"], "LAST_NAME" => $arAuthor["~LAST_NAME"], "SECOND_NAME" => $arAuthor["~SECOND_NAME"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"]), "FILES" => false, "UF" => $comment["UF"], "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "WEB" => array("POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "CLASSNAME" => "", "POST_MESSAGE_TEXT" => $comment["TextFormated"], "AFTER" => <<<HTML
<script>top.text{$commentId} = text{$commentId} = '{$comment["TextFormatedJS"]}';top.title{$commentId} = title{$commentId} = '{$comment["TITLE"]}';top.arComFiles{$commentId} = [];</script>
HTML
), "MOBILE" => array("POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "CLASSNAME" => "", "POST_MESSAGE_TEXT" => $comment["TextFormatedMobile"]))), "NAV_STRING" => "", "NAV_RESULT" => "", "PREORDER" => "N", "RIGHTS" => array("MODERATE" => "N", "EDIT" => "N", "DELETE" => "N"), "VISIBLE_RECORDS_COUNT" => 1, "ERROR_MESSAGE" => "", "OK_MESSAGE" => "", "RESULT" => $commentId, "PUSH&PULL" => array("ACTION" => "REPLY", "ID" => $commentId), "MODE" => "PULL_MESSAGE", "VIEW_URL" => "", "EDIT_URL" => "", "MODERATE_URL" => "", "DELETE_URL" => "", "AUTHOR_URL" => "", "AVATAR_SIZE" => $arParams["AVATAR_SIZE_COMMENT"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "DATE_TIME_FORMAT" => "", "LAZYLOAD" => "", "NOTIFY_TAG" => "", "NOTIFY_TEXT" => "", "SHOW_MINIMIZED" => "Y", "SHOW_POST_FORM" => "", "IMAGE_SIZE" => "", "mfi" => ""), array(), null);
if ($eventHandlerID !== false && intval($eventHandlerID) > 0) {
RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
}
}
return $res;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:blog_comment.php
示例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[
|
请发表评论