当前位置: 首页>>代码示例>>PHP>>正文


PHP CBlogUser::GetByID方法代码示例

本文整理汇总了PHP中CBlogUser::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogUser::GetByID方法的具体用法?PHP CBlogUser::GetByID怎么用?PHP CBlogUser::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBlogUser的用法示例。


在下文中一共展示了CBlogUser::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:60,代码来源:sonet.php

示例2: 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);
}
开发者ID:irotaev,项目名称:vector-vip.server,代码行数:50,代码来源:init.php

示例3: 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;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:49,代码来源:blog_candid.php

示例4: 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);
             }
         }
     }
 }
开发者ID:irotaev,项目名称:vector-vip.server,代码行数:36,代码来源:Social.php

示例5: array

     }
 }
 $dbSearchUser = CUser::GetList($b = "LOGIN", $o = "ASC", array("LOGIN_EQUAL" => $friend));
 if (($arSearchUser = $dbSearchUser->Fetch()) && !in_array($arSearchUser["ID"], $arUserID)) {
     $arUserID[] = $arSearchUser["ID"];
 }
 if (count($arUserID) > 0) {
     for ($i = 0; $i < count($arUserID); $i++) {
         if ($arUserID[$i] != $arBlog["OWNER_ID"] && !in_array($arUserID[$i], $arFriendUsers)) {
             $dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arUserID[$i]));
             if ($dbCandidate->Fetch()) {
                 $okMessage .= str_replace("#NAME#", "[" . $arUserID[$i] . "] " . htmlspecialcharsex($friend), GetMessage("BLOG_BLOG_ADD_F_POS_ALREADY_WANT")) . ".<br />";
             } else {
                 if (CBlogCandidate::Add(array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arUserID[$i]))) {
                     $okMessage .= str_replace("#NAME#", "[" . $arUserID[$i] . "] " . htmlspecialcharsex($friend), GetMessage("BLOG_BLOG_ADD_F_POS_ADDED")) . ".<br />";
                     $BlogUser = CBlogUser::GetByID($arUserID[$i], BLOG_BY_USER_ID);
                     $BlogUser = CBlogTools::htmlspecialcharsExArray($BlogUser);
                     $dbUser = CUser::GetByID($arUserID[$i]);
                     $arUser = $dbUser->GetNext();
                     $AuthorName = CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
                     $dbUser = CUser::GetByID($arBlog["OWNER_ID"]);
                     $arUserBlog = $dbUser->GetNext();
                     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", "www.bitrixsoft.com");
                         }
                     }
                     $arMailFields = array("BLOG_ID" => $arBlog["ID"], "BLOG_NAME" => $arBlog["NAME"], "BLOG_URL" => $arBlog["URL"], "BLOG_ADR" => "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_BLOG"]), array("blog" => $arBlog["URL"])), "USER_ID" => $arUserID[$i], "USER" => $AuthorName, "USER_URL" => "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_USER"]), array("user_id" => $arUserID[$i])), "EMAIL_FROM" => COption::GetOptionString("main", "email_from", "nobody@nobody.com"));
                     $arF1 = $arF2 = $arMailFields;
开发者ID:,项目名称:,代码行数:31,代码来源:

示例6: GetMessage

 if ($dbComment->Fetch() && $arResult["Perm"] < BLOG_PERMS_FULL && !$bIntranetInstalled) {
     $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");
         }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例7: array

             $arSearch["USER_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $Blog["OWNER_ID"]));
             $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") {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例8: GetUserGroups

 function GetUserGroups($ID, $blogID, $joinStatus = "", $selectType = BLOG_BY_BLOG_USER_ID, $bUrl = false)
 {
     global $DB;
     $ID = IntVal($ID);
     $joinStatus = $joinStatus == "Y" || $joinStatus == "N" ? $joinStatus : "";
     $selectType = $selectType == BLOG_BY_USER_ID ? BLOG_BY_USER_ID : BLOG_BY_BLOG_USER_ID;
     if ($bUrl) {
         $bUrl = true;
     } else {
         $bUrl = false;
     }
     if (!$bUrl) {
         $blogID = IntVal($blogID);
     } else {
         $blogID = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($blogID));
     }
     $varName = $selectType == BLOG_BY_USER_ID ? "BLOG_USER2GROUP1_CACHE_" . $blogID . "_" . $joinStatus . "_" . $ID . "_" . $bUrl : "BLOG_USER2GROUP_CACHE_" . $blogID . "_" . $joinStatus . "_" . $ID . "_" . $bUrl;
     if (isset($GLOBALS["BLOG_USER"][$varName]) && is_array($GLOBALS["BLOG_USER"][$varName])) {
         return $GLOBALS["BLOG_USER"][$varName];
     } else {
         $arGroups = array(1);
         if (isset($GLOBALS["USER"]) && is_object($GLOBALS["USER"]) && $GLOBALS["USER"]->IsAuthorized()) {
             $arGroups[] = 2;
         }
         if ($ID > 0 && strlen($blogID) > 0) {
             if ($selectType == BLOG_BY_BLOG_USER_ID) {
                 $arBlogUser = CBlogUser::GetByID($ID, $selectType);
                 $userID = $arBlogUser["USER_ID"];
             } else {
                 $userID = $ID;
             }
             $strSql = "SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID " . "FROM b_blog_user2user_group UG ";
             if ($bUrl) {
                 $strSql .= " INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='" . $DB->ForSql($blogID) . "') ";
             }
             $strSql .= " WHERE UG.USER_ID = " . $userID . " ";
             if (!$bUrl) {
                 $strSql .= "\tAND UG.BLOG_ID = " . $blogID . " ";
             }
             $dbResult = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             while ($arResult = $dbResult->Fetch()) {
                 $arGroups[] = IntVal($arResult["USER_GROUP_ID"]);
             }
         }
         if ($selectType == BLOG_BY_BLOG_USER_ID && !empty($arBlogUser)) {
             $GLOBALS["BLOG_USER"]["BLOG_USER2GROUP_CACHE_" . $blogID . "_" . $joinStatus . "_" . IntVal($arBlogUser["ID"]) . "_" . $bUrl] = $arGroups;
         }
         $GLOBALS["BLOG_USER"]["BLOG_USER2GROUP1_CACHE_" . $blogID . "_" . $joinStatus . "_" . IntVal($userID) . "_" . $bUrl] = $arGroups;
         return $arGroups;
     }
     return False;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:52,代码来源:blog_user.php

示例9: BuildRSS

 function BuildRSS($ID, $type = "RSS .92", $numPosts = 10, $blogTemplate = "", $postTemplate = "", $userTemplate = "", $bSoNet = false, $arParams = array())
 {
     $ID = IntVal($ID);
     if ($ID <= 0 && $arParams["USE_SOCNET"] != "Y") {
         return false;
     }
     $numPosts = IntVal($numPosts);
     $type = strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
     if ($type != "rss2.0" && $type != "atom.03") {
         $type = "rss.92";
     }
     $rssText = False;
     $arBlog = CBlog::GetByID($ID);
     if ($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y" || $arParams["USE_SOCNET"] == "Y") {
         if (!empty($arBlog)) {
             $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
         }
         if ($arGroup["SITE_ID"] == SITE_ID || $arParams["USE_SOCNET"] == "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 ($bSoNet) {
                 if (IntVal($arParams["USER_ID"]) > 0) {
                     $dbUser = CUser::GetByID($arParams["USER_ID"]);
                     if ($arUser = $dbUser->Fetch()) {
                         $blogName = htmlspecialcharsbx(GetMessage("BLG_RSS_NAME_SONET", array("#AUTHOR_NAME#" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true))));
                         $blogURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($blogTemplate, array("user_id" => $arParams["USER_ID"])));
                     }
                 } else {
                     if ($arGroupSoNet = CSocNetGroup::GetByID($arParams["SOCNET_GROUP_ID"])) {
                         $blogName = htmlspecialcharsbx(GetMessage("BLG_RSS_NAME_SONET_GROUP", array("#GROUP_NAME#" => $arGroupSoNet["NAME"])));
                         $blogURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($blogTemplate, array("group_id" => $arParams["SOCNET_GROUP_ID"])));
                     }
                 }
                 $blogDescr = "";
             } else {
                 if (strlen($blogTemplate) > 0) {
                     $blogURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($blogTemplate, 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"]));
                 }
                 $blogName = htmlspecialcharsbx($arBlog["NAME"]);
                 $blogDescr = htmlspecialcharsbx($arBlog["DESCRIPTION"]);
             }
             $rssText = "";
             if ($type == "rss.92") {
                 $rssText .= "<" . "?xml version=\"1.0\" encoding=\"" . $charset . "\"?" . ">\n\n";
                 $rssText .= "<rss version=\".92\">\n";
                 $rssText .= " <channel>\n";
                 $rssText .= "\t<title>" . $blogName . "</title>\n";
                 $rssText .= "\t<link>" . $blogURL . "</link>\n";
                 $rssText .= "\t<description>" . $blogDescr . "</description>\n";
                 $rssText .= "\t<language>" . $language . "</language>\n";
                 $rssText .= "\t<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 .= "\t<title>" . $blogName . "</title>\n";
                 //$rssText .= "	<guid>".$blogURL."</guid>\n";
                 $rssText .= "\t<link>" . $blogURL . "</link>\n";
                 $rssText .= "\t<description>" . $blogDescr . "</description>\n";
                 $rssText .= "\t<language>" . $language . "</language>\n";
                 $rssText .= "\t<docs>http://backend.userland.com/rss2</docs>\n";
                 $rssText .= "\t<pubDate>" . $now . "</pubDate>\n";
                 $rssText .= "\n";
             } elseif ($type == "atom.03") {
                 $atomID = "tag:" . htmlspecialcharsbx($serverName) . "," . date("Y-m-d") . ":" . $ID;
                 $rssText .= "<" . "?xml version=\"1.0\" encoding=\"" . $charset . "\"?" . ">\n\n";
                 $rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"" . $language . "\">\n";
                 $rssText .= "  <title>" . $blogName . "</title>\n";
                 $rssText .= "  <tagline>" . $blogURL . "</tagline>\n";
                 //$rssText .= "  <link href=\"".$blogURL."\"/>";
                 $rssText .= "  <id>" . $atomID . "</id>\n";
                 $rssText .= "  <link rel=\"alternate\" type=\"text/html\" href=\"" . $blogURL . "\" />\n";
                 $rssText .= "  <copyright>Copyright (c) " . $blogURL . "</copyright>\n";
                 $rssText .= "  <modified>" . $nowISO . "</modified>\n";
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:blog.php

示例10: foreach

     }
 }
 //Update categories & images
 if (IntVal($newID) > 0) {
     CBlogPostCategory::DeleteByPostID($newID);
     foreach ($CATEGORYtmp as $v) {
         CBlogPostCategory::Add(array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $newID, "CATEGORY_ID" => $v));
     }
     $DB->Query("UPDATE b_blog_image SET POST_ID=" . $newID . " WHERE BLOG_ID=" . $arBlog["ID"] . " AND POST_ID=0", true);
 }
 if (IntVal($newID) > 0 && strlen($arResult["ERROR_MESSAGE"]) <= 0) {
     if ($arFields["ACTION"] == "ADD") {
         $arResult["SUCCESS_MESSAGE"] = GetMessage("IDEA_NEW_MESSAGE_SUCCESS");
     }
     //Get Author Name
     $arResult["BlogUser"] = CBlogUser::GetByID($arFields["AUTHOR_ID"], BLOG_BY_USER_ID);
     $arResult["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arResult["BlogUser"]);
     $arResult["arUser"] = CUser::GetByID($arFields["AUTHOR_ID"])->GetNext();
     $AuthorName = CBlogUser::GetUserName($arResult["BlogUser"]["~ALIAS"], $arResult["arUser"]["~NAME"], $arResult["arUser"]["~LAST_NAME"], $arResult["arUser"]["~LOGIN"]);
     $IdeaParser = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
     $arCategoryList = CIdeaManagment::getInstance()->Idea()->GetCategoryList();
     $arNotifyFields = array_merge($arFields, array("AUTHOR" => $AuthorName, "IDEA_TEXT" => $IdeaParser->convert4mail($arFields["DETAIL_TEXT"]), "SHOW_RATING" => $arParams["SHOW_RATING"], "RATING_TYPE_ID" => 'BLOG_POST', "RATING_ENTITY_ID" => $newID, "ID" => $newID, "TYPE" => "IDEA", "CATEGORY" => $arCategoryList[$arFields[CIdeaManagment::UFCategroryCodeField]]["NAME"], "FULL_PATH" => "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arFields["PATH"]), array("post_id" => $newID)), "PATH" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arFields["PATH"]), array("post_id" => $newID))));
     //Notifications
     $Notify = CIdeaManagment::getInstance()->Notification($arNotifyFields);
     //Socialnetwork notification
     $Notify->getSonetNotify()->Send();
     //Email notification
     $Notify->getEmailNotify()->Send();
     //Clear Caching and redirect
     BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/first_page/");
     BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/pages/");
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例11: while

 }
 $dbItem = CBlogPost::GetList(array("VIEWS" => "DESC", "NUM_COMMENTS" => "DESC"), $arFilter, false, false, $arSelectedFields);
 while ($arItem = $dbItem->Fetch()) {
     $arBlogs[$arItem["BLOG_ID"]]["VIEWS"] += $arItem["VIEWS"];
     $arBlogs[$arItem["BLOG_ID"]]["NUM_COMMENTS"] += $arItem["NUM_COMMENTS"];
 }
 if (!empty($arBlogs)) {
     uasort($arBlogs, create_function('$a, $b', 'if($a["VIEWS"] == $b["VIEWS"]) { if($a["NUM_COMMENTS"] < $b["NUM_COMMENTS"]) return 1; elseif($a["NUM_COMMENTS"] > $b["NUM_COMMENTS"]) return -1; else return 0;} return ($a["VIEWS"] < $b["VIEWS"])? 1 : -1;'));
     $i = 0;
     foreach ($arBlogs as $blogID => $info) {
         if ($i >= $arParams["BLOG_COUNT"] && IntVal($arParams["BLOG_COUNT"]) > 0) {
             continue;
         }
         $arBlog = CBlog::GetByID($blogID);
         $arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
         $arBlog["BlogUser"] = CBlogUser::GetByID($arBlog["OWNER_ID"], BLOG_BY_USER_ID);
         $arBlog["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arBlog["BlogUser"]);
         $dbUser = CUser::GetByID($arBlog["OWNER_ID"]);
         $arBlog["arUser"] = $dbUser->GetNext();
         $arBlog["AuthorName"] = CBlogUser::GetUserName($arBlog["BlogUser"]["ALIAS"], $arBlog["arUser"]["NAME"], $arBlog["arUser"]["LAST_NAME"], $arBlog["arUser"]["LOGIN"]);
         if (IntVal($arBlog["SOCNET_GROUP_ID"]) > 0) {
             $arBlog["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_BLOG"], array("blog" => $arBlog["URL"], "group_id" => $arBlog["SOCNET_GROUP_ID"]));
             $arBlog["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arBlog["SOCNET_GROUP_ID"]));
         } else {
             $arBlog["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"]));
             $arBlog["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arBlog["OWNER_ID"]));
         }
         if ($i == 0) {
             $arBlog["FIRST_BLOG"] = "Y";
         }
         $i++;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例12: array

     $arImages[$arImage['ID']] = $arImage['FILE_ID'];
 }
 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)));
         }
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例13: GetMessage

 }
 $dbUser = CUser::GetByID($arParams["ID"]);
 if ($arUser = $dbUser->GetNext()) {
     $arResult["User"] = $arUser;
     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) {
                 $arResult["Blog"] = $arBlog;
                 if (CBlog::CanUserManageBlog($arBlog["ID"], IntVal($USER->GetID()))) {
                     if ($arParams["SET_TITLE"] == "Y") {
                         $APPLICATION->SetTitle(str_replace("#NAME#", $arBlog["NAME"], GetMessage("B_B_USE_TITLE_BLOG")));
                     }
                     $errorMessage = "";
                     $okMessage = "";
                     $arBlogUser = CBlogUser::GetByID($arUser["ID"], BLOG_BY_USER_ID);
                     $arBlogUser = CBlogTools::htmlspecialcharsExArray($arBlogUser);
                     $arResult["BlogUser"] = $arBlogUser;
                     if ($GLOBALS["user_action"] == "Y" && check_bitrix_sessid()) {
                         if (strlen($GLOBALS["cancel"]) > 0) {
                             LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"])));
                         }
                         if (empty($arBlogUser)) {
                             CBlogUser::Add(array("USER_ID" => $arUser["ID"], "=LAST_VISIT" => $DB->GetNowFunction(), "=DATE_REG" => $DB->GetNowFunction(), "ALLOW_POST" => "Y"));
                         }
                         CBlogUser::AddToUserGroup($arUser["ID"], $arBlog["ID"], $GLOBALS["add2groups"], "", BLOG_BY_USER_ID, BLOG_CHANGE);
                         $dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arUser["ID"]));
                         if ($arCandidate = $dbCandidate->Fetch()) {
                             CBlogCandidate::Delete($arCandidate["ID"]);
                         }
                         LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"])));
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例14: array

					$arUserGroups = array();
					$dbUserGroups = CUser::GetUserGroupEx($arUser['ID']);
					while ($arG = $dbUserGroups->Fetch())
					{
						if (strlen($arG["STRING_ID"]) > 0)
							$arUserGroups[] = $arG["STRING_ID"];
						elseif ($arG["GROUP_ID"] == 1)
							$arUserGroups[] = "administrators";
						elseif ($arG["GROUP_ID"] == 2)
							$arUserGroups[] = "everyone";
					}
					$arSaveUser["GROUP_ID"] = $arUserGroups;

					if (CModule::IncludeModule("blog"))
					{
						$arBlogUser = CBlogUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
						if (is_array($arBlogUser) && $arBlogUser["AVATAR"] > 0)
							$arSaveUser["BLOG_AVATAR"] = CFile::GetPath($arBlogUser["AVATAR"]);
					}

					if (CModule::IncludeModule("forum"))
					{
						$arForumUser = CForumUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
						if (is_array($arForumUser) && $arForumUser["AVATAR"] > 0)
							$arSaveUser["FORUM_AVATAR"] = CFile::GetPath($arForumUser["AVATAR"]);
					}

					$oResponse->status = "200 OK";
					$oResponse->arParameters['USER_INFO'] = $arSaveUser;
					if (defined("FORMAT_DATE"))
						$oResponse->arParameters['FORMAT_DATE'] = FORMAT_DATE;
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:main_controller.php

示例15: IncludeTemplateLangFile

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
IncludeTemplateLangFile(__FILE__);
$strErrorMessage = "";
$BLOG_USER_ID = intval($_POST["BLOG_USER_ID"]);
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["save"] != "" && check_bitrix_sessid()) {
    if (CModule::IncludeModule("blog")) {
        if ($BLOG_USER_ID <= 0) {
            $BLOG_USER_ID = CBlogUser::Add(array("USER_ID" => $USER->GetID(), "=LAST_VISIT" => $GLOBALS["DB"]->GetNowFunction(), "=DATE_REG" => $GLOBALS["DB"]->GetNowFunction(), "ALLOW_POST" => "Y"));
        }
        $BlogUser = CBlogUser::GetByID($BLOG_USER_ID);
        if ($BlogUser && ($USER->GetID() == $BlogUser["USER_ID"] || $USER->IsAdmin())) {
            $arPICTURE = $_FILES["BLOG_USER_AVATAR"];
            $arPICTURE["old_file"] = $BlogUser["AVATAR"];
            $arPICTURE["del"] = $_POST["BLOG_USER_AVATAR_del"];
            $arHobbyDB = array();
            $arHobby = explode(",", $_POST["BLOG_USER_INTERESTS"]);
            foreach ($arHobby as $Hobby) {
                $Hobby = trim($Hobby);
                $arHobbyDB[] = $Hobby;
            }
            $arHobbyDB = array_unique($arHobbyDB);
            if (count($arHobbyDB) > 0) {
                $Hobby = implode(", ", $arHobbyDB);
            } else {
                $Hobby = "";
            }
            $arFields = array("ALIAS" => $_POST["BLOG_USER_ALIAS"], "DESCRIPTION" => $_POST["BLOG_USER_DESCRIPTION"], "AVATAR" => $arPICTURE, "INTERESTS" => $Hobby);
开发者ID:,项目名称:,代码行数:31,代码来源:


注:本文中的CBlogUser::GetByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。