From 40ed0abd1b6d9f8ea2bb9f2655b2d10ccb5243f2 Mon Sep 17 00:00:00 2001 From: Nozomi Anzai Date: Thu, 15 Jul 2010 04:02:31 +0000 Subject: [PATCH] Replace functions deprecated in PHP 5.3 - ereg -> preg_match - split -> explode - ereg_replace -> str_replace --- common.php | 10 +++++----- pgconfig.php | 8 ++++---- procInfo.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common.php b/common.php index aa8385a..4b2d887 100644 --- a/common.php +++ b/common.php @@ -91,7 +91,7 @@ $messageList = array(); $res_dir = opendir('lang/'); while($file_name = readdir( $res_dir )) { - if(ereg('.*\.lang\.php$', $file_name)) { + if(preg_match('/.*\.lang\.php$/', $file_name)) { if(@is_file('lang/' . $file_name)) { include('lang/' . $file_name); $messageList[$message['lang']] = $message['strLang']; @@ -344,14 +344,14 @@ function readConfigParams($paramList = FALSE) { foreach ($configFile as $line_num => $line) { $line = trim($line); if(preg_match("/^\w/", $line)) { - list($key, $value) = split("=", $line); + list($key, $value) = explode("=", $line); $key = trim($key); $value = trim($value); if(preg_match("/^backend_hostname/", $key)) { $num = str_replace('backend_hostname', '', $key); - $configParam['backend_hostname'][$num] = ereg_replace("'", "", $value); + $configParam['backend_hostname'][$num] = str_replace("'", "", $value); } else if(preg_match("/^backend_port/", $key)) { $num = str_replace('backend_port', '', $key); @@ -363,10 +363,10 @@ function readConfigParams($paramList = FALSE) { } else if(preg_match("/^backend_data_directory/", $key)) { $num = str_replace('backend_data_directory', '', $key); - $configParam['backend_data_directory'][$num] = ereg_replace("'", "", $value); + $configParam['backend_data_directory'][$num] =str_replace("'", "", $value); } else { - $configParam[$key] = ereg_replace("'", "", $value); + $configParam[$key] = str_replace("'", "", $value); } } } diff --git a/pgconfig.php b/pgconfig.php index 56b5d3e..8e70e97 100644 --- a/pgconfig.php +++ b/pgconfig.php @@ -308,11 +308,11 @@ function check($key, $value, &$configParam ,&$error) { */ function checkString($str, $pattern) { - if(ereg($pattern, $str)) { + if(preg_match("/$pattern/", $str)) { return true; } else { return false; - } + } } /** @@ -328,7 +328,7 @@ function checkInteger($str, $min, $max) if(is_numeric($str)) { $minLen = strlen($min); $maxLen = strlen($max); - if(ereg("^[0-9]{".$minLen.",".$maxLen."}$", $str)) { + if(preg_match('/^[0-9]{'.$minLen.','.$maxLen.'}$/', $str)) { if($str < $min || $str > $max) { return false; } else { @@ -389,7 +389,7 @@ function writeConfigFile($configValue, $pgpoolConfigParam) for($i=0; $i < count($configFile); $i++) { $line = $configFile[$i]; if(preg_match("/^\w/", $line)) { - list($key, $value) = split("=", $line); + list($key, $value) = explode("=", $line); $key = trim($key); if(!preg_match("/^backend_hostname/", $key) && !preg_match("/^backend_port/", $key) diff --git a/procInfo.php b/procInfo.php index 1b4d418..01a8839 100644 --- a/procInfo.php +++ b/procInfo.php @@ -36,7 +36,7 @@ if(!array_key_exists('SUCCESS', $ret)) { $tpl->display('innerError.tpl'); exit(); } else { - $procPids = split(" ", $ret['SUCCESS']); + $procPids = explode(" ", $ret['SUCCESS']); } for($i=0; $i