%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.217.104.118
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/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/admin/cat_contractor_edit.php
<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/prolog.php");
global $APPLICATION;
global $DB;
global $USER;

$selfFolderUrl = $adminPage->getSelfFolderUrl();
$listUrl = $selfFolderUrl."cat_contractor_list.php?lang=".LANGUAGE_ID;
$listUrl = $adminSidePanelHelper->editUrlToPublicPage($listUrl);

if (!($USER->CanDoOperation('catalog_read') || $USER->CanDoOperation('catalog_store')))
	$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
CModule::IncludeModule("catalog");
$bReadOnly = !$USER->CanDoOperation('catalog_store');

if ($ex = $APPLICATION->GetException())
{
	require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");

	$strError = $ex->GetString();
	ShowError($strError);

	require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
	die();
}

IncludeModuleLangFile(__FILE__);
ClearVars();

$errorMessage = "";
$bVarsFromForm = false;
$ID = (isset($_REQUEST["ID"]) ? (int)$_REQUEST["ID"] : 0);
$typeReadOnly = false;
$userId = (int)$USER->GetID();

if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && $_REQUEST["Update"] <> '' && !$bReadOnly)
{
	$adminSidePanelHelper->decodeUriComponent();

	if($PERSON_TYPE == CONTRACTOR_INDIVIDUAL)
		$INN = $KPP = $COMPANY = '';
	$PERSON_NAME = ($_REQUEST["PERSON_NAME"] == GetMessage("CONTRACTOR_NAME")) ? '' : $_REQUEST["PERSON_NAME"];
	$PERSON_LASTNAME = ($_REQUEST["PERSON_LASTNAME"] == GetMessage("CONTRACTOR_LAST_NAME")) ? '' : $_REQUEST["PERSON_LASTNAME"];
	$PERSON_MIDDLENAME = ($_REQUEST["PERSON_MIDDLENAME"] == GetMessage("CONTRACTOR_SECOND_NAME")) ? '' : $_REQUEST["PERSON_MIDDLENAME"];
	$arFields = Array(
		"PERSON_TYPE" => $PERSON_TYPE,
		"SITE_ID" => SITE_ID,
		"PERSON_NAME" => $PERSON_NAME,
		"PERSON_LASTNAME" => $PERSON_LASTNAME,
		"PERSON_MIDDLENAME" => $PERSON_MIDDLENAME,
		"EMAIL" => $_REQUEST["EMAIL"],
		"PHONE" => $_REQUEST["PHONE"],
		"POST_INDEX" => $_REQUEST["POST_INDEX"],
		"COUNTRY" => $_REQUEST["COUNTRY"],
		"CITY" => $XML_ID,
		"INN" => $INN,
		"KPP" => $KPP,
		"COMPANY" => $COMPANY,
		"ADDRESS" => $ADDRESS,
		"CREATED_BY" => $userId,
		"MODIFIED_BY" => $userId,
	);
	$DB->StartTransaction();
	if ($errorMessage == '' && $ID > 0 && $res = CCatalogContractor::update($ID, $arFields))
	{
		$ID = $res;
		$DB->Commit();

		$adminSidePanelHelper->sendSuccessResponse("base", array("ID" => $ID));

		if ($_REQUEST["apply"] == '')
		{
			$adminSidePanelHelper->localRedirect($listUrl);
			LocalRedirect($listUrl);
		}
		else
		{
			$applyUrl = $selfFolderUrl."cat_contractor_edit.php?lang=".LANGUAGE_ID."&ID=".$ID;
			$applyUrl = $adminSidePanelHelper->setDefaultQueryParams($applyUrl);
			LocalRedirect($applyUrl);
		}
	}
	elseif ($errorMessage == '' && $ID == 0 && $res = CCatalogContractor::Add($arFields))
	{
		$ID = $res;
		$DB->Commit();

		$adminSidePanelHelper->sendSuccessResponse("base", array("ID" => $ID));

		if ($_REQUEST["apply"] == '')
		{
			$adminSidePanelHelper->localRedirect($listUrl);
			LocalRedirect($listUrl);
		}
		else
		{
			$applyUrl = $selfFolderUrl."cat_contractor_edit.php?lang=".LANGUAGE_ID."&ID=".$ID;
			$applyUrl = $adminSidePanelHelper->setDefaultQueryParams($applyUrl);
			LocalRedirect($applyUrl);
		}
	}
	else
	{
		$bVarsFromForm = true;
		$errorMessage = $APPLICATION->GetException()->GetString();
		$DB->Rollback();

		$adminSidePanelHelper->sendJsonErrorResponse($errorMessage);
	}
}

if ($ID > 0)
	$APPLICATION->SetTitle(str_replace("#ID#", $ID, GetMessage("CONTRACTOR_TITLE_UPDATE")));
else
	$APPLICATION->SetTitle(GetMessage("CONTRACTOR_TITLE_ADD"));

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
$str_ACTIVE = "Y";

if ($ID > 0)
{
	$arSelect = array(
		"ID",
		"PERSON_TYPE",
		"SITE_ID",
		"PERSON_NAME",
		"EMAIL",
		"PHONE",
		"POST_INDEX",
		"COUNTRY",
		"CITY",
		"COMPANY",
		"INN",
		"KPP",
		"ADDRESS",
	);

	$dbResult = CCatalogContractor::GetList(array(),array('ID' => $ID),false,false,$arSelect);
	if (!$dbResult->ExtractFields("str_"))
		$ID = 0;
}

if ($bVarsFromForm)
	$DB->InitTableVarsForEdit("b_catalog_contractor", "", "str_");

if(isset($str_ADDRESS))
	$str_ADDRESS = (trim($str_ADDRESS) != '') ? $str_ADDRESS : '';

$str_PERSON_TYPE = (isset($str_PERSON_TYPE)) ? $str_PERSON_TYPE : CONTRACTOR_INDIVIDUAL;

$aMenu = array(
	array(
		"TEXT" => GetMessage("CONTRACTOR_LIST"),
		"ICON" => "btn_list",
		"LINK" => $listUrl
	)
);

if ($ID > 0 && !$bReadOnly)
{
	$aMenu[] = array("SEPARATOR" => "Y");

	$addUrl = $selfFolderUrl."cat_contractor_edit.php?lang=".LANGUAGE_ID;
	$addUrl = $adminSidePanelHelper->editUrlToPublicPage($addUrl);
	$aMenu[] = array(
		"TEXT" => GetMessage("CONTRACTOR_NEW"),
		"ICON" => "btn_new",
		"LINK" => $addUrl
	);
	$deleteUrl = $selfFolderUrl."cat_contractor_list.php?action=delete&ID[]=".$ID."&lang=".LANGUAGE_ID."&".bitrix_sessid_get()."#tb";
	if ($adminSidePanelHelper->isPublicFrame())
	{
		$deleteUrl = $adminSidePanelHelper->editUrlToPublicPage($deleteUrl);
	}
	$aMenu[] = array(
		"TEXT" => GetMessage("CONTRACTOR_DELETE"),
		"ICON" => "btn_delete",
		"LINK" => "javascript:if(confirm('".GetMessage("CONTRACTOR_DELETE_CONFIRM")."')) top.window.location='".$deleteUrl."';",
		"WARNING" => "Y"
	);
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
?>

<?CAdminMessage::ShowMessage($errorMessage);?>

	<script>
		function fContractorChangeType(el)
		{
			var type = el.value;
			var companyName = document.getElementById('company-name-tr');
			var companyInn = document.getElementById('company-inn-tr');
			var companyKpp = document.getElementById('company-kpp-tr');
			var titleContractor = document.getElementById('title_span');
			var addressContractor = document.getElementById('address_span');
			if(type == 1)
			{
				companyName.style.display = 'none';
				companyInn.style.display = 'none';
				companyKpp.style.display = 'none';
				titleContractor.innerHTML = "<?=GetMessage("CONTRACTOR_TITLE");?>:";
				addressContractor.innerHTML = "<?= GetMessage("CONTRACTOR_ADDRESS")?>:";
			}
			else if(type == 2)
			{
				companyName.style.display = 'table-row';
				companyInn.style.display = 'table-row';
				companyKpp.style.display = 'table-row';
				titleContractor.innerHTML = "<?=GetMessage("CONTRACTOR_TITLE_JURIDICAL");?>:";
				addressContractor.innerHTML = "<?= GetMessage("CONTRACTOR_ADDRESS_JURIDICAL") ?>:";
			}
		}

	</script>
	<?
	$actionUrl = $APPLICATION->GetCurPage();
	$actionUrl = $adminSidePanelHelper->setDefaultQueryParams($actionUrl);
	?>
	<form enctype="multipart/form-data" method="POST" action="<?=$actionUrl?>" name="contractor_edit">
		<?echo GetFilterHiddens("filter_");?>
		<input type="hidden" name="Update" value="Y">
		<input type="hidden" name="lang" value="<?echo LANG ?>">
		<input type="hidden" name="ID" value="<?echo $ID ?>">
		<?=bitrix_sessid_post()?>

		<?
		$aTabs = array(
			array("DIV" => "edit1", "TAB" => GetMessage("CONTRACTOR_TAB"), "ICON" => "catalog", "TITLE" => GetMessage("CONTRACTOR_TAB_DESCR")),
		);

		$tabControl = new CAdminTabControl("tabControl", $aTabs);
		$tabControl->Begin();
		?>

		<?
		$tabControl->BeginNextTab();
		?>
		<style>
			.fio.newo_break_active input {
				color: #CCC;
			}
		</style>
		<?if ($ID > 0):
			$typeReadOnly = true;
			?>

			<tr>
				<td>ID:</td>
				<td><?= $ID ?></td>
			</tr>
		<?endif;?>

		<tr class="adm-detail-required-field">
			<td width="40%"><?= GetMessage("CONTRACTOR_TYPE") ?>:</td>
			<td width="60%">
				<input type="hidden" name="PERSON_TYPE" value="<?=$str_PERSON_TYPE?>">
				<select <?if($typeReadOnly) echo " disabled";?> name="PERSON_TYPE" onchange="fContractorChangeType(this);">
					<option <? if(intval($str_PERSON_TYPE) == CONTRACTOR_INDIVIDUAL) echo" selected";?> value="1"><?= GetMessage("CONTRACTOR_INDIVIDUAL") ?></option>
					<option <? if(intval($str_PERSON_TYPE) == CONTRACTOR_JURIDICAL) echo" selected";?> value="2"><?= GetMessage("CONTRACTOR_JURIDICAL") ?></option>
				</select>
			</td>
		</tr>

		<tr class="adm-detail-required-field" id="company-name-tr" <? if($str_PERSON_TYPE == 1) echo "style=\"display: none\"";?>>
			<td width="40%"><?= GetMessage("CONTRACTOR_COMPANY") ?>:</td>
			<td width="60%">
				<input type="text" name="COMPANY" value="<?=$str_COMPANY?>" size="30" />
			</td>

		</tr>
		<tr id="company-inn-tr"<? if($str_PERSON_TYPE == CONTRACTOR_INDIVIDUAL) echo "style=\"display: none\"";?>>
			<td><?= GetMessage("CONTRACTOR_INN") ?>:</td>
			<td>
				<input type="text" name="INN" value="<?=$str_INN?>" size="30" />
			</td>
		</tr>
		<?if(trim(GetMessage("CONTRACTOR_KPP")) != ''):?>
			<tr id="company-kpp-tr" <? if($str_PERSON_TYPE == CONTRACTOR_INDIVIDUAL) echo "style=\"display: none\"";?>>
				<td><?= GetMessage("CONTRACTOR_KPP") ?>:</td>
				<td>
					<input type="text" name="KPP" value="<?=$str_KPP?>" size="30" />
				</td>
			</tr>
		<?endif;?>
		<tr class="adm-detail-required-field">
			<td> <span id="title_span">
			<?
					if($str_PERSON_TYPE == CONTRACTOR_JURIDICAL)
						echo GetMessage("CONTRACTOR_TITLE_JURIDICAL");
					else
						echo GetMessage("CONTRACTOR_TITLE");
					?>:</span></td>
			<td>
				<input type="text" name="PERSON_NAME" id="BREAK_LAST_NAME" size="50" value="<?=$str_PERSON_NAME?>" />
			</td>
		</tr>
		<tr>
			<td><?= GetMessage("CONTRACTOR_PHONE") ?>:</td>
			<td>
				<input type="text" name="PHONE" value="<?=$str_PHONE?>" size="30" />
			</td>
		</tr>
		<tr>
			<td><?= GetMessage("CONTRACTOR_EMAIL") ?>:</td>
			<td>
				<input type="text" name="EMAIL" value="<?=$str_EMAIL?>" size="30" />
			</td>
		</tr>
		<tr>
			<td><?= GetMessage("CONTRACTOR_POSTINDEX") ?>:</td>
			<td><input type="text" name="POST_INDEX" value="<?=$str_POST_INDEX?>" size="30" />
			</td>
		</tr>
		<tr>
			<td  class="adm-detail-valign-top"><span id="address_span"><? 	if($str_PERSON_TYPE == CONTRACTOR_JURIDICAL) echo GetMessage("CONTRACTOR_ADDRESS_JURIDICAL"); else echo GetMessage("CONTRACTOR_ADDRESS"); ?>:</span></td>
			<td>
				<textarea cols="35" rows="3" class="typearea" name="ADDRESS" wrap="virtual"><?= $str_ADDRESS ?></textarea>
			</td>
		</tr>

		</tr>

		<?echo
		$tabControl->EndTab();

		$tabControl->Buttons(array("disabled" => $bReadOnly, "back_url" => $listUrl));
		$tabControl->End();
		?>
	</form>

<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");?>

Youez - 2016 - github.com/yon3zu
LinuXploit