1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
filter_dictionary.php
См. документацию.
1<?php
2
3##############################################
4# Bitrix Site Manager Forum #
5# Copyright (c) 2002-2009 Bitrix #
6# https://www.bitrixsoft.com #
7# mailto:admin@bitrixsoft.com #
8##############################################
9
10IncludeModuleLangFile(__FILE__);
11
13{
14 public static function CheckFields($arFields = array(), $ACTION = "ADD")
15 {
16 global $APPLICATION, $DB;
17 $strError = "";
18
19 if ((!is_set($arFields, "TITLE")) || (trim($arFields["TITLE"]) == ''))
20 $strError .= GetMessage("FLT_ERR_TITLE_MISSED");
21 if ($ACTION != "UPDATE" && empty($arFields["TYPE"]))
22 $strError .= GetMessage("FLT_ERR_TYPE_MISSED");
23 if ($strError == '')
24 return true;
25 $APPLICATION->ThrowException($strError);
26 return false;
27 }
28
29 public static function Add($arFields)
30 {
31 global $DB;
32 $arFields["TITLE"] = trim($arFields["TITLE"]);
33 $arFields["TYPE"] = mb_strtoupper(trim($arFields["TYPE"]));
34 if ($arFields["TYPE"] != "T")
35 $arFields["TYPE"] = "W";
37 return $DB->Add("b_forum_dictionary", $arFields);
38 return false;
39 }
40
41 public static function Update($ID, $arFields)
42 {
43 global $DB;
44 $ID = intval($ID);
45 if(is_set($arFields, "TITLE"))
46 $arFields["TITLE"]=trim($arFields["TITLE"]);
47 if(is_set($arFields, "TYPE"))
48 {
49 $arFields["TYPE"] = mb_strtoupper(trim($arFields["TYPE"]));
50 if ($arFields["TYPE"] != "T")
51 $arFields["TYPE"] = "W";
52 }
53 if (($ID>0) && (CFilterDictionary::CheckFields($arFields, "UPDATE")))
54 {
55 $strUpdate = $DB->PrepareUpdate("b_forum_dictionary", $arFields);
56 $res = $DB->Query("UPDATE b_forum_dictionary SET ".$strUpdate." WHERE ID=".$ID);
57 return $res;
58 }
59 return false;
60 }
61
62 public static function Delete($ID)
63 {
64 global $DB, $USER;
65
66 $ID = intval($ID);
67 $Dictionary = CFilterDictionary::GetList(array(), array("ID"=>$ID));
68 $Dictionary = $Dictionary->Fetch();
69 $DB->StartTransaction();
70 if ($Dictionary["TYPE"] == "T")
71 {
72 $res = $DB->Query("DELETE FROM b_forum_letter WHERE DICTIONARY_ID=".$ID);
73 }
74 else
75 {
76 $res = $DB->Query("DELETE FROM b_forum_filter WHERE DICTIONARY_ID=".$ID);
77 }
78 if ($res)
79 {
80 $res = $DB->Query("DELETE FROM b_forum_dictionary WHERE ID=".$ID);
81 }
82 if ($res)
83 {
84 $DB->Commit();
85 }
86 else
87 {
88 $DB->Rollback();
89 }
90 return $res;
91 }
92
93 public static function GetFilterOperation($key)
94 {
95 $strNegative = "N";
96 if (mb_substr($key, 0, 1) == "!")
97 {
98 $key = mb_substr($key, 1);
99 $strNegative = "Y";
100 }
101
102 if (mb_substr($key, 0, 2) == ">=")
103 {
104 $key = mb_substr($key, 2);
105 $strOperation = ">=";
106 }
107 elseif (mb_substr($key, 0, 1) == ">")
108 {
109 $key = mb_substr($key, 1);
110 $strOperation = ">";
111 }
112 elseif (mb_substr($key, 0, 2) == "<=")
113 {
114 $key = mb_substr($key, 2);
115 $strOperation = "<=";
116 }
117 elseif (mb_substr($key, 0, 1) == "<")
118 {
119 $key = mb_substr($key, 1);
120 $strOperation = "<";
121 }
122 elseif (mb_substr($key, 0, 1) == "@")
123 {
124 $key = mb_substr($key, 1);
125 $strOperation = "IN";
126 }
127 elseif (mb_substr($key, 0, 1) == "%")
128 {
129 $key = mb_substr($key, 1);
130 $strOperation = "LIKE";
131 }
132 else
133 {
134 $strOperation = "=";
135 }
136 return array("FIELD"=>$key, "NEGATIVE"=>$strNegative, "OPERATION"=>$strOperation);
137 }
138}
139
141{
142 public static function CheckFields($arFields = array())
143 {
144 global $APPLICATION, $DB;
145 $strError = "";
146
147 if ((!is_set($arFields, "LETTER")) || (trim($arFields["LETTER"]) == ''))
148 $strError .= GetMessage("FLT_ERR_SIMBOL_MISSED");
149 if ((!is_set($arFields, "DICTIONARY_ID")) || (intval(trim($arFields["DICTIONARY_ID"]))<=0))
150 $strError .= GetMessage("FLT_ERR_DICTIONARY_MISSED");
151 if ($strError == '')
152 return true;
153 $APPLICATION->ThrowException($strError);
154 return false;
155 }
156
157 public static function Add($arFields)
158 {
159 global $DB, $APPLICATION;
160 $arFields["LETTER"] = trim($arFields["LETTER"]);
161 $arFields["REPLACEMENT"] = trim($arFields["REPLACEMENT"]);
162 $arFields["DICTIONARY_ID"] = intval($arFields["DICTIONARY_ID"]);
163 $db_res = CFilterLetter::GetList(array(), array("DICTIONARY_ID"=>$arFields["DICTIONARY_ID"], "LETTER"=>trim($arFields["LETTER"])));
164 $db_res = $db_res->Fetch();
165 if (!$db_res || $db_res["ID"]<=0)
166 {
168 return $DB->Add("b_forum_letter", $arFields);
169 }
170 else
171 $APPLICATION->ThrowException(GetMessage("FLT_ALREADY_EXIST"));
172 return false;
173 }
174
175 public static function Update($ID, $arFields)
176 {
177 global $DB, $APPLICATION;
178 $ID = intval($ID);
179 $letter = false; $dictionary_id = false; $update = false;
180 if (is_set($arFields, "LETTER"))
181 {
182 $arFields["LETTER"] = trim($arFields["LETTER"]);
183 $letter = true;
184 }
185 if (is_set($arFields, "REPLACEMENT"))
186 $arFields["REPLACEMENT"] = trim($arFields["REPLACEMENT"]);
187 if (is_set($arFields, "DICTIONARY_ID"))
188 {
189 $arFields["DICTIONARY_ID"] = intval($arFields["DICTIONARY_ID"]);
190 $dictionary_id = true;
191 }
192
193 if ($letter || $dictionary_id)
194 {
196 $request = array();
197 if ($letter && !$dictionary_id)
198 $request = array("DICTIONARY_ID"=>$ID1["DICTIONARY_ID"], "LETTER"=>$arFields["LETTER"]);
199 elseif (!$letter && $dictionary_id)
200 $request = array("DICTIONARY_ID"=>$arFields["DICTIONARY_ID"], "LETTER"=>$ID1["LETTER"]);
201 elseif ($letter && $dictionary_id)
202 $request = array("DICTIONARY_ID"=>$arFields["DICTIONARY_ID"], "LETTER"=>$arFields["LETTER"]);
204 $db_res = $db_res->Fetch();
205 if ($db_res === false || isset($db_res["ID"]) && ((intval($db_res["ID"])<=0) || (intval($db_res["ID"]) == $ID)))
206 $update = true;
207 }
208 if (!$update)
209 $APPLICATION->ThrowException(GetMessage("FLT_ALREADY_EXIST"));
210 if (($ID>0) && (CFilterLetter::CheckFields($arFields)) && ($update))
211 {
212 $strUpdate = $DB->PrepareUpdate("b_forum_letter", $arFields);
213 $res = $DB->Query("UPDATE b_forum_letter SET ".$strUpdate." WHERE ID=".$ID);
214 return $res;
215 }
216 return false;
217 }
218
219 public static function Delete($ID)
220 {
221 global $DB, $USER;
222 $ID = intval($ID);
223 return $DB->Query("DELETE FROM b_forum_letter WHERE ID=".$ID);
224 }
225
226 public static function GetByID($ID)
227 {
228 $res = array();
230 if ($res)
231 return $res->GetNext();
232 else
233 return false;
234 }
235}
236
238{
239 public static function CheckPattern($sPattern, &$sError)
240 {
241 $arError = array();
242 $sDelimiter = mb_substr($sPattern, 0, 1);
243 if ($sDelimiter !== '/') // security restriction
244 $arError[] = array(
245 "code" => "bad_delimiter",
246 "title" => GetMessage("FLT_ERR_BAD_DELIMITER"));
247 // Check Modificators
248 $sModificators = strrchr(mb_substr($sPattern, 1), $sDelimiter);
249 if ($sModificators && mb_strpos($sModificators, "e") !== false)
250 $arError[] = array(
251 "code" => "bad_modificator",
252 "title" => GetMessage("FLT_ERR_BAD_MODIFICATOR"));
253 ob_end_clean();
254 ob_start();
255 $arTest = array();
256 $sTest = preg_match($sPattern, "test string", $arTest);
257 $contents = ob_get_contents();
258 ob_end_clean();
259 if (!empty($contents))
260 $arError[] = array(
261 "code" => "bad_pattern",
262 "title" => GetMessage("FLT_ERR_BAD_PATTERN"));
263 if (empty($arError))
264 return true;
265 $sError = ForumShowError($arError);
266 return false;
267 }
268
269 public static function CheckFields($action = "INSERT", $ID = false, $arFields = array())
270 {
271 global $APPLICATION, $DB;
272 $arError = array();
273 $sError = '';
274 $ID = intval($ID);
275
276 if ($action == "INSERT")
277 {
278 if ($action == "INSERT" && trim($arFields["WORDS"]) == '' && trim($arFields["PATTERN"]) == '')
279 $arError[] = array(
280 "code" => "empty_data",
281 "title" => GetMessage("FLT_ERR_DICT_PATT_MISSED"));
282 if (intval($arFields["DICTIONARY_ID"]) <= 0)
283 $arError[] = array(
284 "code" => "bad_dictionary_id",
285 "title" => GetMessage("FLT_ERR_DICTIONARY_MISSED"));
286 }
287 else
288 {
289 if ($ID <= 0)
290 $arError = array(
291 "code" => "empty_id",
292 "title" => GetMessage("FLT_ERR_ID_NOT_ENTER"));
293 if (is_set($arFields, "DICTIONARY_ID") && intval($arFields["DICTIONARY_ID"]) <= 0)
294 $arError[] = array(
295 "code" => "bad_dictionary_id",
296 "title" => GetMessage("FLT_ERR_DICTIONARY_MISSED"));
297 }
298 if (!empty($arFields["PATTERN"]) && !CFilterUnquotableWords::CheckPattern($arFields["PATTERN"], $sError))
299 $arError[] = array(
300 "code" => "bad_pattern",
301 "title" => $sError);
302 if (trim($arFields["WORDS"]) <> '')
303 {
304 $db_res = CFilterUnquotableWords::GetList(array(), array("WORDS" => trim($arFields["WORDS"])));
305 if ($db_res && $res = $db_res->Fetch())
306 {
307 if ($action == "INSERT" || ($action=="UPDATE" && intval($res["ID"]) != $ID))
308 {
309 $arError[] = array(
310 "code" => "already_exists",
311 "title" => GetMessage("FLT_ALREADY_EXIST"));
312 }
313 }
314 }
315 if (empty($arError))
316 return true;
317 $APPLICATION->ThrowException(ForumShowError($arError));
318 return false;
319 }
320
321 public static function Add($arFields)
322 {
323 global $DB;
324 if(CACHED_b_forum_filter !== false)
325 $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_filter");
326 $arFields["DICTIONARY_ID"] = intval($arFields["DICTIONARY_ID"]);
327 $arFields["PATTERN_CREATE"] = mb_strtoupper(trim($arFields["PATTERN_CREATE"]));
328 $arFields["PATTERN_CREATE"] = in_array($arFields["PATTERN_CREATE"], array("WORDS", "PTTRN", "TRNSL")) ? $arFields["PATTERN_CREATE"] : false;
329 if (!$arFields["PATTERN_CREATE"])
330 $arFields["PATTERN_CREATE"] = ($arFields["WORDS"] ? "TRNSL" : "PTTRN");
331
332 $arFields["WORDS"] = trim($arFields["PATTERN_CREATE"] == "TRNSL"? mb_strtolower($arFields["WORDS"]) : $arFields["WORDS"]);
333 $arFields["PATTERN"] = trim($arFields["PATTERN"]);
334 $arFields["REPLACEMENT"] = trim($arFields["REPLACEMENT"]);
335 $arFields["DESCRIPTION"] = trim($arFields["DESCRIPTION"]);
336 $arFields["USE_IT"] = ($arFields["USE_IT"] == "Y" ? "Y" : "N");
338 return $DB->Add("b_forum_filter", $arFields, Array("PATTERN", "DESCRIPTION"));
339 return false;
340 }
341
342 public static function Update($ID, $arFields)
343 {
344 global $DB;
345 $ID = intval($ID);
346 if(CACHED_b_forum_filter !== false)
347 $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_filter");
348 if(is_set($arFields, "DICTIONARY_ID"))
349 $arFields["DICTIONARY_ID"] = intval($arFields["DICTIONARY_ID"]);
350 if(is_set($arFields, "PATTERN_CREATE"))
351 {
352 $arFields["PATTERN_CREATE"] = mb_strtoupper(trim($arFields["PATTERN_CREATE"]));
353 if ($arFields["PATTERN_CREATE"] == '')
354 {
355 if ($arFields["WORDS"])
356 $arFields["PATTERN_CREATE"] = "TRNSL";
357 elseif($arFields["PATTERN_CREATE"])
358 $arFields["PATTERN_CREATE"] = "PTTRN";
359 }
360 }
361 if(is_set($arFields, "WORDS"))
362 {
363 $arFields["WORDS"] = trim($arFields["WORDS"]);
364 if ($arFields["PATTERN_CREATE"] == "TRNSL")
365 $arFields["WORDS"] = mb_strtolower($arFields["WORDS"]);
366 }
367
368 if(is_set($arFields, "PATTERN"))
369 $arFields["PATTERN"] = trim($arFields["PATTERN"]);
370 if(is_set($arFields, "REPLACEMENT"))
371 $arFields["REPLACEMENT"] = trim($arFields["REPLACEMENT"]);
372 if(is_set($arFields, "DESCRIPTION"))
373 $arFields["DESCRIPTION"] = trim($arFields["DESCRIPTION"]);
374 if(is_set($arFields, "USE_IT") && $arFields["USE_IT"]!="Y")
375 $arFields["USE_IT"]="N";
376
377 if (($ID>0) && (CFilterUnquotableWords::CheckFields("UPDATE", $ID, $arFields)))
378 {
379 $strUpdate = $DB->PrepareUpdate("b_forum_filter", $arFields);
380 $strSql = "UPDATE b_forum_filter SET ".$strUpdate." WHERE ID=".$ID;
381 $res = $DB->QueryBind($strSql, Array("PATTERN"=>$arFields["PATTERN"], "DESCRIPTION"=>$arFields["DESCRIPTION"]));
382 return $res;
383 }
384 return false;
385 }
386
387 public static function Delete($ID)
388 {
389 global $DB, $USER;
390 $ID = intval($ID);
391 if(CACHED_b_forum_filter !== false)
392 $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_filter");
393 return $DB->Query("DELETE FROM b_forum_filter WHERE ID=".$ID);
394 }
395
396 public static function GetById($ID)
397 {
398 $ID = intval($ID);
400 return $res->Fetch();
401 }
402
403 public static function GetFilterOperation($key)
404 {
405 $strNegative = "N";
406 if (mb_substr($key, 0, 1) == "!")
407 {
408 $key = mb_substr($key, 1);
409 $strNegative = "Y";
410 }
411
412 if (mb_substr($key, 0, 2) == ">=")
413 {
414 $key = mb_substr($key, 2);
415 $strOperation = ">=";
416 }
417 elseif (mb_substr($key, 0, 1) == ">")
418 {
419 $key = mb_substr($key, 1);
420 $strOperation = ">";
421 }
422 elseif (mb_substr($key, 0, 2) == "<=")
423 {
424 $key = mb_substr($key, 2);
425 $strOperation = "<=";
426 }
427 elseif (mb_substr($key, 0, 1) == "<")
428 {
429 $key = mb_substr($key, 1);
430 $strOperation = "<";
431 }
432 elseif (mb_substr($key, 0, 1) == "@")
433 {
434 $key = mb_substr($key, 1);
435 $strOperation = "IN";
436 }
437 elseif (mb_substr($key, 0, 1) == "%")
438 {
439 $key = mb_substr($key, 1);
440 $strOperation = "LIKE";
441 }
442 else
443 {
444 $strOperation = "=";
445 }
446 return array("FIELD"=>$key, "NEGATIVE"=>$strNegative, "OPERATION"=>$strOperation);
447 }
448
449 public static function GenPattern($ID=false, $DICTIONARY_ID_T=0)
450 {
451 $DICTIONARY_ID_T = intval($DICTIONARY_ID_T);
452 if (!$DICTIONARY_ID_T)
453 $DICTIONARY_ID_T = (COption::GetOptionString("forum", "FILTER_DICT_T", '', LANGUAGE_ID));
454 $ID = intval($ID);
455 if ($ID):
456 $res = CFilterUnquotableWords::GetByID($ID);
457 if ((trim($res["WORDS"]) <> '') && ($res["PATTERN_CREATE"] == "TRNSL")):
458 $pattern = CFilterUnquotableWords::CreatePattern(trim($res["WORDS"]), $DICTIONARY_ID_T);
460 return true;
461 endif;
462 endif;
463 return false;
464 }
465
466 public static function GenPatternAll($DICTIONARY_ID_W=0, $DICTIONARY_ID_T=0)
467 {
468 $DICTIONARY_ID_W = intval($DICTIONARY_ID_W);
469 $DICTIONARY_ID_T = intval($DICTIONARY_ID_T);
470 if (!$DICTIONARY_ID_W)
471 $DICTIONARY_ID_W = (COption::GetOptionString("forum", "FILTER_DICT_W", '', LANGUAGE_ID));
472 if (!$DICTIONARY_ID_T)
473 $DICTIONARY_ID_T = (COption::GetOptionString("forum", "FILTER_DICT_T", '', LANGUAGE_ID));
474 if ($DICTIONARY_ID_W):
475 $db_res = CFilterUnquotableWords::GetList(array(), array("DICTIONARY_ID"=>$DICTIONARY_ID_W));
476 while ($res = $db_res->Fetch()):
477 if ((trim($res["WORDS"]) <> '') && ($res["PATTERN_CREATE"] == "TRNSL")):
478 $pattern = CFilterUnquotableWords::CreatePattern(trim($res["WORDS"]), $DICTIONARY_ID_T);
479 if ($pattern)
481 endif;
482 endwhile;
483 return true;
484 endif;
485 return false;
486 }
487
488 public static function CreatePattern($pattern="", $DICTIONARY_ID=0)
489 {
490 $res = "";
491 $NotWord = "\s.,;:!?\#\-\*\|\[\]\‍(\‍)";
492 $word_separator = "[".$NotWord."]";
493 $pattern = mb_strtolower(trim($pattern));
494 $DICTIONARY_ID = intval($DICTIONARY_ID);
495
496 if ($pattern == '')
497 return false;
498
499 if ($DICTIONARY_ID == 0)
500 $DICTIONARY_ID = (COption::GetOptionString("forum", "FILTER_DICT_T", '', LANGUAGE_ID));
501 elseif ($DICTIONARY_ID < 0)
502 $DICTIONARY_ID = 0;
503
504 $lettPatt = array();
505 $lettersPatt = array();
506
507 $letters = CFilterLetter::GetList(array(), array("DICTIONARY_ID"=>$DICTIONARY_ID));
508 while ($lett = $letters->Fetch())
509 {
510 $space = false;
511 $arrRes = array();
512 $arrRepl = array();
513
514 $arrRepl = explode(",", $lett["REPLACEMENT"]);
515 // create letters.
516 for ($ii = 0; $ii < count($arrRepl); $ii++)
517 {
518 $arrRepl[$ii] = trim($arrRepl[$ii]);
519 if (mb_strlen($lett["LETTER"]) == 1)
520 {
521 if (mb_strlen($arrRepl[$ii]) == 1)
522 $arrRes[$ii] = $arrRepl[$ii]."+";
523 elseif (mb_substr($arrRepl[$ii], 0, 1) == "(" && (mb_substr($arrRepl[$ii], -1, 1) == ")" || mb_substr($arrRepl[$ii], -2, 1) == ")"))
524 {
525 if (mb_substr($arrRepl[$ii], -1, 1) == ")")
526 $arrRes[$ii] = $arrRepl[$ii]."+";
527 else
528 $arrRes[$ii] = $arrRepl[$ii];
529 }
530 elseif (mb_strlen($arrRepl[$ii]) > 1)
531 $arrRes[$ii] = "[".$arrRepl[$ii]."]+";
532 else
533 $space = true;
534 }
535 else
536 {
537 if ($arrRepl[$ii] <> '')
538 $arrRes[$ii] = $arrRepl[$ii];
539 }
540 }
541
542 if (mb_strlen($lett["LETTER"]) == 1)
543 {
544 if ($space)
545 $arrRes[] = "";
546// $lettPatt[$lett["LETTER"]] = str_replace("+", "*", $lettPatt[$lett["LETTER"]]);
547 $lettPatt[$lett["LETTER"]] = implode("|", $arrRes);
548 }
549 else
550 {
551 $lettersPatt["/".preg_quote($lett["LETTER"])."/isu"] = "(".implode("|", $arrRes).")";
552 }
553 }
554 // letters
555 foreach ($lettersPatt as $key => $val)
556 $pattern = preg_replace($key, $val, $pattern);
557 for ($ii = 0; $ii < mb_strlen($pattern); $ii++)
558 {
559 $sPattern = mb_substr($pattern, $ii, 1);
560 if (is_set($lettPatt, mb_substr($pattern, $ii, 1)))
561 $res .= "(".$lettPatt[mb_substr($pattern, $ii, 1)].")";
562 else
563 {
564 $ord = ord(mb_substr($pattern, $ii, 1));
565 if ((48>$ord) || ((64>$ord) and ($ord>57)) || ((97>$ord) and ($ord>90)) || ((127>$ord) and ($ord>122)))
566 {
567 if ($ord == 42)
568 $res .= "[^".$NotWord."]*";
569 elseif ($ord == 43)
570 $res .= "[^".$NotWord."]+";
571 elseif ($ord == 63)
572 $res .= ".?";
573 else
574 $res .= mb_substr($pattern, $ii, 1);
575 }
576 else
577 $res .= mb_substr($pattern, $ii, 1)."+";
578 }
579 $res .= $separator;
580 }
581 $res = "/(?<=".$word_separator.")(".$res.")(?=".$word_separator.")/isu";
582 return $res;
583 }
584
585 public static function FilterPerm()
586 {
587 return CForumUser::IsAdmin();
588 }
589
590 public static function Filter($message)
591 {
593 static $arFilterPattern = array();
594 $filter = array();
595 $pattern = array();
596 $replacement = array();
597
598 if (!array_key_exists(LANGUAGE_ID, $arFilterPattern))
599 {
600 $cache_id = "b_forum_filter_".COption::GetOptionInt("forum", "FILTER_DICT_W", false, LANGUAGE_ID);
601 if (CACHED_b_forum_filter !== false && $CACHE_MANAGER->Read(CACHED_b_forum_filter, $cache_id, "b_forum_filter"))
602 {
603 $arFilterPattern[LANGUAGE_ID] = $CACHE_MANAGER->Get($cache_id);
604 }
605 else
606 {
608 array("USE_IT"=>"Y", "DICTIONARY_ID"=>COption::GetOptionInt("forum", "FILTER_DICT_W", false, LANGUAGE_ID)));
609 $replace = COption::GetOptionString("forum", "FILTER_RPL", "*");
610 while ($res = $db_res->Fetch())
611 {
612 if (trim($res["PATTERN"]) <> '' )
613 {
614 $arFilterPattern[LANGUAGE_ID]["pattern"][] = trim($res["PATTERN"]);
615 $arFilterPattern[LANGUAGE_ID]["replacement"][] = $res["REPLACEMENT"] <> '' ? " ".$res["REPLACEMENT"]." " : " ".$replace." ";
616 }
617 }
618 }
619 }
620
621 if (empty($arFilterPattern[LANGUAGE_ID]["pattern"])):
622 return $message;
623 endif;
624
625 $pattern = $arFilterPattern[LANGUAGE_ID]["pattern"];
626 $replacement = $arFilterPattern[LANGUAGE_ID]["replacement"];
627
628 ksort($pattern); ksort($replacement);
629 $message = ' '.$message.' ';
630 switch (COption::GetOptionString("forum", "FILTER_ACTION", "rpl"))
631 {
632 case "rpl":
633 $message = preg_replace($pattern, $replacement, $message);
634 break;
635 case "del":
636 $message = preg_replace($pattern, '', $message);
637 break;
638 }
639 return trim($message);
640 }
641}
$db_res
Определения options_user_settings.php:8
global $APPLICATION
Определения include.php:80
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static GetFilterOperation($key)
Определения filter_dictionary.php:93
static Delete($ID)
Определения filter_dictionary.php:62
static Add($arFields)
Определения filter_dictionary.php:29
static Update($ID, $arFields)
Определения filter_dictionary.php:41
static CheckFields($arFields=array(), $ACTION="ADD")
Определения filter_dictionary.php:14
static Delete($ID)
Определения filter_dictionary.php:219
static CheckFields($arFields=array())
Определения filter_dictionary.php:142
static Add($arFields)
Определения filter_dictionary.php:157
static GetByID($ID)
Определения filter_dictionary.php:226
static Update($ID, $arFields)
Определения filter_dictionary.php:175
static GetFilterOperation($key)
Определения filter_dictionary.php:403
static Delete($ID)
Определения filter_dictionary.php:387
static GetById($ID)
Определения filter_dictionary.php:396
static Add($arFields)
Определения filter_dictionary.php:321
static CheckPattern($sPattern, &$sError)
Определения filter_dictionary.php:239
static Filter($message)
Определения filter_dictionary.php:590
static CheckFields($action="INSERT", $ID=false, $arFields=array())
Определения filter_dictionary.php:269
static FilterPerm()
Определения filter_dictionary.php:585
static GenPatternAll($DICTIONARY_ID_W=0, $DICTIONARY_ID_T=0)
Определения filter_dictionary.php:466
static CreatePattern($pattern="", $DICTIONARY_ID=0)
Определения filter_dictionary.php:488
static Update($ID, $arFields)
Определения filter_dictionary.php:342
static GenPattern($ID=false, $DICTIONARY_ID_T=0)
Определения filter_dictionary.php:449
static IsAdmin($userId=false, $arGroups=false)
Определения user.php:11
static GetList($arOrder=array("ID"=>"ASC"), $arFilter=array(), $bCount=false)
Определения filter_dictionary.php:7
static GetList($arOrder=array("ID"=>"ASC"), $arFilter=array(), $bCount=false)
Определения filter_dictionary.php:90
static GetList($arOrder=array("ID"=>"ASC"), $arFilter=array(), $bCount=false)
Определения filter_dictionary.php:184
global $CACHE_MANAGER
Определения clear_component_cache.php:7
$contents
Определения commerceml2.php:57
if(!in_array("BC". $f_USER_ID, $arContra)) endwhile
Определения commerceml.php:102
$arFields
Определения dblapprove.php:5
</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
ForumShowError($arError, $bShowErrorCode=false)
Определения include.php:1738
if($ajaxMode) $ID
Определения get_user.php:27
$filter
Определения iblock_catalog_list.php:54
$strError
Определения options_user_settings.php:4
global $DB
Определения cron_frame.php:29
global $USER
Определения csv_new_run.php:40
$ACTION
Определения csv_new_setup.php:27
endif
Определения csv_new_setup.php:990
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
is_set($a, $k=false)
Определения tools.php:2133
GetMessage($name, $aReplace=null)
Определения tools.php:3397
$message
Определения payment.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
</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
if(!Loader::includeModule('sale')) $pattern
Определения index.php:20
$action
Определения file_dialog.php:21
$GLOBALS['_____370096793']
Определения update_client.php:1