issue 3644, php5대응 file_put_contents 함수 적용

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@13199 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
khongchi 2013-11-12 02:17:35 +00:00
parent 4f4c63ed3d
commit d9f001266c
7 changed files with 17 additions and 49 deletions

View file

@ -459,13 +459,7 @@ class DB
$buff[] = '<?php exit(); ?>';
}
$buff[] = print_r($log, TRUE);
if(@!$fp = fopen($debug_file, "a"))
{
return;
}
fwrite($fp, implode("\n", $buff) . "\n\n");
fclose($fp);
@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND);
}
}
else
@ -486,11 +480,7 @@ class DB
$buff .= sprintf("%s\t%s\n\t%0.6f sec\tquery_id:%s\n\n", date("Y-m-d H:i"), $this->query, $elapsed_time, $this->query_id);
if($fp = fopen($log_file, 'a'))
{
fwrite($fp, $buff);
fclose($fp);
}
@file_put_contents($log_file, $buff, FILE_APPEND);
}
}

View file

@ -297,13 +297,10 @@ class DisplayHandler extends Handler
$buff = str_repeat('=', 40) . "\n" . $buff . str_repeat('-', 40);
$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
if(@!$fp = fopen($debug_file, 'a'))
if (!@file_put_contents($debug_file, $buff, FILE_APPEND))
{
return;
}
fwrite($fp, $buff);
fclose($fp);
}
}
}

View file

@ -682,19 +682,7 @@ class Validator
return FALSE;
}
if(is_callable('file_put_contents'))
{
@file_put_contents($filepath, $content);
}
else
{
$fp = @fopen($filepath, 'w');
if(is_resource($fp))
{
fwrite($fp, $content);
fclose($fp);
}
}
@file_put_contents($filepath, $content);
return $filepath;
}

View file

@ -829,12 +829,7 @@ function debugPrint($debug_output = NULL, $display_option = TRUE, $file = '_debu
}
$debug_output = "\n<?php\n/*" . $debug_output . "*/\n?>\n";
if(@!$fp = fopen($debug_file, 'a'))
{
return;
}
fwrite($fp, $debug_output);
fclose($fp);
@file_put_contents($debug_file, $debug_output, FILE_APPEND);
}
}

View file

@ -190,7 +190,7 @@ class installAdminController extends install
foreach($ftp_info as $key => $val)
{
if(!$val) continue;
if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
{
continue;
}

View file

@ -894,19 +894,15 @@ class moduleAdminController extends module
$langMap[$langCode] += $langMap[$targetLangCode];
}
$fp = fopen(sprintf('%s/%d.%s.php', $cache_path, $args->site_srl, $langCode), 'w');
if(!$fp)
$str = "<?php if(!defined('__XE__')) exit(); \r\n");
foreach($langMap[$langCode] as $code => $value)
{
$str = sprintf('$lang[\'%s\'] = \'%s\';', $code, addcslashes($value, "'"));
}
if (!@file_put_contents(sprintf('%s/%d.%s.php', $cache_path, $args->site_srl, $langCode), $str))
{
return;
}
fwrite($fp, "<?php if(!defined('__XE__')) exit(); \r\n");
foreach($langMap[$langCode] as $code => $value)
{
fwrite($fp, sprintf('$lang[\'%s\'] = \'%s\';', $code, addcslashes($value, "'")));
}
fwrite($fp, '?>');
}
}

View file

@ -279,13 +279,15 @@ class pointAdminController extends point
$output = executeQuery("point.initMemberPoint");
if(!$output->toBool()) return $output;
// Save the file temporarily
$f = fopen("./files/cache/pointRecal.txt","w");
$str = '';
foreach($member as $key => $val)
{
$val += (int)$config->signup_point;
fwrite($f, $key.','.$val."\r\n");
$str . = $key.','.$val."\r\n";
}
fclose($f);
@file_put_contents('./files/cache/pointRecal.txt', $str);
$this->add('total', count($member));
$this->add('position', 0);