本文整理汇总了PHP中CUser::IsAuthorized方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::IsAuthorized方法的具体用法?PHP CUser::IsAuthorized怎么用?PHP CUser::IsAuthorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::IsAuthorized方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserCreate
public static function UserCreate($name, $phone, $domen, $login, $group) //$name - string, $phone - string, $domen - string, $login - string, $group - array
{
if (CUser::IsAuthorized()) {
$userId = CUser::GetID();
return (int)$userId;
} else {
$usersCheck = CUser::GetByLogin($login);
if ($arUser = $usersCheck->Fetch()) {
return (int)$arUser["ID"];
} else {
$stringPhone = preg_replace('~\D~','',$phone);
$password = OrderClick::GeneratePassword(10);
$user = new CUser;
$arFields = Array(
"NAME" => $name,
"EMAIL" => $stringPhone . "@" . $domen,
"LOGIN" => $phone,
"ACTIVE" => "N", // Делаю пользователя не активным
"GROUP_ID" => $group,
"PASSWORD" => $password,
"CONFIRM_PASSWORD" => $password,
"PERSONAL_PHONE" => $stringPhone,
);
return $user->Add($arFields);
}
}
}
示例2: elemAdd
function elemAdd($elemId)
{
$usr = new CUser();
if (!empty($elemId) and $usr->IsAuthorized()) {
$hlHandler = $this->hlHandler;
$data = array("UF_USER_ID" => $usr->GetID(), "UF_FAV_ID" => $elemId, "UF_XML_ID" => "wf{$elemId}");
$res = $hlHandler::add($data);
return $res->getId();
}
return false;
}
示例3: Connect
/**
* Выполняет подключение к Carrot Quest на стороне клиента (JavaScript). JS объект <var>carrotquest</var> уже должен быть инициализирован.
* Если пользователь залогинен, шлет идентификационные данные методом <var>carrotquest.identify()</var>.
* <b>Параметры:</b> отсутствуют
* <b>Возвращаемое значение:</b>
* true, если в параметрах модуля найден API-KEY, false в противном случае
*/
public function Connect ()
{
// В header-е уже должен быть инициализирован carrotquest (в js)
$ApiKey = COption::GetOptionString($this->MODULE_ID,"cqApiKey");
if ($ApiKey)
{?>
<script>
if (typeof(carrotquest) != "undefined")
carrotquest.connect("<?php
echo $ApiKey;
?>
");
else ;
// console.log("Ошибка сервера carrotquest (connect)!");
</script>
<!-- Вызов идентификации -->
<?if (CUser::IsAuthorized()) { ?>
<script>
if (typeof(carrotquest) != "undefined") // На всякий случай, чтобы не выдавал в консоль ругань
{
carrotquest.identify({
$uid: "<?php
echo CUser::GetID();
?>
",
$email: "<?php
echo CUser::GetEmail();
?>
",
$name: "<?php
echo CUser::GetLogin();
?>
"
});
}
else ;
// console.log("Ошибка сервера carrotquest (identify)!");
</script>
<? }
}
else
{
return false;
}
return true;
}
示例4: CUser
$GLOBALS['APPLICATION']->RestartBuffer();
CModule::IncludeModule("iblock");
CModule::IncludeModule("sale");
CModule::IncludeModule("catalog");
global $USER;
if (!is_object($USER)) {
$USER = new CUser();
}
$result = array();
$result['status'] = false;
$result['message'] = '';
$result['errors'] = array();
if (strlen($_POST['ajax_key']) && $_POST['ajax_key'] != md5('ajax_' . LICENSE_KEY) || !check_bitrix_sessid()) {
$result['errors']["old-password"] = "Сессия не действительна!";
}
if ($USER->IsAuthorized()) {
$rsUser = CUser::GetByID($USER->GetID());
$arUser = $rsUser->Fetch();
$salt = substr($arUser['PASSWORD'], 0, strlen($arUser['PASSWORD']) - 32);
$realPassword = substr($arUser['PASSWORD'], -32);
$old_password = md5($salt . $_POST['old-password']);
if ($old_password != $realPassword) {
$result['errors']["old-password"] = "Старый пароль введен неправильно!";
}
$password = htmlspecialcharsbx($_POST['new-password']);
$password2 = htmlspecialcharsbx($_POST['new-password2']);
if (strlen($password) < 6 || strlen($password2) < 6) {
$result['errors']["new-password"] = "Длина пароля должна быть не менее 6 символов!";
}
if ($password != $password2) {
$result['errors']["new-password"] = "Пароли не совпадают!";
示例5: AuthtorizeAfterAds
/**
* функция после добавлением элемента в инфоблока
* @param $arFields поля элемента ифоблока
* для страницы Объявления
* eсли VIP объявление то добавляет корзину
* привязывает по ID созданное объявления к товару в корзине
* редирект на необходимы url
*/
function AuthtorizeAfterAds(&$arFields){
unset($_SESSION['user777999authorize']);
if($arFields['PROPERTY_VALUES']['114']){
foreach($arFields['PROPERTY_VALUES']['114'] as $key114 => $item114){
if($item114['VALUE']){
foreach($arFields['PROPERTY_VALUES']['113'] as $key113 => $item113){
if($item113['VALUE']){
$arFields['PROPERTY_VALUES']['113'][$key113]=ConvertDateTime($item114['VALUE'], "YYYY-MM-DD HH:MI:SS");
}else{
$arFields['PROPERTY_VALUES']['113'][n0]=ConvertDateTime($item114['VALUE'], "YYYY-MM-DD HH:MI:SS");
}
}
}
}
}
if(($arFields["IBLOCK_ID"] == 16)&&(!CUser::IsAuthorized())){
global $USER;
$rsUser = CUser::GetByID($_SESSION['NEW_USER_ID']);
$arUser = $rsUser->Fetch();
$_SESSION['$arUser']=$arUser;
$USER = new CUser;
$arAuthResult = $USER->Login($arUser['LOGIN'], $arUser['PASSWORD'], "Y","N");
}
//$_SESSION['user777authorize']=$arFields;
if(($arFields["IBLOCK_ID"] == 16)&&(CModule::IncludeModule("catalog"))&&(CModule::IncludeModule("sale"))){
$price_product=floatval($arFields["PROPERTY_VALUES"][86]);
$quantity_product=floatval($arFields["PROPERTY_VALUES"][87]);
if($price_product){
$PRODUCT_ID = $arFields['ID'];
$PRICE_TYPE_ID = 1;
$arFieldsprice = Array(
"PRODUCT_ID" => $PRODUCT_ID,
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID,
"PRICE" =>$price_product,
"CURRENCY" => "RUB",
"QUANTITY_FROM" => 1,
);
$res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $PRODUCT_ID,
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID
)
);
if ($arr = $res->Fetch())
{
CPrice::Update($arr["ID"], $arFieldsprice);
}
else
{
CPrice::Add($arFieldsprice,true);
}
}
}
if (
(
(($arFields["IBLOCK_ID"] == 2)&& (is_numeric($arFields["PROPERTY_VALUES"][73])))
||
(($arFields["IBLOCK_ID"] == 15)&& (is_numeric($arFields["PROPERTY_VALUES"][76])))
||
(($arFields["IBLOCK_ID"] == 14)&& (is_numeric($arFields["PROPERTY_VALUES"][78])))
)
&&
CModule::IncludeModule("catalog")
&&
CModule::IncludeModule("sale")
&&
((strstr($_SERVER['REQUEST_URI'],'/personal/moy-magazin/'))||(strstr($_SERVER['REQUEST_URI'],'/obyavleniya/add-ads/')))
)
{
switch($arFields["IBLOCK_ID"]){
case 2:
$price_product=floatval($arFields["PROPERTY_VALUES"][73]);
$quantity_product=floatval($arFields["PROPERTY_VALUES"][75]);
break;
case 14:
$price_product=floatval($arFields["PROPERTY_VALUES"][78]);
$quantity_product=floatval($arFields["PROPERTY_VALUES"][79]);
//.........这里部分代码省略.........
示例6: Update
function Update($ID)
{
global $DB, $USER;
if (!is_object($USER)) {
$USER = new CUser();
}
$ID = IntVal($ID);
$arFields = array("=DATE_UPDATE" => $DB->GetNowFunction());
if ($USER->IsAuthorized()) {
$arFields["USER_ID"] = IntVal($USER->GetID());
}
CSaleUser::_Update($ID, $arFields);
$secure = false;
if (COption::GetOptionString("sale", "use_secure_cookies", "N") == "Y" && CMain::IsHTTPS()) {
$secure = 1;
}
if (COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y") {
$arRes = CSaleUser::GetList(array("ID" => $ID));
if (!empty($arRes)) {
$GLOBALS["APPLICATION"]->set_cookie("SALE_UID", $arRes["CODE"], false, "/", false, $secure, "Y", false);
}
} else {
$GLOBALS["APPLICATION"]->set_cookie("SALE_UID", $ID, false, "/", false, $secure, "Y", false);
}
return true;
}
示例7: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
if (CUser::IsAuthorized()) {
?>
<div class="clearfix">
<div class="f_right">
<?php
$APPLICATION->IncludeComponent("imedia:iblock.vote", "im_like", array("CACHE_TIME" => "36000000", "CACHE_TYPE" => "A", "COMPONENT_TEMPLATE" => "im_like", "DISPLAY_AS_RATING" => "rating", "ELEMENT_CODE" => $arResult['CODE'], "ELEMENT_ID" => $arResult['ID'], "IBLOCK_ID" => $arResult['IBLOCK_ID'], "IBLOCK_TYPE" => $arResult['IBLOCK']['IBLOCK_TYPE_ID'], "MAX_VOTE" => "1", "MESSAGE_404" => "", "SET_STATUS_404" => "N", "SHOW_RATING" => "N", "VOTE_NAMES" => array("1")));
?>
</div>
</div>
<?php
}
示例8: CUser
define('STOP_STATISTICS', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
$GLOBALS['APPLICATION']->RestartBuffer();
global $USER;
if (!is_object($USER)) {
$USER = new CUser();
}
$result = array();
$result['status'] = "fail";
$result['errors'] = array();
if (strlen($_POST['ajax_key']) && $_POST['ajax_key'] != md5('ajax_' . LICENSE_KEY) || !check_bitrix_sessid()) {
$result["message"] = "Сессия не действительна!";
}
$text = htmlspecialcharsbx($_REQUEST["text"]);
$prog_id = intval($_REQUEST["prog_id"]);
if ($USER->IsAuthorized() && !empty($text)) {
$USER_ID = $USER->GetID();
/*if($_REQUEST["force_add"]=="y")
{
$arComments = array();
}else{
$arComments = CCommentEx::getList(array("UF_USER_ID"=>$USER_ID, "UF_TEXT"=>$text, "UF_PROG_ID" => $prog_id), array("ID"));
}*/
$rsUser = CUser::GetByID($USER_ID);
$arUser = $rsUser->Fetch();
/*if(count($arComments)>0)
{
$result = array(
"status" => "warning",
"username" => trim($arUser["NAME"]." ".$arUser["LAST_NAME"]),
"user_photo" => CFile::GetPath($arUser["PERSONAL_PHOTO"]),
示例9: intval
<?php
define('STOP_STATISTICS', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
$GLOBALS['APPLICATION']->RestartBuffer();
global $USER;
if (!is_object($USER)) {
$USER = new \CUser();
}
$status = false;
$record_id = intval($_REQUEST["broadcastID"]);
if ($USER->IsAuthorized() && $record_id > 0 && $_REQUEST["delete"]) {
$result = \Hawkart\Megatv\RecordTable::getById($record_id);
$arRecord = $result->fetch();
if ($arRecord["UF_USER_ID"] == $USER->GetID()) {
$USER_ID = $USER->GetID();
$rsUser = \CUser::GetByID($USER_ID);
$arUser = $rsUser->Fetch();
$arRecord["UF_DATE_START"] = $arRecord['UF_DATE_START']->toString();
$arRecord["UF_DATE_END"] = $arRecord['UF_DATE_END']->toString();
$duration = strtotime($arRecord["UF_DATE_END"]) - strtotime($arRecord["UF_DATE_START"]);
$minutes = ceil($duration / 60);
$gb = $minutes * (18.5 / 1024);
$busy = floatval($arUser["UF_CAPACITY_BUSY"]) - $gb;
$user = new \CUser();
$user->Update($arUser["ID"], array("UF_CAPACITY_BUSY" => $busy));
\Hawkart\Megatv\RecordTable::update($record_id, array("UF_DELETED" => 1));
$status = "success";
}
}
exit(json_encode(array("status" => $status)));
示例10: CUser
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
$GLOBALS['APPLICATION']->RestartBuffer();
//include lang file
CComponentUtil::__IncludeLang(dirname($_SERVER["SCRIPT_NAME"]), "/ajax.php");
global $USER;
if (!is_object($USER)) {
$USER = new CUser();
}
$result = array();
$result['status'] = 'error';
$result['message'] = '';
$result['errors'] = array();
if (strlen($_POST['ajax_key']) && $_POST['ajax_key'] != md5('ajax_' . LICENSE_KEY) || htmlspecialcharsbx($_POST["TYPE"]) != "REGISTRATION" || !check_bitrix_sessid()) {
$result['errors']["USER_NAME"] = GetMessage('AUTH_ERROR_SESSION_EXPIRED');
}
if (!$USER->IsAuthorized() && count($result['errors']) == 0) {
$EMAIL = htmlspecialcharsbx(strip_tags($_POST["USER_EMAIL"]));
$AGREE = htmlspecialcharsbx(strip_tags($_POST["AGREE"]));
$password = htmlspecialcharsbx($_POST["USER_PASSWORD"]);
$phone = preg_replace("/[^0-9]/", '', $EMAIL);
if (!\CDev::check_email($EMAIL) && !\CDev::check_phone($phone)) {
$result['errors']["USER_EMAIL"] = GetMessage('AUTH_ERROR_DATA_FORMAT');
} else {
if (\CDev::check_phone($phone)) {
$rsUsers = \CUser::GetList($by = "EMAIL", $order = "desc", array("PERSONAL_PHONE" => $phone));
if ($arUser = $rsUsers->GetNext()) {
if ($arUser["ACTIVE"] == "N") {
$result["status"] = "need_confirm";
exit(json_encode($result));
}
$result['errors']["USER_EMAIL"] = GetMessage('AUTH_ERROR_PHONE_EXIST');
示例11: CUser
<?php
define('STOP_STATISTICS', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
$GLOBALS['APPLICATION']->RestartBuffer();
global $USER;
if (!is_object($USER)) {
$USER = new CUser();
}
$status = false;
$prog_time = intval($_REQUEST["broadcastID"]);
if ($USER->IsAuthorized() && $prog_time > 0) {
//get subsribe channel list
$selectedChannels = array();
$result = \Hawkart\Megatv\SubscribeTable::getList(array('filter' => array("=UF_ACTIVE" => 1, "=UF_USER_ID" => $USER->GetID(), ">UF_CHANNEL_ID" => 0), 'select' => array("UF_CHANNEL_ID")));
while ($arSub = $result->fetch()) {
$selectedChannels[] = $arSub["UF_CHANNEL_ID"];
}
$USER_ID = $USER->GetID();
$rsUser = \CUser::GetByID($USER_ID);
$arUser = $rsUser->Fetch();
//get inform about schedule
$result = \Hawkart\Megatv\ScheduleTable::getList(array('filter' => array("=ID" => $prog_time), 'select' => array("ID", "UF_DATE_START", "UF_DATE_END", "UF_DATE", "UF_CHANNEL_BASE_ID" => "UF_CHANNEL.UF_BASE_ID", "UF_PROG_ID", "UF_CHANNEL_EPG_ID" => "UF_CHANNEL.UF_BASE.UF_EPG_ID", "UF_IMG_PATH" => "UF_PROG.UF_IMG.UF_PATH", "UF_PROG_EPG_ID" => "UF_PROG.UF_EPG_ID", "UF_EPG_ID", "UF_CHANNEL_ID"), 'limit' => 1));
if ($arSchedule = $result->fetch()) {
$arSchedule["UF_DATE_START"] = $arSchedule['UF_DATE_START']->toString();
$arSchedule["UF_DATE_END"] = $arSchedule['UF_DATE_END']->toString();
}
//check if schedule in recording yet. Deleted to recordable
$update = false;
$result = \Hawkart\Megatv\RecordTable::getList(array('filter' => array("=UF_USER_ID" => $USER_ID, "=UF_SCHEDULE_ID" => $prog_time), 'select' => array("ID", "UF_DELETED"), 'limit' => 1));
if ($arRecord = $result->fetch()) {
示例12: array
<?php
define('STOP_STATISTICS', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
$GLOBALS['APPLICATION']->RestartBuffer();
global $USER;
if (!is_object($USER)) {
$USER = new \CUser();
}
if (!$USER->IsAuthorized() && empty($_REQUEST["url"])) {
return false;
}
/**
* Показ прямого эфира канала
*/
if (isset($_REQUEST["channel_id"])) {
$result = \Hawkart\Megatv\ChannelTable::getList(array('filter' => array("=ID" => intval($_REQUEST["channel_id"])), 'select' => array('ID', 'UF_TITLE' => 'UF_BASE.UF_TITLE', 'UF_STREAM_URL' => 'UF_BASE.UF_STREAM_URL'), 'limit' => 1));
$arChannel = $result->fetch();
if (empty($arChannel["UF_STREAM_URL"])) {
$arChannel["UF_STREAM_URL"] = $_REQUEST["url"];
$arChannel["UF_TITLE"] = "Test";
}
?>
<div class="broadcast-player" data-module="broadcast-player">
<script type="text/x-config">
{
"seekTime": "0",
"broadcastID": "0",
"streamURL": "<?php
echo $arChannel["UF_STREAM_URL"];
?>
示例13: Init
function Init($Params)
{
global $USER;
$access = new CAccess();
$access->UpdateCodes();
if (!$USER || !is_object($USER)) {
$USER = new CUser();
}
// Owner params
self::$siteId = isset($Params['siteId']) ? $Params['siteId'] : SITE_ID;
self::$type = $Params['type'];
self::$arTypes = CCalendarType::GetList();
self::$bIntranet = CCalendar::IsIntranetEnabled();
self::$bSocNet = self::IsSocNet();
self::$userId = isset($Params['userId']) ? intVal($Params['userId']) : CCalendar::GetCurUserId();
self::$bOwner = self::$type == 'user' || self::$type == 'group';
self::$settings = self::GetSettings();
self::$userSettings = self::GetUserSettings();
self::$pathesForSite = self::GetPathes(self::$siteId);
self::$pathToUser = self::$pathesForSite['path_to_user'];
self::$bSuperpose = $Params['allowSuperpose'] != false && self::$bSocNet;
self::$bAnonym = !$USER || !$USER->IsAuthorized();
self::$userNameTemplate = self::$settings['user_name_template'];
self::$bAMPM = IsAmPmMode();
self::$bWideDate = strpos(FORMAT_DATETIME, 'MMMM') !== false;
if (isset($Params['SectionControlsDOMId'])) {
self::$SectionsControlsDOMId = $Params['SectionControlsDOMId'];
}
if (self::$bOwner && isset($Params['ownerId']) && $Params['ownerId'] > 0) {
self::$ownerId = intVal($Params['ownerId']);
}
self::$bTasks = self::$type == 'user' && $Params['showTasks'] !== false && CModule::IncludeModule('tasks');
if (self::$bTasks && self::$ownerId != self::$userId) {
self::$bTasks = false;
}
self::GetPermissions(array('type' => self::$type, 'bOwner' => self::$bOwner, 'userId' => self::$userId, 'ownerId' => self::$ownerId));
// Cache params
if (isset($Params['cachePath'])) {
self::$cachePath = $Params['cachePath'];
}
if (isset($Params['cacheTime'])) {
self::$cacheTime = $Params['cacheTime'];
}
self::$bCache = self::$cacheTime > 0;
// Urls
$page = preg_replace(array("/EVENT_ID=.*?\\&/i", "/CHOOSE_MR=.*?\\&/i", "/action=.*?\\&/i", "/bx_event_calendar_request=.*?\\&/i", "/clear_cache=.*?\\&/i", "/bitrix_include_areas=.*?\\&/i", "/bitrix_show_mode=.*?\\&/i", "/back_url_admin=.*?\\&/i"), "", $Params['pageUrl'] . '&');
$page = preg_replace(array("/^(.*?)\\&\$/i", "/^(.*?)\\?\$/i"), "\$1", $page);
self::$actionUrl = $page;
if (self::$bOwner && !empty(self::$ownerId)) {
self::$path = self::GetPath(self::$type, self::$ownerId, true);
} else {
self::$path = CCalendar::GetServerPath() . $page;
}
self::$outerUrl = $GLOBALS['APPLICATION']->GetCurPageParam('', array("action", "bx_event_calendar_request", "clear_cache", "bitrix_include_areas", "bitrix_show_mode", "back_url_admin", "SEF_APPLICATION_CUR_PAGE_URL", "EVENT_ID", "CHOOSE_MR"), false);
// Superposing
self::$bCanAddToSuperpose = false;
if (self::$bSuperpose) {
if (self::$type == 'user' || self::$type == 'group') {
self::$bCanAddToSuperpose = true;
}
foreach (self::$arTypes as $t) {
if (is_array(self::$settings['denied_superpose_types']) && !in_array($t['XML_ID'], self::$settings['denied_superpose_types'])) {
self::$arSPTypes[] = $t['XML_ID'];
}
}
self::$bCanAddToSuperpose = is_array(self::$arSPTypes) && in_array(self::$type, self::$arSPTypes);
}
// **** Reserve meeting and reserve video meeting
// *** Meeting room params ***
$RMiblockId = self::$settings['rm_iblock_id'];
self::$allowReserveMeeting = $Params["allowResMeeting"] && $RMiblockId > 0;
if (self::$allowReserveMeeting && !$USER->IsAdmin() && CIBlock::GetPermission($RMiblockId) < "R") {
self::$allowReserveMeeting = false;
}
// *** Video meeting room params ***
$VMiblockId = self::$settings['vr_iblock_id'];
self::$allowVideoMeeting = $Params["allowVideoMeeting"] && $VMiblockId > 0;
if (self::$allowVideoMeeting && !$USER->IsAdmin() && CIBlock::GetPermission($VMiblockId) < "R" || !CModule::IncludeModule("video")) {
self::$allowVideoMeeting = false;
}
}