29 "project" =>
"project",
30 "corporation" =>
"corporation",
31 "company" =>
"company",
32 "company2" =>
"company2",
33 "company3" =>
"company3",
48 "ent1000" =>
"ent1000",
49 "ent2000" =>
"ent2000",
50 "ent3000" =>
"ent3000",
51 "ent4000" =>
"ent4000",
52 "ent5000" =>
"ent5000",
53 "ent6000" =>
"ent6000",
54 "ent7000" =>
"ent7000",
55 "ent8000" =>
"ent8000",
56 "ent9000" =>
"ent9000",
57 "ent10000" =>
"ent10000",
66 if(!is_array(self::$arMethodsList))
68 $globalMethods =
array(
69 CRestUtil::GLOBAL_SCOPE =>
array(
70 'batch' =>
array(__CLASS__,
'methodsBatch'),
72 'scope' =>
array(__CLASS__,
'scopeList'),
73 'methods' =>
array(__CLASS__,
'methodsList'),
74 'method.get' =>
array(__CLASS__,
'getMethod'),
76 'server.time' =>
array(__CLASS__,
'getServerTime'),
81 CRestUtil::GLOBAL_SCOPE =>
array(
82 'app.option.get' =>
array(__CLASS__,
'appOptionGet'),
83 'app.option.set' =>
array(__CLASS__,
'appOptionSet'),
84 'user.option.get' =>
array(__CLASS__,
'userOptionGet'),
85 'user.option.set' =>
array(__CLASS__,
'userOptionSet'),
87 CRestUtil::EVENTS =>
array(
88 'OnAppUninstall' =>
array(
91 array(__CLASS__,
'OnAppEvent'),
97 'OnAppInstall' =>
array(
100 array(__CLASS__,
'OnAppEvent'),
102 "sendRefreshToken" =>
true,
106 'OnAppUpdate' =>
array(
109 array(__CLASS__,
'OnAppEvent'),
111 "sendRefreshToken" =>
true,
115 'OnAppPayment' =>
array(
118 array(__CLASS__,
'OnAppPayment'),
123 'OnSubscriptionRenew' => [
125 'onAfterSubscriptionRenew',
128 'onSubscriptionRenew',
131 'sendRefreshToken' =>
true,
134 'OnAppTest' =>
array(
137 array(__CLASS__,
'OnAppEvent'),
139 "sendRefreshToken" =>
true,
142 'OnAppMethodConfirm' =>
array(
144 'OnRestAppMethodConfirm',
145 array(__CLASS__,
'OnAppEvent'),
152 CRestUtil::PLACEMENTS =>
array(
153 CRestUtil::PLACEMENT_APP_URI =>
array(
160 if(!\
Bitrix\
Rest\Integration\OAuthModule::isSupported())
162 $ownMethods[CRestUtil::GLOBAL_SCOPE][
'app.info'] =
array(__CLASS__,
'appInfo');
163 $ownMethods[CRestUtil::GLOBAL_SCOPE][
'feature.get'] =
array(__CLASS__,
'getFeature');
166 $arDescription =
array();
168 foreach(
GetModuleEvents(
"rest",
"OnRestServiceBuildDescription",
true) as $arEvent)
173 $arDescription = array_merge_recursive(
$res, $arDescription);
177 self::$arMethodsList = array_merge_recursive(
183 if(!array_key_exists(
'profile', self::$arMethodsList[CRestUtil::GLOBAL_SCOPE]))
185 self::$arMethodsList[CRestUtil::GLOBAL_SCOPE][
'profile'] =
array(
186 'callback' =>
array(__CLASS__,
'getProfile'),
187 'options' =>
array(),
191 foreach(self::$arMethodsList as $scope => $arScopeMethods)
193 self::$arMethodsList[$scope] = array_change_key_case(self::$arMethodsList[$scope], CASE_LOWER);
195 array_key_exists(CRestUtil::EVENTS, self::$arMethodsList[$scope])
196 && is_array(self::$arMethodsList[$scope][CRestUtil::EVENTS])
199 self::$arMethodsList[$scope][CRestUtil::EVENTS] = array_change_key_case(self::$arMethodsList[$scope][CRestUtil::EVENTS], CASE_UPPER);
202 array_key_exists(CRestUtil::PLACEMENTS, self::$arMethodsList[$scope])
203 && is_array(self::$arMethodsList[$scope][CRestUtil::PLACEMENTS])
206 self::$arMethodsList[$scope][CRestUtil::PLACEMENTS] = array_change_key_case(self::$arMethodsList[$scope][CRestUtil::PLACEMENTS], CASE_UPPER);
211 return self::$arMethodsList;
218 if(!
$USER->isAuthorized())
224 $userInfo =
$dbRes->fetch();
228 if($userInfo[
'ACTIVE'] ==
'Y')
231 'ID' => $userInfo[
'ID'],
232 'ADMIN' => CRestUtil::isAdmin(),
233 'NAME' => $userInfo[
'NAME'],
234 'LAST_NAME' => $userInfo[
'LAST_NAME'],
235 'PERSONAL_GENDER' => $userInfo[
'PERSONAL_GENDER'],
236 'TIME_ZONE' => $userInfo[
'TIME_ZONE'],
239 if($userInfo[
'PERSONAL_PHOTO'] > 0)
241 $result[
'PERSONAL_PHOTO'] = CRestUtil::GetFile($userInfo[
"PERSONAL_PHOTO"]);
244 $securityState =
array(
247 "LAST_NAME" =>
$result[
'LAST_NAME'],
259 $arQuery = array_change_key_case($arQuery, CASE_UPPER);
261 $bHalt = isset($arQuery[
'HALT']) && $arQuery[
'HALT'];
270 if (isset($arQuery[
'CMD']))
274 $authData = $server->
getAuth();
275 foreach ($arQuery[
'CMD'] as
$key => $call)
277 if (($cnt++) < CRestUtil::BATCH_MAX_LENGTH)
279 if (!is_string($call))
283 $queryData = parse_url($call);
286 $query = $queryData[
'query'];
289 if (method_exists(
'CSecurityFilter',
'processVar'))
295 $method === CRestUtil::METHOD_DOWNLOAD
296 ||
$method === CRestUtil::METHOD_UPLOAD
297 ||
$method === Client::METHOD_BATCH
301 'error' => self::ERROR_BATCH_METHOD_NOT_ALLOWED,
302 'error_description' =>
'Method is not allowed for batch usage',
307 if (is_array($authData))
309 foreach($authData as $authParam => $authValue)
318 foreach ($methods as $restMethod)
321 'CLASS' => __CLASS__,
322 'METHOD' => $restMethod,
325 $pseudoServer->setApplicationId($server->
getClientId());
326 $pseudoServer->setAuthKeys(array_keys($authData));
327 $pseudoServer->setAuthData($server->
getAuthData());
328 $pseudoServer->setAuthType($server->
getAuthType());
329 $res = $pseudoServer->process();
331 unset($pseudoServer);
336 && !empty(
$res[
'error'])
337 &&
$res[
'error'] ===
'ERROR_METHOD_NOT_FOUND'
351 'error' => self::ERROR_BATCH_LENGTH_EXCEEDED,
352 'error_description' =>
'Max batch length exceeded',
358 if (isset(
$res[
'error']))
369 if (isset(
$res[
'error']) &&
$res[
'error'] && $bHalt)
387 $arQuery = array_change_key_case($arQuery, CASE_UPPER);
389 if(isset($arQuery[
'FULL']) && $arQuery[
'FULL'])
391 $arScope = ScopeManager::getInstance()->listScope();
408 $arQuery = array_change_key_case($arQuery, CASE_UPPER);
410 if(isset($arQuery[
'SCOPE']))
412 if($arQuery[
'SCOPE'] !=
'')
415 elseif(isset($arQuery[
'FULL']) && $arQuery[
'FULL'])
422 $arScope[] = CRestUtil::GLOBAL_SCOPE;
425 foreach ($arMethods as $scope => $arScopeMethods)
429 unset($arScopeMethods[CRestUtil::METHOD_DOWNLOAD]);
430 unset($arScopeMethods[CRestUtil::METHOD_UPLOAD]);
431 unset($arScopeMethods[CRestUtil::EVENTS]);
432 unset($arScopeMethods[CRestUtil::PLACEMENTS]);
434 foreach($arScopeMethods as
$method => $methodDesc)
436 if(isset($methodDesc[
"options"][
"private"]) && $methodDesc[
"options"][
"private"] ===
true)
438 unset($arScopeMethods[
$method]);
449 public static function getMethod(
$query,
$n, CRestServer $server):
array
452 'isExisting' =>
false,
453 'isAvailable' =>
false,
458 $currentScope = self::getScope($server);
459 $currentScope[] = CRestUtil::GLOBAL_SCOPE;
460 $cache = Cache::createInstance();
461 if ($cache->initCache(
462 ScopeManager::CACHE_TIME,
463 'info' . md5(
$name . implode(
'|', $currentScope)),
464 ScopeManager::CACHE_DIR .
'method/'
469 elseif ($cache->startDataCache())
471 $method = ScopeManager::getInstance()->getMethodInfo(
$name);
474 foreach ($arMethods as $scope => $methodList)
476 if (!empty($methodList[
$name]))
478 if (in_array($scope, $currentScope,
true))
489 Context::getCurrent()->getServer(),
500 [$controller,
$action] = Resolver::getControllerAndAction(
504 Controller::SCOPE_REST
508 if (in_array(
$method[
'scope'], $currentScope,
true))
525 $licensePrevious =
'';
528 $result = self::getBitrix24LicenseName();
533 $result = self::getBitrix24LicenseName(CBitrix24::LICENSE_TYPE_PREVIOUS);
534 $licensePrevious =
$result[
'LICENSE'];
539 $license = LANGUAGE_ID.
'_selfhosted';
544 $arApp = self::getApp($server);
551 'VERSION' => intval(
$arApp[
'VERSION']),
552 'STATUS' =>
$info[
'STATUS'],
554 'PAYMENT_EXPIRED' =>
$info[
'PAYMENT_EXPIRED'],
555 'DAYS' =>
$info[
'DAYS_LEFT'],
556 'LANGUAGE_ID' => CRestUtil::getLanguage(),
559 if ($licensePrevious)
561 $res[
'LICENSE_PREVIOUS'] = $licensePrevious;
563 if (CModule::IncludeModule(
'bitrix24'))
565 $res[
'LICENSE_TYPE'] = CBitrix24::getLicenseType();
566 $res[
'LICENSE_FAMILY'] = CBitrix24::getLicenseFamily();
574 'SCOPE' => static::getScope($server),
586 if(is_array($eventData))
588 if(!isset(
$res[
'ADDITIONAL']))
593 $res[
'ADDITIONAL'] = array_merge(
$res[
'ADDITIONAL'], $eventData);
621 'CODE can\'t be empty',
623 CRestServer::STATUS_WRONG_REQUEST
629 $result[
'value'] = \Bitrix\Bitrix24\Feature::isFeatureEnabled(
$params[
'CODE']) ?
'Y' :
'N';
641 if (is_array($eventData))
643 if ($eventData[
'value'] ===
true || $eventData[
'value'] ===
'Y')
656 $result[
'value'] = LANGUAGE_ID .
'_selfhosted';
683 if(!
$USER->IsAuthorized())
690 if($appOptions <>
'')
692 $appOptions = unserialize($appOptions, [
'allowed_classes' =>
false]);
696 $appOptions =
array();
701 return $appOptions[
$params[
'option']] ??
null;
738 if(CRestUtil::isAdmin())
741 if($appOptions <>
'')
743 $appOptions = unserialize($appOptions, [
'allowed_classes' =>
false]);
747 $appOptions =
array();
752 $appOptions[
$key] = $value;
785 if(!
$USER->IsAuthorized())
790 $userOptions = CUserOptions::GetOption(
"app_options",
"options_".$server->
getClientId(),
array());
794 return $userOptions[
$params[
'option']] ??
null;
823 if(!
$USER->IsAuthorized())
838 $userOptions = CUserOptions::GetOption(
"app_options",
"options_".$server->
getClientId(),
array());
842 $userOptions[
$key] = $value;
845 CUserOptions::SetOption(
"app_options",
"options_".$server->
getClientId(), $userOptions);
852 return date(
'c', time());
858 if($arEventFields[
'APP_ID'] == $arHandler[
'APP_ID'] || $arEventFields[
'APP_ID'] == $arHandler[
'APP_CODE'])
860 $arEventFields[
"LANGUAGE_ID"] = CRestUtil::getLanguage();
862 unset($arEventFields[
'APP_ID']);
863 return $arEventFields;
881 'CODE' =>
$app[
'CODE'],
882 'VERSION' => intval(
$app[
'VERSION']),
883 'STATUS' =>
$info[
'STATUS'],
884 'PAYMENT_EXPIRED' =>
$info[
'PAYMENT_EXPIRED'],
885 'DAYS' =>
$info[
'DAYS_LEFT']
893 private static function getBitrix24LicenseName($licenseType = CBitrix24::LICENSE_TYPE_CURRENT)
895 if (!\
Bitrix\
Main\ModuleManager::isModuleInstalled(
'bitrix24'))
900 $licenseOption = ($licenseType == CBitrix24::LICENSE_TYPE_CURRENT?
"~controller_group_name":
"~prev_controller_group_name");
904 [
$lang, $licenseName, $additional] = explode(
"_", $licenseInfo, 3);
906 if(!array_key_exists($licenseName, static::$licenseList))
908 $licenseName = static::LICENSE_DEFAULT;
918 'TYPE' => static::$licenseList[$licenseName],
919 'LICENSE' =>
$lang.
"_".static::$licenseList[$licenseName]
925 if(self::$arApp ==
null)
928 \
Bitrix\
Rest\Integration\OAuthModule::isSupported()
929 && CModule::IncludeModule(
'oauth')
932 $client = OAuth\Base::instance($server->
getClientId());
936 self::$arApp = $client->getClient();
938 if(is_array(self::$arApp) && is_array(self::$arApp[
'SCOPE']))
940 self::$arApp[
'SCOPE'] = implode(
',', self::$arApp[
'SCOPE']);
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
static get($moduleId, $name, $default="", $siteId=false)
static set($moduleId, $name, $value="", $siteId="")
static includeModule($moduleName)
static isModuleInstalled($moduleName)
static getAppStatusInfo($app, $detailUrl)
static getByClientId($clientId)
static GetOptionString($module_id, $name, $def="", $site=false, $bExactSite=false)
static getServerTime($params)
static getApp(CRestServer $server)
const ERROR_BATCH_LENGTH_EXCEEDED
static getFeature($params, $n, CRestServer $server)
static getProfile($params, $n, CRestServer $server)
static getScope(CRestServer $server)
static appOptionSet($params, $n, CRestServer $server)
static userOptionSet($params, $n, CRestServer $server)
const ERROR_BATCH_METHOD_NOT_ALLOWED
static OnAppPayment($arParams, $arHandler)
static methodsList($arQuery, $n, CRestServer $server)
static OnAppEvent($arParams, $arHandler)
static scopeList($arQuery, $n, CRestServer $server)
static userOptionGet($params, $n, CRestServer $server)
static appInfo($params, $n, CRestServer $server)
static methodsBatch($arQuery, $start, CRestServer $server)
static appOptionGet($params, $n, CRestServer $server)
setSecurityState($state=null)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!defined('SITE_ID')) $lang
if(file_exists(( $_fname=__DIR__ . "/classes/general/update_db_updater.php"))) if(($_fname=getLocalPath("init.php")) !==false) if(( $_fname=getLocalPath("php_interface/init.php", BX_PERSONAL_ROOT)) !==false) if(($_fname=getLocalPath("php_interface/" . SITE_ID . "/init.php", BX_PERSONAL_ROOT)) !==false) if((!(defined("STATISTIC_ONLY") &&STATISTIC_ONLY &&!str_starts_with( $GLOBALS["APPLICATION"]->GetCurPage(), BX_ROOT . "/admin/"))) &&COption::GetOptionString("main", "include_charset", "Y")=="Y" &&LANG_CHARSET !='') if(COption::GetOptionString("main", "set_p3p_header", "Y")=="Y") $license
if($NS['step']==6) if( $NS[ 'step']==7) if(COption::GetOptionInt('main', 'disk_space', 0) > 0) $info
ExecuteModuleEventEx($arEvent, $arParams=[])
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']