Permalink
Browse files

Remove ereg family of functions.

  • Loading branch information...
1 parent 416707f commit 05b92fdcaa4e36c92ac42e47d33439bdbf2dc95c @tpenguin tpenguin committed Apr 29, 2014
Showing with 20 additions and 20 deletions.
  1. +12 −12 install/install.inc
  2. +8 −8 install/install_db_core.inc
View
@@ -28,8 +28,8 @@ if (is_file($_SERVER["PATH_TRANSLATED"])) {
} else {
$path = PATH_AGILE;
}
-$path = eregi_replace('index.php', '', $path);
-$path = eregi_replace("[\\\\]", '/', $path);
+$path = preg_replace('/index.php/i', '', $path);
+$path = preg_replace("/[\\\\]/", '/', $path);
# Get the current IP & Domain
if(isset($_SERVER)) {
@@ -270,13 +270,13 @@ function write_config ($VAR)
fclose($file);
# replace the user vars
- $data = ereg_replace('%%PATH_AGILE%%', @$VAR['path_agile'], $data);
- $data = ereg_replace('%%AGILE_DB_TYPE%%', @$VAR['db_type'], $data);
- $data = ereg_replace('%%AGILE_DB_HOST%%', @$VAR['db_host'], $data);
- $data = ereg_replace('%%AGILE_DB_DATABASE%%', @$VAR['db_database'], $data);
- $data = ereg_replace('%%AGILE_DB_USERNAME%%', @$VAR['db_username'], $data);
- $data = ereg_replace('%%AGILE_DB_PASSWORD%%', @$VAR['db_password'], $data);
- $data = ereg_replace('%%AGILE_DB_PREFIX%%', @$VAR['db_prefix'], $data);
+ $data = preg_replace('/%%PATH_AGILE%%/', @$VAR['path_agile'], $data);
+ $data = preg_replace('/%%AGILE_DB_TYPE%%/', @$VAR['db_type'], $data);
+ $data = preg_replace('/%%AGILE_DB_HOST%%/', @$VAR['db_host'], $data);
+ $data = preg_replace('/%%AGILE_DB_DATABASE%%/', @$VAR['db_database'], $data);
+ $data = preg_replace('/%%AGILE_DB_USERNAME%%/', @$VAR['db_username'], $data);
+ $data = preg_replace('/%%AGILE_DB_PASSWORD%%/', @$VAR['db_password'], $data);
+ $data = preg_replace('/%%AGILE_DB_PREFIX%%/', @$VAR['db_prefix'], $data);
if(!defined("DEFAULT_SITE")) define("DEFAULT_SITE", 1);
$data = str_replace('%%AGILE_DEFAULT_SITE%%', DEFAULT_SITE, $data);
@@ -342,7 +342,7 @@ function test_connection()
$err = @$db->ErrorMsg();
if(!empty($err) )
{
- if (eregi('No Database Selected', $err) || eregi('Unknown database', $err))
+ if (preg_match('/No Database Selected/i', $err) || preg_match('/Unknown database/i', $err))
{
# attempt to create the database
$result = $db->Execute('CREATE DATABASE '.AGILE_DB_DATABASE);
@@ -353,7 +353,7 @@ function test_connection()
else
$result = true;
}
- elseif (eregi('Access denied', $err))
+ elseif (preg_match('/Access denied/i', $err))
{
return "<br><br><b>Database Problem Detected:</b><br>".
"The database `".AGILE_DB_DATABASE."` cannot be accessed with the user user/pass provided. [ERROR-4]";
@@ -399,4 +399,4 @@ function test_connection()
return true;
}
-?>
+?>
@@ -88,7 +88,7 @@ class install_db
$sqlcount++;
}
## echo '<BR>' . $sqls. ' ' . $sql;
- $sql = ereg_replace("site_id = '1',", "site_id = ".DEFAULT_SITE.",",$sql);
+ $sql = preg_replace("/site_id = '1',/", "site_id = ".DEFAULT_SITE.",",$sql);
$result = $db->Execute($sqls. ' ' . $sql);
}
@@ -103,7 +103,7 @@ class install_db
if ($runsql)
{
- $sql = ereg_replace("site_id = '1',", "site_id = ".DEFAULT_SITE.",",$sql);
+ $sql = preg_replace("/site_id = '1',/", "site_id = ".DEFAULT_SITE.",",$sql);
#echo '<BR>' . $sqls. ' ' . $sql;
$result = $db->Execute($sqls. ' ' . $sql);
if($result === false)
@@ -156,11 +156,11 @@ class install_db
$field = $key;
$t_s = $arr_field["$key"]["type"];
- if(ereg('[(]',$t_s))
+ if(preg_match('/[(]/',$t_s))
{
$ts = preg_split('/[(]/',$t_s);
$type = $ts[0];
- $size = ereg_replace('[)]', '', $ts[1]);
+ $size = preg_replace('/[)]/', '', $ts[1]);
$flds[] = Array($field, $type, $size);
}
else
@@ -220,7 +220,7 @@ class install_db
# create index
$dict = NewDataDictionary($db);
- if(eregi("fulltext", $index) && AGILE_DB_TYPE == 'mysql')
+ if(preg_match("/fulltext/i", $index) && AGILE_DB_TYPE == 'mysql')
$sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields, array('FULLTEXT'));
else
$sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields);
@@ -421,11 +421,11 @@ class install_db
$t_s = $arr_field["$key"]["type"];
- if(ereg('[(]',$t_s))
+ if(preg_match('/[(]/',$t_s))
{
$ts = preg_split('/[(]/',$t_s);
$type = $ts[0];
- $size = ereg_replace('[)]', '', $ts[1]);
+ $size = preg_replace('/[)]/', '', $ts[1]);
$flds[] = Array($field, $type, $size);
}
else
@@ -464,7 +464,7 @@ class install_db
# create index
$dict = NewDataDictionary($db);
- if(eregi("fulltext", $index) && AGILE_DB_TYPE == 'mysql')
+ if(preg_match("/fulltext/i", $index) && AGILE_DB_TYPE == 'mysql')
$sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields, array('FULLTEXT'));
else
$sqlarray = $dict->CreateIndexSQL($index, AGILE_DB_PREFIX.$table, $fields);

0 comments on commit 05b92fd

Please sign in to comment.