Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function logout(){
- global $USER;
- if (!is_object($USER))
- $USER = new CUser;
- if($_SERVER['HTTP_X_TOKEN']):
- Load::includeModule('main');
- $result = array();
- $userBy = "id";
- $userOrder = "desc";
- $userFilter = array(
- "ACTIVE" => "Y",
- "UF_API_TOKEN" => $_SERVER['HTTP_X_TOKEN']
- );
- $userParam = array(
- "FIELDS" => array(
- "ID",
- "LOGIN"
- )
- );
- $rsUser = CUser::GetList(
- $userBy,
- $userOrder,
- $userFilter,
- $userParam
- );
- if($arUser = $rsUser -> Fetch()) {
- $oUser = new CUser;
- $aFields = array(
- 'UF_API_TOKEN' => '',
- 'UF_API_TOKEN_DATE' => ''
- );
- $res = $oUser->Update($arUser['ID'], $aFields);
- if ($res) {
- $result['success'] = true;
- }
- else{
- $result['success'] = true;
- }
- }
- endif;
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement