";
52 | $str .= $val2;
53 | $str .= "' disabled >";
54 | } elseif ($val == "BPCORD") {
55 | $str .= "
";
56 | $str .= "
Client ";
57 | $str .= "
";
60 | } elseif ($val == "ORDDAT") {
61 | $str .= "
";
62 | $str .= "
order date ";
63 | $str .= "
";
68 | } elseif ($val == "CUSORDREF") {
69 | $str .= "
";
70 | $str .= "
Reference ";
71 | $str .= "
";
74 | } elseif ($val == "SALFCY") {
75 | $str .= "
";
91 | $str .= "
";
92 | // Lines
93 | $RES = $dom->getElementsByTagName ( 'LIN' );
94 |
95 | // $str.="
No commande ";
96 | // $str.="
";
99 | $str .= "
";
100 | $str .= "Product Designation Quantity ";
101 |
102 | foreach ( $RES as $R ) {
103 |
104 | $commande = $R->getElementsByTagName ( 'FLD' );
105 | // echo "";
106 | $str .= " ";
107 | foreach ( $commande as $c ) {
108 | $val = $c->getAttribute ( 'NAME' );
109 | if (in_array ( $val, $listFieldLines )) {
110 | // echo "";
111 | $str .= " ";
112 |
113 | $val2 = $c->nodeValue;
114 |
115 | $str .= $c->nodeValue;
116 |
117 | $str .= " ";
118 | }
119 | }
120 | $str .= " ";
121 | }
122 | $str .= "
";
123 | $str .= "
";
124 |
125 | return $str;
126 | }
127 |
128 | function showListe() {
129 | $WS = "*";
130 | $this->CAdxResultXml = $this->query ( Config::$WS_ORDER, $WS, 100 );
131 | //var_dump($this->soapClient->__getLastRequestHeaders());
132 | $result = $this->CAdxResultXml->resultXml;
133 | // $result contient le fichier XML des réponses
134 | $dom = new DomDocument ();
135 | $dom->loadXML ( $result );
136 | $RES = $dom->getElementsByTagName ( 'LIN' );
137 | $str = "
";
138 | $str .= "Order num Client Order date Reference Sales rep Delivery status Postal code ";
139 |
140 | foreach ( $RES as $R ) {
141 | $commande = $R->getElementsByTagName ( 'FLD' );
142 | $str .= "";
143 | foreach ( $commande as $c ) {
144 | $str .= "";
145 | $val = $c->getAttribute ( 'NAME' );
146 | $val2 = $c->nodeValue;
147 | if ($val == "SOHNUM") {
148 | $str .= "";
149 | $str .= $c->nodeValue;
150 | $str .= " ";
151 | } elseif ($val == "DLVSTA") {
152 | switch ($c->nodeValue) {
153 | case 1 :
154 | $str .= "Not delivered";
155 | break;
156 | case 2 :
157 | $str .= "Partially delivered";
158 | break;
159 | case 3 :
160 | $str .= "Delivered";
161 | break;
162 | }
163 | } else {
164 | $str .= $c->nodeValue;
165 | }
166 | $str .= " ";
167 | }
168 | $str .= " ";
169 | }
170 | $str .= "
";
171 | $str .= "
";
172 |
173 | return $str;
174 | }
175 |
176 | function create($WS) {
177 | $this->CAdxResultXml = $this->save ( Config::$WS_ORDER, $WS );
178 | $adxResultXml = $this->CAdxResultXml;
179 | $ret="";
180 | $messages = array();
181 | $status = $adxResultXml->status;
182 | if ($status == 1) {
183 | $ret.=ToolsWS::getSucces('Order created');
184 | //return $ret;
185 | // echo "order créée
";
186 | } else {
187 | $ret.=ToolsWS::getError('Order not created');
188 | //return $ret;
189 | // echo "Erreur, commande non créée
";
190 | }
191 |
192 | // echo "Messages:
";
193 | if (property_exists(get_class($adxResultXml), 'messages')){
194 | $messages = $adxResultXml->messages;
195 |
196 | foreach ( $messages as $value ) {
197 | $ret .= $value->message;
198 | $ret .= "
";
199 | }
200 | }
201 | // echo "resultXml
";
202 | // echo "$result2->resultXml
";
203 | if ($status == 0) {
204 | return $ret;
205 | }
206 | $dom = new DomDocument ();
207 | $resultXml = $adxResultXml->resultXml;
208 | $dom->loadXML ( $resultXml );
209 |
210 |
211 | $fld = $dom->getElementsByTagName ( 'FLD' );
212 | $ret .= "
";
213 |
214 | foreach ( $fld as $f ) {
215 | $val = $f->getAttribute ( 'NAME' );
216 | $val2 = $f->nodeValue;
217 | if ($val == "SOHNUM") {
218 | $ret .= "
";
219 | $ret .= "
";
220 | $ret .="Order num ";
221 | $ret .="".$val2." ";
222 | $ret .="
";
223 | }
224 | }
225 | return $ret;
226 | }
227 |
228 | }
229 |
230 | ?>
231 |
--------------------------------------------------------------------------------
/vendor/firebase/php-jwt/src/CachedKeySet.php:
--------------------------------------------------------------------------------
1 |
18 | */
19 | class CachedKeySet implements ArrayAccess
20 | {
21 | /**
22 | * @var string
23 | */
24 | private $jwksUri;
25 | /**
26 | * @var ClientInterface
27 | */
28 | private $httpClient;
29 | /**
30 | * @var RequestFactoryInterface
31 | */
32 | private $httpFactory;
33 | /**
34 | * @var CacheItemPoolInterface
35 | */
36 | private $cache;
37 | /**
38 | * @var ?int
39 | */
40 | private $expiresAfter;
41 | /**
42 | * @var ?CacheItemInterface
43 | */
44 | private $cacheItem;
45 | /**
46 | * @var array
>
47 | */
48 | private $keySet;
49 | /**
50 | * @var string
51 | */
52 | private $cacheKey;
53 | /**
54 | * @var string
55 | */
56 | private $cacheKeyPrefix = 'jwks';
57 | /**
58 | * @var int
59 | */
60 | private $maxKeyLength = 64;
61 | /**
62 | * @var bool
63 | */
64 | private $rateLimit;
65 | /**
66 | * @var string
67 | */
68 | private $rateLimitCacheKey;
69 | /**
70 | * @var int
71 | */
72 | private $maxCallsPerMinute = 10;
73 | /**
74 | * @var string|null
75 | */
76 | private $defaultAlg;
77 |
78 | public function __construct(
79 | string $jwksUri,
80 | ClientInterface $httpClient,
81 | RequestFactoryInterface $httpFactory,
82 | CacheItemPoolInterface $cache,
83 | int $expiresAfter = null,
84 | bool $rateLimit = false,
85 | string $defaultAlg = null
86 | ) {
87 | $this->jwksUri = $jwksUri;
88 | $this->httpClient = $httpClient;
89 | $this->httpFactory = $httpFactory;
90 | $this->cache = $cache;
91 | $this->expiresAfter = $expiresAfter;
92 | $this->rateLimit = $rateLimit;
93 | $this->defaultAlg = $defaultAlg;
94 | $this->setCacheKeys();
95 | }
96 |
97 | /**
98 | * @param string $keyId
99 | * @return Key
100 | */
101 | public function offsetGet($keyId): Key
102 | {
103 | if (!$this->keyIdExists($keyId)) {
104 | throw new OutOfBoundsException('Key ID not found');
105 | }
106 | return JWK::parseKey($this->keySet[$keyId], $this->defaultAlg);
107 | }
108 |
109 | /**
110 | * @param string $keyId
111 | * @return bool
112 | */
113 | public function offsetExists($keyId): bool
114 | {
115 | return $this->keyIdExists($keyId);
116 | }
117 |
118 | /**
119 | * @param string $offset
120 | * @param Key $value
121 | */
122 | public function offsetSet($offset, $value): void
123 | {
124 | throw new LogicException('Method not implemented');
125 | }
126 |
127 | /**
128 | * @param string $offset
129 | */
130 | public function offsetUnset($offset): void
131 | {
132 | throw new LogicException('Method not implemented');
133 | }
134 |
135 | /**
136 | * @return array
137 | */
138 | private function formatJwksForCache(string $jwks): array
139 | {
140 | $jwks = json_decode($jwks, true);
141 |
142 | if (!isset($jwks['keys'])) {
143 | throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
144 | }
145 |
146 | if (empty($jwks['keys'])) {
147 | throw new InvalidArgumentException('JWK Set did not contain any keys');
148 | }
149 |
150 | $keys = [];
151 | foreach ($jwks['keys'] as $k => $v) {
152 | $kid = isset($v['kid']) ? $v['kid'] : $k;
153 | $keys[(string) $kid] = $v;
154 | }
155 |
156 | return $keys;
157 | }
158 |
159 | private function keyIdExists(string $keyId): bool
160 | {
161 | if (null === $this->keySet) {
162 | $item = $this->getCacheItem();
163 | // Try to load keys from cache
164 | if ($item->isHit()) {
165 | // item found! retrieve it
166 | $this->keySet = $item->get();
167 | // If the cached item is a string, the JWKS response was cached (previous behavior).
168 | // Parse this into expected format array instead.
169 | if (\is_string($this->keySet)) {
170 | $this->keySet = $this->formatJwksForCache($this->keySet);
171 | }
172 | }
173 | }
174 |
175 | if (!isset($this->keySet[$keyId])) {
176 | if ($this->rateLimitExceeded()) {
177 | return false;
178 | }
179 | $request = $this->httpFactory->createRequest('GET', $this->jwksUri);
180 | $jwksResponse = $this->httpClient->sendRequest($request);
181 | if ($jwksResponse->getStatusCode() !== 200) {
182 | throw new UnexpectedValueException(
183 | sprintf('HTTP Error: %d %s for URI "%s"',
184 | $jwksResponse->getStatusCode(),
185 | $jwksResponse->getReasonPhrase(),
186 | $this->jwksUri,
187 | ),
188 | $jwksResponse->getStatusCode()
189 | );
190 | }
191 | $this->keySet = $this->formatJwksForCache((string) $jwksResponse->getBody());
192 |
193 | if (!isset($this->keySet[$keyId])) {
194 | return false;
195 | }
196 |
197 | $item = $this->getCacheItem();
198 | $item->set($this->keySet);
199 | if ($this->expiresAfter) {
200 | $item->expiresAfter($this->expiresAfter);
201 | }
202 | $this->cache->save($item);
203 | }
204 |
205 | return true;
206 | }
207 |
208 | private function rateLimitExceeded(): bool
209 | {
210 | if (!$this->rateLimit) {
211 | return false;
212 | }
213 |
214 | $cacheItem = $this->cache->getItem($this->rateLimitCacheKey);
215 | if (!$cacheItem->isHit()) {
216 | $cacheItem->expiresAfter(1); // # of calls are cached each minute
217 | }
218 |
219 | $callsPerMinute = (int) $cacheItem->get();
220 | if (++$callsPerMinute > $this->maxCallsPerMinute) {
221 | return true;
222 | }
223 | $cacheItem->set($callsPerMinute);
224 | $this->cache->save($cacheItem);
225 | return false;
226 | }
227 |
228 | private function getCacheItem(): CacheItemInterface
229 | {
230 | if (\is_null($this->cacheItem)) {
231 | $this->cacheItem = $this->cache->getItem($this->cacheKey);
232 | }
233 |
234 | return $this->cacheItem;
235 | }
236 |
237 | private function setCacheKeys(): void
238 | {
239 | if (empty($this->jwksUri)) {
240 | throw new RuntimeException('JWKS URI is empty');
241 | }
242 |
243 | // ensure we do not have illegal characters
244 | $key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $this->jwksUri);
245 |
246 | // add prefix
247 | $key = $this->cacheKeyPrefix . $key;
248 |
249 | // Hash keys if they exceed $maxKeyLength of 64
250 | if (\strlen($key) > $this->maxKeyLength) {
251 | $key = substr(hash('sha256', $key), 0, $this->maxKeyLength);
252 | }
253 |
254 | $this->cacheKey = $key;
255 |
256 | if ($this->rateLimit) {
257 | // add prefix
258 | $rateLimitKey = $this->cacheKeyPrefix . 'ratelimit' . $key;
259 |
260 | // Hash keys if they exceed $maxKeyLength of 64
261 | if (\strlen($rateLimitKey) > $this->maxKeyLength) {
262 | $rateLimitKey = substr(hash('sha256', $rateLimitKey), 0, $this->maxKeyLength);
263 | }
264 |
265 | $this->rateLimitCacheKey = $rateLimitKey;
266 | }
267 | }
268 | }
269 |
--------------------------------------------------------------------------------
/WebServiceSOAP/models/Product.php:
--------------------------------------------------------------------------------
1 | key = "ITMREF";
20 | $cle->value = $crit;
21 | //echo("oma");echo($cle->key);
22 | //echo("oma");echo($cle->value);
23 | $this->CAdxResultXml = $this->read ( Config::$WS_PRODUCT, Array (
24 | $cle
25 | ) );
26 | if ($this->CAdxResultXml->status == 0) {
27 | return ToolsWS::getSucces ( "No result" );
28 | }
29 | $resultXml = $this->CAdxResultXml->resultXml;
30 | // $result contient le fichier XML des réponses
31 |
32 | $dom = new DomDocument ();
33 | $dom->loadXML ( $resultXml );
34 | // $xpath = new DOMXpath($dom);
35 |
36 | $str = "";
37 | // header
38 | $fld = $dom->getElementsByTagName ( 'FLD' );
39 | $str .= "";
40 | foreach ( $fld as $f ) {
41 | $val = $f->getAttribute ( 'NAME' );
42 | if ( $val == "IMG") {
43 | $val2 = $f->nodeValue;
44 | $str .= "
";
45 | $str .= "
";
46 | $str .= "
";
47 | }
48 | }
49 | foreach ( $fld as $f ) {
50 |
51 | $val = $f->getAttribute ( 'NAME' );
52 | if (in_array ( $val, $listFieldHeader )) {
53 | $val2 = $f->nodeValue;
54 |
55 | if ($val == "ITMREF") {
56 | $str .= "
";
57 | $str .= "
Product num ";
58 | $str .= "
";
60 | $str .= $val2;
61 | $str .= "' disabled >";
62 | } elseif ($val == "DES1AXX") {
63 | $str .= "
";
64 | $str .= "
Description ";
65 | $str .= "
";
68 | } elseif ($val == "TCLCOD") {
69 | $str .= "
";
70 | $str .= "
Category ";
71 | $str .= "
";
74 | } elseif ($val == "ITMSTA") {
75 | $str .= "
";
76 | $str .= "
Status ";
77 | $str .= "
";
80 | } elseif ($val == "EANCOD") {
81 | $str .= "
";
97 | $str .= "
";
98 | // Lines
99 | $RES = $dom->getElementsByTagName ( 'LIN' );
100 |
101 | // $str.="
No commande ";
102 | // $str.="
";
105 | $str .= "
";
106 | $str .= "Supplier Name ";
107 |
108 | foreach ( $RES as $R ) {
109 |
110 | $product = $R->getElementsByTagName ( 'FLD' );
111 | // echo "";
112 | $str .= " ";
113 | foreach ( $product as $p ) {
114 | $val = $p->getAttribute ( 'NAME' );
115 | if (in_array ( $val, $listFieldLines )) {
116 | // echo "";
117 | $str .= " ";
118 |
119 | $val2 = $p->nodeValue;
120 |
121 | $str .= $p->nodeValue;
122 |
123 | $str .= " ";
124 | }
125 | }
126 | $str .= " ";
127 | }
128 | $str .= "
";
129 | $str .= "
";
130 |
131 | return $str;
132 | }
133 | function showListe() {
134 | //$WS = "";
135 | $WS = new CAdxParamKeyValue ();
136 | $WS->key = "ITMSTA";
137 | $WS->value = "<>5";
138 | $this->CAdxResultXml = $this->query ( Config::$WS_PRODUCT, Array ($WS) , 100 );
139 | $result = $this->CAdxResultXml->resultXml;
140 | // $result contient le fichier XML des réponses
141 | $dom = new DomDocument ();
142 | $dom->loadXML ( $result );
143 | $RES = $dom->getElementsByTagName ( 'LIN' );
144 | $str = "
";
145 | $str .= "Product num Description Category Product status EAN code Search key ";
146 |
147 | foreach ( $RES as $R ) {
148 | $product = $R->getElementsByTagName ( 'FLD' );
149 | $str .= "";
150 | foreach ( $product as $p ) {
151 | $str .= "";
152 | $val = $p->getAttribute ( 'NAME' );
153 | $val2 = $p->nodeValue;
154 | if ($val == "ITMREF") {
155 | $str .= "";
156 | $str .= $p->nodeValue;
157 | $str .= " ";
158 | } elseif ($val == "ITMSTA") {
159 | switch ($p->nodeValue) {
160 | case 1 :
161 | $str .= "Active";
162 | break;
163 | case 2 :
164 | $str .= "In development";
165 | break;
166 | case 3 :
167 | $str .= "Shortage";
168 | break;
169 | case 4 :
170 | $str .= "Not Renewed";
171 | break;
172 | case 5 :
173 | $str .= "Obsolete";
174 | break;
175 | case 6 :
176 | $str .= "Not Usable";
177 | break;
178 | }
179 | } else {
180 | $str .= $p->nodeValue;
181 | }
182 | $str .= " ";
183 | }
184 | $str .= " ";
185 | }
186 | $str .= "
";
187 | $str .= "
";
188 |
189 | return $str;
190 | }
191 | function create($WS) {
192 | $this->CAdxResultXml = $this->save ( Config::$WS_ORDER, $WS );
193 | $adxResultXml = $this->CAdxResultXml;
194 | $ret = "";
195 | $messages = array ();
196 | $status = $adxResultXml->status;
197 | if ($status == 1) {
198 | $ret .= ToolsWS::getSucces ( 'Order created' );
199 | // return $ret;
200 | // echo "order créée
";
201 | } else {
202 | $ret .= ToolsWS::getError ( 'Order not created' );
203 | // return $ret;
204 | // echo "Erreur, commande non créée
";
205 | }
206 |
207 | // echo "Messages:
";
208 | if (property_exists ( get_class ( $adxResultXml ), 'messages' )) {
209 | $messages = $adxResultXml->messages;
210 |
211 | foreach ( $messages as $value ) {
212 | $ret .= $value->message;
213 | $ret .= "
";
214 | }
215 | }
216 | // echo "resultXml
";
217 | // echo "$result2->resultXml
";
218 | if ($status == 0) {
219 | return $ret;
220 | }
221 | $dom = new DomDocument ();
222 | $resultXml = $adxResultXml->resultXml;
223 | $dom->loadXML ( $resultXml );
224 |
225 | $fld = $dom->getElementsByTagName ( 'FLD' );
226 | $ret .= "
";
227 |
228 | foreach ( $fld as $f ) {
229 | $val = $f->getAttribute ( 'NAME' );
230 | $val2 = $f->nodeValue;
231 | if ($val == "SOHNUM") {
232 | $ret .= "
";
233 | $ret .= "
";
234 | $ret .= "Order num ";
235 | $ret .= "" . $val2 . " ";
236 | $ret .= "
";
237 | }
238 | }
239 | return $ret;
240 | }
241 | }
242 |
243 | ?>
244 |
--------------------------------------------------------------------------------