本文整理汇总了PHP中CBlogUser类的典型用法代码示例。如果您正苦于以下问题:PHP CBlogUser类的具体用法?PHP CBlogUser怎么用?PHP CBlogUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBlogUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnAfterUserAuthorizeHandler
function OnAfterUserAuthorizeHandler(&$arFields)
{
$f = fopen($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/md/log.txt', 'a+');
global $USER;
$rsUser = CUser::GetByID($USER->GetId());
$arUser = $rsUser->Fetch();
fwrite($f, "---start\n");
if ($arUser['ID'] > 0 && $arUser['EXTERNAL_AUTH_ID'] == 'Facebook' && $arUser['UF_RULES'] != '1') {
$facebook = new Facebook_Facebook(array('appId' => '447579571927341', 'secret' => '2f2cf9cd60f9e98d6cf3309e6b7bde5d'));
$id = $arUser["XML_ID"];
$user_info = $facebook->api('/' . $id . '?fields=id,name,first_name,middle_name,last_name,gender,birthday,email,picture');
$props = array();
if (!$arUser['PERSONAL_GENDER']) {
if (isset($user_info['gender']) && $user_info['gender']) {
$props['PERSONAL_GENDER'] = $user_info['gender'] == 'male' ? 'M' : 'F';
}
}
if (!empty($props)) {
$user = new CUser();
$user->Update($arUser["ID"], $props);
}
CModule::IncludeModule("blog");
$blogUser = CBlogUser::GetByID($USER->GetId(), BLOG_BY_USER_ID);
$props = array();
if (!$blogUser['AVATAR']) {
if (isset($user_info['picture']) && $user_info['picture']) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://graph.facebook.com/{$id}/picture?type=large");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
$output = curl_exec($ch);
if ($output) {
$fileName = md5($user_info['picture']);
$fullPath = $_SERVER['DOCUMENT_ROOT'] . "/bitrix/cache/social_pictures/{$fileName}.jpg";
if (file_put_contents($fullPath, $output) !== false) {
$picture = CFile::MakeFileArray($fullPath);
$props['AVATAR'] = $picture;
$user = new CBlogUser();
$user->Update($blogUser["ID"], $props);
unlink($fullPath);
}
}
}
}
}
fwrite($f, "---finish\n");
fclose($f);
}
示例2: CallBack_AddComment
public static function CallBack_AddComment($arFields)
{
if (!CModule::IncludeModule('blog')) {
return false;
}
$arResult = array();
$arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "RATING_ENTITY_ID"))->Fetch();
if ($arLog) {
$arIdeaPost = CBlogPost::GetById($arLog["SOURCE_ID"]);
if ($arIdeaPost) {
$UserIP = CBlogUser::GetUserIP();
$IdeaCommentId = CBlogComment::Add(array("BLOG_ID" => $arIdeaPost["BLOG_ID"], "POST_ID" => $arIdeaPost["ID"], "AUTHOR_ID" => $arFields["USER_ID"], "POST_TEXT" => $arFields["MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "PARENT_ID" => false, "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1]));
$arResult = array("SOURCE_ID" => $IdeaCommentId);
if ($arLog["RATING_ENTITY_ID"] > 0) {
$arResult["RATING_TYPE_ID"] = "BLOG_COMMENT";
$arResult["RATING_ENTITY_ID"] = $IdeaCommentId;
}
if (intval($IdeaCommentId) == 0) {
global $APPLICATION;
if ($ex = $APPLICATION->GetException()) {
$arResult["ERROR"] = $ex->GetString();
}
} else {
//clear cache on succcess
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/pages/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/comment/" . $arIdeaPost["ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/post/" . $arIdeaPost["ID"] . "/");
}
}
}
return $arResult;
}
示例3: CanUserDeletePost
public static function CanUserDeletePost($ID, $userID, $blogOwnerID, $groupOwnerID)
{
$ID = IntVal($ID);
$userID = IntVal($userID);
$blogOwnerID = IntVal($blogOwnerID);
$groupOwnerID = IntVal($groupOwnerID);
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W") {
return True;
}
$arPost = CBlogPost::GetByID($ID);
if (empty($arPost)) {
return False;
}
if ($groupOwnerID > 0) {
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return False;
}
$perms = BLOG_PERMS_DENY;
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "view_post")) {
$perms = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "write_post")) {
$perms = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "full_post")) {
$perms = BLOG_PERMS_FULL;
}
if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
return true;
}
if ($perms > BLOG_PERMS_WRITE) {
return true;
}
} else {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return False;
}
$perms = BLOG_PERMS_DENY;
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "view_post")) {
$perms = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "write_post")) {
$perms = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "full_post")) {
$perms = BLOG_PERMS_FULL;
}
if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
return true;
}
if ($perms > BLOG_PERMS_WRITE) {
return true;
}
}
return False;
}
示例4: Add
public static function Add($arFields)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CBlogCandidate::CheckFields("ADD", $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_blog_user2blog", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = False;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_blog_user2blog(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
}
if ($ID) {
$arCandidat = CBlogCandidate::GetByID($ID);
if ($arCandidat) {
$arBlog = CBlog::GetByID($arCandidat["BLOG_ID"]);
if (strlen($arBlog["AUTO_GROUPS"]) > 0) {
$arAutoGroups = unserialize($arBlog["AUTO_GROUPS"]);
if (is_array($arAutoGroups) && count($arAutoGroups) > 0) {
$arBlogUser = CBlogUser::GetByID($arCandidat["USER_ID"], BLOG_BY_USER_ID);
if (!$arBlogUser) {
CBlogUser::Add(array("USER_ID" => $arCandidat["USER_ID"], "=LAST_VISIT" => $GLOBALS["DB"]->GetNowFunction(), "=DATE_REG" => $GLOBALS["DB"]->GetNowFunction(), "ALLOW_POST" => "Y"));
}
CBlogUser::AddToUserGroup($arCandidat["USER_ID"], $arCandidat["BLOG_ID"], $arAutoGroups, "", BLOG_BY_USER_ID, BLOG_CHANGE);
CBlogCandidate::Delete($ID);
}
}
}
}
return $ID;
}
示例5: OnAfterUserAuthorizeHandler
public function OnAfterUserAuthorizeHandler(&$arFields)
{
global $USER;
$rsUser = CUser::GetByID($USER->GetId());
$arUser = $rsUser->Fetch();
$social = MH_Social_SocialFabric::getSocial($arUser['EXTERNAL_AUTH_ID'], $arUser["XML_ID"]);
if ($arUser['ID'] > 0 && $arUser['UF_RULES'] != '1') {
$props = array();
if (!$arUser['PERSONAL_GENDER']) {
$props['PERSONAL_GENDER'] = $social->getGender();
}
if (!$arUser['PERSONAL_BIRTHDAY']) {
$props['PERSONAL_BIRTHDAY'] = $social->getBirthday();
}
if (!empty($props)) {
$user = new CUser();
$user->Update($arUser["ID"], $props);
}
CModule::IncludeModule("blog");
$blogUser = CBlogUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
if (!$blogUser || !$blogUser['AVATAR']) {
$props = array('USER_ID' => $arUser['ID']);
if ($path = $social->getPicture()) {
$picture = CFile::MakeFileArray($path);
$props['AVATAR'] = $picture;
$user = new CBlogUser();
if ($blogUser) {
$user->Update($blogUser["ID"], $props);
} else {
$user->Add($props);
}
unlink($path);
}
}
}
}
示例6: array
} else {
$arOwnerBlog = CBlog::GetByOwnerID($arTmp["AUTHOR_ID"], $arParams["GROUP_ID"]);
if (!empty($arOwnerBlog)) {
$arTmp["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"], "user_id" => $arOwnerBlog["OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"]));
} else {
$arTmp["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arPost["BLOG_URL"], "user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"]));
}
}
}
if (IntVal($arPost["BLOG_SOCNET_GROUP_ID"]) > 0) {
$arTmp["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"]));
} else {
$arTmp["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"]));
}
$arTmp["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arPost["AUTHOR_ID"]));
$arTmp["AuthorName"] = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arPost["AUTHOR_NAME"], $arPost["AUTHOR_LAST_NAME"], $arPost["AUTHOR_LOGIN"]);
if ($itemCnt == 0) {
$arTmp["FIRST"] = "Y";
}
$text = preg_replace("#\\[img\\](.+?)\\[/img\\]#is", "", $arPost["~DETAIL_TEXT"]);
$text = preg_replace("#\\[url(.+?)\\](.*?)\\[/url\\]#is", "\\2", $text);
$text = preg_replace("#\\[video(.+?)\\](.+?)\\[/video\\]#is", "", $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|/*)(.*?)(\\]|>)#is", "", $text);
$text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text1 = $text;
$title = $p->convert($text1, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N"));
$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;
示例7: trim
}
$arParams["PATH_TO_MODERATION"] = trim($arParams["PATH_TO_MODERATION"]);
if (strlen($arParams["PATH_TO_MODERATION"]) <= 0) {
$arParams["PATH_TO_MODERATION"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=moderation&" . $arParams["BLOG_VAR"] . "=#blog#");
}
if (!$USER->IsAuthorized()) {
$arResult["urlToAuth"] = htmlspecialcharsbx($APPLICATION->GetCurPageParam("auth=Y", array("login", "logout", "register", "forgot_password", "change_password")));
if (COption::GetOptionString("main", "new_user_registration", "Y") == "Y") {
$arResult["urlToRegister"] = htmlspecialcharsbx($APPLICATION->GetCurPageParam("auth=Y®ister=yes", array("login", "logout", "register", "forgot_password", "change_password", "backurl")));
}
} else {
$arResult["urlToLogout"] = $APPLICATION->GetCurPageParam("logout=yes", array("login", "logout", "register", "forgot_password", "change_password", "backurl"));
}
$user_id = $USER->GetID();
if (IntVal($user_id) > 0) {
CBlogUser::SetLastVisit();
$arResult["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $user_id));
$arOwnBlog = CBlog::GetByOwnerID($user_id, $arParams["GROUP_ID"]);
if ($arOwnBlog["ACTIVE"] == "Y") {
$arGroup = CBlogGroup::GetByID($arOwnBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID) {
if (!empty($arOwnBlog)) {
$arResult["OwnBlog"] = $arOwnBlog;
$arResult["urlToOwnBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnBlog["URL"]));
$arResult["urlToFriends"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FRIENDS"], array("user_id" => $user_id));
$arResult["urlToOwnNewPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_EDIT"], array("blog" => $arOwnBlog["URL"], "post_id" => "new"));
$arResult["urlToOwnBlogEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_EDIT"], array("blog" => $arOwnBlog["URL"]));
}
} else {
unset($arOwnBlog);
}
示例8: 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;
}
}
}
示例9: ToLower
$arResult["Post"]["DATE_PUBLISH_FORMATED"] = ToLower($arResult["Post"]["DATE_PUBLISH_FORMATED"]);
$arResult["Post"]["DATE_PUBLISH_DATE"] = ToLower($arResult["Post"]["DATE_PUBLISH_DATE"]);
}
// strip current year
if (!empty($arParams['DATE_TIME_FORMAT_S']) && ($arParams['DATE_TIME_FORMAT_S'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT_S'] == 'j F Y g:i a')) {
$arResult["Post"]["DATE_PUBLISH_FORMATED"] = ltrim($arResult["Post"]["DATE_PUBLISH_FORMATED"], '0');
$arResult["Post"]["DATE_PUBLISH_DATE"] = ltrim($arResult["Post"]["DATE_PUBLISH_DATE"], '0');
$curYear = date('Y');
$arResult["Post"]["DATE_PUBLISH_FORMATED"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arResult["Post"]["DATE_PUBLISH_FORMATED"]);
$arResult["Post"]["DATE_PUBLISH_DATE"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arResult["Post"]["DATE_PUBLISH_DATE"]);
}
$arResult["Post"]["DATE_PUBLISH_TIME"] = FormatDateFromDB($arResult["Post"]["DATE_PUBLISH"], strpos($arParams["DATE_TIME_FORMAT_S"], 'a') !== false || ($arParams["DATE_TIME_FORMAT_S"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'GG:MI');
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$arResult["Post"]["DATE_PUBLISH_TIME"] = ToLower($arResult["Post"]["DATE_PUBLISH_TIME"]);
}
$arResult["arUser"] = CBlogUser::GetUserInfo($arPost["AUTHOR_ID"], $arParams["PATH_TO_USER"], array("AVATAR_SIZE" => isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"], "AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]));
$arResult["arUser"]["isExtranet"] = intval($arPost["AUTHOR_ID"]) > 0 && is_array($GLOBALS["arExtranetUserID"]) && in_array($arPost["AUTHOR_ID"], $GLOBALS["arExtranetUserID"]);
$arResult["Post"]["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"]));
if (strlen($arPost["CATEGORY_ID"]) > 0) {
$bHasTag = true;
$arCategory = explode(",", $arPost["CATEGORY_ID"]);
$dbCategory = CBlogCategory::GetList(array(), array("@ID" => $arCategory));
while ($arCatTmp = $dbCategory->Fetch()) {
$arCatTmp["~NAME"] = $arCatTmp["NAME"];
$arCatTmp["NAME"] = htmlspecialcharsEx($arCatTmp["NAME"]);
$arCatTmp["urlToCategory"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_SEARCH_TAG"], array("tag" => urlencode($arCatTmp["NAME"])));
$arResult["Category"][] = $arCatTmp;
}
}
$bAll = false;
$arResult["Post"]["SPERM"] = array();
示例10: UpdateLog
public static function UpdateLog($commentID, $arBlogUser, $arUser, $arComment, $arPost, $arParams)
{
if (!CModule::IncludeModule('socialnetwork'))
return;
$AuthorName = CBlogUser::GetUserName($arBlogUser["~ALIAS"], $arUser["~NAME"], $arUser["~LAST_NAME"], $arUser["~LOGIN"], $arUser["~SECOND_NAME"]);
$parserBlog = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
$text4message = $parserBlog->convert($arComment["POST_TEXT"], false, $arParams["IMAGES"], $arAllow, array("isSonetLog"=>true));
$text4mail = $parserBlog->convert4mail($arComment["POST_TEXT"], $arParams["IMAGES"]);
$arSoFields = Array(
"TITLE_TEMPLATE" => htmlspecialcharsback($AuthorName)." ".GetMessage("BLG_SONET_COMMENT_TITLE"),
"TITLE" => $arPost['~TITLE'],
"MESSAGE" => $text4message,
"TEXT_MESSAGE" => $text4mail
);
$dbRes = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array("blog_comment", "blog_comment_micro"),
"SOURCE_ID" => $commentID
),
false,
false,
array("ID")
);
while ($arRes = $dbRes->Fetch())
CSocNetLogComments::Update($arRes["ID"], $arSoFields);
}
示例11: array
}
if ($ID > 0) {
// Проверяем: новая запись или изменение старой
$newID = CBlogPost::Update($ID, $arFields);
} else {
$arFields['=DATE_CREATE'] = $DB->GetNowFunction();
$arFields['AUTHOR_ID'] = $USER_ID;
$arFields['BLOG_ID'] = $BLOG_ID;
$newID = CBlogPost::Add($arFields);
if ($newID && $arBlog['EMAIL_NOTIFY'] == 'Y' && $USER_ID != $arBlog['OWNER_ID']) {
$BlogUser = CBlogUser::GetByID($USER_ID, BLOG_BY_USER_ID);
$res = CUser::GetByID($arBlog['OWNER_ID']);
$arOwner = $res->Fetch();
$dbUser = CUser::GetByID($USER_ID);
$arUser = $dbUser->Fetch();
$AuthorName = CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
CEvent::Send("NEW_BLOG_MESSAGE", SITE_ID, array("BLOG_ID" => $BLOG_ID, "BLOG_NAME" => $arBlog['NAME'], "BLOG_URL" => $arBlog['URL'], "MESSAGE_TITLE" => $_POST['POST_TITLE'], "MESSAGE_TEXT" => $_POST['POST_MESSAGE'], "MESSAGE_DATE" => $DATE_PUBLISH, "MESSAGE_PATH" => "http://" . (COption::GetOptionString("main", "server_name") . $sBlogPath . "/" . ($is404 ? $arBlog['URL'] . "/" . $newID . ".php" : "post.php?blog=" . $arBlog['URL'] . "&post_id=" . $newID)), "AUTHOR" => $AuthorName, "EMAIL_FROM" => COption::GetOptionString("main", "email_from", "nobody@nobody.com"), "EMAIL_TO" => $arOwner['EMAIL']));
}
}
if ($newID > 0) {
$DB->Query("UPDATE b_blog_image SET POST_ID='{$newID}' WHERE BLOG_ID={$BLOG_ID} AND POST_ID=0", true);
if (strlen($TRACKBACK) > 0) {
$arPingUrls = explode("\n", $TRACKBACK);
CBlogTrackback::SendPing($newID, $arPingUrls);
}
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog['URL'] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog['URL'] . "/calendar/");
BXClearCache(True, "/" . SITE_ID . "/blog/last_messages/");
BXClearCache(True, "/" . SITE_ID . "/blog/groups/" . $arBlog['GROUP_ID'] . "/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog['URL'] . "/trackback/" . $ID . "/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog['URL'] . "/comment/" . $ID . "/");
示例12: PreparePath2User
function PreparePath2User($arParams = array())
{
return CBlogUser::PreparePath(isset($arParams["USER_ID"]) ? $arParams["USER_ID"] : 0, False);
}
示例13: array
$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::GetUserNameEx($arUsrTmp["arUser"], $arUsrTmp["BlogUser"], $arParams);
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 (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";
}
$arResult["USER_CACHE"][$arComment["AUTHOR_ID"]] = $arUsrTmp;
}
$arComment["urlToAuthor"] = $arResult["USER_CACHE"][$arComment["AUTHOR_ID"]]["urlToAuthor"];
示例14: array
<?php
$blogWarningTmp = "";
if (CModule::IncludeModule("blog") && check_bitrix_sessid()) {
$arblogFields = array("ALIAS" => $blog_ALIAS, "DESCRIPTION" => $blog_DESCRIPTION, "INTERESTS" => $blog_INTERESTS, "AVATAR" => $_FILES["blog_AVATAR"]);
$arblogFields["AVATAR"]["del"] = $blog_AVATAR_del;
if ($USER->IsAdmin()) {
$arblogFields["ALLOW_POST"] = $blog_ALLOW_POST == "Y" ? "Y" : "N";
}
$ar_res = CBlogUser::GetByID($ID, BLOG_BY_USER_ID);
if ($ar_res) {
$arblogFields["AVATAR"]["old_file"] = $ar_res["AVATAR"];
$BLOG_USER_ID = IntVal($ar_res["ID"]);
$BLOG_USER_ID1 = CBlogUser::Update($BLOG_USER_ID, $arblogFields);
$blog_res = IntVal($BLOG_USER_ID1) > 0;
} else {
$arblogFields["USER_ID"] = $ID;
$arblogFields["~DATE_REG"] = CDatabase::CurrentTimeFunction();
$BLOG_USER_ID = CBlogUser::Add($arblogFields);
$blog_res = IntVal($BLOG_USER_ID) > 0;
}
}
示例15: 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;
}