本文整理汇总了PHP中CBlogTools类的典型用法代码示例。如果您正苦于以下问题:PHP CBlogTools类的具体用法?PHP CBlogTools怎么用?PHP CBlogTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBlogTools类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (($arParams["GET_FOLLOW"] == "Y" && (!array_key_exists("FOLLOW", $arParams) || strlen($arParams["FOLLOW"]) <= 0) || intval($arParams["LOG_ID"]) <= 0) && CModule::IncludeModule("socialnetwork")) {
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_micro", "blog_post_important"), "SOURCE_ID" => $arParams["ID"], "SITE_ID" => CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite() ? SITE_ID : array(SITE_ID, false)), false, false, $arParams["GET_FOLLOW"] == "Y" ? array("ID", "FOLLOW", "FAVORITES_USER_ID") : array("ID", "FAVORITES_USER_ID"), $arParams["GET_FOLLOW"] == "Y" ? array("USE_FOLLOW" => "Y") : array());
if ($arLogSrc = $rsLogSrc->Fetch()) {
$arParams["LOG_ID"] = $arLogSrc["ID"];
$arParams["FAVORITES_USER_ID"] = $arLogSrc["FAVORITES_USER_ID"];
if ($arParams["GET_FOLLOW"] == "Y") {
$arParams["FOLLOW"] = $arLogSrc["FOLLOW"];
}
} elseif (!$arResult["bFromList"]) {
$bNoLogEntry = true;
}
}
if (!$arResult["bFromList"]) {
CBlogPost::CounterInc($arPost["ID"]);
}
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
if ($arPost["AUTHOR_ID"] == $user_id) {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_FULL;
} elseif ($arResult["bFromList"]) {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_READ;
if (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, !isset($arParams["MOBILE"]) || $arParams["MOBILE"] != "Y") || $APPLICATION->GetGroupRight("blog") >= "W") {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_FULL;
}
} else {
$arPost["perms"] = $arResult["PostPerm"] = $bNoLogEntry ? BLOG_PERMS_DENY : CBlogPost::GetSocNetPostPerms($arPost["ID"], true, false, $arPost["AUTHOR_ID"]);
}
$arResult["Post"] = $arPost;
$arResult["PostSrc"] = $arPost;
$arResult["Blog"] = $arBlog;
$arResult["PostSrc"]["PATH_TO_CONPANY_DEPARTMENT"] = $arParams["PATH_TO_CONPANY_DEPARTMENT"];
$arResult["PostSrc"]["PATH_TO_GROUP"] = $arParams["PATH_TO_GROUP"];
示例2: preg_replace
}
$text = preg_replace(array("#\\[img\\](.+?)\\[/img\\]#ie", "/\\[document id=\\d+([^\\]]*)\\]/is"), "", $arPost["~DETAIL_TEXT"]);
$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, 60);
$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"] = htmlspecialcharsback($arTmp["TITLE"]);
if (strlen($arTmp["TITLE"]) <= 0) {
$arTmp["TITLE"] = $arPost["TITLE"];
$arTmp["~TITLE"] = $arPost["~TITLE"];
}
}
$user = CUser::GetByID($arPost["AUTHOR_ID"]);
$arTmp["arUser"] = $user->Fetch();
$itemCnt++;
$arResult[] = $arTmp;
$ids[] = $arTmp["ID"];
}
$arResult["IDS"] = $ids;
}
示例3: array
$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) {
if (empty($arResult["USER_CACHE"][$arComment["AUTHOR_ID"]])) {
$arUsrTmp = array();
$arUsrTmp["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["AUTHOR_ID"]));
$arUsrTmp["BlogUser"] = CBlogUser::GetByID($arComment["AUTHOR_ID"], BLOG_BY_USER_ID);
$arUsrTmp["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arUsrTmp["BlogUser"]);
$dbUser = CUser::GetByID($arComment["AUTHOR_ID"]);
$arUsrTmp["arUser"] = $dbUser->GetNext();
$arUsrTmp["AuthorName"] = CBlogUser::GetUserName($arUsrTmp["BlogUser"]["ALIAS"], $arUsrTmp["arUser"]["NAME"], $arUsrTmp["arUser"]["LAST_NAME"], $arUsrTmp["arUser"]["LOGIN"]);
if (IntVal($arUsrTmp["BlogUser"]["AVATAR"]) > 0) {
$arUsrTmp["AVATAR_file"] = CFile::ResizeImageGet($arUsrTmp["BlogUser"]["AVATAR"], array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_EXACT, false);
} elseif ($arResult["bSoNet"] && IntVal($arUsrTmp["arUser"]["PERSONAL_PHOTO"]) > 0) {
$arUsrTmp["AVATAR_file"] = CFile::ResizeImageGet($arUsrTmp["arUser"]["PERSONAL_PHOTO"], array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_EXACT, false);
}
if ($arUsrTmp["AVATAR_file"] !== false) {
$arUsrTmp["AVATAR_img"] = CFile::ShowImage($arUsrTmp["AVATAR_file"]["src"], 30, 30, "border=0 align='right'");
}
$arUsrTmp["Blog"] = CBlog::GetByOwnerID(IntVal($arComment["AUTHOR_ID"]), $arParams["GROUP_ID"]);
if ($arUsrTmp["AUTHOR_ID"] == $arUsrTmp["AUTHOR_ID"]) {
$arUsrTmp["AuthorIsPostAuthor"] = "Y";
}
示例4: trim
$arParams["PAGE_VAR"] = "page";
}
if (strLen($arParams["POST_VAR"]) <= 0) {
$arParams["POST_VAR"] = "id";
}
$arParams["PATH_TO_TRACKBACK"] = trim($arParams["PATH_TO_TRACKBACK"]);
if (strlen($arParams["PATH_TO_TRACKBACK"]) <= 0) {
$arParams["PATH_TO_TRACKBACK"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=trackback&" . $arParams["BLOG_VAR"] . "=#blog#" . "&" . $arParams["POST_VAR"] . "=#post_id#");
}
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
if (COption::GetOptionString("blog", "enable_trackback", "Y") == "Y") {
if ($arPost = CBlogPost::GetByID($arParams["ID"])) {
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arResult["Post"] = $arPost;
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
$arResult["USER_ID"] = $USER->GetID();
$arResult["PostPerm"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["USER_ID"]);
$arResult["Blog"] = $arBlog;
$arBlogUrl = CBlog::GetByUrl($arParams["BLOG_URL"]);
if (!empty($arBlogUrl) && $arBlogUrl["URL"] == $arBlog["URL"]) {
if ($arPost["ENABLE_TRACKBACK"] == "Y") {
if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
if (check_bitrix_sessid() && IntVal($_GET["delete_trackback_id"]) > 0 && CBlogPost::CanUserDeletePost(IntVal($arPost["ID"]), IntVal($USER->GetID()))) {
CBlogTrackback::Delete(IntVal($_GET["delete_trackback_id"]));
if (intval($arBlog["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork") && method_exists("CSocNetGroup", "GetSite")) {
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arBlog["SOCNET_GROUP_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
示例5: array
CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]);
$arResult = $Vars["arResult"];
$cache->Output();
} else {
if ($arParams["CACHE_TIME"] > 0) {
$cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
}
if ($arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"])) {
if ($arBlog["ACTIVE"] == "Y") {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID) {
$arBlog["Group"] = $arGroup;
$arResult = $arBlog;
$arResult["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"]));
$arResult["arUserBlog"] = CBlogUser::GetByID($arBlog["OWNER_ID"], BLOG_BY_USER_ID);
$arResult["arUserBlog"] = CBlogTools::htmlspecialcharsExArray($arResult["arUserBlog"]);
$dbUser = CUser::GetByID($arBlog["OWNER_ID"]);
$arResult["arUser"] = $dbUser->GetNext();
$arResult["AuthorName"] = CBlogUser::GetUserName($arResult["arUserBlog"]["ALIAS"], $arResult["arUser"]["NAME"], $arResult["arUser"]["LAST_NAME"], $arResult["arUser"]["LOGIN"]);
$arResult["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arBlog["OWNER_ID"]));
$arResult["Avatar"] = CFile::GetFileArray($arResult["arUserBlog"]["AVATAR"]);
if (!empty($arResult["Avatar"])) {
$arResult["Avatar_FORMATED"] = CFile::ShowImage($arResult["Avatar"]["SRC"], 100, 100, 'title="' . $arResult["AuthorName"] . '" border="0"');
}
$arCategoryAll = array();
//$dbCategory = CBlogCategory::GetList(Array("NAME"=>"ASC"), Array("BLOG_ID"=>$arBlog["ID"]));
$dbCategory = CBlogPostCategory::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"], "POST_PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH), array("CATEGORY_ID", "NAME"), false, array("POST_ID", "BLOG_ID", "NAME", "CATEGORY_ID"));
while ($arCategory = $dbCategory->GetNext()) {
if ($arParams["CATEGORY_ID"] == $arCategory["CATEGORY_ID"]) {
$arCategory["SELECTED"] = "Y";
}
示例6: explode
$arPost["POST_PROPERTIES"]["SHOW"] = "Y";
}
}
$arPost["BlogUser"] = CBlogUser::GetByID($arPost["AUTHOR_ID"], BLOG_BY_USER_ID);
$arPost["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arPost["BlogUser"]);
$dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
$arPost["arUser"] = $dbUser->GetNext();
$arPost["AuthorName"] = CBlogUser::GetUserName($arPost["BlogUser"]["ALIAS"], $arPost["arUser"]["NAME"], $arPost["arUser"]["LAST_NAME"], $arPost["arUser"]["LOGIN"]);
if (preg_match("/(\\[CUT\\])/i", $arPost["DETAIL_TEXT"]) || preg_match("/(<CUT>)/i", $arPost["DETAIL_TEXT"])) {
$arPost["CUT"] = "Y";
}
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));
$arPost["Category"][] = $arCatTmp;
}
}
}
$arPost["DATE_PUBLISH_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL")));
$arResult["FRIENDS_POSTS"][] = array("POST" => $arPost, "BLOG" => $arBlog);
}
if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["IDS"])) {
$arResult['RATING'] = CRatings::GetRatingVoteResult('BLOG_POST', $arResult["IDS"]);
}
} else {
$arResult["FATAL_MESSAGE"] = GetMessage("B_B_FR_NO_USER");
CHTTP::SetStatus("404 Not Found");
}
示例7: elseif
} elseif ($arParams["YEAR"]) {
$from = mktime(0, 0, 0, 1, 1, $arParams["YEAR"]);
$to = mktime(0, 0, 0, 1, 1, $arParams["YEAR"] + 1);
if ($to > ($t = time() + CTimeZone::GetOffset())) {
$to = $t;
}
$arFilter[">=DATE_PUBLISH"] = ConvertTimeStamp($from, "FULL");
$arFilter["<DATE_PUBLISH"] = ConvertTimeStamp($to, "FULL");
} else {
$arFilter["<=DATE_PUBLISH"] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL");
}
if (IntVal($arParams["CATEGORY_ID"]) > 0) {
$arFilter["CATEGORY_ID_F"] = $arParams["CATEGORY_ID"];
if ($arParams["SET_TITLE"] == "Y") {
$arCat = CBlogCategory::GetByID($arFilter["CATEGORY_ID"]);
$arResult["title"]["category"] = CBlogTools::htmlspecialcharsExArray($arCat);
}
}
$arResult["filter"] = $arFilter;
$dbPost = CBlogPost::GetList($SORT, $arFilter, false, array("bDescPageNumbering" => true, "nPageSize" => $arParams["MESSAGE_COUNT"], "bShowAll" => false), array("ID", "TITLE", "BLOG_ID", "AUTHOR_ID", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "DATE_PUBLISH", "PUBLISH_STATUS", "ENABLE_COMMENTS", "VIEWS", "NUM_COMMENTS", "CATEGORY_ID", "CODE", "BLOG_OWNER_ID", "BLOG_GROUP_ID", "BLOG_GROUP_SITE_ID", "MICRO"));
$arResult["NAV_STRING"] = $dbPost->GetPageNavString(GetMessage("MESSAGE_COUNT"), $arParams["NAV_TEMPLATE"]);
$arResult["POST"] = array();
$arResult["IDS"] = array();
while ($arPost = $dbPost->GetNext()) {
$arPost["perms"] = $arResult["perms"];
if (!$bGroupMode && $arParams["USER_ID"] == $user_id && (empty($arParams["4ME"]) || $arPost["AUTHOR_ID"] == $user_id)) {
$arPost["perms"] = BLOG_PERMS_FULL;
} elseif (!$bGroupMode && $arParams["USER_ID"] != $user_id || strlen($arParams["4ME"]) > 0) {
$arPost["perms"] = CBlogPost::GetSocNetPostPerms($arPost["ID"], true);
}
$arPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"]));
示例8: array
$arSearch["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $Blog["URL"], "post_id" => $postID));
if (strpos($arSearch["URL"], "?") !== false) {
$arSearch["URL"] .= "&";
} else {
$arSearch["URL"] .= "?";
}
$arSearch["URL"] .= "commentId=" . substr($arSearch["ITEM_ID"], 1) . "#" . substr($arSearch["ITEM_ID"], 1);
}
} else {
if (!empty($Blog)) {
$arSearch["USER_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $Blog["OWNER_ID"]));
}
}
if ($where != "USER") {
$arSearch["BlogUser"] = CBlogUser::GetByID($arSearch["PARAM2"], BLOG_BY_USER_ID);
$arSearch["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arSearch["BlogUser"]);
$dbUser = CUser::GetByID($arSearch["PARAM2"]);
$arSearch["arUser"] = $dbUser->GetNext();
$arSearch["AuthorName"] = CBlogUser::GetUserName($arSearch["BlogUser"]["ALIAS"], $arSearch["arUser"]["NAME"], $arSearch["arUser"]["LAST_NAME"], $arSearch["arUser"]["LOGIN"]);
}
$arSearch["FULL_DATE_CHANGE_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arSearch["FULL_DATE_CHANGE"], CSite::GetDateFormat("FULL")));
$arResult["SEARCH_RESULT"][] = $arSearch;
}
if (count($arResult["SEARCH_RESULT"]) > 0) {
if (strlen($arResult["~tags"]) > 0) {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("tags=" . urlencode($arResult["tags"]) . "&where=" . urlencode($arResult["where"]), array("tags", "where", "how"));
} else {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("q=" . urlencode($arResult["q"]) . "&where=" . urlencode($arResult["where"]), array("q", "where", "how"));
}
if ($arResult["~how"] != "d") {
$arResult["ORDER_LINK"] .= "&how=d";
示例9: preg_replace
$arRatingResult = CRatings::GetRatingResult($authorityRatingId, $arComment["AUTHOR_ID"]);
if ($arRatingResult["CURRENT_VALUE"] < $arParams["NO_URL_IN_COMMENTS_AUTHORITY"]) {
$arAllow["ANCHOR"] = "Y";
$arAllow["CUT_ANCHOR"] = "Y";
}
} else {
$text = preg_replace("#\\[url(.*?)\\](.*?)\\[/url\\]#is", "\\2", $text);
}
$text = $p->convert($text, false, false, $arAllow);
$text = preg_replace("#(\\[|<)(/?)(b|u|i|list|code|quote|url|img|color|font|video|table|tr|td|align|user|/*)(.*?)(\\]|>)#is", "", $text);
$text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$arComment["TEXT_FORMATED"] = $text;
if (IntVal($arComment["AUTHOR_ID"]) > 0) {
$arComment["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["AUTHOR_ID"]));
$arComment["BlogUser"] = CBlogUser::GetByID($arComment["AUTHOR_ID"], BLOG_BY_USER_ID);
$arComment["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arComment["BlogUser"]);
$dbUser = CUser::GetByID($arComment["AUTHOR_ID"]);
$arComment["arUser"] = $dbUser->GetNext();
$arComment["AuthorName"] = CBlogUser::GetUserName($arComment["BlogUser"]["ALIAS"], $arComment["arUser"]["NAME"], $arComment["arUser"]["LAST_NAME"], $arComment["arUser"]["LOGIN"]);
$arComment["Blog"] = CBlog::GetByOwnerID(IntVal($arComment["AUTHOR_ID"]), $arParams["GROUP_ID"]);
if (!empty($arComment["Blog"])) {
$arComment["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arComment["Blog"]["URL"], "user_id" => $arComment["AUTHOR_ID"]));
} else {
$arComment["urlToBlog"] = $arComment["urlToAuthor"];
}
} else {
$arComment["AuthorName"] = $arComment["AUTHOR_NAME"];
$arComment["AuthorEmail"] = $arComment["AUTHOR_EMAIL"];
}
if (IntVal($arComment["BLOG_SOCNET_GROUP_ID"]) > 0) {
$arComment["urlToComment"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_BLOG_POST"], array("blog" => $arComment["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arComment["POST_ID"], $arComment["POST_CODE"], $arParams["ALLOW_POST_CODE"]), "group_id" => $arComment["BLOG_SOCNET_GROUP_ID"]));
示例10: unset
if (!is_array($arResult["PostToShow"]["SPERM"]["U"][$arPost["AUTHOR_ID"]]) || !in_array("U" . $arPost["AUTHOR_ID"], $arResult["PostToShow"]["SPERM"]["U"][$arPost["AUTHOR_ID"]])) {
unset($arResult["PostToShow"]["SPERM"]["U"][$arPost["AUTHOR_ID"]]);
}
} else {
$arResult["PostToShow"]["TITLE"] = htmlspecialcharsEx($_POST["POST_TITLE"]);
$arResult["PostToShow"]["CATEGORY_ID"] = $_POST["CATEGORY_ID"];
$arResult["PostToShow"]["CategoryText"] = htmlspecialcharsEx($_POST["TAGS"]);
$arResult["PostToShow"]["DETAIL_TEXT"] = $_POST["POST_MESSAGE"];
$arResult["PostToShow"]["~DETAIL_TEXT"] = $_POST["POST_MESSAGE"];
$arResult["PostToShow"]["PUBLISH_STATUS"] = htmlspecialcharsEx($_POST["PUBLISH_STATUS"]);
$arResult["PostToShow"]["ENABLE_COMMENTS"] = htmlspecialcharsEx($_POST["ENABLE_COMMENTS"]);
$arResult["PostToShow"]["DATE_PUBLISH"] = $_POST["DATE_PUBLISH"] ? htmlspecialcharsEx($_POST["DATE_PUBLISH"]) : ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL");
if ($arParams["ALLOW_POST_CODE"]) {
$arResult["PostToShow"]["CODE"] = htmlspecialcharsEx($_POST["CODE"]);
}
$arResult["PostToShow"]["SPERM"] = CBlogTools::htmlspecialcharsExArray($_POST["SPERM"]);
if (empty($arResult["PostToShow"]["SPERM"])) {
$arResult["PostToShow"]["SPERM"] = array();
}
if (empty($_POST["SPERM"])) {
if (IntVal($arParams["SOCNET_GROUP_ID"]) > 0) {
$arResult["PostToShow"]["SPERM"]["SG"][IntVal($arParams["SOCNET_GROUP_ID"])] = "";
}
if (IntVal($arParams["SOCNET_USER_ID"]) > 0) {
$arResult["PostToShow"]["SPERM"]["U"][IntVal($arParams["SOCNET_USER_ID"])] = "";
}
} else {
foreach ($_POST["SPERM"] as $k => $v) {
foreach ($v as $vv1) {
if (strlen($vv1) > 0) {
if ($vv1 == "UA") {
示例11: array
}
if ($arResult["postPreview"]["POST_MESSAGE_TYPE"] == "html" && $arResult["allowHTML"] == "Y") {
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "QUOTE" => "Y", "CODE" => "Y");
if ($arResult["allowVideo"] != "Y") {
$arAllow["VIDEO"] = "N";
}
$arResult["postPreview"]["textFormated"] = $p->convert($arResult["postPreview"]["~DETAIL_TEXT"], false, $arImages, $arAllow, $arParserParams);
} else {
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y");
if ($arResult["allowVideo"] != "Y") {
$arAllow["VIDEO"] = "N";
}
$arResult["postPreview"]["textFormated"] = $p->convert($arResult["postPreview"]["DETAIL_TEXT"], false, $arImages, $arAllow, $arParserParams);
}
$arResult["postPreview"]["BlogUser"] = CBlogUser::GetByID($arResult["UserID"], BLOG_BY_USER_ID);
$arResult["postPreview"]["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arResult["postPreview"]["BlogUser"]);
$dbUser = CUser::GetByID($arResult["UserID"]);
$arResult["postPreview"]["arUser"] = $dbUser->GetNext();
$arResult["postPreview"]["AuthorName"] = CBlogUser::GetUserName($arResult["postPreview"]["BlogUser"]["ALIAS"], $arResult["postPreview"]["arUser"]["NAME"], $arResult["postPreview"]["arUser"]["LAST_NAME"], $arResult["postPreview"]["arUser"]["LOGIN"]);
$arResult["postPreview"]["BlogUser"]["AVATAR_file"] = CFile::GetFileArray($arResult["postPreview"]["BlogUser"]["AVATAR"]);
if ($arResult["postPreview"]["BlogUser"]["AVATAR_file"] !== false) {
$arResult["postPreview"]["BlogUser"]["Avatar_resized"] = CFile::ResizeImageGet($arResult["postPreview"]["BlogUser"]["AVATAR_file"], array("width" => 100, "height" => 100), BX_RESIZE_IMAGE_EXACT, false);
$arResult["postPreview"]["BlogUser"]["AVATAR_img"] = CFile::ShowImage($arResult["postPreview"]["BlogUser"]["Avatar_resized"]["src"], 100, 100, "border=0 align='right'");
}
if (strlen($arResult["PostToShow"]["CategoryText"]) > 0) {
$arCatTmp = explode(",", $arResult["PostToShow"]["CategoryText"]);
if (is_array($arCatTmp)) {
foreach ($arCatTmp as $v) {
$arResult["postPreview"]["Category"][] = array("NAME" => htmlspecialcharsbx(trim($v)));
}
}
示例12: DeleteDoubleBR
function DeleteDoubleBR($text)
{
if(strpos($text, "<br />\r<br />") !== false)
{
$text = str_replace("<br />\r<br />", "<br />", $text);
return CBlogTools::DeleteDoubleBR($text);
}
if(strpos($text, "<br /><br />") !== false)
{
$text = str_replace("<br /><br />", "<br />", $text);
return CBlogTools::DeleteDoubleBR($text);
}
if(strpos($text, "<br />") == 0 && strpos($text, "<br />") !== false)
{
$text = substr($text, 6);
}
return $text;
}
示例13: htmlspecialcharsbx
if (strlen($arParams["PATH_TO_BLOG"]) <= 0) {
$arParams["PATH_TO_BLOG"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=blog&" . $arParams["BLOG_VAR"] . "=#blog#");
}
$arParams["PATH_TO_POST"] = trim($arParams["PATH_TO_POST"]);
if (strlen($arParams["PATH_TO_POST"]) <= 0) {
$arParams["PATH_TO_POST"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=post&" . $arParams["BLOG_VAR"] . "=#blog#&" . $arParams["POST_VAR"] . "=#post_id#");
}
$arParams["PATH_TO_USER"] = trim($arParams["PATH_TO_USER"]);
if (strlen($arParams["PATH_TO_USER"]) <= 0) {
$arParams["PATH_TO_USER"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=user&" . $arParams["USER_VAR"] . "=#user_id#");
}
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
if (empty($arParams["GROUP_ID"]) || !empty($arParams["GROUP_ID"]) && in_array($arParams["ID"], $arParams["GROUP_ID"]) || $bShowAll) {
$arGroup = CBlogGroup::GetByID($arParams["ID"]);
if (!empty($arGroup) || $bShowAll) {
$arGroup = CBlogTools::htmlspecialcharsExArray($arGroup);
$arResult["GROUP"] = $arGroup;
if ($arParams["SET_TITLE"] == "Y") {
if ($bShowAll) {
$APPLICATION->SetTitle(GetMessage("B_B_GR_TITLE"));
} else {
$APPLICATION->SetTitle(GetMessage("B_B_GR_TITLE_NAME", array("#group#" => $arGroup["NAME"])));
}
}
$cache = new CPHPCache();
$cache_id = "blog_groups_" . serialize($arParams) . "_" . CDBResult::NavStringForCache($arParams["BLOG_COUNT"]);
if (($tzOffset = CTimeZone::GetOffset()) != 0) {
$cache_id .= "_" . $tzOffset;
}
$cache_path = "/" . SITE_ID . "/blog/groups/" . $arParams["ID"] . "/";
if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
示例14: Notify
function Notify($arPost, $arBlog, $arParams)
{
global $DB;
if (empty($arBlog)) {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
}
if ($arParams["bSoNet"] || $arBlog["EMAIL_NOTIFY"] == "Y" && $arParams["user_id"] != $arBlog["OWNER_ID"]) {
$BlogUser = CBlogUser::GetByID($arParams["user_id"], BLOG_BY_USER_ID);
$BlogUser = CBlogTools::htmlspecialcharsExArray($BlogUser);
$res = CUser::GetByID($arBlog["OWNER_ID"]);
$arOwner = $res->GetNext();
$dbUser = CUser::GetByID($arParams["user_id"]);
$arUser = $dbUser->Fetch();
$AuthorName = CBlogUser::GetUserNameEx($arUser, $BlogUser, $arParams);
$parserBlog = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$text4mail = $arPost["DETAIL_TEXT"];
if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
$text4mail = HTMLToTxt($text4mail);
}
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "N"));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
$text4mail = $parserBlog->convert4mail($text4mail, $arImages);
$dbSite = CSite::GetByID(SITE_ID);
$arSite = $dbSite->Fetch();
$serverName = htmlspecialcharsEx($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 (!$arParams["bSoNet"] && $arBlog["EMAIL_NOTIFY"] == "Y" && $arParams["user_id"] != $arBlog["OWNER_ID"] && IntVal($arBlog["OWNER_ID"]) > 0) {
CEvent::Send("NEW_BLOG_MESSAGE", SITE_ID, array("BLOG_ID" => $arBlog["ID"], "BLOG_NAME" => htmlspecialcharsBack($arBlog["NAME"]), "BLOG_URL" => $arBlog["URL"], "MESSAGE_TITLE" => $arPost["TITLE"], "MESSAGE_TEXT" => $text4mail, "MESSAGE_DATE" => GetTime(MakeTimeStamp($arPost["DATE_PUBLISH"]) - CTimeZone::GetOffset(), "FULL"), "MESSAGE_PATH" => "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("blog" => $arBlog["URL"], "post_id" => $arPost["ID"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"])), "AUTHOR" => $AuthorName, "EMAIL_FROM" => COption::GetOptionString("main", "email_from", "nobody@nobody.com"), "EMAIL_TO" => $arOwner["EMAIL"]));
}
if ($arParams["bSoNet"] && $arPost["ID"] && CModule::IncludeModule("socialnetwork")) {
if ($arPost["DETAIL_TEXT_TYPE"] == "html" && $arParams["allowHTML"] == "Y" && $arBlog["ALLOW_HTML"] == "Y") {
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "Y", "QUOTE" => "Y", "CODE" => "Y");
if ($arParams["allowVideo"] != "Y") {
$arAllow["VIDEO"] = "N";
}
$text4message = $parserBlog->convert($arPost["DETAIL_TEXT"], false, $arImages, $arAllow);
} else {
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "TABLE" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
$text4message = $parserBlog->convert($arPost["DETAIL_TEXT"], false, $arImages, $arAllow, array("isSonetLog" => true));
}
$arSoFields = array("EVENT_ID" => "blog_post", "=LOG_DATE" => strlen($arPost["DATE_PUBLISH"]) > 0 ? MakeTimeStamp($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $SITE_ID)) > time() + CTimeZone::GetOffset() ? $DB->CharToDateFunction($arPost["DATE_PUBLISH"], "FULL", SITE_ID) : $DB->CurrentTimeFunction() : $DB->CurrentTimeFunction(), "TITLE_TEMPLATE" => "#USER_NAME# " . GetMessage("BLG_SONET_TITLE"), "TITLE" => $arPost["TITLE"], "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "MODULE_ID" => "blog", "CALLBACK_FUNC" => false, "SOURCE_ID" => $arPost["ID"], "ENABLE_COMMENTS" => array_key_exists("ENABLE_COMMENTS", $arPost) && $arPost["ENABLE_COMMENTS"] == "N" ? "N" : "Y");
$arSoFields["RATING_TYPE_ID"] = "BLOG_POST";
$arSoFields["RATING_ENTITY_ID"] = intval($arPost["ID"]);
if ($arParams["bGroupMode"]) {
$arSoFields["ENTITY_TYPE"] = SONET_ENTITY_GROUP;
$arSoFields["ENTITY_ID"] = $arParams["SOCNET_GROUP_ID"];
$arSoFields["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => $arPost["ID"]));
} else {
$arSoFields["ENTITY_TYPE"] = SONET_ENTITY_USER;
$arSoFields["ENTITY_ID"] = $arBlog["OWNER_ID"];
$arSoFields["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => $arPost["ID"]));
}
if (intval($arParams["user_id"]) > 0) {
$arSoFields["USER_ID"] = $arParams["user_id"];
}
$logID = CSocNetLog::Add($arSoFields, false);
if (intval($logID) > 0) {
$socnetPerms = CBlogPost::GetSocNetPermsCode($arPost["ID"]);
if (!in_array("U" . $arPost["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $arPost["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
if (CModule::IncludeModule("extranet")) {
$arSiteID = CExtranet::GetSitesByLogDestinations($socnetPerms);
CSocNetLog::Update($logID, array("SITE_ID" => $arSiteID));
}
CSocNetLogRights::DeleteByLogID($logID);
CSocNetLogRights::Add($logID, $socnetPerms);
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
return $logID;
}
}
}
示例15: GetMessage
$arResult["COMMENT_ERROR"] = "<b>" . GetMessage("B_B_PC_COM_ERROR_EDIT") . "</b><br />" . GetMessage("B_B_PC_EDIT_ALREADY_COMMENTED");
} else {
if (!empty($_POST["attachedFilesRaw"]) && is_array($_POST["attachedFilesRaw"])) {
CSocNetLogComponent::saveRawFilesToUF($_POST["attachedFilesRaw"], IsModuleInstalled("webdav") || IsModuleInstalled("disk") ? "UF_BLOG_COMMENT_FILE" : "UF_BLOG_COMMENT_DOC", $arFields);
}
if ($commentID = CBlogComment::Update($commentID, $arFields)) {
BXClearCache(true, "/blog/comment/" . intval($arParams["ID"] / 100) . "/" . $arParams["ID"] . "/");
$images = array();
$res = CBlogImage::GetList(array(), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "COMMENT_ID" => $commentID, "IS_COMMENT" => "Y"));
while ($aImg = $res->Fetch()) {
$images[$aImg["ID"]] = $aImg["FILE_ID"];
}
$arParamsUpdateLog = array("PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "IMAGES" => $images);
if (IntVal($user_id) > 0) {
$arResult["BlogUser"] = CBlogUser::GetByID($user_id, BLOG_BY_USER_ID);
$arResult["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arResult["BlogUser"]);
$dbUser = CUser::GetByID($user_id);
$arResult["arUser"] = $dbUser->GetNext();
$arResult["User"]["NAME"] = CBlogUser::GetUserName($arResult["BlogUser"]["ALIAS"], $arResult["arUser"]["NAME"], $arResult["arUser"]["LAST_NAME"], $arResult["arUser"]["LOGIN"]);
}
CBlogComment::UpdateLog($commentID, $arResult["BlogUser"], $arResult["User"], $arFields, $arPost, $arParamsUpdateLog);
$res = CBlogImage::GetList(array(), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y", "COMMENT_ID" => false, "<=TIMESTAMP_X" => ConvertTimeStamp(AddToTimeStamp(array("HH" => -3)), "FULL")));
while ($aImg = $res->Fetch()) {
CBlogImage::Delete($aImg["ID"]);
}
$commentUrl = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"]));
$commentUrl .= strpos($commentUrl, "?") !== false ? "&" : "?";
if (strlen($arFields["PUBLISH_STATUS"]) > 0 && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
$arResult["MESSAGE"] = GetMessage("B_B_PC_MES_HIDDEN_EDITED");
}
$arResult["ajax_comment"] = $commentID;