%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.226.222.6
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/general/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/general/sale_cond.php
<?
use Bitrix\Main\Localization\Loc;

Loc::loadMessages(__FILE__);

class CCatalogCondCtrlBasketProductFields extends CCatalogCondCtrlIBlockFields
{
	public static function GetControlDescr()
	{
		$description = parent::GetControlDescr();
		$description['SORT'] = 400;
		return $description;
	}

	public static function GetControlShow($arParams)
	{
		$result = parent::GetControlShow($arParams);
		$result['label'] = Loc::getMessage('BT_MOD_SALE_COND_IBLOCK_CONTROLGROUP_LABEL');
		return $result;
	}

	public static function Generate($arOneCondition, $arParams, $arControl, $arSubs = false)
	{
		$strParentResult = '';
		$strResult = '';
		$parentResultValues = array();
		$resultValues = array();

		if (is_string($arControl))
		{
			$arControl = static::GetControls($arControl);
		}
		$boolError = !is_array($arControl);

		$arValues = array();
		if (!$boolError)
		{
			$arValues = static::Check($arOneCondition, $arOneCondition, $arControl, false);
			$boolError = ($arValues === false);
		}

		if (!$boolError)
		{
			$arLogic = static::SearchLogic($arValues['logic'], $arControl['LOGIC']);
			if (!isset($arLogic['OP'][$arControl['MULTIPLE']]) || empty($arLogic['OP'][$arControl['MULTIPLE']]))
			{
				$boolError = true;
			}
			else
			{
				$useParent = ($arControl['PARENT'] && isset($arLogic['PARENT']));
				$strParent = $arParams['BASKET_ROW'].'[\'CATALOG\'][\'PARENT_'.$arControl['FIELD'].'\']';
				$strField = $arParams['BASKET_ROW'].'[\'CATALOG\'][\''.$arControl['FIELD'].'\']';
				switch ($arControl['FIELD_TYPE'])
				{
					case 'int':
					case 'double':
						if (is_array($arValues['value']))
						{
							if (!isset($arLogic['MULTI_SEP']))
							{
								$boolError = true;
							}
							else
							{
								foreach ($arValues['value'] as &$value)
								{
									if ($useParent)
										$parentResultValues[] = str_replace(
											array('#FIELD#', '#VALUE#'),
											array($strParent, $value),
											$arLogic['OP'][$arControl['MULTIPLE']]
										);
									$resultValues[] = str_replace(
										array('#FIELD#', '#VALUE#'),
										array($strField, $value),
										$arLogic['OP'][$arControl['MULTIPLE']]
									);
								}
								unset($value);
								if ($useParent)
									$strParentResult = '('.implode($arLogic['MULTI_SEP'], $parentResultValues).')';
								$strResult = '('.implode($arLogic['MULTI_SEP'], $resultValues).')';
								unset($resultValues, $parentResultValues);
							}
						}
						else
						{
							if ($useParent)
								$strParentResult = str_replace(
									array('#FIELD#', '#VALUE#'),
									array($strParent, $arValues['value']),
									$arLogic['OP'][$arControl['MULTIPLE']]
								);
							$strResult = str_replace(
								array('#FIELD#', '#VALUE#'),
								array($strField, $arValues['value']),
								$arLogic['OP'][$arControl['MULTIPLE']]
							);
						}
						break;
					case 'char':
					case 'string':
					case 'text':
						if (is_array($arValues['value']))
						{
							$boolError = true;
						}
						else
						{
							if ($useParent)
								$strParentResult = str_replace(
									array('#FIELD#', '#VALUE#'),
									array($strParent, '"'.EscapePHPString($arValues['value']).'"'),
									$arLogic['OP'][$arControl['MULTIPLE']]
								);
							$strResult = str_replace(
								array('#FIELD#', '#VALUE#'),
								array($strField, '"'.EscapePHPString($arValues['value']).'"'),
								$arLogic['OP'][$arControl['MULTIPLE']]
							);
						}
						break;
					case 'date':
					case 'datetime':
						if (is_array($arValues['value']))
						{
							$boolError = true;
						}
						else
						{
							if ($useParent)
								$strParentResult = str_replace(
									array('#FIELD#', '#VALUE#'),
									array($strParent, $arValues['value']),
									$arLogic['OP'][$arControl['MULTIPLE']]
								);
							$strResult = str_replace(
								array('#FIELD#', '#VALUE#'),
								array($strField, $arValues['value']),
								$arLogic['OP'][$arControl['MULTIPLE']]
							);
						}
						break;
				}

				$strResult = 'isset('.$strField.') && '.$strResult;
				if ($useParent)
					$strResult = 'isset('.$strParent.') ? (('.$strResult.')'.$arLogic['PARENT'].$strParentResult.') : ('.$strResult.')';
				$strResult = '('.$strResult.')';
			}
		}

		return (!$boolError ? $strResult : false);
	}

	public static function GetShowIn($arControls)
	{
		if (!empty($arControls))
		{
			$strDisableKey = CSaleCondCtrlGroup::GetControlID();
			$arControlsMap = array_fill_keys($arControls, true);
			if (array_key_exists($strDisableKey, $arControlsMap))
				unset($arControlsMap[$strDisableKey]);
			$arControls = array_keys($arControlsMap);
		}
		return $arControls;
	}
}

class CCatalogCondCtrlBasketProductProps extends CCatalogCondCtrlIBlockProps
{
	public static function GetControlDescr()
	{
		$description = parent::GetControlDescr();
		$description['SORT'] = 500;
		return $description;
	}

	public static function Generate($arOneCondition, $arParams, $arControl, $arSubs = false)
	{
		$strResult = '';
		$resultValues = array();
		$arValues = false;

		if (is_string($arControl))
		{
			$arControl = static::GetControls($arControl);
		}
		$boolError = !is_array($arControl);

		if (!$boolError)
		{
			$arValues = static::Check($arOneCondition, $arOneCondition, $arControl, false);
			$boolError = ($arValues === false);
		}

		if (!$boolError)
		{
			$arLogic = static::SearchLogic($arValues['logic'], $arControl['LOGIC']);
			if (!isset($arLogic['OP'][$arControl['MULTIPLE']]) || empty($arLogic['OP'][$arControl['MULTIPLE']]))
			{
				$boolError = true;
			}
			else
			{
				$strField = $arParams['BASKET_ROW'].'[\'CATALOG\'][\''.$arControl['FIELD'].'\']';
				switch ($arControl['FIELD_TYPE'])
				{
					case 'int':
					case 'double':
						if (is_array($arValues['value']))
						{
							if (!isset($arLogic['MULTI_SEP']))
							{
								$boolError = true;
							}
							else
							{
								foreach ($arValues['value'] as &$value)
								{
									$resultValues[] = str_replace(
										array('#FIELD#', '#VALUE#'),
										array($strField, $value),
										$arLogic['OP'][$arControl['MULTIPLE']]
									);
								}
								unset($value);
								$strResult = '('.implode($arLogic['MULTI_SEP'], $resultValues).')';
								unset($resultValues);
							}
						}
						else
						{
							$strResult = str_replace(
								array('#FIELD#', '#VALUE#'),
								array($strField, $arValues['value']),
								$arLogic['OP'][$arControl['MULTIPLE']]
							);
						}
						break;
					case 'char':
					case 'string':
					case 'text':
						if (is_array($arValues['value']))
						{
							$boolError = true;
						}
						else
						{
							$strResult = str_replace(
								array('#FIELD#', '#VALUE#'),
								array($strField, '"'.EscapePHPString($arValues['value']).'"'),
								$arLogic['OP'][$arControl['MULTIPLE']]
							);
						}
						break;
					case 'date':
					case 'datetime':
						if (is_array($arValues['value']))
						{
							$boolError = true;
						}
						else
						{
							$strResult = str_replace(
								array('#FIELD#', '#VALUE#'),
								array($strField, $arValues['value']),
								$arLogic['OP'][$arControl['MULTIPLE']]
							);
						}
						break;
				}
				$strResult = '(isset('.$strField.') && '.$strResult.')';
			}
		}

		return (!$boolError ? $strResult : false);
	}

	public static function GetShowIn($arControls)
	{
		if (!empty($arControls))
		{
			$strDisableKey = CSaleCondCtrlGroup::GetControlID();
			$arControlsMap = array_fill_keys($arControls, true);
			if (array_key_exists($strDisableKey, $arControlsMap))
				unset($arControlsMap[$strDisableKey]);
			$arControls = array_keys($arControlsMap);
		}
		return $arControls;
	}
}

class CCatalogCondCtrlCatalogSettings extends CGlobalCondCtrlComplex
{
	public static function GetControlDescr()
	{
		$description = parent::GetControlDescr();
		$description['SORT'] = 900;
		return $description;
	}

	public static function GetControlShow($arParams)
	{
		$controlList = static::GetControls();
		$result = array(
			'controlgroup' => true,
			'group' =>  false,
			'label' => Loc::getMessage('BX_COND_CATALOG_SETTINGS_CONTROLGROUP_LABEL'),
			'showIn' => static::GetShowIn($arParams['SHOW_IN_GROUPS']),
			'children' => array()
		);
		foreach ($controlList as &$control)
		{
			$jsControl = array(
				'controlId' => $control['ID'],
				'group' => ($control['GROUP'] == 'Y'),
				'label' => $control['LABEL'],
				'showIn' => static::GetShowIn($arParams['SHOW_IN_GROUPS']),
				'control' => array()
			);
			if ($control['ID'] == 'CondCatalogRenewal')
			{
				$jsControl['control'] = array(
					array(
						'id' => 'prefix',
						'type' => 'prefix',
						'text' => $control['PREFIX'],
					),
					static::GetValueAtom($control['JS_VALUE'])
				);
			}
			else
			{
				$jsControl['control'] = array(
					array(
						'id' => 'prefix',
						'type' => 'prefix',
						'text' => $control['PREFIX'],
					),
					static::GetLogicAtom($control['LOGIC']),
					static::GetValueAtom($control['JS_VALUE'])
				);
			}
			$result['children'][] = $jsControl;
		}
		unset($jsControl, $control, $controlList);
		return $result;
	}

	public static function GetConditionShow($arParams)
	{
		if (!isset($arParams['ID']))
			return false;

		if ($arParams['ID'] == 'CondCatalogRenewal')
		{
			$control = static::GetControls($arParams['ID']);
			if ($control === false)
				return false;

			return array(
				'id' => $arParams['COND_NUM'],
				'controlId' => $control['ID'],
				'values' => array('value' => 'Y')
			);
		}
		else
		{
			return parent::GetConditionShow($arParams);
		}
	}

	public static function Parse($arOneCondition)
	{
		if (!isset($arOneCondition['controlId']))
			return false;
		if ($arOneCondition['controlId'] == 'CondCatalogRenewal')
		{
			$control = static::GetControls($arOneCondition['controlId']);
			if ($control === false)
				return false;
			return array('value' => 'Y');
		}
		else
		{
			return parent::Parse($arOneCondition);
		}
	}

	public static function Generate($arOneCondition, $arParams, $arControl, $arSubs = false)
	{
		$strResult = '';

		if (is_string($arControl))
		{
			$arControl = static::GetControls($arControl);
		}
		$boolError = !is_array($arControl);

		if (!$boolError && $arOneCondition['value'] === 'Y')
		{
			$strField = $arParams['ORDER']."['RECURRING_ID']";
			$strResult = 'isset('.$strField.') && '.$strField;
		}

		return (!$boolError ? $strResult : false);
	}

	public static function GetShowIn($arControls)
	{
		return array(CSaleCondCtrlGroup::GetControlID());
	}

	public static function GetControlID()
	{
		return array(
			'CondCatalogRenewal'
		);
	}
	/**
	 * @param bool|string $strControlID
	 * @return bool|array
	 */
	public static function GetControls($strControlID = false)
	{
		$controlList = array(
			'CondCatalogRenewal' => array(
				'ID' => 'CondCatalogRenewal',
				'PARENT' => false,
				'EXECUTE_MODULE' => 'catalog',
				'EXIST_HANDLER' => 'Y',
				'MODULE_ID' => 'catalog',
				'MODULE_ENTITY' => 'catalog',
				'ENTITY' => 'DISCOUNT',
				'FIELD' => 'RENEWAL',
				'FIELD_TABLE' => 'RENEWAL',
				'FIELD_TYPE' => 'char',
				'MULTIPLE' => 'N',
				'GROUP' => 'N',
				'LABEL' => Loc::getMessage('BX_COND_CATALOG_RENEWAL_LABEL'),
				'PREFIX' => Loc::getMessage('BX_COND_CATALOG_RENEWAL_PREFIX'),
				'JS_VALUE' => array(
					'type' => 'hidden',
					'value' => 'Y',
				),
			)
		);
		if ($strControlID === false)
		{
			return $controlList;
		}
		elseif (isset($controlList[$strControlID]))
		{
			return $controlList[$strControlID];
		}
		else
		{
			return false;
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit