1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
city.php
См. документацию.
1<?
2/*.
3 require_module 'standard';
4 require_module 'bitrix_main';
5 require_module 'bitrix_statistic_include';
6.*/
8
10{
11 public $is_installed = false;
12 public $ip_addr = "";
13 public $ip_number = "";
14 public $country_code = "";
16 public $country_full_name = "";
17 public $region_name = "";
18 public $city_name = "";
19 public $city_id = "";
20 public $charset = "";
21
25 function __construct($arDBRecord = /*.(array[string]string).*/array())
26 {
27 if(is_array($arDBRecord))
28 {
29 if(array_key_exists("IPA", $arDBRecord)) $this->ip_addr = $arDBRecord["IPA"];
30 if(array_key_exists("IPN", $arDBRecord)) $this->ip_number = $arDBRecord["IPN"];
31 if(array_key_exists("COC", $arDBRecord)) $this->country_code = $arDBRecord["COC"];
32 if(array_key_exists("COS", $arDBRecord)) $this->country_short_name = $arDBRecord["COS"];
33 if(array_key_exists("COF", $arDBRecord)) $this->country_full_name = $arDBRecord["COF"];
34 if(array_key_exists("REN", $arDBRecord)) $this->region_name = $arDBRecord["REN"];
35 if(array_key_exists("CIN", $arDBRecord)) $this->city_name = $arDBRecord["CIN"];
36 if(array_key_exists("CID", $arDBRecord)) $this->city_id = $arDBRecord["CID"];
37 }
38 else
39 {
40 $ip = $this->ip_addr = $_SERVER["REMOTE_ADDR"];
41 $this->ip_number = ip2number($ip);
42 }
43 }
44
49 public static function OnCityLookup($arDBRecord = /*.(array[string]string).*/array())
50 {
51 return new CCityLookup($arDBRecord);
52 }
53
57 function ArrayForDB()
58 {
59 $ar = /*.(array[string]string).*/array();
60 if($this->ip_addr <> '') $ar["IPA"] = $this->ip_addr;
61 if($this->ip_number <> '') $ar["IPN"] = $this->ip_number;
62 if($this->country_code <> '') $ar["COC"] = $this->country_code;
63 if($this->country_short_name <> '') $ar["COS"] = $this->country_short_name;
64 if($this->country_full_name <> '') $ar["COF"] = $this->country_full_name;
65 if($this->region_name <> '') $ar["REN"] = $this->region_name;
66 if($this->city_name <> '') $ar["CIN"] = $this->city_name;
67 if($this->city_id <> '') $ar["CID"] = $this->city_id;
68 return $ar;
69 }
70
74 function GetFullInfo()
75 {
76 return array(
77 "IP_ADDR" => array(
78 "TITLE" => GetMessage("STAT_CITY_IP_ADDR"),
79 "VALUE~" => $this->ip_addr,
80 "VALUE" => htmlspecialcharsbx($this->ip_addr),
81 ),
82 "COUNTRY_CODE" => array(
83 "TITLE" => GetMessage("STAT_CITY_COUNTRY_CODE"),
84 "VALUE~" => $this->country_code,
85 "VALUE" => htmlspecialcharsbx($this->country_code),
86 ),
87 "COUNTRY_NAME" => array(
88 "TITLE" => GetMessage("STAT_CITY_COUNTRY_NAME"),
89 "VALUE~" => $this->country_full_name,
90 "VALUE" => htmlspecialcharsbx($this->country_full_name),
91 ),
92 "REGION_NAME" => array(
93 "TITLE" => GetMessage("STAT_CITY_REGION_NAME"),
94 "VALUE~" => $this->region_name,
95 "VALUE" => htmlspecialcharsbx($this->region_name),
96 ),
97 "CITY_NAME" => array(
98 "TITLE" => GetMessage("STAT_CITY_CITY_NAME"),
99 "VALUE~" => $this->city_name,
100 "VALUE" => htmlspecialcharsbx($this->city_name),
101 ),
102 );
103 }
104
108 function GetDescription()
109 {
110 $res = /*.(array[string]mixed).*/array();
111 $res["ID"] = "CCityLookup";
112 $res["DESCRIPTION"] = "";
113 $res["IS_INSTALLED"] = false;
114 $res["CAN_LOOKUP_COUNTRY"] = true;
115 $res["CAN_LOOKUP_CITY"] = false;
116 return $res;
117 }
118
122 function IsInstalled()
123 {
124 return false;
125 }
126
130 function Lookup()
131 {
132 $this->country_code = "N0";
133 $this->country_short_name = "N00";
134 $this->country_full_name = "NA";
135 }
136}
137
139{
145 function GetList($arOrder = /*.(array[string]string).*/array(), $arFilter = /*.(array[string]string).*/array())
146 {
147 $DB = CDatabase::GetModuleConnection('statistic');
148
149 $arQueryOrder = array();
150 if(is_array($arOrder))
151 {
152 foreach($arOrder as $strColumn => $strDirection)
153 {
154 $strColumn = mb_strtoupper($strColumn);
155 $strDirection = mb_strtoupper($strDirection) === "ASC"? "ASC": "DESC";
156 switch($strColumn)
157 {
158 case "COUNTRY_ID":
159 case "COUNTRY_SHORT_NAME":
160 case "COUNTRY_NAME":
161 case "REGION_NAME":
162 $arQueryOrder[$strColumn] = $strColumn." ".$strDirection;
163 break;
164 case "REGION":
165 $arQueryOrder["COUNTRY_ID"] = "COUNTRY_ID ".$strDirection;
166 $arQueryOrder["REGION_NAME"] = "REGION_NAME ".$strDirection;
167 break;
168 default:
169 break;
170 }
171 }
172 }
173
174 $obQueryWhere = new CSQLWhere;
175 $obQueryWhere->SetFields(array(
176 "COUNTRY_ID" => array(
177 "TABLE_ALIAS" => "R",
178 "FIELD_NAME" => "R.COUNTRY_ID",
179 "FIELD_TYPE" => "string",
180 "JOIN" => "",
181 ),
182 "COUNTRY_SHORT_NAME" => array(
183 "TABLE_ALIAS" => "C",
184 "FIELD_NAME" => "C.SHORT_NAME",
185 "FIELD_TYPE" => "string",
186 "JOIN" => "",
187 ),
188 "COUNTRY_NAME" => array(
189 "TABLE_ALIAS" => "C",
190 "FIELD_NAME" => "C.NAME",
191 "FIELD_TYPE" => "string",
192 "JOIN" => "",
193 ),
194 "REGION_NAME" => array(
195 "TABLE_ALIAS" => "R",
196 "FIELD_NAME" => "R.REGION",
197 "FIELD_TYPE" => "string",
198 "JOIN" => "",
199 ),
200 ));
201
202 $strSql = "
203 SELECT
204 R.COUNTRY_ID
205 ,C.SHORT_NAME COUNTRY_SHORT_NAME
206 ,C.NAME COUNTRY_NAME
207 ,R.REGION REGION_NAME
208 FROM
209 b_stat_city R
210 INNER JOIN b_stat_country C on C.ID = R.COUNTRY_ID
211 ";
212
213 $strQueryWhere = $obQueryWhere->GetQuery($arFilter);
214
215 if($strQueryWhere <> '')
216 {
217 $strSql .= "
218 WHERE
219 ".$strQueryWhere."
220 ";
221 }
222 $strSql .= "
223 GROUP BY
224 R.COUNTRY_ID, R.REGION, C.SHORT_NAME, C.NAME
225 ";
226
227 if(count($arQueryOrder) > 0)
228 {
229 $strSql .= "
230 ORDER BY
231 ".implode(", ", $arQueryOrder)."
232 ";
233 }
234
235 return $DB->Query($strSql);
236 }
237}
238
239class CCity
240{
241 private $lookup_class = "";
242 private $lookup = /*.(CCityLookup).*/null;
243 private $country_code = "";
244 private $city_id = "";
245
249 function __construct($dbRecord = "")
250 {
251 if($dbRecord <> '')
252 $arDBRecord = unserialize($dbRecord, ['allowed_classes' => false]);
253 else
254 $arDBRecord = false;
255
256 if(is_array($arDBRecord))
257 {
258 $this->lookup_class = $arDBRecord["LC"];
259 if(!$this->lookup_class || !class_exists(mb_strtolower($this->lookup_class)))
260 $this->lookup_class = "CCityLookup";
261
262 $this->lookup = call_user_func_array(array($this->lookup_class, "OnCityLookup"), array($arDBRecord["LD"]));
263
264 $this->country_code = $arDBRecord["CC"];
265 $this->city_id = $arDBRecord["CI"];
266 }
267 else
268 {
269 $this->lookup_class = $this->GetHandler();
270 if(!$this->lookup_class || !class_exists(mb_strtolower($this->lookup_class)))
271 $this->lookup_class = "CCityLookup";
272
273 $ob = call_user_func_array(array($this->lookup_class, "OnCityLookup"), array());
274
275 if(!$ob || !$ob->IsInstalled())
276 {
277 $this->lookup_class = "CCityLookup";
278 $this->lookup = new CCityLookup;
279 }
280 else
281 {
282 $this->lookup = $ob;
283 }
284 }
285 }
286
292 public static function GetList($arOrder = /*.(array[string]string).*/array(), $arFilter = /*.(array[string]string).*/array())
293 {
294 $DB = CDatabase::GetModuleConnection('statistic');
295
296 if(!is_array($arOrder))
297 $arOrder = array();
298
299 $arQueryOrder = array();
300 foreach($arOrder as $strColumn => $strDirection)
301 {
302 $strColumn = mb_strtoupper($strColumn);
303 $strDirection = mb_strtoupper($strDirection) === "ASC"? "ASC": "DESC";
304 switch($strColumn)
305 {
306 case "COUNTRY_ID":
307 case "COUNTRY_SHORT_NAME":
308 case "COUNTRY_NAME":
309 case "REGION_NAME":
310 case "CITY_NAME":
311 $arQueryOrder[$strColumn] = $strColumn." ".$strDirection;
312 break;
313 case "CITY":
314 $arQueryOrder["COUNTRY_ID"] = "COUNTRY_ID ".$strDirection;
315 $arQueryOrder["REGION_NAME"] = "REGION_NAME ".$strDirection;
316 $arQueryOrder["CITY_NAME"] = "CITY_NAME ".$strDirection;
317 break;
318 default:
319 break;
320 }
321 }
322
323 $obQueryWhere = new CSQLWhere;
324 $obQueryWhere->SetFields(array(
325 "CITY_ID" => array(
326 "TABLE_ALIAS" => "CITY",
327 "FIELD_NAME" => "CITY.ID",
328 "FIELD_TYPE" => "int",
329 "JOIN" => "",
330 ),
331 "COUNTRY_ID" => array(
332 "TABLE_ALIAS" => "CITY",
333 "FIELD_NAME" => "CITY.COUNTRY_ID",
334 "FIELD_TYPE" => "string",
335 "JOIN" => "",
336 ),
337 "COUNTRY_SHORT_NAME" => array(
338 "TABLE_ALIAS" => "C",
339 "FIELD_NAME" => "C.SHORT_NAME",
340 "FIELD_TYPE" => "string",
341 "JOIN" => "",
342 ),
343 "COUNTRY_NAME" => array(
344 "TABLE_ALIAS" => "C",
345 "FIELD_NAME" => "C.NAME",
346 "FIELD_TYPE" => "string",
347 "JOIN" => "",
348 ),
349 "REGION_NAME" => array(
350 "TABLE_ALIAS" => "CITY",
351 "FIELD_NAME" => "CITY.REGION",
352 "FIELD_TYPE" => "string",
353 "JOIN" => "",
354 ),
355 "CITY_NAME" => array(
356 "TABLE_ALIAS" => "CITY",
357 "FIELD_NAME" => "CITY.NAME",
358 "FIELD_TYPE" => "string",
359 "JOIN" => "",
360 ),
361 ));
362
363 $strSql = "
364 SELECT
365 CITY.ID CITY_ID
366 ,CITY.COUNTRY_ID
367 ,C.SHORT_NAME COUNTRY_SHORT_NAME
368 ,C.NAME COUNTRY_NAME
369 ,CITY.REGION REGION_NAME
370 ,CITY.NAME CITY_NAME
371 FROM
372 b_stat_city CITY
373 INNER JOIN b_stat_country C on C.ID = CITY.COUNTRY_ID
374 ";
375 $strQueryWhere = $obQueryWhere->GetQuery($arFilter);
376
377 if($strQueryWhere <> '')
378 {
379 $strSql .= "
380 WHERE
381 ".$strQueryWhere."
382 ";
383 }
384
385 if(count($arQueryOrder) > 0)
386 {
387 $strSql .= "
388 ORDER BY
389 ".implode(", ", $arQueryOrder)."
390 ";
391 }
392
393 return $DB->Query($strSql);
394 }
395
396
400 function ForSQL()
401 {
402 $DB = CDatabase::GetModuleConnection('statistic');
403 return $DB->ForSQL(serialize(array(
404 "LC" => $this->lookup_class,
405 "LD" => $this->lookup->ArrayForDB(),
406 "CC" => $this->country_code,
407 "CI" => $this->city_id,
408 )));
409 }
410
411 function GetFullInfo()
412 {
413 $this->GetCityID();
414 return $this->lookup->GetFullInfo();
415 }
416
417 public static function GetHandler()
418 {
419 $selected = COption::GetOptionString("statistic", "IP_LOOKUP_CLASS", "");
420 if(!$selected)
421 {
422 $arResolvers = array();
423 foreach(GetModuleEvents("statistic", "OnCityLookup", true) as $arEvent)
424 {
425 $ob = ExecuteModuleEventEx($arEvent);
426 $ar = $ob->GetDescription();
427 $arResolvers[$ar["CLASS"]] = $ob;
428 }
429 if(!array_key_exists($selected, $arResolvers))
430 {
431 foreach($arResolvers as $ID => $ob)
432 {
433 if($ob->IsInstalled())
434 {
435 $selected = $ID;
436 break;
437 }
438 }
439 }
440 COption::SetOptionString("statistic", "IP_LOOKUP_CLASS", $selected);
441 }
442 return $selected;
443 }
444
445 function GetCountryCode()
446 {
447 if(!$this->country_code)
448 {
449 $this->lookup->Lookup();
450 $this->country_code = $this->lookup->country_code;
451 }
452 return $this->country_code? $this->country_code: "N0";
453 }
454
455 function Recode($str)
456 {
457 if($str && $this->lookup->charset)
458 {
460 }
461 return $str;
462 }
463
464 function GetCityID()
465 {
466 $DB = CDatabase::GetModuleConnection('statistic');
467 $country_code = $this->GetCountryCode();
468
469 if(!$this->city_id)
470 $this->city_id = $this->lookup->city_id;
471
472 if(!$this->city_id)
473 {
474 $city_name = $this->Recode($this->lookup->city_name);
475 $region_name = $this->Recode($this->lookup->region_name);
476
477 $rs = $DB->Query("
478 SELECT ID
479 FROM b_stat_city
480 WHERE COUNTRY_ID = '".$DB->ForSQL($country_code, 2)."'
481 AND ".($region_name? "REGION = '".$DB->ForSQL($region_name, 255)."'": "REGION IS NULL")."
482 AND ".($city_name? "NAME = '".$DB->ForSQL($city_name, 255)."'": "NAME IS NULL")."
483 ");
484 $ar = $rs->Fetch();
485 if($ar)
486 {
487 $this->city_id = $ar["ID"];
488 }
489 else
490 {
491 $rs = $DB->Query("
492 SELECT ID
493 FROM b_stat_country
494 WHERE ID = '".$DB->ForSQL($country_code, 2)."'
495 ");
496 $ar = $rs->Fetch();
497 if(!$ar)
498 {
499 $country_short_name = $this->Recode($this->lookup->country_short_name);
500 $country_full_name = $this->Recode($this->lookup->country_full_name);
501 $DB->Query("
502 INSERT INTO b_stat_country (ID, SHORT_NAME, NAME) VALUES (
503 '".$DB->ForSql($country_code, 2)."',
504 ".($country_short_name? "'".$DB->ForSql($country_short_name, 3)."'": "'N00'").",
505 ".($country_full_name? "'".$DB->ForSql($country_full_name, 50)."'": "'NA'")."
506 )
507 ");
508 }
509 $this->city_id = $DB->Add("b_stat_city", array(
510 "COUNTRY_ID" => $country_code,
511 "REGION" => $region_name ? $region_name: false,
512 "NAME" => $city_name ? $city_name: false,
513 ));
514 }
515 }
516 return $this->city_id > 0? intval($this->city_id): "";
517 }
518
519 public static function GetGraphArray($arFilter, &$arLegend, $sort = false, $top = 0)
520 {
521 global $arCityColor;
522 $DB = CDatabase::GetModuleConnection('statistic');
523 $arSqlSearch = Array();
524 if(is_array($arFilter))
525 {
526 foreach ($arFilter as $key => $val)
527 {
528 if(is_array($val))
529 {
530 if(count($val) <= 0)
531 continue;
532 }
533 else
534 {
535 if( ((string)$val == '') || ($val === "NOT_REF") )
536 continue;
537 }
538 $match_value_set = array_key_exists($key."_EXACT_MATCH", $arFilter);
539 $key = strtoupper($key);
540 switch($key)
541 {
542 case "COUNTRY_ID":
543 if ($val!="NOT_REF")
544 $arSqlSearch[] = GetFilterQuery("C.COUNTRY_ID",$val,"N");
545 break;
546 case "DATE1":
547 if (CheckDateTime($val))
548 $arSqlSearch[] = "D.DATE_STAT>=".$DB->CharToDateFunction($val, "SHORT");
549 break;
550 case "DATE2":
551 if (CheckDateTime($val))
552 $arSqlSearch[] = "D.DATE_STAT<=".$DB->CharToDateFunction($val." 23:59:59", "FULL");
553 break;
554 }
555 }
556 }
557 $arrDays = array();
558 $arLegend = array();
559 $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
560 $strSql = "
561 SELECT
562 ".$DB->DateToCharFunction("D.DATE_STAT","SHORT")." DATE_STAT,
563 ".$DB->DateFormatToDB("DD", "D.DATE_STAT")." DAY,
564 ".$DB->DateFormatToDB("MM", "D.DATE_STAT")." MONTH,
565 ".$DB->DateFormatToDB("YYYY", "D.DATE_STAT")." YEAR,
566 D.CITY_ID,
567 D.SESSIONS,
568 D.NEW_GUESTS,
569 D.HITS,
570 D.C_EVENTS,
571 C.NAME,
572 C.SESSIONS TOTAL_SESSIONS,
573 C.NEW_GUESTS TOTAL_NEW_GUESTS,
574 C.HITS TOTAL_HITS,
575 C.C_EVENTS TOTAL_C_EVENTS
576 FROM
577 b_stat_city_day D
578 INNER JOIN b_stat_city C ON (C.ID = D.CITY_ID)
579 WHERE
580 ".$strSqlSearch."
581 ORDER BY
582 D.DATE_STAT, D.CITY_ID
583 ";
584
585 $rsD = $DB->Query($strSql);
586 while ($arD = $rsD->Fetch())
587 {
588 $arrDays[$arD["DATE_STAT"]]["D"] = $arD["DAY"];
589 $arrDays[$arD["DATE_STAT"]]["M"] = $arD["MONTH"];
590 $arrDays[$arD["DATE_STAT"]]["Y"] = $arD["YEAR"];
591 $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["SESSIONS"] = $arD["SESSIONS"];
592 $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["NEW_GUESTS"] = $arD["NEW_GUESTS"];
593 $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["HITS"] = $arD["HITS"];
594 $arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["C_EVENTS"] = $arD["C_EVENTS"];
595
596 $arLegend[$arD["CITY_ID"]]["CITY_ID"] = intval($arD["CITY_ID"]);
597 $arLegend[$arD["CITY_ID"]]["NAME"] = $arD["NAME"];
598 $arLegend[$arD["CITY_ID"]]["SESSIONS"] += $arD["SESSIONS"];
599 $arLegend[$arD["CITY_ID"]]["NEW_GUESTS"] += $arD["NEW_GUESTS"];
600 $arLegend[$arD["CITY_ID"]]["HITS"] += $arD["HITS"];
601 $arLegend[$arD["CITY_ID"]]["C_EVENTS"] += $arD["C_EVENTS"];
602
603 $arLegend[$arD["CITY_ID"]]["TOTAL_SESSIONS"] = $arD["TOTAL_SESSIONS"];
604 $arLegend[$arD["CITY_ID"]]["TOTAL_NEW_GUESTS"] = $arD["TOTAL_NEW_GUESTS"];
605 $arLegend[$arD["CITY_ID"]]["TOTAL_HITS"] = $arD["TOTAL_HITS"];
606 $arLegend[$arD["CITY_ID"]]["TOTAL_C_EVENTS"] = $arD["TOTAL_C_EVENTS"];
607 }
608
609 if($sort)
610 {
611 CStatisticSort::Sort($arLegend, $sort);
612 }
613
614 if($top)
615 {
616 $totals = array(
617 "CITY_ID" => 0,
618 "NAME" => GetMessage("STAT_CITY_OTHER"),
619 "SESSIONS" => 0,
620 "NEW_GUESTS" => 0,
621 "HITS" => 0,
622 "C_EVENTS" => 0,
623 "TOTAL_SESSIONS" => 0,
624 "TOTAL_NEW_GUESTS" => 0,
625 "TOTAL_HITS" => 0,
626 "TOTAL_C_EVENTS" => 0,
627 );
628 $i = 0;
629 while(count($arLegend) > $top)
630 {
631 $i++;
632 $tail = array_pop($arLegend);
633 $totals["SESSIONS"] += $tail["SESSIONS"];
634 $totals["NEW_GUESTS"] += $tail["NEW_GUESTS"];
635 $totals["HITS"] += $tail["HITS"];
636 $totals["C_EVENTS"] += $tail["C_EVENTS"];
637 $totals["TOTAL_SESSIONS"] += $tail["TOTAL_SESSIONS"];
638 $totals["TOTAL_NEW_GUESTS"] += $tail["TOTAL_NEW_GUESTS"];
639 $totals["TOTAL_HITS"] += $tail["TOTAL_HITS"];
640 $totals["TOTAL_C_EVENTS"] += $tail["TOTAL_C_EVENTS"];
641 }
642 if($i)
643 $arLegend[0] = $totals;
644
645 foreach($arrDays as $DATE_STAT => $arDate)
646 {
647 foreach($arDate as $CITY_ID => $arCity)
648 {
649 if(intval($CITY_ID) > 0)
650 {
651 if(!array_key_exists($CITY_ID, $arLegend))
652 {
653 $arrDays[$DATE_STAT][0]["CITY_ID"] = 0;
654 $arrDays[$DATE_STAT][0]["NAME"] = GetMessage("STAT_CITY_OTHER");
655 $arrDays[$DATE_STAT][0]["SESSIONS"] += $arCity["SESSIONS"];
656 $arrDays[$DATE_STAT][0]["NEW_GUESTS"] += $arCity["NEW_GUESTS"];
657 $arrDays[$DATE_STAT][0]["HITS"] += $arCity["HITS"];
658 $arrDays[$DATE_STAT][0]["C_EVENTS"] += $arCity["C_EVENTS"];
659 unset($arrDays[$DATE_STAT][$CITY_ID]);
660 }
661 }
662 }
663 }
664 }
665
666 $color_getnext = '';
667 $total = count($arLegend);
668 foreach($arLegend as $key => $arr)
669 {
670 if ($arCityColor[$key] <> '')
671 {
672 $color = $arCityColor[$key];
673 }
674 else
675 {
676 $color = GetNextRGB($color_getnext, $total);
677 $color_getnext = $color;
678 }
679 $arr["COLOR"] = $color;
680 $arLegend[$key] = $arr;
681 }
682
683 return $arrDays;
684 }
685
686 public static function FindFiles($type = 'country', $path = '/bitrix/modules/statistic/ip2country')
687 {
688 $arFiles = array();
689 $handle = opendir($_SERVER["DOCUMENT_ROOT"].$path);
690 if($handle)
691 {
692 while(false!==($fname = readdir($handle)))
693 {
694 if (is_file($_SERVER["DOCUMENT_ROOT"].$path."/".$fname) && $fname!="." && $fname!="..")
695 {
696 $ext = mb_substr(mb_strtolower($fname), -4);
697 if($ext === ".csv" || $ext === ".txt")
698 {
699 $arFiles[] = $fname;
700 }
701 }
702 }
703 closedir($handle);
704 }
705
706 $arResult = array();
707 foreach($arFiles as $file)
708 {
709 $fp = fopen($_SERVER["DOCUMENT_ROOT"].$path."/".$file, "r");
710 if($fp)
711 {
712 switch(CCity::GetCSVFormatType($fp))
713 {
714 case "MAXMIND-IP-COUNTRY":
715 if($type == 'country')
716 $arResult[] = array(
717 "FILE" => $file,
718 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
719 "SOURCE" => "MAXMIND-IP-COUNTRY",
720 );
721 break;
722 case "IP-TO-COUNTRY":
723 if($type == 'country')
724 $arResult[] = array(
725 "FILE" => $file,
726 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
727 "SOURCE" => "IP-TO-COUNTRY",
728 );
729 break;
730 case "MAXMIND-IP-LOCATION":
731 if($type == 'city')
732 $arResult[] = array(
733 "FILE" => $file,
734 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
735 "SOURCE" => "MAXMIND-IP-LOCATION",
736 );
737 break;
738 case "MAXMIND-CITY-LOCATION":
739 if($type == 'city')
740 $arResult[] = array(
741 "FILE" => $file,
742 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
743 "SOURCE" => "MAXMIND-CITY-LOCATION",
744 );
745 break;
746 case "IPGEOBASE":
747 if($type == 'city')
748 $arResult[] = array(
749 "FILE" => $file,
750 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
751 "SOURCE" => "IPGEOBASE",
752 );
753 break;
754 case "IPGEOBASE2":
755 if($type == 'city')
756 $arResult[] = array(
757 "FILE" => $file,
758 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
759 "SOURCE" => "IPGEOBASE2",
760 );
761 break;
762 case "IPGEOBASE2-CITY":
763 if($type == 'city')
764 $arResult[] = array(
765 "FILE" => $file,
766 "SIZE" => filesize($_SERVER["DOCUMENT_ROOT"].$path."/".$file),
767 "SOURCE" => "IPGEOBASE2-CITY",
768 );
769 break;
770 }
771 fclose($fp);
772 }
773 }
774 return $arResult;
775 }
776
777 public static function GetCSVFormatType($fp)
778 {
779 $line = trim(fgets($fp, 1024), " \t\n\r");
780 if(preg_match('/maxmind/i', $line))
781 $line = trim(fgets($fp, 1024), " \t\n\r");
782
783 if(
784 preg_match('/^"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})","(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})","(\d+)","(\d+)","..",".*?"$/', $line, $match)
785 && (ip2number($match[1]) == $match[3])
786 && (ip2number($match[2]) == $match[4])
787 )
788 {
789 return "MAXMIND-IP-COUNTRY";
790 }
791 elseif(
792 preg_match('/^"\d+","\d+","..","...",".*?"$/', $line)
793 )
794 {
795 return "IP-TO-COUNTRY";
796 }
797 elseif(
798 preg_match('/^startIpNum,endIpNum,locId$/', $line)
799 )
800 {
801 return "MAXMIND-IP-LOCATION";
802 }
803 elseif(
804 preg_match('/^locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode$/', $line)
805 )
806 {
807 return "MAXMIND-CITY-LOCATION";
808 }
809 elseif(
810 preg_match('/^(\d+)\t(\d+)\t(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\t(..)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+)$/', $line, $match)
811 && (ip2number($match[3]) == $match[1])
812 && (ip2number($match[4]) == $match[2])
813 )
814 {
815 return "IPGEOBASE";
816 }
817 elseif(
818 preg_match('/^(\d+)\t(\d+)\t(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\t(..)/', $line, $match)
819 && (ip2number($match[3]) == $match[1])
820 && (ip2number($match[4]) == $match[2])
821 )
822 {
823 return "IPGEOBASE2";
824 }
825 elseif(
826 preg_match('/^\d+\t(.+?)\t(.+?)\t(.+?)\t([0-9.]+?)\t([0-9.]+?)$/', $line)
827 )
828 {
829 return "IPGEOBASE2-CITY";
830 }
831 else
832 {
833 return "UNKNOWN";
834 }
835 }
836
837 public static function ResolveIPRange($newStartIP, $newEndIP)
838 {
839 global $DB;
840
841 $rsConflictIP = $DB->Query("
842 select * from b_stat_city_ip
843 where start_ip between ".$newStartIP." and ".$newEndIP."
844 union
845 select * from b_stat_city_ip
846 where end_ip between ".$newStartIP." and ".$newEndIP."
847 union
848 select * from b_stat_city_ip
849 where START_IP = (
850 SELECT MAX(START_IP)
851 FROM b_stat_city_ip
852 WHERE START_IP <= ".$newStartIP."
853 )
854 AND END_IP >= ".$newStartIP."
855 ");
856
857 $arToUpdate = false;
858 while($arConflictIP = $rsConflictIP->Fetch())
859 {
860 //Exact match
861 if(
862 $arConflictIP["START_IP"] == $newStartIP
863 && $arConflictIP["END_IP"] == $newEndIP
864 )
865 {
866 $arToUpdate = $arConflictIP;
867 }
868 //Left overlap
869 elseif(
870 $newStartIP <= $arConflictIP["START_IP"]
871 && $newEndIP < $arConflictIP["END_IP"]
872 )
873 {
874 //Move conflict to the right
875 $rs = $DB->Query("
876 UPDATE b_stat_city_ip
877 SET START_IP = '".($newEndIP+1)."'
878 WHERE START_IP = '".$arConflictIP["START_IP"]."'
879 ", true);
880 //Delete if there is new conflict raises
881 if(!$rs)
882 $rs = $DB->Query("
883 DELETE FROM b_stat_city_ip
884 WHERE START_IP = '".$arConflictIP["START_IP"]."'
885 ");
886 }
887 //Full overlap
888 elseif(
889 $newStartIP <= $arConflictIP["START_IP"]
890 && $arConflictIP["END_IP"] < $newEndIP
891 )
892 {
893 //Delete
894 $rs = $DB->Query("
895 DELETE FROM b_stat_city_ip
896 WHERE START_IP = '".$arConflictIP["START_IP"]."'
897 ");
898 }
899 //Right overlap
900 elseif(
901 $arConflictIP["START_IP"] < $newStartIP
902 && $arConflictIP["END_IP"] <= $newEndIP
903 )
904 {
905 //Move conflict to the left
906 $rs = $DB->Query("
907 UPDATE b_stat_city_ip
908 SET END_IP = '".($newStartIP-1)."'
909 WHERE START_IP = '".$arConflictIP["START_IP"]."'
910 ");
911 }
912 //Inside
913 else/*if(
914 $arConflictIP["START_IP"] < $newStartIP
915 && $newEndIP < $arConflictIP["END_IP"]
916 )*/
917 {
918 //Split
919 $rs = $DB->Query("
920 UPDATE b_stat_city_ip
921 SET END_IP = '".($newStartIP-1)."'
922 WHERE START_IP = '".$arConflictIP["START_IP"]."'
923 ");
924 $rs = $DB->Query("
925 INSERT INTO b_stat_city_ip
926 (START_IP, END_IP, COUNTRY_ID, CITY_ID)
927 VALUES
928 ('".($newEndIP+1)."', '".$arConflictIP["END_IP"]."', '".$arConflictIP["COUNTRY_ID"]."', '".$arConflictIP["CITY_ID"]."')
929 ", true);
930 //Delete if there is new conflict raises
931 if(!$rs)
932 $rs = $DB->Query("
933 DELETE FROM b_stat_city_ip
934 WHERE START_IP = '".$arConflictIP["START_IP"]."'
935 ");
936 }
937 }
938
939 return $arToUpdate;
940 }
941
942
943 public static function LoadCSV($file_name, $step, &$file_position)
944 {
945 $DB = CDatabase::GetModuleConnection('statistic');
946 $arCache = array();
947 $arLookupCache = array();
948 $arCountryCache = array();
949
950 $fp = fopen($_SERVER["DOCUMENT_ROOT"].$file_name, "rb");
951 if(!$fp)
952 return "Y";
953
954 $file_format = CCity::GetCSVFormatType($fp);
955 $file_position = intval($file_position);
956 fseek($fp, $file_position);
957
958 if($step > 0)
959 $end_time = microtime(true) + $step;
960 else
961 $end_time = 0;
962
963 switch($file_format)
964 {
965 case "MAXMIND-IP-COUNTRY":
966 $delimiter = ",";
967 $char_set = LANG_CHARSET;
968 $table_name = "b_stat_country";
969 $arFieldsMap = array(
970 "ID" => array("key" => true, "index" => 4, "type" => "varchar", "len" => 2, "default" => "NA"),
971 "NAME" => array("index" => 5, "type" => "varchar", "len" => 50, "default" => "N00", "enc" => true),
972 );
973 break;
974 case "IP-TO-COUNTRY":
975 $delimiter = ",";
976 $char_set = LANG_CHARSET;
977 $table_name = "b_stat_country";
978 $arFieldsMap = array(
979 "ID" => array("key" => true, "index" => 2, "type" => "varchar", "len" => 2, "default" => "NA"),
980 "SHORT_NAME" => array("index" => 3, "type" => "varchar", "len" => 3, "default" => "N00"),
981 "NAME" => array("index" => 4, "type" => "varchar", "len" => 50, "enc" => true),
982 );
983 break;
984 case "MAXMIND-IP-LOCATION":
985 $delimiter = ",";
986 $char_set = LANG_CHARSET;
987 $table_name = "b_stat_city_ip";
988 $arFieldsMap = array(
989 "START_IP" => array("key" => true,"index" => 0, "type" => "ipnum"),
990 "END_IP" => array("index" => 1, "type" => "ipnum"),
991 "XML_ID" => array("index" => 2, "type" => "lookup"),
992 "COUNTRY_ID" => array("index" => -1, "type" => "varchar"),
993 "CITY_ID" => array("index" => -2, "type" => "number"),
994 );
995 //Some files need to skip first line
996 if($file_position <= 0)
997 {
998 fgets($fp, 4096);
999 fgets($fp, 4096);
1000 }
1001 break;
1002 case "MAXMIND-CITY-LOCATION":
1003 $delimiter = ",";
1004 $char_set = "iso-8859-1";
1005 $table_name = "b_stat_city";
1006 $arFieldsMap = array(
1007 "COUNTRY_ID" => array("index" => 1, "type" => "varchar", "len" => 2, "default" => "NA"),
1008 "REGION" => array("index" => 2, "type" => "varchar", "len" => 255, "enc" => true),
1009 "NAME" => array("index" => 3, "type" => "varchar", "len" => 255, "enc" => true),
1010 "XML_ID" => array("key" => true, "index" => 0, "type" => "varchar", "len" => 255),
1011 );
1012 //Some files need to skip first line
1013 if($file_position <= 0)
1014 {
1015 fgets($fp, 4096);
1016 fgets($fp, 4096);
1017 }
1018 break;
1019 case "IPGEOBASE":
1020 $delimiter = "\t";
1021 $char_set = "Windows-1251";
1022 $table_name = "b_stat_city_ip";
1023 $arFieldsMap = array(
1024 "START_IP" => array("key" => true,"index" => 0, "type" => "ipnum"),
1025 "END_IP" => array("index" => 1, "type" => "ipnum"),
1026 "COUNTRY_ID" => array("index" => 3, "type" => "varchar", "len" => 2, "default" => "NA"),
1027 "XML_ID" => array("index" => array(3, 4, 5), "type" => "upsert", "enc" => true,
1028 "master" => array(
1029 "COUNTRY_ID" => array("index" => 3, "type" => "varchar", "len" => 2, "default" => "NA"),
1030 "REGION" => array("index" => 5, "type" => "varchar", "len" => 255, "enc" => true),
1031 "NAME" => array("index" => 4, "type" => "varchar", "len" => 255, "enc" => true),
1032 ),
1033 ),
1034 "CITY_ID" => array("index" => -1, "type" => "number"),
1035 );
1036 break;
1037 case "IPGEOBASE2":
1038 $delimiter = "\t";
1039 $char_set = "Windows-1251";
1040 $table_name = "b_stat_city_ip";
1041 $arFieldsMap = array(
1042 "START_IP" => array("key" => true,"index" => 0, "type" => "ipnum"),
1043 "END_IP" => array("index" => 1, "type" => "ipnum"),
1044 "COUNTRY_ID" => array("index" => 3, "type" => "varchar", "len" => 2, "default" => "NA", "update_city" => 4),
1045 "XML_ID" => array("index" => 4, "type" => "lookup"),
1046 "CITY_ID" => array("index" => -1, "type" => "number"),
1047 );
1048 break;
1049 case "IPGEOBASE2-CITY":
1050 $delimiter = "\t";
1051 $char_set = "Windows-1251";
1052 $table_name = "b_stat_city";
1053 $arFieldsMap = array(
1054 "COUNTRY_ID" => array("skip_update" => true, "index" => 100, "type" => "varchar", "len" => 2, "default" => "NA"),
1055 "REGION" => array("index" => 2, "type" => "varchar", "len" => 255, "enc" => true),
1056 "NAME" => array("index" => 1, "type" => "varchar", "len" => 255, "enc" => true),
1057 "XML_ID" => array("key" => true, "index" => 0, "type" => "varchar", "len" => 255),
1058 );
1059 break;
1060 default:
1061 return "Y";
1062 }
1063
1064 $bConv = $char_set != LANG_CHARSET;
1065
1066 while(!feof($fp))
1067 {
1068 //$arr = fgetcsv($fp, 4096, $delimiter);
1069 $arr = fgets($fp, 4096);
1070 if($bConv && preg_match("/[^a-zA-Z0-9 \t\n\r]/", $arr))
1072 $arr = preg_split("/".$delimiter."/u", $arr);
1073
1074 $arAllSQLFields = array();
1075 $arFields = array();
1076 $strUpdate = "";
1077 $strWhere = "";
1078 $strInsert1 = "";
1079 $strInsert2 = "";
1080 $bEmptyKey = false;
1081 foreach($arFieldsMap as $FIELD_ID => $arField)
1082 {
1083 if(is_array($arField["index"]))
1084 {
1085 $value = "";
1086 foreach($arField["index"] as $index)
1087 $value .= trim($arr[$index], "\" \n\r\t");
1088 $value = md5($value);
1089 }
1090 else
1091 {
1092 $value = trim($arr[$arField["index"]], "\" \n\r\t");
1093 }
1094 if(!$value && $arField["default"])
1095 $value = $arField["default"];
1096
1097 if($arField["type"] == "upsert")
1098 {
1099 if(!array_key_exists($value, $arLookupCache))
1100 {
1101 $rs = $DB->Query("SELECT ID as CITY_ID FROM b_stat_city WHERE XML_ID = '".$DB->ForSQL($value)."'");
1102 $ar = $rs->Fetch();
1103 if(!$ar)
1104 {
1105 $arNewMaster = array(
1106 "XML_ID" => $value,
1107 );
1108 foreach($arField["master"] as $MASTER_FIELD_ID => $arMasterField)
1109 {
1110 $m_value = trim($arr[$arMasterField["index"]], "\"");
1111 if(!$m_value && $arMasterField["default"])
1112 $m_value = $arMasterField["default"];
1113 $arNewMaster[$MASTER_FIELD_ID] = $m_value;
1114 }
1115 $ar = array("CITY_ID" => $DB->Add("b_stat_city", $arNewMaster));
1116 }
1117 $arLookupCache[$value] = $ar;
1118 }
1119 foreach($arLookupCache[$value] as $key => $val)
1120 $arr[$arFieldsMap[$key]["index"]] = $val;
1121 continue;
1122 }
1123
1124 if($arField["type"] == "lookup")
1125 {
1126 if(!array_key_exists($value, $arLookupCache))
1127 {
1128 $rs = $DB->Query("SELECT COUNTRY_ID, ID as CITY_ID FROM b_stat_city WHERE XML_ID = '".$DB->ForSQL($value)."'");
1129 $ar = $rs->Fetch();
1130 if(!$ar)
1131 $ar = array("COUNTRY_ID" => "NA", "CITY_ID" => 0);
1132 $arLookupCache[$value] = $ar;
1133 }
1134 foreach($arLookupCache[$value] as $key => $val)
1135 $arr[$arFieldsMap[$key]["index"]] = $val;
1136 continue;
1137 }
1138
1139 if(
1140 $FIELD_ID === "COUNTRY_ID"
1141 && !array_key_exists($value, $arCountryCache)
1142 && $value <> ''
1143 )
1144 {
1145 $cid = $DB->ForSQL($value, 2);
1146 $rs = $DB->Query("SELECT ID FROM b_stat_country WHERE ID = '".$cid."'");
1147 if(!$rs->Fetch())
1148 $DB->Query("insert into b_stat_country (ID) values ('".$cid."')");
1149 $arCountryCache[$value] = true;
1150 }
1151
1152 if(
1153 $FIELD_ID === "COUNTRY_ID"
1154 && isset($arField["update_city"])
1155 && $value <> ''
1156 )
1157 {
1158 $city_id = $DB->ForSQL(trim($arr[$arField["update_city"]], "\" \n\r\t"));
1159 $cid = $DB->ForSQL($value, 2);
1160 $rs = $DB->Query("UPDATE b_stat_city SET COUNTRY_ID = '".$cid."' WHERE XML_ID = '".$city_id."'");
1161 }
1162
1163 switch($arField["type"])
1164 {
1165 case "varchar":
1166 $sql_value = "'".$DB->ForSQL($value, $arField["len"])."'";
1167 break;
1168 case "ipnum":
1169 case "number":
1170 $sql_value = preg_replace("/[^0-9]/", "", $value);
1171 break;
1172 default:
1173 $sql_value = "'".$DB->ForSQL($value)."'";
1174 break;
1175 }
1176
1177 $arAllSQLFields[$FIELD_ID] = $sql_value;
1178
1179 if($arField["key"])
1180 {
1181 if($value)
1182 {
1183 if($strWhere)
1184 $strWhere .= " AND ";
1185 $strWhere .= $FIELD_ID." = ".$sql_value;
1186 }
1187 else
1188 {
1189 $bEmptyKey = true;
1190 }
1191 }
1192 else
1193 {
1194 $arFields[$FIELD_ID] = $value;
1195 if($strUpdate)
1196 $strUpdate .= ", ";
1197 $strUpdate .= $FIELD_ID." = ".$sql_value;
1198 }
1199
1200 if($strInsert1)
1201 $strInsert1 .= ", ";
1202 $strInsert1 .= $FIELD_ID;
1203
1204 if($strInsert2)
1205 $strInsert2 .= ", ";
1206 $strInsert2 .= $sql_value;
1207 }
1208
1209 if(!$bEmptyKey && $strWhere && $strUpdate && !array_key_exists($strWhere, $arCache))
1210 {
1211 if($table_name == "b_stat_city_ip" && $arAllSQLFields["START_IP"] && $arAllSQLFields["END_IP"])
1212 {
1213 $arToUpdate = CCity::ResolveIPRange($arAllSQLFields["START_IP"], $arAllSQLFields["END_IP"]);
1214 }
1215 else
1216 {
1217 $rs = $DB->Query("SELECT * FROM $table_name WHERE $strWhere");
1218 $arToUpdate = $rs->Fetch();
1219 }
1220 if($arToUpdate)
1221 {
1222 $bNeedUpdate = false;
1223 foreach($arFields as $UPD_FIELD_ID => $upd_value)
1224 {
1225 if(!isset($arFieldsMap[$UPD_FIELD_ID]["skip_update"]))
1226 {
1227 if($upd_value != $arToUpdate[$UPD_FIELD_ID])
1228 {
1229 $bNeedUpdate = true;
1230 break;
1231 }
1232 }
1233 }
1234 if($bNeedUpdate)
1235 $DB->Query("UPDATE $table_name SET $strUpdate WHERE $strWhere");
1236 }
1237 else
1238 {
1239 $DB->Query("INSERT INTO $table_name ($strInsert1) VALUES ($strInsert2)");
1240 }
1241 $arCache[$strWhere] = true;
1242 }
1243
1244 if($end_time && microtime(true) > $end_time)
1245 {
1246 $file_position = ftell($fp);
1247 return "N";
1248 }
1249 }
1250 $file_position = ftell($fp);
1251 return "Y";
1252 }
1253}
$path
Определения access_edit.php:21
$type
Определения options.php:106
$arResult
Определения generate_coupon.php:16
static convertEncoding($data, $charsetFrom, $charsetTo)
Определения encoding.php:17
SetFields($arFields)
Определения sqlwhere.php:239
Определения city.php:240
Recode($str)
Определения city.php:455
__construct($dbRecord="")
Определения city.php:249
GetCityID()
Определения city.php:464
static GetCSVFormatType($fp)
Определения city.php:777
static ResolveIPRange($newStartIP, $newEndIP)
Определения city.php:837
static GetGraphArray($arFilter, &$arLegend, $sort=false, $top=0)
Определения city.php:519
GetFullInfo()
Определения city.php:411
GetCountryCode()
Определения city.php:445
static FindFiles($type='country', $path='/bitrix/modules/statistic/ip2country')
Определения city.php:686
static LoadCSV($file_name, $step, &$file_position)
Определения city.php:943
static GetHandler()
Определения city.php:417
static GetList($arOrder=array(), $arFilter=array())
Определения city.php:292
ForSQL()
Определения city.php:400
Определения city.php:10
$city_id
Определения city.php:19
static OnCityLookup($arDBRecord=array())
Определения city.php:49
ArrayForDB()
Определения city.php:57
$is_installed
Определения city.php:11
$country_full_name
Определения city.php:16
$country_short_name
Определения city.php:15
__construct($arDBRecord=array())
Определения city.php:25
GetFullInfo()
Определения city.php:74
$city_name
Определения city.php:18
$ip_number
Определения city.php:13
IsInstalled()
Определения city.php:122
$region_name
Определения city.php:17
$country_code
Определения city.php:14
$ip_addr
Определения city.php:12
Lookup()
Определения city.php:130
$charset
Определения city.php:20
GetDescription()
Определения city.php:108
Определения sqlwhere.php:1359
Определения city.php:139
GetList($arOrder=array(), $arFilter=array())
Определения city.php:145
static Sort(&$ar, $field)
Определения stat_tools.php:1094
$str
Определения commerceml2.php:63
$arFields
Определения dblapprove.php:5
$arr
Определения file_new.php:624
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
GetFilterSqlSearch($arSqlSearch=array(), $FilterLogic="FILTER_logic")
Определения filter_tools.php:397
GetFilterQuery($field, $val, $procent="Y", $ex_sep=array(), $clob="N", $div_fields="Y", $clob_upper="N")
Определения filter_tools.php:383
$handle
Определения include.php:55
if($ajaxMode) $ID
Определения get_user.php:27
ip2number($dotted)
Определения ip_tools.php:240
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DB
Определения cron_frame.php:29
GetNextRGB($base_color, $total)
Определения img.php:93
const LANG_CHARSET
Определения include.php:65
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
CheckDateTime($datetime, $format=false)
Определения tools.php:398
$arFiles
Определения options.php:60
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$ar
Определения options.php:199
if(empty($signedUserToken)) $key
Определения quickway.php:257
$i
Определения factura.php:643
</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."%"
Определения waybill.php:936
$val
Определения options.php:1793
$rs
Определения action.php:82
$arFilter
Определения user_search.php:106