-
Notifications
You must be signed in to change notification settings - Fork 2
/
supplierslist.php
executable file
·57 lines (43 loc) · 1.65 KB
/
supplierslist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*
* Äàííûé ôàéë âûâîäèò ñïèñîê ïîñòàâùèêîâ è ïðåäíàçíà÷åí â ïåðâóþ î÷åðåäü äëÿ ñîâìåñòèìîñòè ñèñòåìû ñ ïðåäûäóùèìè âåðñèÿìè îôôëàéíîâîãî êëèåíòà
*/
require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
$login = COption::GetOptionString('linemedia.auto', 'LM_AUTO_MAIN_SUPPLIERS_LIST_LOGIN', 'x');
$password = COption::GetOptionString('linemedia.auto', 'LM_AUTO_MAIN_SUPPLIERS_LIST_PASSWORD', 'y');
$use = (!empty($login) || !empty($password));
/*
* HTTP-àâòîðèçàöèÿ.
*/
if ($use) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Forbidden"');
header('HTTP/1.0 401 Unauthorized');
exit();
}
if ($_SERVER['PHP_AUTH_USER'] != $login || $_SERVER['PHP_AUTH_PW'] != $password) {
header('WWW-Authenticate: Basic realm="Forbidden"');
header('HTTP/1.0 401 Unauthorized');
exit();
}
}
CModule::IncludeModule('iblock');
/*
* Âûâîä ïîñòàâùèêîâ â îòâåò
*/
$iSuppliersIBlockID = COption::GetOptionString('linemedia.auto', 'LM_AUTO_IBLOCK_SUPPLIERS');
$oSuppRes = CIBlockElement::GetList(
array(),
array('IBLOCK_ID' => $iSuppliersIBlockID),
false,
false,
array('ID', 'NAME', 'SORT', 'IBLOCK_TYPE_ID', 'IBLOCK_ID', 'PROPERTY_supplier_id')
);
header('Content-Type: text/html; charset=utf-8');
while ($aSuppItem = $oSuppRes->Fetch()) {
$name = $aSuppItem['NAME'];
if (!defined('BX_UTF') || BX_UTF != true) {
$name = iconv('cp1251', 'UTF-8', $name);
}
echo $aSuppItem['PROPERTY_SUPPLIER_ID_VALUE'] . '->' . $name . "<br />";
}