Permalink
Browse files

fixed for php 5.5

  • Loading branch information...
zhudewei1985 committed Aug 7, 2015
1 parent 8e994fa commit 967529aab86e460aee2815719742a45e4130de47
@@ -0,0 +1,2 @@
+
+
@@ -705,7 +705,8 @@ function workat($file) {
} else {
$this->_rs = fopen ( $this->_file, 'rb+' ) or $this->trigger_error ( 'Can\'t open the cachefile: ' . realpath ( $this->_file ), E_USER_ERROR );
$this->_seek ( $this->header_padding );
- $info = unpack ( 'V1max_size/a*ver', fread ( $this->_rs, $this->info_size ) );
+ $info_size = fread ( $this->_rs, $this->info_size );
+ $info = unpack ( 'V1max_size/Z*ver', $info_size);
if ($info ['ver'] != $this->ver) {
$this->_format ( true );
} else {
@@ -246,7 +246,7 @@ public function fetch_str($source)
$source = $this->smarty_prefilter_preCompile($source);
}
$source = preg_replace("/<\?[^><]+\?>/i", "", $source);
- return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');",
+ return preg_replace_callback("/{([^\}\{\n]*)}/", function($r){return $this->select($r[1]);},
$source);
}
@@ -343,7 +343,8 @@ public function select($tag)
break;
}
} else {
- $tag_sel = array_shift(explode(' ', $tag));
+ $tag_arr = explode(' ', $tag);
+ $tag_sel = array_shift($tag_arr);
switch ($tag_sel) {
case 'if':
return $this->_compile_if_tag(substr($tag, 3));
@@ -397,8 +398,8 @@ public function select($tag)
break;
case 'insert':
$t = $this->get_para(substr($tag, 7), false);
- $out = "<?php \n" . '$k = ' . preg_replace(
- "/(\'\\$[^,]+)/e", "stripslashes(trim('\\1','\''));",
+ $out = "<?php \n" . '$k = ' . preg_replace_callback(
+ "/(\'\\$[^,]+)/", function($r){return stripslashes(trim($r[1],'\''));},
var_export($t, true)) . ";\n";
$out .= 'echo $this->_schash . $k[\'name\'] . \'|\' . serialize($k) . $this->_schash;' .
"\n?>";
@@ -455,8 +456,8 @@ public function select($tag)
public function get_val($val)
{
if (strrpos($val, '[') !== false) {
- $val = preg_replace("/\[([^\[\]]*)\]/eis",
- "'.'.str_replace('$','\$','\\1')", $val);
+ $val = preg_replace_callback("/\[([^\[\]]*)\]/is",
+ function($r){ return '.'.str_replace('$','\$', $r[1]);}, $val);
}
if (strrpos($val, '|') !== false) {
$moddb = explode('|', $val);
@@ -879,9 +880,9 @@ public function smarty_prefilter_preCompile($source)
*/
if ($file_type == '.dwt') {
/* 将模板中所有library替换为链接 */
- $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
- $replacement = "'{include file='.strtolower('\\1'). '}'";
- $source = preg_replace($pattern, $replacement, $source);
+ $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
+ $source = preg_replace_callback($pattern,
+ function($r){return '{include file=\''. strtolower($r[1]).'\'}';}, $source);
/* 检查有无动态库文件,如果有为其赋值 */
$dyna_libs = get_dyna_libs($skyuc->options['themes'],
$this->_current_file);
@@ -1227,7 +1227,8 @@ function dyna_libs_replace($matches)
*/
function get_dyna_libs($theme, $tmp)
{
- $ext = end(explode('.', $tmp));
+ $tmp_arr = explode('.', $tmp);
+ $ext = end($tmp_arr);
$tmp = basename($tmp, ".$ext");
$sql = 'SELECT region, library, sort_order, id, number, type' . ' FROM ' .
TABLE_PREFIX . 'template' . " WHERE theme = '" . $theme .
@@ -1267,7 +1268,9 @@ function assign_dynamic($tmp)
put_file_cache($key, $arr); //写缓存
}
foreach ($arr as $row) {
- switch ($row['type']) {
+ if (!isset($row['type'])) continue;
+ $type = (int)$row['type'];
+ switch ($type) {
case 1:
// 分类下的影片
$GLOBALS['smarty']->assign(
@@ -1680,7 +1683,7 @@ function block_cc()
}
if ((int)$GLOBALS['skyuc']->config['Misc']['db_loadavg'] > 0 &&(int)$GLOBALS['skyuc']->loadcache['loadavg'] > 0 ) {
(int)$GLOBALS['skyuc']->loadcache['loadavg'] > (int)$GLOBALS['skyuc']->config['Misc']['db_loadavg'] &&
- $GLOBALS['skyuc']->config['Misc']['db_cc'] = 2;
+ $GLOBALS['skyuc']->config['Misc']['db_cc'] == 2;
}
}
if ((!isset($_COOKIE) && !isset($_SERVER['HTTP_USER_AGENT'])) || ($GLOBALS['skyuc']->config['Misc']['db_cc'] == 2 && $c_agentip) ) {
View
@@ -193,7 +193,7 @@
define ( 'NOSHUTDOWNFUNC', true );
// 获取引用(来源)页的 URL
-$skyuc->url = & $skyuc->input->fetch_url ();
+$skyuc->url = $skyuc->input->fetch_url ();
define ( 'REFERRER_PASSTHRU', $skyuc->url );
// #############################################################################
@@ -0,0 +1,2 @@
+
+
@@ -0,0 +1,2 @@
+
+

0 comments on commit 967529a

Please sign in to comment.