2namespace Bitrix\Landing\PublicAction;
5use Bitrix\Landing\Error;
6use Bitrix\Landing\Manager;
7use Bitrix\Landing\Site;
8use Bitrix\Main\Localization\Loc;
9use Bitrix\Rest\Marketplace\Client;
10use Bitrix\Rest\PlacementTable;
11use Bitrix\Landing\Placement;
12use Bitrix\Landing\PublicActionResult;
13use Bitrix\Landing\Node\StyleImg;
15Loc::loadMessages(__FILE__);
51 $error = new \Bitrix\Landing\Error;
55 if (!empty(
$error->getErrors()))
65 if (is_array($manifest[
'nodes'] ??
null))
67 foreach ($manifest[
'nodes'] as $selector => $manifestItem)
71 if (isset($manifest[
'style'][$selector]))
73 $styleItem = $manifest[
'style'][$selector];
75 if (isset($manifest[
'style'][
'nodes'][$selector]))
77 $styleItem = $manifest[
'style'][
'nodes'][$selector];
80 if ($styleItem[
'type'] ??
null)
85 'MANIFEST_INTERSECT_IMG',
86 Loc::getMessage(
'LANDING_APP_MANIFEST_INTERSECT_IMG', [
'#selector#' => $selector])
107 Loc::getMessage(
'LANDING_APP_CONTENT_IS_BAD')
115 isset($manifest[
'cards']) &&
116 is_array($manifest[
'cards'])
119 foreach ($manifest[
'cards'] as $cardCode => &$card)
122 isset($card[
'presets']) &&
123 is_array($card[
'presets'])
126 foreach ($card[
'presets'] as $presetCode => &$preset)
128 foreach ([
'html',
'name',
'values'] as
$code)
130 if (isset($preset[
$code]))
139 'PRESET_CONTENT_IS_BAD',
141 'LANDING_APP_PRESET_CONTENT_IS_BAD',
143 '#preset#' => $presetCode,
144 '#card#' => $cardCode,
161 $fields[
'MANIFEST'] = serialize($manifest);
173 $exists = Landing\Repo::getList([
178 '=XML_ID' =>
$fields[
'XML_ID'],
179 '=APP_CODE' =>
$fields[
'APP_CODE'],
182 '=XML_ID' =>
$fields[
'XML_ID'],
196 if (
$res->isSuccess())
204 'repo_' .
$res->getId()
233 foreach ($requiredFields as $field)
238 'REQUIRED_FIELD_NO_EXISTS',
239 Loc::getMessage(
'LANDING_FIELD_NO_EXISTS', [
'#field#' => $field])
257 $notAllowedManifestKey = [
'callbacks'];
258 foreach ($notAllowedManifestKey as
$key)
260 if (isset($manifest[
$key]))
262 unset($manifest[
$key]);
267 if (isset($manifest[
'block'][
'type']))
269 $manifest[
'block'][
'type'] = array_filter(
270 (
array)$manifest[
'block'][
'type'],
272 $notAllowedBlockTypes = [
275 if (in_array(mb_strtolower(
$type), $notAllowedBlockTypes))
278 'UNSUPPORTED_BLOCK_TYPE',
279 Loc::getMessage(
'LANDING_UNSUPPORTED_BLOCK_TYPE', [
'#type#' =>
$type])
290 if (isset($manifest[
'block'][
'subtype']))
292 $manifest[
'block'][
'subtype'] = array_filter(
293 (
array)$manifest[
'block'][
'subtype'],
295 $notAllowedSubtypes = [
298 if (in_array(mb_strtolower(
$type), $notAllowedSubtypes))
301 'UNSUPPORTED_BLOCK_SUBTYPE',
302 Loc::getMessage(
'LANDING_UNSUPPORTED_BLOCK_SUBTYPE', [
'#type#' =>
$type])
321 $error = new \Bitrix\Landing\Error;
325 if (!is_string(
$code))
334 $app = \Bitrix\Landing\PublicAction::restApplication();
336 $row = Landing\Repo::getList(
array(
344 '=APP_CODE' =>
$app[
'CODE'],
353 $codeToDelete =
array();
362 '=APP_CODE' =>
$app[
'CODE'],
368 while ($rowRepo =
$res->fetch())
370 $codeToDelete[] =
'repo_' . $rowRepo[
'ID'];
372 if (!empty($codeToDelete))
374 Landing\Block::deleteByCode($codeToDelete);
378 if (
$res->isSuccess())
402 $error = new \Bitrix\Landing\Error;
405 if (!is_string(
$code))
413 'CODE' => $appLocal[
'CODE'],
414 'NAME' => $appLocal[
'APP_NAME'],
415 'DATE_FINISH' => (
string)$appLocal[
'DATE_FINISH'],
416 'PAYMENT_ALLOW' => $appLocal[
'PAYMENT_ALLOW'],
421 if (\
Bitrix\
Main\Loader::includeModule(
'rest'))
423 $appRemote = Client::getApp(
$code);
424 if (isset($appRemote[
'ITEMS']))
426 $data = $appRemote[
'ITEMS'];
427 if (isset(
$data[
'ICON']))
431 if (isset(
$data[
'PRICE']) && !empty(
$data[
'PRICE']))
436 $updates = Client::getUpdates(
array(
437 $code => $appLocal[
'VERSION'],
440 isset($updates[
'ITEMS'][0][
'VERSIONS']) &&
441 is_array($updates[
'ITEMS'][0][
'VERSIONS'])
444 $app[
'UPDATES'] =
count($updates[
'ITEMS'][0][
'VERSIONS']);
454 Loc::getMessage(
'LANDING_APP_NOT_FOUND')
471 $error = new \Bitrix\Landing\Error;
484 'APP_ID' => isset(
$fields[
'APP_ID'])
487 'PLACEMENT' => isset(
$fields[
'PLACEMENT'])
490 'PLACEMENT_HANDLER' => isset(
$fields[
'PLACEMENT_HANDLER'])
498 if (\
Bitrix\
Main\Loader::includeModule(
'rest'))
501 $resLocal = Placement::add(
$fields);
502 if ($resLocal->isSuccess())
505 $resRest = PlacementTable::add(
508 if ($resRest->isSuccess())
514 $error->addFromResult($resRest);
515 Placement::delete($resLocal->getId());
520 $error->addFromResult($resLocal);
528 Loc::getMessage(
'LANDING_APP_PLACEMENT_EXIST')
546 $error = new \Bitrix\Landing\Error;
548 if (!is_string(
$code))
575 '=PLACEMENT' =>
$code,
580 $params[
'filter'][
'=PLACEMENT_HANDLER'] = trim($handler);
585 while ($row =
$res->fetch())
588 Placement::delete($row[
'ID']);
593 if (\
Bitrix\
Main\Loader::includeModule(
'rest'))
596 while ($row =
$res->fetch())
598 PlacementTable::delete($row[
'ID']);
611 'PLACEMENT_NO_EXIST',
612 Loc::getMessage(
'LANDING_APP_PLACEMENT_NO_EXIST')
648 $params[
'filter'][
'APP_CODE'] =
false;
654 $params[
'select'][] =
'MANIFEST';
660 while ($row =
$res->fetch())
662 if (isset($row[
'DATE_CREATE']))
664 $row[
'DATE_CREATE'] = (string) $row[
'DATE_CREATE'];
666 if (isset($row[
'DATE_MODIFY']))
668 $row[
'DATE_MODIFY'] = (string) $row[
'DATE_MODIFY'];
670 $row[
'MANIFEST'] = unserialize($row[
'MANIFEST'], [
'allowed_classes' =>
false]);
static sanitize($value, &$bad=false, $splitter=' ')
static getList(array $params=array())
static onRegisterBefore(array &$fields, array &$manifest, Error $error)
static bind(array $fields)
static onRegisterCheckFields($fields, Error $error)
static unbind($code, $handler=null)
static checkContent($content, $splitter='#SANITIZE#')
static update($id, $fields=array())
static getAppByCode($code)
const SCOPE_CODE_MAINPAGE
static register($extName)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
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']