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


PHP CUser::Authorize方法代码示例

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


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

示例1: Add

 public function Add()
 {
     \ChromePhp::log("Subscr CRUD Add");
     if ($subscriber = $this->getSubscriber()) {
         $this->user = \CUser::GetByID($subscriber)->Fetch();
         \CUser::Authorize($this->user["ID"]);
         if ($subscribe = \CSubscription::GetList(False, array("ACTIVE" => "Y", "USER_ID" => $this->user["ID"]))->Fetch()) {
             return $subscribe["ID"];
         } else {
             try {
                 return $this->addSubscribe();
             } catch (SubscribeException $e) {
                 prentExpection($e->getMessage());
             }
         }
     } else {
         throw new SubscribeUserException("No user for add to subscribers" . ". Line: " . __LINE__);
     }
 }
开发者ID:ASDAFF,项目名称:bitrix_tehnomir,代码行数:19,代码来源:CRUD.php

示例2: trim

             }
             if (trim($_POST["WORK_PHONE"]) != '') {
                 $arFields["WORK_PHONE"] = trim($_POST["WORK_PHONE"]);
             }
             if (is_array($_FILES["PERSONAL_PHOTO"])) {
                 $arFields["PERSONAL_PHOTO"] = $_FILES["PERSONAL_PHOTO"];
             }
             $obUser = new CUser();
             $obUser->Update($arResult["USER"]["ID"], $arFields);
             $strError = $obUser->LAST_ERROR;
             if ($strError == '') {
                 $db_events = GetModuleEvents("main", "OnUserInitialize", true);
                 foreach ($db_events as $arEvent) {
                     ExecuteModuleEventEx($arEvent, array($arResult["USER"]["ID"], $arFields));
                 }
                 $obUser->Authorize($arResult["USER"]["ID"], $_POST["USER_REMEMBER"] == "Y");
                 LocalRedirect(SITE_DIR);
             } else {
                 $arResult["MESSAGE_TEXT"] .= $strError;
                 $arResult["MESSAGE_CODE"][] = "E10";
                 $arResult["SHOW_FORM"] = true;
             }
         }
     }
     if (empty($arResult["MESSAGE_CODE"])) {
         $arResult["SHOW_FORM"] = true;
     }
 } else {
     $arResult["MESSAGE_TEXT"] .= GetMessage("CC_MAIN_REG_INIT_MESSAGE_NO_USER");
     $arResult["MESSAGE_CODE"][] = "E01";
 }
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:component.php

示例3: CUser

         //Пользователь с логином не найден!';
         if ($userFromFB_ID = User::findFromFB($arFileds["id"])) {
             // ищем по ID Facebook
             $ID = $userFromFB_ID;
         } else {
             //тогда создаем нового пользователя
             $user = new CUser();
             $password = randString(7);
             $arFields = array("NAME" => $arFileds["first_name"], "LAST_NAME" => $arFileds["last_name"], "EMAIL" => $arFileds["email"], "LOGIN" => $arFileds["email"], "PERSONAL_BIRTHDAY" => str_replace("/", ".", $arFileds["birthday"]), "LID" => "ru", "ACTIVE" => "Y", "PASSWORD" => $password, "CONFIRM_PASSWORD" => $password, "PERSONAL_PHOTO" => CFile::MakeFileArray("http://graph.facebook.com/" . $arFileds["id"] . "/picture?type=large"));
             $ID = $user->Add($arFields);
         }
     }
     // Тут пользователь должен быть полюбому
     // Авторизуем его
     $userRes = new CUser();
     $userRes->Authorize($ID);
 }
 //Получаем друзей пользователя Фэйсбука
 $fUrl = "https://graph.facebook.com/me/friends?access_token={$fb_token}";
 $fResponse = file_get_contents($fUrl);
 $FriendsData = json_decode($fResponse);
 $FriendsDataSerialized = serialize($FriendsData);
 $ob = CIBlockElement::GetList(array("SORT" => "ASC"), array("PROPERTY_USER" => $USER::GetId(), "IBLOCK_ID" => IB_USER_PROPS), FALSE, FALSE, array("ID", "PROPERTY_USER", "PROPERTY_LINK_NEWS", "PROPERTY_LINK_EVENT", "PROPERTY_LINK_STOK"))->Fetch();
 if ($ob) {
     CIBlockElement::SetPropertyValuesEx(intval($ob["ID"]), IB_USER_PROPS, array("TOKEN_FACEBOOK" => $fb_token, "FRIENDS_FACEBOOK" => $FriendsDataSerialized, "ID_FACEBOOK" => $arFileds["id"]));
     if ($_GET['r']) {
         $path = base64_decode($_GET['r']);
         header('Location: ' . $path);
         exit;
     }
 }
开发者ID:nProfessor,项目名称:Mytb,代码行数:31,代码来源:facebook.php

示例4: TempUser

 public static function TempUser($TmpUser = false, $create = true, $ID = false)
 {
     global $USER;
     if ($create && $TmpUser === false && (!$USER || !is_object($USER))) {
         $USER = new CUser();
         if ($ID && intVal($ID) > 0) {
             $USER->Authorize(intVal($ID));
         }
         return $USER;
     } elseif (!$create && $USER && is_object($USER)) {
         unset($USER);
         return false;
     }
     return false;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:15,代码来源:calendar.php

示例5: trim

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$email = trim($_POST["email"]);
$reg = intval($_POST["reg"]);
$password = trim($_POST["password"]);
if ($email == "" || $password == "") {
    die(json_encode(array("status" => "errors", "message" => "Пустой логин или пароль", "input" => array("email", "password"))));
}
global $USER;
$user = new CUser();
$arAuthResult = $user->Login($email, $password, "Y");
if ($arAuthResult['TYPE'] != "ERROR") {
    die(json_encode(array("status" => "ok")));
} elseif ($reg == 1) {
    if (CUser::GetByLogin($email)->Fetch() == NULL) {
        $arFields = array("EMAIL" => $email, "LOGIN" => $email, "ACTIVE" => "Y", "PASSWORD" => $password, "CONFIRM_PASSWORD" => $password);
        $ID = $user->Add($arFields);
        if (intval($ID) > 0) {
            if ($user->Authorize($ID)) {
                die(json_encode(array("status" => "ok")));
            } else {
                die(json_encode(array("status" => "ok", "message" => "Не получилось авторизировать")));
            }
        } else {
            die(json_encode(array("status" => "errors", "message" => $user->LAST_ERROR)));
        }
    } else {
        die(json_encode(array("status" => "errors", "message" => "Логин уже занят")));
    }
} else {
    die(json_encode(array("status" => "errors", "message" => "Неверный пароль", "input" => array("email", "password"))));
}
开发者ID:nProfessor,项目名称:Mytb,代码行数:31,代码来源:auth.php


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