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


PHP CBlogUser::Add方法代码示例

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


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

示例1: 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

示例2: 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

示例3: array

 }
 if ($strError == '') {
     if (CModule::IncludeModule("blog")) {
         $APPLICATION->ResetException();
         $arblogFields = array("ALIAS" => $_REQUEST["blog_ALIAS"], "DESCRIPTION" => $_REQUEST["blog_DESCRIPTION"], "INTERESTS" => $_REQUEST["blog_INTERESTS"], "AVATAR" => $_FILES["blog_AVATAR"]);
         $arblogFields["AVATAR"]["del"] = $_REQUEST["blog_AVATAR_del"];
         $ar_res = CBlogUser::GetByID($arResult["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"] = $arResult["ID"];
             $arblogFields["~DATE_REG"] = CDatabase::CurrentTimeFunction();
             $BLOG_USER_ID = CBlogUser::Add($arblogFields);
             $blog_res = intval($BLOG_USER_ID) > 0;
         }
         if ($ex = $APPLICATION->GetException()) {
             $strError = $ex->GetString();
         }
     }
 }
 if (CModule::IncludeModule("learning") && $strError == '') {
     $arStudentFields = array("RESUME" => $_REQUEST["student_RESUME"], "PUBLIC_PROFILE" => $_REQUEST["student_PUBLIC_PROFILE"] == "Y" ? "Y" : "N");
     $ar_res = CStudent::GetList(array(), array("USER_ID" => $arResult["ID"]));
     if ($arStudent = $ar_res->Fetch()) {
         $learning_res = CStudent::Update($arResult["ID"], $arStudentFields);
     } else {
         $arStudentFields["USER_ID"] = $arResult["ID"];
         $STUDENT_USER_ID = CStudent::Add($arStudentFields);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例4: SetLastVisit

 function SetLastVisit()
 {
     if (isset($GLOBALS["BLOG_USER"]["BLOG_LAST_VISIT_SET"]) && $GLOBALS["BLOG_USER"]["BLOG_LAST_VISIT_SET"] == "Y") {
         return True;
     }
     if (!$GLOBALS["USER"]->IsAuthorized()) {
         return False;
     }
     $userID = IntVal($GLOBALS["USER"]->GetID());
     if ($userID <= 0) {
         return False;
     }
     $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
     if ($arBlogUser) {
         CBlogUser::Update($arBlogUser["ID"], array("=LAST_VISIT" => $GLOBALS["DB"]->GetNowFunction()));
     } else {
         CBlogUser::Add(array("USER_ID" => $userID, "=LAST_VISIT" => $GLOBALS["DB"]->GetNowFunction(), "=DATE_REG" => $GLOBALS["DB"]->GetNowFunction(), "ALLOW_POST" => "Y"));
     }
     $GLOBALS["BLOG_USER"]["BLOG_LAST_VISIT_SET"] = "Y";
     return True;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:21,代码来源:blog_user.php

示例5: array

$arResult["arUser"] = $dbUser->GetNext();
$arResult["bEdit"] = $_REQUEST['mode'] == 'edit' && ($USER->GetID() == $arParams["ID"] || $USER->IsAdmin()) ? "Y" : "N";
if ($arParams["ID"] == $USER->GetID() || $USER->IsAdmin()) {
    $arResult["urlToEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_EDIT"], array("user_id" => $arParams["ID"]));
}
if (!is_array($arResult["arUser"])) {
    $arResult["FATAL_ERROR"] = GetMessage("B_B_USER_NO_USER");
    CHTTP::SetStatus("404 Not Found");
} else {
    $BLOG_USER_ID = intval($_POST["BLOG_USER_ID"]);
    if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["save"]) > 0 && check_bitrix_sessid()) {
        if (CModule::IncludeModule("blog")) {
            if ($BLOG_USER_ID <= 0) {
                $BlogUser = CBlogUser::GetByID($arParams["ID"], BLOG_BY_USER_ID);
                if (empty($BlogUser)) {
                    $BLOG_USER_ID = CBlogUser::Add(array("USER_ID" => $arParams["ID"], "=LAST_VISIT" => $DB->GetNowFunction(), "=DATE_REG" => $DB->GetNowFunction(), "ALLOW_POST" => "Y", "PATH" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arParams["ID"]))));
                    $BlogUser = CBlogUser::GetByID($BLOG_USER_ID);
                } else {
                    $BLOG_USER_ID = $BlogUser["ID"];
                }
            } else {
                $BlogUser = CBlogUser::GetByID($BLOG_USER_ID);
            }
            $BlogUser = CBlogTools::htmlspecialcharsExArray($BlogUser);
            if ($BlogUser && ($USER->GetID() == $BlogUser["USER_ID"] || $USER->IsAdmin())) {
                $arPICTURE = $_FILES["AVATAR"];
                $arPICTURE["old_file"] = $BlogUser["AVATAR"];
                $arPICTURE["del"] = $_POST["AVATAR_del"];
                $arHobbyDB = array();
                $arHobby = explode(",", $_POST["INTERESTS"]);
                foreach ($arHobby as $Hobby) {
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例6: GetMessage

 $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"])));
     }
     $arResult["ERROR_MESSAGE"] = $errorMessage;
     $arResult["OK_MESSAGE"] = $okMessage;
     $arResult["userName"] = CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
     $arResult["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
     $arResult["arUserGroups"] = CBlogUser::GetUserGroups($arUser["ID"], $arBlog["ID"], "Y", BLOG_BY_USER_ID);
     $dbBlogGroups = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), false, false, array("ID", "NAME"));
     while ($arBlogGroups = $dbBlogGroups->GetNext()) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: 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,代码来源:

示例8: foreach

         foreach ($arBlogFields as $key => $value) {
             if (!in_array('BLOG_' . $key, $arParams['EDITABLE_FIELDS'])) {
                 unset($arBlogFields[$key]);
             }
         }
         if (isset($arBlogFields['AVATAR'])) {
             $arBlogFields["AVATAR"]["del"] = $_POST['BLOG_AVATAR_del'];
             $arBlogFields["AVATAR"]["old_file"] = $arResult['User']["BLOG_AVATAR"];
         }
         if (count($arBlogFields) > 0) {
             if ($arResult['User']['BLOG_ID']) {
                 $BID = CBlogUser::Update($arResult['User']['BLOG_ID'], $arBlogFields);
             } else {
                 $arBlogFields["USER_ID"] = $arParams['ID'];
                 $arBlogFields["~DATE_REG"] = CDatabase::CurrentTimeFunction();
                 $BID = CBlogUser::Add($arBlogFields);
             }
             if (!$BID && ($ex = $APPLICATION->GetException())) {
                 $strErrorMessage = $ex->GetString();
             }
         }
     }
     if (IsModuleInstalled("bitrix24") && isset($arFieldsValue["GROUP_ID"]) && defined("BX_COMP_MANAGED_CACHE")) {
         global $CACHE_MANAGER;
         $CACHE_MANAGER->ClearByTag('sonet_group');
     }
 }
 if (strlen($strErrorMessage) <= 0) {
     if ($_REQUEST['backurl']) {
         LocalRedirect($_REQUEST['backurl']);
     } else {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


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