12 $len = mb_strlen(
$str);
13 for (
$i = 0;
$i < $len;
$i++)
15 if (ord(mb_substr(
$str,
$i, 1)) >> 7)
30 $maxl = intval((76 - mb_strlen($charset) + 7) * 0.4);
34 $len = mb_strlen(
$text);
35 for (
$i = 0;
$i < $len;
$i += $maxl)
41 $res .=
'=?' . $charset .
'?B?' . base64_encode(mb_substr(
$text,
$i, $maxl)) .
'?=';
48 return '=?' . $charset .
'?B?' . base64_encode(
$text) .
'?=';
68 return '=?' . $charset .
'?B?' . base64_encode(substr(
$text, 0,
$i)) .
'?=' . substr(
$text,
$i);
82 if (array_key_exists($src, $this->aMatches))
84 $uid = $this->aMatches[$src][
'ID'];
88 $filePath =
$io->GetPhysicalName(
$_SERVER[
'DOCUMENT_ROOT'] . $src);
89 if (!file_exists($filePath))
95 $this->maxFileSize > 0
96 && filesize($filePath) > $this->maxFileSize
102 $image = new \Bitrix\Main\File\Image($filePath);
103 $info = $image->getInfo();
109 if (function_exists(
'image_type_to_mime_type'))
118 $uid = uniqid(md5($src));
120 $this->aMatches[$src] = [
133 if ($this->pcre_backtrack_limit ===
false)
135 $this->pcre_backtrack_limit = intval(ini_get(
'pcre.backtrack_limit'));
137 $text_len = strlen(
$text);
139 if ($this->pcre_backtrack_limit < $text_len)
141 @ini_set(
'pcre.backtrack_limit', $text_len);
142 $this->pcre_backtrack_limit = intval(ini_get(
'pcre.backtrack_limit'));
145 if (!isset($this->server_name))
147 $this->server_name = COption::GetOptionString(
'main',
'server_name',
'');
150 if ($this->server_name !=
'')
152 $text = preg_replace(
153 "/(<a\\s[^>]*?(?<=\\s)href\\s*=\\s*)([\"'])(\\/.*?)(\\2)(\\s.+?>|\\s*>)/is",
154 "\\1\\2http://" . $this->server_name .
"\\3\\4\\5",
164 if ($this->pcre_backtrack_limit ===
false)
166 $this->pcre_backtrack_limit = intval(ini_get(
'pcre.backtrack_limit'));
168 $text_len = strlen(
$text);
170 if ($this->pcre_backtrack_limit < $text_len)
172 @ini_set(
'pcre.backtrack_limit', $text_len);
173 $this->pcre_backtrack_limit = intval(ini_get(
'pcre.backtrack_limit'));
175 $this->maxFileSize = intval(COption::GetOptionInt(
'subscribe',
'max_file_size'));
176 $this->aMatches = [];
177 $text = preg_replace_callback(
178 "/(<img\\s[^>]*?(?<=\\s)src\\s*=\\s*)([\"']?)(.*?)(\\2)(\\s.+?>|\\s*>)/is",
179 [$this,
'__replace_img'],
182 $text = preg_replace_callback(
183 "/(background-image\\s*:\\s*url\\s*\\()([\"']?)(.*?)(\\2)(\\s*\\);)/is",
184 [$this,
'__replace_img'],
187 $text = preg_replace_callback(
188 "/(<td\\s[^>]*?(?<=\\s)background\\s*=\\s*)([\"']?)(.*?)(\\2)(\\s.+?>|\\s*>)/is",
189 [$this,
'__replace_img'],
192 $text = preg_replace_callback(
193 "/(<table\\s[^>]*?(?<=\\s)background\\s*=\\s*)([\"']?)(.*?)(\\2)(\\s.+?>|\\s*>)/is",
194 [$this,
'__replace_img'],
206 4 =>
'application/x-shockwave-flash',
211 9 =>
'application/octet-stream',
213 11 =>
'application/octet-stream',
214 12 =>
'application/octet-stream',
215 13 =>
'application/x-shockwave-flash',
217 15 =>
'image/vnd.wap.wbmp',
220 if (isset($aTypes[
$type]))
222 return $aTypes[
$type];
226 return 'application/octet-stream';
$_SERVER["DOCUMENT_ROOT"]
if($NS['step']==6) if( $NS[ 'step']==7) if(COption::GetOptionInt('main', 'disk_space', 0) > 0) $info
bx_basename($path, $ext="")