本文整理汇总了PHP中CBlog::AddSocnetRead方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlog::AddSocnetRead方法的具体用法?PHP CBlog::AddSocnetRead怎么用?PHP CBlog::AddSocnetRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlog
的用法示例。
在下文中一共展示了CBlog::AddSocnetRead方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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");
}
//.........这里部分代码省略.........
示例2: SetSoNetFeaturePermIndexSearch
function SetSoNetFeaturePermIndexSearch($ID, $arFields)
{
$featurePerm = CSocNetFeaturesPerms::GetByID($ID);
if ($featurePerm["OPERATION_ID"] == "view_post") {
if (CModule::IncludeModule("socialnetwork")) {
$feature = CSocNetFeatures::GetByID($featurePerm["FEATURE_ID"]);
if ($feature["FEATURE"] == "blog" && IntVal($feature["ENTITY_ID"]) > 0) {
if ($feature["ACTIVE"] == "Y" && ($feature["ENTITY_TYPE"] == "U" && $arFields["ROLE"] == "A" || $feature["ENTITY_TYPE"] == "G" && $arFields["ROLE"] == "N")) {
$arFilter = array("USE_SOCNET" => "Y");
if ($feature["ENTITY_TYPE"] == "U") {
$arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
} else {
$arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
if ($arBlog = $dbBlog->Fetch()) {
CBlog::AddSocnetRead($arBlog["ID"]);
}
} else {
$arFilter = array("USE_SOCNET" => "Y");
if ($feature["ENTITY_TYPE"] == "U") {
$arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
} else {
$arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
if ($arBlog = $dbBlog->Fetch()) {
CBlog::DeleteSocnetRead($arBlog["ID"]);
}
}
if ($arBlog && 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"];
}
} else {
$arSites = array(SITE_ID);
}
foreach ($arSites as $site_id_tmp) {
BXClearCache(True, "/" . $site_id_tmp . "/blog/sonet/");
}
}
}
}
}
示例3: while
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);
BXClearCache(true, "/blog/form/blog/");
if ($bRights) {
CBlog::AddSocnetRead($blogID);
}
$arBlog = CBlog::GetByID($blogID, $arParams["GROUP_ID"]);
}
}
} else {
$arResult["ERROR_MESSAGE"] = GetMessage("BPE_SESS");
}
}
if ($_GET["image_upload_frame"] == "Y" || $_GET["image_upload"] || $_POST["do_upload"] || $_GET["del_image_id"]) {
if (check_bitrix_sessid()) {
if (IntVal($_GET["del_image_id"]) > 0) {
$del_image_id = IntVal($_GET["del_image_id"]);
$aImg = CBlogImage::GetByID($del_image_id);
if ($aImg["BLOG_ID"] == $arBlog["ID"] && $aImg["POST_ID"] == IntVal($arParams["ID"])) {
CBlogImage::Delete($del_image_id);
示例4: IntVal
$arFields["=DATE_CREATE"] = $DB->CurrentTimeFunction();
$ID = CBlog::Add($arFields);
$ID = IntVal($ID);
$result = $ID > 0;
$dbBlog = CBlog::GetList(array(), array("ID" => $ID), false, false, array("ID", "GROUP_SITE_ID", "GROUP_ID"));
$arBlogOld = $dbBlog->Fetch();
}
if (CModule::IncludeModule("socialnetwork")) {
if ($arFields["USE_SOCNET"] == "Y") {
$bRights = false;
$featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $arFields["OWNER_ID"], "blog", "view_post");
if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
$bRights = true;
}
if ($bRights) {
CBlog::AddSocnetRead($ID);
} else {
if (CBlog::GetSocnetReadByBlog($ID)) {
CBlog::DeleteSocnetRead($ID);
}
}
} else {
if (CBlog::GetSocnetReadByBlog($ID)) {
CBlog::DeleteSocnetRead($ID);
}
}
}
if (!$result) {
$bVarsFromForm = true;
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . "<br />";
示例5: createBlog
private function createBlog($userId, $blogGroupId, $siteId)
{
global $DB;
$arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => $blogGroupId, "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($userId);
$arUser = $rsUser->Fetch();
if (strlen($arUser["NAME"] . "" . $arUser["LAST_NAME"]) <= 0) {
$arFields["NAME"] = GetMessage("SNBPA_BLOG_NAME") . " " . $arUser["LOGIN"];
} else {
$arFields["NAME"] = GetMessage("SNBPA_BLOG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"];
}
$arFields["URL"] = str_replace(" ", "_", $arUser["LOGIN"]) . "-blog-" . $siteId;
$arFields["OWNER_ID"] = $userId;
$urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
if ($urlCheck != $arFields["URL"]) {
$arFields["URL"] = "u" . $userId . "-blog-" . $siteId;
}
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;
}
$blogID = CBlog::Add($arFields);
BXClearCache(true, "/blog/form/blog/");
if ($bRights) {
CBlog::AddSocnetRead($blogID);
}
return CBlog::GetByID($blogID, $blogGroupId);
}