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


PHP CBlogUser::Update方法代码示例

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


在下文中一共展示了CBlogUser::Update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:irotaev,项目名称:vector-vip.server,代码行数:50,代码来源:init.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 ($ex = $APPLICATION->GetException()) {
             $strError = $ex->GetString();
         }
     }
 }
 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"]));
开发者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

 $arPICTURE["del"] = $_POST["AVATAR_del"];
 $arHobbyDB = array();
 $arHobby = explode(",", $_POST["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["ALIAS"], "DESCRIPTION" => $_POST["DESCRIPTION"], "AVATAR" => $arPICTURE, "INTERESTS" => $Hobby, "PATH" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arParams["ID"])));
 $DB->StartTransaction();
 $res = CBlogUser::Update($BLOG_USER_ID, $arFields);
 if ($res) {
     $arPICTURE = $_FILES["PERSONAL_PHOTO"];
     $arPICTURE["old_file"] = $arResult["arUser"]["PERSONAL_PHOTO"];
     $arPICTURE["del"] = $_POST["PERSONAL_PHOTO_del"];
     $arFields = array("PERSONAL_WWW" => $_POST["PERSONAL_WWW"], "PERSONAL_GENDER" => $_POST["PERSONAL_GENDER"], "PERSONAL_BIRTHDAY" => $_POST["PERSONAL_BIRTHDAY"], "PERSONAL_PHOTO" => $arPICTURE);
     $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("USER", $arFields);
     $res = $USER->Update($BlogUser["USER_ID"], $arFields);
     if ($res) {
         $DB->Commit();
     } else {
         $DB->Rollback();
         $strErrorMessage .= $USER->LAST_ERROR;
     }
     $arFilter = array("OWNER_ID" => $BlogUser["USER_ID"], "ACTIVE" => "Y", "GROUP_SITE_ID" => SITE_ID);
     if (!empty($arParams["GROUP_ID"])) {
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php


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