summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-05-04 08:31:55 +0000
committeralecpl <alec@alec.pl>2009-05-04 08:31:55 +0000
commit23a2eec4d540b5f971ed6377e7ad776456ee0633 (patch)
tree34081a5830cb6c2c843dbf3b873bf2643400c134
parentdb5abc6c211d78ad80b716ddef11eabe5e32f137 (diff)
- ereg -> preg
-rw-r--r--bin/quotaimg.php2
-rw-r--r--program/include/html.php2
-rwxr-xr-xprogram/include/iniset.php2
-rw-r--r--program/include/rcube_browser.php10
-rw-r--r--program/include/rcube_html_page.php2
-rw-r--r--program/include/rcube_imap.php4
-rw-r--r--program/include/rcube_plugin.php2
-rw-r--r--program/include/rcube_plugin_api.php2
-rw-r--r--program/include/rcube_shared.inc2
-rw-r--r--program/include/rcube_smtp.inc2
-rw-r--r--program/include/rcube_user.php6
-rw-r--r--program/include/rcube_vcard.php2
-rw-r--r--program/steps/mail/compose.inc4
13 files changed, 21 insertions, 21 deletions
diff --git a/bin/quotaimg.php b/bin/quotaimg.php
index fc3997a39..817d38590 100644
--- a/bin/quotaimg.php
+++ b/bin/quotaimg.php
@@ -102,7 +102,7 @@ function genQuota($used, $total, $width, $height)
***********************************/
// @todo: Set to "??" instead?
- if (ereg("^[^0-9?]*$", $used) || ereg("^[^0-9?]*$", $total)) {
+ if (preg_match('/^[^0-9?]*$/', $used) || preg_match('/^[^0-9?]*$/', $total)) {
return false;
}
diff --git a/program/include/html.php b/program/include/html.php
index 78e696cb6..350b894ee 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -457,7 +457,7 @@ class html_textarea extends html
unset($this->attrib['value']);
}
- if (!empty($value) && !ereg('mce_editor', $this->attrib['class'])) {
+ if (!empty($value) && !preg_match('/mce_editor/', $this->attrib['class'])) {
$value = Q($value, 'strict', false);
}
diff --git a/program/include/iniset.php b/program/include/iniset.php
index 46f3750ea..eef1ec537 100755
--- a/program/include/iniset.php
+++ b/program/include/iniset.php
@@ -34,7 +34,7 @@ define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
// make sure path_separator is defined
if (!defined('PATH_SEPARATOR')) {
- define('PATH_SEPARATOR', (eregi('win', PHP_OS) ? ';' : ':'));
+ define('PATH_SEPARATOR', (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') ? ';' : ':');
}
// RC include folders MUST be included FIRST to avoid other
diff --git a/program/include/rcube_browser.php b/program/include/rcube_browser.php
index 56e6d3ce2..4010dbc48 100644
--- a/program/include/rcube_browser.php
+++ b/program/include/rcube_browser.php
@@ -47,23 +47,23 @@ class rcube_browser
$this->safari = ($this->khtml || stristr($HTTP_USER_AGENT, 'safari'));
if ($this->ns) {
- $test = eregi("mozilla\/([0-9\.]+)", $HTTP_USER_AGENT, $regs);
+ $test = preg_match('/mozilla\/([0-9.]+)/i', $HTTP_USER_AGENT, $regs);
$this->ver = $test ? (float)$regs[1] : 0;
}
if ($this->mz) {
- $test = ereg("rv:([0-9\.]+)", $HTTP_USER_AGENT, $regs);
+ $test = preg_match('/rv:([0-9.]+)/', $HTTP_USER_AGENT, $regs);
$this->ver = $test ? (float)$regs[1] : 0;
}
if($this->ie) {
- $test = eregi("msie ([0-9\.]+)", $HTTP_USER_AGENT, $regs);
+ $test = preg_match('/msie ([0-9.]+)/i', $HTTP_USER_AGENT, $regs);
$this->ver = $test ? (float)$regs[1] : 0;
}
if ($this->opera) {
- $test = eregi("opera ([0-9\.]+)", $HTTP_USER_AGENT, $regs);
+ $test = preg_match('/opera ([0-9.]+)/i', $HTTP_USER_AGENT, $regs);
$this->ver = $test ? (float)$regs[1] : 0;
}
- if (eregi(" ([a-z]{2})-([a-z]{2})", $HTTP_USER_AGENT, $regs))
+ if (preg_match('/ ([a-z]{2})-([a-z]{2})/i', $HTTP_USER_AGENT, $regs))
$this->lang = $regs[1];
else
$this->lang = 'en';
diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php
index c83c6aeea..b8db7b37a 100644
--- a/program/include/rcube_html_page.php
+++ b/program/include/rcube_html_page.php
@@ -54,7 +54,7 @@ class rcube_html_page
{
static $sa_files = array();
- if (!ereg('^https?://', $file) && $file[0] != '/')
+ if (!preg_match('|^https?://|i', $file) && $file[0] != '/')
$file = $this->scripts_path . $file;
if (in_array($file, $sa_files)) {
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index c97a5f1dc..8cb5c6dd0 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -139,7 +139,7 @@ class rcube_imap
if (!empty($this->conn->rootdir))
{
$this->set_rootdir($this->conn->rootdir);
- $this->root_ns = ereg_replace('[\.\/]$', '', $this->conn->rootdir);
+ $this->root_ns = preg_replace('/[.\/]$/', '', $this->conn->rootdir);
}
}
@@ -195,7 +195,7 @@ class rcube_imap
*/
function set_rootdir($root)
{
- if (ereg('[\.\/]$', $root)) //(substr($root, -1, 1)==='/')
+ if (preg_match('/[.\/]$/', $root)) //(substr($root, -1, 1)==='/')
$root = substr($root, 0, -1);
$this->root_dir = $root;
diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php
index 8aa4db64b..365ef2898 100644
--- a/program/include/rcube_plugin.php
+++ b/program/include/rcube_plugin.php
@@ -195,7 +195,7 @@ abstract class rcube_plugin
*/
private function ressource_url($fn)
{
- if ($fn[0] != '/' && !eregi('^https?://', $fn))
+ if ($fn[0] != '/' && !preg_match('|^https?://|i', $fn))
return $this->ID . '/' . $fn;
else
return $fn;
diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index 4780f2e7e..588f35e39 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -302,7 +302,7 @@ class rcube_plugin_api
*/
private function ressource_url($fn)
{
- if ($fn[0] != '/' && !eregi('^https?://', $fn))
+ if ($fn[0] != '/' && !preg_match('|^https?://|i', $fn))
return $this->url . $fn;
else
return $fn;
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index a05815800..9bbc8299b 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -170,7 +170,7 @@ function json_serialize($var)
foreach ($var as $key => $value)
{
// enclose key with quotes if it is not variable-name conform
- if (!ereg("^[_a-zA-Z]{1}[_a-zA-Z0-9]*$", $key) || is_js_reserved_word($key))
+ if (!preg_match('/^[_a-zA-Z]{1}[_a-zA-Z0-9]*$/', $key) || is_js_reserved_word($key))
$key = "'$key'";
$pairs[] = sprintf("%s%s", $is_assoc ? "$key:" : '', json_serialize($value));
diff --git a/program/include/rcube_smtp.inc b/program/include/rcube_smtp.inc
index 692106d9b..ad6a6e0af 100644
--- a/program/include/rcube_smtp.inc
+++ b/program/include/rcube_smtp.inc
@@ -337,7 +337,7 @@ function smtp_parse_rfc822($recipients)
{
if ((strpos($word, "@") > 0) && (strpos($word, "\"")===false))
{
- $word = ereg_replace('^<|>$', '', trim($word));
+ $word = preg_replace('/^<|>$/', '', trim($word));
if (in_array($word, $addresses)===false)
array_push($addresses, $word);
}
diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php
index 9d5cc5fc0..79721d51b 100644
--- a/program/include/rcube_user.php
+++ b/program/include/rcube_user.php
@@ -425,7 +425,7 @@ class rcube_user
*/
static function email2user($email)
{
- $r = self::findinvirtual('^' . quotemeta($email) . '[[:space:]]');
+ $r = self::findinvirtual('/^' . preg_quote($email, '/') . '\s/');
for ($i=0; $i<count($r); $i++)
{
@@ -463,7 +463,7 @@ class rcube_user
}
}
// File lookup
- $r = self::findinvirtual('[[:space:]]' . quotemeta($user) . '[[:space:]]*$');
+ $r = self::findinvirtual('/\s' . preg_quote($user, '/') . '\s*$/');
for ($i=0; $i<count($r); $i++)
{
$data = $r[$i];
@@ -505,7 +505,7 @@ class rcube_user
if (empty($line) || $line{0}=='#')
continue;
- if (eregi($pattern, $line))
+ if (preg_match($pattern, $line))
$result[] = $line;
}
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index 444900cde..c9ff49fcd 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -271,7 +271,7 @@ class rcube_vcard
if ((list($key, $value) = explode('=', $attr)) && $value) {
if ($key == 'ENCODING') {
# add next line(s) to value string if QP line end detected
- while ($value == 'QUOTED-PRINTABLE' && ereg('=$', $lines[$i]))
+ while ($value == 'QUOTED-PRINTABLE' && preg_match('/=$/', $lines[$i]))
$line[2] .= "\n" . $lines[++$i];
$line[2] = self::decode_value($line[2], $value);
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 8ddb2f590..d122a9232 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -673,14 +673,14 @@ function rcmail_compose_subject($attrib)
}
// create a reply-subject
else if ($compose_mode == RCUBE_COMPOSE_REPLY) {
- if (eregi('^re:', $MESSAGE->subject))
+ if (preg_match('/^re:/i', $MESSAGE->subject))
$subject = $MESSAGE->subject;
else
$subject = 'Re: '.$MESSAGE->subject;
}
// create a forward-subject
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) {
- if (eregi('^fwd:', $MESSAGE->subject))
+ if (preg_match('/^fwd:/i', $MESSAGE->subject))
$subject = $MESSAGE->subject;
else
$subject = 'Fwd: '.$MESSAGE->subject;