// Due to annoying PHP bugs, shell arguments cannot be escaped
// (command simply fails), so we cannot allow complex objects
// to be dumped.
- if (ereg('^[_.[:alnum:]]+$', $str))
+ if (preg_match('/^[_.[:alnum:]]+$/', $str))
return $str;
else {
echo $lang['strcannotdumponwindows'];
$field = $adodb->selectField($sql, 'version');
// Check the platform, if it's mingw, set it
- if (eregi(' mingw ', $field))
+ if (preg_match('/ mingw /i', $field))
$this->platform = 'MINGW';
$params = explode(' ', $field);
private
function valid_dolquote($dquote) {
// XXX: support multibyte
- return (ereg('^[$][$]', $dquote) || ereg('^[$][_[:alpha:]][_[:alnum:]]*[$]', $dquote));
+ return (preg_match('/^[$][$]/', $dquote) || preg_match('/^[$][_[:alpha:]][_[:alnum:]]*[$]/', $dquote));
}
/**
* of a dollar quote.
*/
// XXX: multibyte here
- else if (ereg('^[_[:alpha:]]$', substr($line, $i, 1))) {
+ else if (preg_match('/^[_[:alpha:]]$/', substr($line, $i, 1))) {
$sub = substr($line, $i, $thislen);
- while (ereg('^[\$_A-Za-z0-9]$', $sub)) {
+ while (preg_match('/^[\$_A-Za-z0-9]$/', $sub)) {
/* keep going while we still have identifier chars */
$this->advance_1($i, $prevlen, $thislen);
$sub = substr($line, $i, $thislen);
foreach ($orderby as $k => $v) {
if ($first) $first = false;
else $sql .= ', ';
- if (ereg('^[0-9]+$', $k)) {
+ if (preg_match('/^[0-9]+$/', $k)) {
$sql .= $k;
}
else {
// If $type is TABLE, then generate the query
switch ($type) {
case 'TABLE':
- if (ereg('^[0-9]+$', $sortkey) && $sortkey > 0) $orderby = array($sortkey => $sortdir);
+ if (preg_match('/^[0-9]+$/', $sortkey) && $sortkey > 0) $orderby = array($sortkey => $sortdir);
else $orderby = array();
$query = $this->getSelectSQL($table, array(), array(), array(), $orderby);
break;
// Figure out ORDER BY. Sort key is always the column number (based from one)
// of the column to order by. Only need to do this for non-TABLE queries
- if ($type != 'TABLE' && ereg('^[0-9]+$', $sortkey) && $sortkey > 0) {
+ if ($type != 'TABLE' && preg_match('/^[0-9]+$/', $sortkey) && $sortkey > 0) {
$orderby = " ORDER BY {$sortkey}";
// Add sort order
if ($sortdir == 'desc')
$grodata = $this->selectSet($sql);
if ($grodata->fields['grolist'] !== null && $grodata->fields['grolist'] != '{}') {
$members = $grodata->fields['grolist'];
- $members = ereg_replace("\{|\}","",$members);
+ $members = preg_replace("/\{|\}/","",$members);
$this->clean($members);
$sql = "SELECT usename FROM pg_user WHERE usesysid IN ({$members}) ORDER BY usename";
}
// To figure out the length, look in the brackets :(
// XXX: HACKY
- if ($column->fields['type'] != $column->fields['base_type'] && ereg('\\(([0-9, ]*)\\)', $column->fields['type'], $bits)) {
+ if ($column->fields['type'] != $column->fields['base_type'] && preg_match('/\\(([0-9, ]*)\\)/', $column->fields['type'], $bits)) {
$_REQUEST['length'] = $bits[1];
}
else
$v = $data->escapeBytea($v);
// We add an extra escaping slash onto octal encoded characters
- $v = ereg_replace('\\\\([0-7]{3})', '\\\\\1', $v);
+ $v = preg_replace('/\\\\([0-7]{3})/', '\\\\\1', $v);
if ($first) {
echo ($v == null) ? '\\N' : $v;
$first = false;
// EXCEPT the 'special' ones like \r \n \t, etc.
$v = addCSlashes($v, "\0..\37\177..\377");
// We add an extra escaping slash onto octal encoded characters
- $v = ereg_replace('\\\\([0-7]{3})', '\\\1', $v);
+ $v = preg_replace('/\\\\([0-7]{3})/', '\\\1', $v);
// Finally, escape all apostrophes
$v = str_replace("'", "''", $v);
}