1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
update_functions.php
См. документацию.
1<?
2// GetUpdatedFiles("/updates/forum", $pFiles);
3function GetUpdatedFiles($path, &$pFiles, $kill_prefix="")
4{
5 global $DOCUMENT_ROOT;
6
7 $arDirs = Array();
8
9 $path = $path[strlen($path)-1]=="/" ? substr($path, 0, strlen($path)-1) : $path;
10// $abs_path = $DOCUMENT_ROOT.$path;
11
12 if (!file_exists($path) || !is_dir($path))
13 return False;
14
15 $handle = @opendir($path);
16 $file = @readdir($handle); // .
17 $file = @readdir($handle); // ..
18 while ($file = @readdir($handle))
19 {
20 $strFile = $path."/".$file;
21 if (is_dir($path."/".$file))
22 {
23 $arDirs[] = $strFile;
24 }
25 else
26 {
27 if ($kill_prefix == substr($strFile, 0, strlen($kill_prefix)))
28 {
29 $strFile = substr($strFile, strlen($kill_prefix));
30 }
31 if (strtoupper(substr($strFile, 0, 13))!="/DESCRIPTION.")
32 {
33 $pFiles[] = $strFile;
34 }
35 }
36 }
37 closedir($handle);
38
39 for ($i=0; $i<count($arDirs); $i++)
40 {
41 GetUpdatedFiles($arDirs[$i], $pFiles, $kill_prefix);
42 }
43}
44
45function getHTTPPage($page, $strVars, &$strError)
46{
47 global $SERVER_NAME, $CONNECTION_OPENED, $FP;
48
49 $ServerIP = COption::GetOptionString("main", "update_site", "www.office.bitrix.ru");
50 $ServerPort = "80";
51
52 if ($CONNECTION_OPENED!="Y" || !$FP)
53 {
54 $FP = fsockopen($ServerIP, $ServerPort, &$errno, &$errstr, 120);
55 $CONNECTION_OPENED = "Y";
56 }
57
58 if ($FP)
59 {
60 $strRequest = "POST /updates/$page HTTP/1.0\r\n";
61 $strRequest.= "User-Agent: BitrixSMUpdater\r\n";
62 $strRequest.= "Accept: */*\r\n";
63 $strRequest.= "Host: $ServerIP\r\n";
64 $strRequest.= "Accept-Language: en\r\n";
65 $strRequest.= "Content-type: application/x-www-form-urlencoded\r\n";
66 $strRequest.= "Content-length: ".strlen($strVars)."\r\n\r\n";
67 $strRequest.= "$strVars";
68 $strRequest.= "\r\n";
69
70 fputs($FP, $strRequest);
71
72 $strAll = "";
73 while ($line = fgets($FP, 4096))
74 {
75 $strAll .= $line;
76 }
77
78 $arAll = explode("\r\n", $strAll);
79 $is_headers = 1;
80 $content = "";
81 for ($i = 0; $i < count($arAll); $i++ )
82 {
83 $input_line = "";
84 $input_line = Trim($arAll[$i]);
85 if ($is_headers == 0 && strlen($input_line)>0)
86 {
87 $content .= $input_line;
88 }
89 if ($is_headers == 1 && $input_line == "")
90 {
91 $is_headers = 0;
92 }
93 }
94 $CONNECTION_OPENED = "N";
95 fclose($FP);
96 }
97 else
98 {
99 $content = "";
100 $strError = "Error ".$errno.": ".$errstr;
101 if (IntVal($errno)<=0) $strError = "Connection failed. ";
102 }
103 return $content;
104}
105
107{
108 global $CONNECTION_OPENED, $FP;
109 if ($CONNECTION_OPENED=="Y" && $FP)
110 {
111 $CONNECTION_OPENED = "N";
112 fclose($FP);
113 }
114}
115
116function xmlize($data)
117{
118 $data = trim($data);
119 $vals = $index = $array = array();
120 $parser = xml_parser_create();
121 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
122 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
123 xml_parse_into_struct($parser, $data, $vals, $index);
124 xml_parser_free($parser);
125
126 $i = 0;
127
128 $tagname = $vals[$i]['tag'];
129 if ( isset ($vals[$i]['attributes'] ) )
130 {
131 $array[$tagname]['@'] = $vals[$i]['attributes'];
132 } else {
133 $array[$tagname]['@'] = array();
134 }
135
136 $array[$tagname]["#"] = xml_depth($vals, $i);
137
138 return $array;
139}
140
141function xml_depth($vals, &$i)
142{
143 $children = array();
144
145 if ( isset($vals[$i]['value']) )
146 {
147 array_push($children, $vals[$i]['value']);
148 }
149
150 while (++$i < count($vals)) {
151
152 switch ($vals[$i]['type']) {
153
154 case 'open':
155
156 if ( isset ( $vals[$i]['tag'] ) )
157 {
158 $tagname = $vals[$i]['tag'];
159 } else {
160 $tagname = '';
161 }
162
163 if ( isset ( $children[$tagname] ) )
164 {
165 $size = sizeof($children[$tagname]);
166 } else {
167 $size = 0;
168 }
169
170 if ( isset ( $vals[$i]['attributes'] ) ) {
171 $children[$tagname][$size]['@'] = $vals[$i]["attributes"];
172 }
173
174 $children[$tagname][$size]['#'] = xml_depth($vals, $i);
175
176 break;
177
178 case 'cdata':
179 array_push($children, $vals[$i]['value']);
180 break;
181
182 case 'complete':
183 $tagname = $vals[$i]['tag'];
184
185 if( isset ($children[$tagname]) )
186 {
187 $size = sizeof($children[$tagname]);
188 } else {
189 $size = 0;
190 }
191
192 if( isset ( $vals[$i]['value'] ) )
193 {
194 $children[$tagname][$size]["#"] = $vals[$i]['value'];
195 } else {
196 $children[$tagname][$size]["#"] = '';
197 }
198
199 if ( isset ($vals[$i]['attributes']) ) {
200 $children[$tagname][$size]['@']
201 = $vals[$i]['attributes'];
202 }
203
204 break;
205
206 case 'close':
207 return $children;
208 break;
209 }
210
211 }
212
213 return $children;
214}
215?>
$path
Определения access_edit.php:21
$strAll
Определения yandex.php:60
$children
Определения sync.php:12
$content
Определения commerceml.php:144
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$handle
Определения include.php:55
$strError
Определения options_user_settings.php:4
$DOCUMENT_ROOT
Определения cron_frame.php:10
if(! $ar_profile) $strFile
Определения cron_frame.php:59
$i
Определения factura.php:643
$page
Определения order_form.php:33
</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
$arDirs
Определения translate_tools.php:10
CloseConnection()
Определения update_functions.php:106
GetUpdatedFiles($path, &$pFiles, $kill_prefix="")
Определения update_functions.php:3
xml_depth($vals, &$i)
Определения update_functions.php:141
getHTTPPage($page, $strVars, &$strError)
Определения update_functions.php:45
xmlize($data)
Определения update_functions.php:116