Skip to content

Commit

Permalink
Set preg_quote delimiter parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
slackero committed Nov 6, 2015
1 parent 5003321 commit 22e91b9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/inc_act/act_formmailer.php
Expand Up @@ -71,7 +71,7 @@ function phpwcms_form_encode($in_str, $charset) {

// remove trailing spacer and
// add start and end delimiters
$spacer = preg_quote($spacer);
$spacer = preg_quote($spacer, '/');
$out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
$out_str = $start . $out_str . $end;
}
Expand Down
2 changes: 1 addition & 1 deletion include/inc_front/content/cnt13.article.inc.php
Expand Up @@ -96,7 +96,7 @@
$_strlen_value = mb_strlen($value);
if($_strlen_value >= $content["search"]["minchar"]) {
$value = trim($value);
$content["search_word"][$key] = preg_quote($value);
$content["search_word"][$key] = preg_quote($value, '/');
$content["search_word"][$key] = str_replace("\\?", '.?', $content["search_word"][$key]);
$content["search_word"][$key] = str_replace("\\*", '.*', $content["search_word"][$key]);
$content['highlight'][] = $value;
Expand Down
7 changes: 4 additions & 3 deletions include/inc_front/content/cnt18.article.inc.php
Expand Up @@ -96,9 +96,10 @@
$guestbook['ban'] = convertStringToArray($guestbook['ban'], ' ');
if(is_array($guestbook['ban']) && count($guestbook['ban'])) {
foreach($guestbook['ban'] as $key => $value) {
$value = preg_quote(trim($value));
$guestbook['ban'][$key] = '/'.$value.'/i';
$guestbook['ban_count']++;
if($value = trim($value)) {
$guestbook['ban'][$key] = '/'.preg_quote($value, '/').'/i';
$guestbook['ban_count']++;
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions include/inc_front/front.func.inc.php
Expand Up @@ -2490,7 +2490,7 @@ function render_cnt_date($text='', $date, $livedate=NULL, $killdate=NULL) {
}
// render date by replacing placeholder tags by value
function render_date($text='', $date, $rt='DATE') {
$rt = preg_quote($rt);
$rt = preg_quote($rt, '/');
$GLOBALS['phpwcms']['callback'] = $date;
$text = preg_replace_callback('/\{'.$rt.':(.*?) lang=(..)\}/', 'international_date_format_callback', $text);
$text = preg_replace_callback('/\{'.$rt.':(.*?)\}/', 'date_callback', $text);
Expand Down Expand Up @@ -3516,8 +3516,8 @@ function sanitize_replacement_tags( $string, $rt='', $bracket=array('{}', '[]')
if( is_array($bracket) && count($bracket) && count($tag) ) {
foreach($bracket as $value) {
if(strlen($value) < 2) continue;
$prefix = preg_quote($value{0});
$suffix = preg_quote($value{1});
$prefix = preg_quote($value{0}, '/');
$suffix = preg_quote($value{1}, '/');
foreach($tag as $row) {
$string = preg_replace('/' . $prefix . $row[0] . $suffix . '(.*?)' . $prefix . '\/' . $row[1] . $suffix . '/si', '$1', $string);
}
Expand Down Expand Up @@ -4133,7 +4133,7 @@ function render_device($string) {

}

$match = preg_quote($match);
$match = preg_quote($match, '/');
if(array_sum($validity) == count($values)) {
// Valid – delete the !if and !if:default
$string = preg_replace(
Expand Down
8 changes: 4 additions & 4 deletions include/inc_module/mod_feedimport/frontend.init.php
Expand Up @@ -143,16 +143,16 @@
$article_summary = preg_replace(array(
'/<.+?[^>]*>\s*<\/.+?>/',
'/<.+?[^>]*><\/.+?>/',
'/<.+?[^>]*>'.preg_quote($rssvalue->get_title()).'<\/.+?>/',
'/<.+?[^>]*>'.preg_quote(html_entities($article_title)).'<\/.+?>/'
'/<.+?[^>]*>'.preg_quote($rssvalue->get_title(), '/').'<\/.+?>/',
'/<.+?[^>]*>'.preg_quote(html_entities($article_title), '/').'<\/.+?>/'
), '', $article_summary);
}
if($article_content && strpos($article_content, '<') !== false) {
$article_content = preg_replace(array(
'/<.+?[^>]*>\s*<\/.+?>/',
'/<.+?[^>]*><\/.+?>/',
'/<.+?[^>]*>'.preg_quote($rssvalue->get_title()).'<\/.+?>/',
'/<.+?[^>]*>'.preg_quote(html_entities($article_title)).'<\/.+?>/'
'/<.+?[^>]*>'.preg_quote($rssvalue->get_title(), '/').'<\/.+?>/',
'/<.+?[^>]*>'.preg_quote(html_entities($article_title), '/').'<\/.+?>/'
), '', $article_content);
}

Expand Down

0 comments on commit 22e91b9

Please sign in to comment.