本文整理汇总了PHP中CBlogUser::PreparePath方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogUser::PreparePath方法的具体用法?PHP CBlogUser::PreparePath怎么用?PHP CBlogUser::PreparePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogUser
的用法示例。
在下文中一共展示了CBlogUser::PreparePath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BuildRSS
public static function BuildRSS($postID, $blogID, $type = "RSS2.0", $numPosts = 10, $arPathTemplate = Array())
{
$blogID = IntVal($blogID);
$postID = IntVal($postID);
if($blogID <= 0)
return false;
if($postID <= 0)
return false;
$numPosts = IntVal($numPosts);
$type = strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
if ($type != "rss.92" && $type != "atom.03")
$type = "rss2.0";
$rssText = False;
$arBlog = CBlog::GetByID($blogID);
if ($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y")
{
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if($arGroup["SITE_ID"] == SITE_ID)
{
$arPost = CBlogPost::GetByID($postID);
if(!empty($arPost) && $arPost["BLOG_ID"] == $arBlog["ID"] && $arPost["ENABLE_COMMENTS"] == "Y")
{
$now = date("r");
$nowISO = date("Y-m-d\TH:i:s").substr(date("O"), 0, 3).":".substr(date("O"), -2, 2);
$serverName = "";
$charset = "";
$language = "";
$dbSite = CSite::GetList(($b = "sort"), ($o = "asc"), array("LID" => SITE_ID));
if ($arSite = $dbSite->Fetch())
{
$serverName = $arSite["SERVER_NAME"];
$charset = $arSite["CHARSET"];
$language = $arSite["LANGUAGE_ID"];
}
if (strlen($serverName) <= 0)
{
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
$serverName = SITE_SERVER_NAME;
else
$serverName = COption::GetOptionString("main", "server_name", "");
}
if (strlen($charset) <= 0)
{
if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0)
$charset = SITE_CHARSET;
else
$charset = "windows-1251";
}
if(strlen($arPathTemplate["PATH_TO_BLOG"])>0)
$blogURL = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
else
$blogURL = htmlspecialcharsbx("http://".$serverName.CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"]));
if(strlen($arPathTemplate["PATH_TO_POST"])>0)
$url = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplate["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
else
$url = htmlspecialcharsbx("http://".$serverName.CBlogPost::PreparePath($arBlog["URL"], $arPost["ID"], $arGroup["SITE_ID"]));
$dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
$arUser = $dbUser->Fetch();
if($arPathTemplate["USE_SOCNET"] == "Y")
{
$blogName = GetMessage("BLG_GCM_RSS_TITLE_SOCNET", Array("#AUTHOR_NAME#" => htmlspecialcharsEx($arUser["NAME"]." ".$arUser["LAST_NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
}
else
{
$blogName = GetMessage("BLG_GCM_RSS_TITLE", Array("#BLOG_NAME#" => htmlspecialcharsEx($arBlog["NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
}
$rssText = "";
if ($type == "rss.92")
{
$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
$rssText .= "<rss version=\".92\">\n";
$rssText .= " <channel>\n";
$rssText .= " <title>".$blogName."</title>\n";
$rssText .= " <description>".$blogName."</description>\n";
$rssText .= " <link>".$url."</link>\n";
$rssText .= " <language>".$language."</language>\n";
$rssText .= " <docs>http://backend.userland.com/rss092</docs>\n";
$rssText .= "\n";
}
elseif ($type == "rss2.0")
{
$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
$rssText .= "<rss version=\"2.0\">\n";
$rssText .= " <channel>\n";
$rssText .= " <title>".$blogName."</title>\n";
$rssText .= " <description>".$blogName."</description>\n";
//$rssText .= " <guid>".$url."</guid>\n";
$rssText .= " <link>".$url."</link>\n";
$rssText .= " <language>".$language."</language>\n";
$rssText .= " <docs>http://backend.userland.com/rss2</docs>\n";
//.........这里部分代码省略.........
示例2: 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();
//.........这里部分代码省略.........
示例3: CPHPCache
$cache = new CPHPCache();
$cache_id = "blog_groups_" . serialize($arParams) . "_" . CDBResult::NavStringForCache($BLOGS_COUNT);
$cache_path = "/" . SITE_ID . "/blog/groups/" . $ID . "/";
if ($CACHE_TIME > 0 && $cache->InitCache($CACHE_TIME, $cache_id, $cache_path)) {
$cache->Output();
} else {
if ($CACHE_TIME > 0) {
$cache->StartDataCache($CACHE_TIME, $cache_id, $cache_path);
}
$dbBlogs = CBlog::GetList($SORT, $arFilter, false, $COUNT, $arSelectFields);
if ($arBlogs = $dbBlogs->NavNext(false)) {
//$dbBlogs->NavPrint(GetMessage("B_B_GR_TITLE"));
do {
$urlToBlog = CBlog::PreparePath($arBlogs["URL"], SITE_ID, $is404);
$urlToPost = CBlogPost::PreparePath($arBlogs["URL"], $arBlogs["LAST_POST_ID"], SITE_ID, $is404);
$urlToAuthor = CBlogUser::PreparePath($arBlogs["OWNER_ID"], SITE_ID, $is404);
$AuthorName = CBlogUser::GetUserName($arBlogs["BLOG_USER_ALIAS"], $arBlogs["OWNER_NAME"], $arBlogs["OWNER_LAST_NAME"], $arBlogs["OWNER_LOGIN"]);
?>
<table class="blogtableborder" cellspacing="1" cellpadding="0" width="100%" border="0">
<tr>
<td>
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="blogtablebody">
<tr>
<td class="blogtablehead" align="left" nowrap width="70%" style="padding-left:10px;"><font class="blogpostdate"><a href="<?php
echo $urlToBlog;
?>
"><?php
echo htmlspecialcharsex($arBlogs["NAME"]);
?>
</a><br></font></font></td>
<td class="blogtablehead" align="right" nowrap width="30%" style="padding-right:10px;"><font class="blogauthor"><?php
示例4: PreparePath2User
function PreparePath2User($arParams = array())
{
return CBlogUser::PreparePath(isset($arParams["USER_ID"]) ? $arParams["USER_ID"] : 0, False);
}
示例5: Update
function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CBlogUser::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_blog_user", $arFields, "blog/avatar");
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$arUser = CBlogUser::GetByID($ID, BLOG_BY_BLOG_USER_ID);
$strSql = "UPDATE b_blog_user SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
unset($GLOBALS["BLOG_USER_CACHE_" . $ID]);
unset($GLOBALS["BLOG_USER1_CACHE_" . $arUser["USER_ID"]]);
} else {
$ID = false;
}
if ($ID && !(count($arFields1) == 1 && strlen($arFields1["LAST_VISIT"]) > 0)) {
if (CModule::IncludeModule("search")) {
$arBlogUser = CBlogUser::GetByID($ID);
$dbUser = CUser::GetByID($arBlogUser["USER_ID"]);
$arUser = $dbUser->Fetch();
$arBlog = CBlog::GetByOwnerID($arBlogUser["USER_ID"]);
if ($arBlog) {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
$arPostSite = array($arGroup["SITE_ID"] => CBlogUser::PreparePath($arBlogUser["USER_ID"], $arGroup["SITE_ID"]));
} else {
$arPostSite = array(SITE_ID => CBlogUser::PreparePath($arBlogUser["USER_ID"], SITE_ID));
}
if (strlen($arBlogUser["LAST_VISIT"]) <= 0) {
$arBlogUser["LAST_VISIT"] = ConvertTimeStamp(false, "FULL", false);
}
$arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arBlogUser["LAST_VISIT"], "PARAM1" => "USER", "PARAM2" => $arBlogUser["USER_ID"], "PERMISSIONS" => array(2), "TITLE" => CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]), "BODY" => blogTextParser::killAllTags($arBlogUser["INTERESTS"] . " " . $arBlogUser["DESCRIPTION"]));
CSearch::Index("blog", "U" . $ID, $arSearchIndex);
}
}
return $ID;
}
示例6: GetRSS
//.........这里部分代码省略.........
//SELECT
$arSelFields = array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "BLOG_USER_ALIAS", "BLOG_ID", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_GROUP_SITE_ID", "CODE", self::UFCategroryCodeField);
//WHERE
$arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "BLOG_ENABLE_RSS" => "Y", "MICRO" => "N");
if (intval($arSettings["BLOG_CODE"]) === $arSettings["BLOG_CODE"]) {
$arFilter["BLOG_ID"] = $arSettings["BLOG_CODE"];
} else {
$arFilter["BLOG_URL"] = $arSettings["BLOG_CODE"];
}
//Extend standart filter
$arFilter = array_merge($arFilter, $arFilterExt);
CTimeZone::Disable();
$dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), $arSelFields);
CTimeZone::Enable();
while ($arPost = $dbPosts->Fetch()) {
//Can read
if (CBlogPost::GetBlogUserPostPerms($arPost["ID"], $arSettings["CURRENT_USER_ID"]) < BLOG_PERMS_READ) {
continue;
}
$arAuthorUser = $USER->GetByID($arPost["AUTHOR_ID"])->Fetch();
$author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arAuthorUser["NAME"], $arAuthorUser["LAST_NAME"], $arAuthorUser["LOGIN"], $arAuthorUser["SECOND_NAME"]);
$title = str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $author . ": " . $arPost["TITLE"]);
//Idea Images
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
$arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
if (!empty($arPathTemplates)) {
$url = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$url = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
$category = "";
if (isset($arPost[self::UFCategroryCodeField]) && is_array($arSettings["CATEGORIES"][ToUpper($arPost[self::UFCategroryCodeField])])) {
$category = htmlspecialcharsbx($arSettings["CATEGORIES"][ToUpper($arPost[self::UFCategroryCodeField])]["NAME"]);
}
if (strlen($arPathTemplates["USER"]) > 0) {
$authorURL = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$authorURL = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
$IdeaText = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
} else {
$IdeaText = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, true, $arParserParams);
}
$IdeaText .= "<br /><a href=\"" . $url . "\">" . GetMessage("BLG_GB_RSS_DETAIL") . "</a>";
$IdeaText = "<![CDATA[" . $IdeaText . "]]>";
if ($arSettings["RSS_TYPE"] == "rss.92") {
$arSettings["RSS"] .= "\t<item>\n";
$arSettings["RSS"] .= "\t <title>" . $title . "</title>\n";
$arSettings["RSS"] .= "\t <description>" . $IdeaText . "</description>\n";
$arSettings["RSS"] .= "\t <link>" . $url . "</link>\n";
$arSettings["RSS"] .= "\t</item>\n";
$arSettings["RSS"] .= "\n";
} elseif ($arSettings["RSS_TYPE"] == "rss2.0") {
$arSettings["RSS"] .= "\t<item>\n";
$arSettings["RSS"] .= "\t <title>" . $title . "</title>\n";
$arSettings["RSS"] .= "\t <description>" . $IdeaText . "</description>\n";
$arSettings["RSS"] .= "\t <link>" . $url . "</link>\n";
$arSettings["RSS"] .= "\t <guid>" . $url . "</guid>\n";
$arSettings["RSS"] .= "\t <pubDate>" . $date . "</pubDate>\n";
if (strlen($category) > 0) {
示例7: intval
if (CModule::IncludeModule("blog")) {
$is404 = $is404 == 'N' ? false : true;
$CACHE_TIME = intval($CACHE_TIME);
$category = IntVal($CATEGORY);
$arSelectFields = array("ID", "NAME", "URL", "ACTIVE", "OWNER_ID");
$dbBlog = CBlog::GetList(array(), array("URL" => $URL, "ACTIVE" => "Y"), false, array("nTopCount" => 1), $arSelectedFields);
if ($arBlog = $dbBlog->Fetch()) {
echo '<div align="left" style="padding-left:25px;">';
echo '<p><font class="blogtext"><b><a href="' . CBlog::PreparePath($arBlog["URL"], SITE_ID, $is404) . '">';
echo htmlspecialcharsex($arBlog["NAME"]);
echo '</a></b></font><br><br>';
$arUserBlog = CBlogUser::GetByID($arBlog["OWNER_ID"], BLOG_BY_USER_ID);
$dbUser = CUser::GetByID($arBlog["OWNER_ID"]);
$arUser = $dbUser->Fetch();
$AuthorName = CBlogUser::GetUserName($arUserBlog["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
echo '<a href="' . CBlogUser::PreparePath($arBlog["OWNER_ID"], SITE_ID, $is404) . '">';
echo CFile::ShowImage($arUserBlog["AVATAR"], 100, 100, 'title="' . $AuthorName . '" border="0"');
echo '</a></p>';
if ($GLOBALS["USER"]->IsAuthorized()) {
$arMyBlog = CBlog::GetByOwnerID($GLOBALS["USER"]->GetID());
if ($arMyBlog && $arMyBlog["ID"] != $arBlog["ID"]) {
echo "<p><font class=\"blogtext\">";
$arPath = CBlogSitePath::GetBySiteID(SITE_ID);
$strPath = $arPath["PATH"];
if (CBlog::IsFriend($arBlog["ID"], $GLOBALS["USER"]->GetID())) {
echo "<a href=\"" . CBlog::PreparePath($arBlog["URL"], SITE_ID, $is404) . ($is404 ? "?" : "&") . "become_friend=N\" title=\"" . GetMessage("BLOG_BLOG_BLOGINFO_IO11") . "\">" . GetMessage("BLOG_BLOG_BLOGINFO_IO1") . "</a><br>";
} else {
echo "<a href=\"" . CBlog::PreparePath($arBlog["URL"], SITE_ID, $is404) . ($is404 ? "?" : "&") . "become_friend=Y\" title=\"" . GetMessage("BLOG_BLOG_BLOGINFO_IO21") . "\">" . GetMessage("BLOG_BLOG_BLOGINFO_IO2") . "</a><br>";
}
if (CBlog::IsFriend($arMyBlog["ID"], $arBlog["OWNER_ID"])) {
echo "<a href=\"" . CBlog::PreparePath($arMyBlog["URL"], SITE_ID, $is404) . "user_settings.php?del_id=" . $arBlog["OWNER_ID"] . "\" title=\"" . GetMessage("BLOG_BLOG_BLOGINFO_IO31") . "\">" . GetMessage("BLOG_BLOG_BLOGINFO_IO3") . "</a><br>";
示例8: BuildRSSAll
//.........这里部分代码省略.........
$arFilter["FOR_USER"] = $user_id;
unset($arFilter["MICRO"]);
}
CTimeZone::Disable();
$dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), $arSelFields);
CTimeZone::Enable();
while ($arPost = $dbPosts->Fetch()) {
$perms = CBlogPost::GetBlogUserPostPerms($arPost["ID"], $GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0);
if ($perms < BLOG_PERMS_READ) {
continue;
}
$dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
$arUser = $dbUser->Fetch();
$author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]);
$title = str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $author . ": " . $arPost["TITLE"]);
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
$arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
if (strlen($arPost["PATH"]) > 0) {
$url = htmlspecialcharsbx("http://" . $serverName . str_replace("#post_id#", CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), $arPost["PATH"]));
} elseif (!empty($arPathTemplates)) {
if (IntVal($arPost["BLOG_SOCNET_GROUP_ID"]) > 0 && strlen($arPathTemplates["GROUP_BLOG_POST"]) > 0) {
$url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["GROUP_BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
}
} elseif (strLen($postTemplate) > 0) {
$url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($postTemplate, array("blog" => $arPost["BLOG_URL"], "post_id" => $arPost["ID"], "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$url = htmlspecialcharsbx("http://" . $serverName . CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
$category = htmlspecialcharsbx($arPost["CATEGORY_NAME"]);
if (strlen($arPathTemplates["USER"]) > 0) {
$authorURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} elseif (strLen($userTemplate) > 0) {
$authorURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($userTemplate, array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$authorURL = htmlspecialcharsbx("http://" . $serverName . CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
$text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
} else {
$text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, true, $arParserParams);
}
if ($bUserSocNet != "Y") {
$text .= "<br /><a href=\"" . $url . "\">" . GetMessage("BLG_GB_RSS_DETAIL") . "</a>";
}
$text = "<![CDATA[" . $text . "]]>";
if ($type == "rss.92") {
$rssText .= " <item>\n";
$rssText .= " <title>" . $title . "</title>\n";
$rssText .= " <description>" . $text . "</description>\n";
$rssText .= " <link>" . $url . "</link>\n";
$rssText .= " </item>\n";
$rssText .= "\n";
} elseif ($type == "rss2.0") {
$rssText .= " <item>\n";
$rssText .= " <title>" . $title . "</title>\n";
$rssText .= " <description>" . $text . "</description>\n";
$rssText .= " <link>" . $url . "</link>\n";
$rssText .= " <guid>" . $url . "</guid>\n";
$rssText .= " <pubDate>" . $date . "</pubDate>\n";