Skip to content

Commit b37a878

Browse files
committed
modify preg_replace with e modifier to preg_replace_callback
1 parent 85e2b93 commit b37a878

31 files changed

+170
-248
lines changed

source/admincp/admincp_checktools.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ function checkhook($currentdir, $ext = '', $sub = 1, $skip = '') {
575575
} else {
576576
$data = file_get_contents($file);
577577
$hooks = array();
578-
preg_replace("/\{hook\/(\w+?)(\s+(.+?))?\}/ie", "findhook('\\1', '\\3')", $data);
578+
preg_replace_callback("/\{hook\/(\w+?)(\s+(.+?))?\}/i", function($matches) { return findhook($matches[1], $matches[3]); }, $data);
579579
if($hooks) {
580580
foreach($hooks as $v) {
581581
$hookdata[$file][$v][] = $v;

source/admincp/admincp_setting.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,15 +2553,11 @@ function setrowtypedata(sendtype) {
25532553
$settingnew['uc']['key'] = addslashes($settingnew['uc']['key'] == '********' ? addslashes(UC_KEY) : $settingnew['uc']['key']);
25542554

25552555
if($settingnew['uc']['connect']) {
2556-
$uc_dblink = function_exists("mysql_connect") ? @mysql_connect($settingnew['uc']['dbhost'], $settingnew['uc']['dbuser'], $ucdbpassnew, 1) : new mysqli($settingnew['uc']['dbhost'], $settingnew['uc']['dbuser'], $ucdbpassnew);
2556+
$uc_dblink = new mysqli($settingnew['uc']['dbhost'], $settingnew['uc']['dbuser'], $ucdbpassnew);
25572557
if(!$uc_dblink) {
25582558
cpmsg('uc_database_connect_error', '', 'error');
25592559
} else {
2560-
if(function_exists("mysql_connect")) {
2561-
mysql_close($uc_dblink);
2562-
} else {
2563-
$uc_dblink->close();
2564-
}
2560+
$uc_dblink->close();
25652561
}
25662562
}
25672563

@@ -3695,4 +3691,4 @@ function showsetting_threadprfile($authorinfoitems, $template = array()) {
36953691
<tr><td colspan="2"><div class="threadprofilenode">'.$buttons.'</div><textarea name="templatenew[top]" id="ttop" class="marginbot" style="width:80%" rows="10" onkeyup="textareasize(this)" onkeydown="textareakey(this, event)">'.$template_top.'</textarea></td></tr>';
36963692
}
36973693

3698-
?>
3694+
?>

source/class/class_bbcode.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ function bbcode2html($message, $parseurl=0) {
5151
}
5252

5353
if($parseurl==2) {
54-
$this->search_exp[] = "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies";
55-
$this->replace_exp[] = '$this->bb_img(\'\\1\')';
5654
$message = bbcode::parseurl($message);
55+
$message = preg_replace_callback("/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is" , function($matches) { return $this->bb_img($matches[1]); }, $message);
5756
}
5857

5958
@$message = str_replace($this->search_str, $this->replace_str,preg_replace($this->search_exp, $this->replace_exp, $message, 20));

source/class/class_template.php

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,27 @@ function parse_template($tplfile, $templateid, $tpldir, $file, $cachefile) {
4444
$this->subtemplates = array();
4545
for($i = 1; $i <= 3; $i++) {
4646
if(strexists($template, '{subtemplate')) {
47-
$template = preg_replace("/[\n\r\t]*(\<\!\-\-)?\{subtemplate\s+([a-z0-9_:\/]+)\}(\-\-\>)?[\n\r\t]*/ies", "\$this->loadsubtemplate('\\2')", $template);
47+
$template = preg_replace_callback("/[\n\r\t]*(\<\!\-\-)?\{subtemplate\s+([a-z0-9_:\/]+)\}(\-\-\>)?[\n\r\t]*/is", function($matches) { return $this->loadsubtemplate($matches[2]); }, $template);
4848
}
4949
}
5050

5151
$template = preg_replace("/([\n\r]+)\t+/s", "\\1", $template);
5252
$template = preg_replace("/\<\!\-\-\{(.+?)\}\-\-\>/s", "{\\1}", $template);
53-
$template = preg_replace("/\{lang\s+(.+?)\}/ies", "\$this->languagevar('\\1')", $template);
54-
$template = preg_replace("/[\n\r\t]*\{block\/(\d+?)\}[\n\r\t]*/ie", "\$this->blocktags('\\1')", $template);
55-
$template = preg_replace("/[\n\r\t]*\{blockdata\/(\d+?)\}[\n\r\t]*/ie", "\$this->blockdatatags('\\1')", $template);
56-
$template = preg_replace("/[\n\r\t]*\{ad\/(.+?)\}[\n\r\t]*/ie", "\$this->adtags('\\1')", $template);
57-
$template = preg_replace("/[\n\r\t]*\{ad\s+([a-zA-Z0-9_\[\]]+)\/(.+?)\}[\n\r\t]*/ie", "\$this->adtags('\\2', '\\1')", $template);
58-
$template = preg_replace("/[\n\r\t]*\{date\((.+?)\)\}[\n\r\t]*/ie", "\$this->datetags('\\1')", $template);
59-
$template = preg_replace("/[\n\r\t]*\{avatar\((.+?)\)\}[\n\r\t]*/ie", "\$this->avatartags('\\1')", $template);
60-
$template = preg_replace("/[\n\r\t]*\{eval\}\s*(\<\!\-\-)*(.+?)(\-\-\>)*\s*\{\/eval\}[\n\r\t]*/ies", "\$this->evaltags('\\2')", $template);
61-
$template = preg_replace("/[\n\r\t]*\{eval\s+(.+?)\s*\}[\n\r\t]*/ies", "\$this->evaltags('\\1')", $template);
62-
$template = preg_replace("/[\n\r\t]*\{csstemplate\}[\n\r\t]*/ies", "\$this->loadcsstemplate()", $template);
53+
$template = preg_replace_callback("/\{lang\s+(.+?)\}/is", function($matches) { return $this->languagevar($matches[1]); }, $template);
54+
$template = preg_replace_callback("/[\n\r\t]*\{block\/(\d+?)\}[\n\r\t]*/i", function($matches) { return $this->blocktags($matches[1]); }, $template);
55+
$template = preg_replace_callback("/[\n\r\t]*\{blockdata\/(\d+?)\}[\n\r\t]*/i", function($matches) { return $this->blockdatatags($matches[1]); }, $template);
56+
$template = preg_replace_callback("/[\n\r\t]*\{ad\/(.+?)\}[\n\r\t]*/i", function($matches) { return $this->adtags($matches[1]); }, $template);
57+
$template = preg_replace_callback("/[\n\r\t]*\{ad\s+([a-zA-Z0-9_\[\]]+)\/(.+?)\}[\n\r\t]*/i", function($matches) { return $this->adtags($matches[2], $matches[1]); }, $template);
58+
$template = preg_replace_callback("/[\n\r\t]*\{date\((.+?)\)\}[\n\r\t]*/i", function($matches) { return $this->datetags($matches[1]); }, $template);
59+
$template = preg_replace_callback("/[\n\r\t]*\{avatar\((.+?)\)\}[\n\r\t]*/i", function($matches) { return $this->avatartags($matches[1]); }, $template);
60+
$template = preg_replace_callback("/[\n\r\t]*\{eval\}\s*(\<\!\-\-)*(.+?)(\-\-\>)*\s*\{\/eval\}[\n\r\t]*/is", function($matches) { return $this->evaltags($matches[2]); }, $template);
61+
$template = preg_replace_callback("/[\n\r\t]*\{eval\s+(.+?)\s*\}[\n\r\t]*/is", function($matches) { return $this->evaltags($matches[1]); }, $template);
62+
$template = preg_replace_callback("/[\n\r\t]*\{csstemplate\}[\n\r\t]*/is", function($matches) { return $this->loadcsstemplate(); }, $template);
6363
$template = str_replace("{LF}", "<?=\"\\n\"?>", $template);
6464
$template = preg_replace("/\{(\\\$[a-zA-Z0-9_\-\>\[\]\'\"\$\.\x7f-\xff]+)\}/s", "<?=\\1?>", $template);
65-
$template = preg_replace("/\{hook\/(\w+?)(\s+(.+?))?\}/ie", "\$this->hooktags('\\1', '\\3')", $template);
66-
$template = preg_replace("/$var_regexp/es", "template::addquote('<?=\\1?>')", $template);
67-
$template = preg_replace("/\<\?\=\<\?\=$var_regexp\?\>\?\>/es", "\$this->addquote('<?=\\1?>')", $template);
65+
$template = preg_replace_callback("/\{hook\/(\w+?)(\s+(.+?))?\}/i", function($matches) { return $this->hooktags($matches[1], $matches[3]); }, $template);
66+
$template = preg_replace_callback("/$var_regexp/s", function($matches) { return template::addquote('<?='.$matches[1].'?>'); }, $template);
67+
$template = preg_replace_callback("/\<\?\=\<\?\=$var_regexp\?\>\?\>/s", function($matches) { return $this->addquote('<?='.$matches[1].'?>'); }, $template);
6868

6969
$headeradd = $headerexists ? "hookscriptoutput('$basefile');" : '';
7070
if(!empty($this->subtemplates)) {
@@ -82,17 +82,17 @@ function parse_template($tplfile, $templateid, $tpldir, $file, $cachefile) {
8282

8383
$template = "<? if(!defined('IN_DISCUZ')) exit('Access Denied'); {$headeradd}?>\n$template";
8484

85-
$template = preg_replace("/[\n\r\t]*\{template\s+([a-z0-9_:\/]+)\}[\n\r\t]*/ies", "\$this->stripvtags('<? include template(\'\\1\'); ?>')", $template);
86-
$template = preg_replace("/[\n\r\t]*\{template\s+(.+?)\}[\n\r\t]*/ies", "\$this->stripvtags('<? include template(\'\\1\'); ?>')", $template);
87-
$template = preg_replace("/[\n\r\t]*\{echo\s+(.+?)\}[\n\r\t]*/ies", "\$this->stripvtags('<? echo \\1; ?>')", $template);
85+
$template = preg_replace_callback("/[\n\r\t]*\{template\s+([a-z0-9_:\/]+)\}[\n\r\t]*/is", function($matches) { return $this->stripvtags('<? include template(\''.$matches[1].'\'); ?>'); }, $template);
86+
$template = preg_replace_callback("/[\n\r\t]*\{template\s+(.+?)\}[\n\r\t]*/is", function($matches) { return $this->stripvtags('<? include template(\''.$matches[1].'\'); ?>'); }, $template);
87+
$template = preg_replace_callback("/[\n\r\t]*\{echo\s+(.+?)\}[\n\r\t]*/is", function($matches) { return $this->stripvtags('<? echo '.$matches[1].'; ?>'); }, $template);
88+
$template = preg_replace_callback("/([\n\r\t]*)\{if\s+(.+?)\}([\n\r\t]*)/is", function($matches) { return $this->stripvtags($matches[1].'<? if('.$matches[2].') { ?>'.$matches[3]); }, $template);
89+
$template = preg_replace_callback("/([\n\r\t]*)\{elseif\s+(.+?)\}([\n\r\t]*)/is", function($matches) { return $this->stripvtags($matches[1].'<? } elseif('.$matches[2].') { ?>'.$matches[3]); }, $template);
8890

89-
$template = preg_replace("/([\n\r\t]*)\{if\s+(.+?)\}([\n\r\t]*)/ies", "\$this->stripvtags('\\1<? if(\\2) { ?>\\3')", $template);
90-
$template = preg_replace("/([\n\r\t]*)\{elseif\s+(.+?)\}([\n\r\t]*)/ies", "\$this->stripvtags('\\1<? } elseif(\\2) { ?>\\3')", $template);
9191
$template = preg_replace("/\{else\}/i", "<? } else { ?>", $template);
9292
$template = preg_replace("/\{\/if\}/i", "<? } ?>", $template);
9393

94-
$template = preg_replace("/[\n\r\t]*\{loop\s+(\S+)\s+(\S+)\}[\n\r\t]*/ies", "\$this->stripvtags('<? if(is_array(\\1)) foreach(\\1 as \\2) { ?>')", $template);
95-
$template = preg_replace("/[\n\r\t]*\{loop\s+(\S+)\s+(\S+)\s+(\S+)\}[\n\r\t]*/ies", "\$this->stripvtags('<? if(is_array(\\1)) foreach(\\1 as \\2 => \\3) { ?>')", $template);
94+
$template = preg_replace_callback("/[\n\r\t]*\{loop\s+(\S+)\s+(\S+)\}[\n\r\t]*/is", function($matches) { return $this->stripvtags('<? if(is_array('.$matches[1].')) foreach('.$matches[1].' as '.$matches[2].') { ?>'); }, $template);
95+
$template = preg_replace_callback("/[\n\r\t]*\{loop\s+(\S+)\s+(\S+)\s+(\S+)\}[\n\r\t]*/is", function($matches) { return $this->stripvtags('<? if(is_array('.$matches[1].')) foreach('.$matches[1].' as '.$matches[2].' => '.$matches[3].') { ?>'); }, $template);
9696
$template = preg_replace("/\{\/loop\}/i", "<? } ?>", $template);
9797

9898
$template = preg_replace("/\{$const_regexp\}/s", "<?=\\1?>", $template);
@@ -105,9 +105,9 @@ function parse_template($tplfile, $templateid, $tpldir, $file, $cachefile) {
105105
$this->error('directory_notfound', dirname(DISCUZ_ROOT.$cachefile));
106106
}
107107

108-
$template = preg_replace("/\"(http)?[\w\.\/:]+\?[^\"]+?&[^\"]+?\"/e", "\$this->transamp('\\0')", $template);
109-
$template = preg_replace("/\<script[^\>]*?src=\"(.+?)\"(.*?)\>\s*\<\/script\>/ies", "\$this->stripscriptamp('\\1', '\\2')", $template);
110-
$template = preg_replace("/[\n\r\t]*\{block\s+([a-zA-Z0-9_\[\]]+)\}(.+?)\{\/block\}/ies", "\$this->stripblock('\\1', '\\2')", $template);
108+
$template = preg_replace_callback("/\"(http)?[\w\.\/:]+\?[^\"]+?&[^\"]+?\"/", function($matches) { return $this->transamp($matches[0]); }, $template);
109+
$template = preg_replace_callback("/\<script[^\>]*?src=\"(.+?)\"(.*?)\>\s*\<\/script\>/is", function($matches) { return $this->stripscriptamp($matches[1], $matches[2]); }, $template);
110+
$template = preg_replace_callback("/[\n\r\t]*\{block\s+([a-zA-Z0-9_\[\]]+)\}(.+?)\{\/block\}/is", function($matches) { return $this->stripblock($matches[1], $matches[2]); }, $template);
111111
$template = preg_replace("/\<\?(\s{1})/is", "<?php\\1", $template);
112112
$template = preg_replace("/\<\?\=(.+?)\?\>/is", "<?php echo \\1;?>", $template);
113113

@@ -226,7 +226,7 @@ function hooktags($hookid, $key = '') {
226226
if(isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] == 2) {
227227
$dev = "echo '<hook>[".($key ? 'array' : 'string')." $hookid".($key ? '/\'.'.$key.'.\'' : '')."]</hook>';";
228228
}
229-
$key = $key !== '' ? "[$key]" : '';
229+
$key = $key != '' ? "[$key]" : '';
230230
$this->replacecode['replace'][$i] = "<?php {$dev}if(!empty(\$_G['setting']['pluginhooks']['$hookid']$key)) echo \$_G['setting']['pluginhooks']['$hookid']$key;?>";
231231
return $search;
232232
}
@@ -257,7 +257,8 @@ function loadcsstemplate() {
257257
$scripts = array(STYLEID.'_common');
258258
$content = $this->csscurmodules = '';
259259
$content = @implode('', file(DISCUZ_ROOT.'./data/cache/style_'.STYLEID.'_module.css'));
260-
$content = preg_replace("/\[(.+?)\](.*?)\[end\]/ies", "\$this->cssvtags('\\1','\\2')", $content);
260+
$content = preg_replace_callback("/\[(.+?)\](.*?)\[end\]/is", function($matches) { return $this->cssvtags($matches[1], $matches[2]); }, $content);
261+
261262
if($this->csscurmodules) {
262263
$this->csscurmodules = preg_replace(array('/\s*([,;:\{\}])\s*/', '/[\t\n\r]/', '/\/\*.+?\*\//'), array('\\1', '',''), $this->csscurmodules);
263264
if(@$fp = fopen(DISCUZ_ROOT.'./data/cache/style_'.STYLEID.'_'.$_G['basescript'].'_'.CURMODULE.'.css', 'w')) {
@@ -303,8 +304,8 @@ function addquote($var) {
303304

304305

305306
function stripvtags($expr, $statement = '') {
306-
$expr = str_replace("\\\"", "\"", preg_replace("/\<\?\=(\\\$.+?)\?\>/s", "\\1", $expr));
307-
$statement = str_replace("\\\"", "\"", $statement);
307+
$expr = str_replace('\\\"', '\"', preg_replace("/\<\?\=(\\\$.+?)\?\>/s", "\\1", $expr));
308+
$statement = str_replace('\\\"', '\"', $statement);
308309
return $expr.$statement;
309310
}
310311

source/class/helper/helper_mobile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static function mobileoutput() {
1919
if(!defined('TPL_DEFAULT')) {
2020
$content = ob_get_contents();
2121
ob_end_clean();
22-
$content = preg_replace("/href=\"(\w+\.php)(.*?)\"/e", "mobilereplace('\\1', '\\2')", $content);
22+
$content = preg_replace_callback("/href=\"(\w+\.php)(.*?)\"/", function($matches) { return mobilereplace($matches[1], $matches[2]); }, $content);
2323

2424
ob_start();
2525
$content = '<?xml version="1.0" encoding="utf-8"?>'.$content;

source/class/helper/helper_seo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public static function parse_related_link($content, $extent) {
9191
}
9292
if($searcharray && $replacearray) {
9393
$_G['trunsform_tmp'] = array();
94-
$content = preg_replace("/(<script\s+.*?>.*?<\/script>)|(<a\s+.*?>.*?<\/a>)|(<img\s+.*?[\/]?>)|(\[attach\](\d+)\[\/attach\])/ies", "helper_seo::base64_transform('encode', '<relatedlink>', '\\1\\2\\3\\4', '</relatedlink>')", $content);
94+
$content = preg_replace_callback("/(<script\s+.*?>.*?<\/script>)|(<a\s+.*?>.*?<\/a>)|(<img\s+.*?[\/]?>)|(\[attach\](\d+)\[\/attach\])/is", function($matches) { return helper_seo::base64_transform('encode', '<relatedlink>', $matches[1].$matches[2].$matches[3].$matches[4], '</relatedlink>'); }, $content);
9595
$content = preg_replace($searcharray, $replacearray, $content, 1);
96-
$content = preg_replace("/<relatedlink>(.*?)<\/relatedlink>/ies", "helper_seo::base64_transform('decode', '', '\\1', '')", $content);
96+
$content = preg_replace_callback("/<relatedlink>(.*?)<\/relatedlink>/is", function($matches) { return helper_seo::base64_transform('decode', '', $matches[1], ''); }, $content);
9797
}
9898
}
9999
return $content;

source/class/table/table_forum_postcomment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function fetch_postcomment_by_pid($pids, $postcache, $commentcount, $tota
160160
}
161161
if($comment['authorid'] == '-1') {
162162
$cic = 0;
163-
$totalcomment[$comment['pid']] = preg_replace('/<i>([\.\d]+)<\/i>/e', "'<i class=\"cmstarv\" style=\"background-position:20px -'.(intval(\\1) * 16).'px\">'.sprintf('%1.1f', \\1).'</i>'.(\$cic++ % 2 ? '<br />' : '');", $comment['comment']);
163+
$totalcomment[$comment['pid']] = preg_replace_callback('/<i>([\.\d]+)<\/i>/', function($matches) use($cic) { return '<i class="cmstarv" style="background-position:20px -'.(intval($matches[1]) * 16).'px">'.sprintf('%1.1f', $matches[1]).'</i>'.($cic++ % 2 ? '<br />' : ''); }, $comment['comment']);
164164
}
165165
$postcache[$comment['pid']]['comment']['count'] = $commentcount[$comment['pid']];
166166
$postcache[$comment['pid']]['comment']['data'] = $comments[$comment['pid']];

source/class/table/table_forum_thread.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ public function fetch_all_search($conditions, $tableid = 0, $start = 0, $limit =
496496
}
497497
}
498498
}
499-
if(!defined('IN_MOBILE') && $defult && $conditions['sticky'] == 4 && $start == 0 && $limit && strtolower(preg_replace("/\s?/ies", '', $order)) == 'displayorderdesc,lastpostdesc' && empty($sort)) {
499+
if(!defined('IN_MOBILE') && $defult && $conditions['sticky'] == 4 && $start == 0 && $limit && strtolower(preg_replace_callback("/\s?/is", function($matches) { return ''; }, $order)) == 'displayorderdesc,lastpostdesc' && empty($sort)) {
500500
foreach($conditions['displayorder'] as $id) {
501501
if($id < 2) {
502502
$firstpage = true;

source/function/cache/cache_setting.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ function build_cache_setting() {
271271
} else {
272272
$data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/'.$data['watermarktext']['fontpath'][$k];
273273
}
274-
$data['watermarktext']['color'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['color'][$k]);
275-
$data['watermarktext']['shadowcolor'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['shadowcolor'][$k]);
274+
$data['watermarktext']['color'][$k] = preg_replace_callback('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/', function($matches) { return hexdec($matches[1]).','.hexdec($matches[2]).','.hexdec($matches[3]); }, $data['watermarktext']['color'][$k]);
275+
$data['watermarktext']['shadowcolor'][$k] = preg_replace_callback('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/', function($matches) { return hexdec($matches[1]).','.hexdec($matches[2]).','.hexdec($matches[3]); }, $data['watermarktext']['shadowcolor'][$k]);
276276
} else {
277277
$data['watermarktext']['text'][$k] = '';
278278
$data['watermarktext']['fontpath'][$k] = '';
@@ -993,7 +993,7 @@ function get_cachedata_threadprofile() {
993993
}
994994
foreach($data['template'] as $id => $template) {
995995
foreach($template as $type => $row) {
996-
$data['template'][$id][$type] = preg_replace('/\{([\w:]+)(=([^}]+?))?\}(([^}]+?)\{\*\}([^}]+?)\{\/\\1\})?/es', "get_cachedata_threadprofile_nodeparse(\$id, \$type, '\\1', '\\5', '\\6', '\\3')", $template[$type]);
996+
$data['template'][$id][$type] = preg_replace_callback('/\{([\w:]+)(=([^}]+?))?\}(([^}]+?)\{\*\}([^}]+?)\{\/\\1\})?/s', function($matches) use($id, $type) { return get_cachedata_threadprofile_nodeparse($id, $type, $matches[1], $matches[5], $matches[6], $matches[3]); }, $template[$type]);
997997
}
998998
}
999999
$data['code'] = $_G['cachedata_threadprofile_code'];

source/function/cache/cache_styles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function writetocsscache($data) {
117117
}
118118
}
119119
}
120-
$cssdata = preg_replace("/\{([A-Z0-9]+)\}/e", '\$data[strtolower(\'\1\')]', $cssdata);
120+
$cssdata = preg_replace_callback("/\{([A-Z0-9]+)\}/", function($matches) use($data) { return $data[strtolower($matches[1])]; }, $cssdata);
121121
$cssdata = preg_replace("/<\?.+?\?>\s*/", '', $cssdata);
122122
$cssdata = !preg_match('/^http:\/\//i', $data['styleimgdir']) ? preg_replace("/url\(([\"'])?".preg_quote($data['styleimgdir'], '/')."/i", "url(\\1$_G[siteurl]$data[styleimgdir]", $cssdata) : $cssdata;
123123
$cssdata = !preg_match('/^http:\/\//i', $data['imgdir']) ? preg_replace("/url\(([\"'])?".preg_quote($data['imgdir'], '/')."/i", "url(\\1$_G[siteurl]$data[imgdir]", $cssdata) : $cssdata;

0 commit comments

Comments
 (0)