Fixed bug #9994: ereg* is deprecated in PHP 5.3 alpha3
authorKarsten Dambekalns <karsten.dambekalns@typo3.org>
Fri, 15 May 2009 23:12:32 +0000 (23:12 +0000)
committerKarsten Dambekalns <karsten.dambekalns@typo3.org>
Fri, 15 May 2009 23:12:32 +0000 (23:12 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5424 709f56b5-9817-0410-a4d7-c38de5d9e867

79 files changed:
ChangeLog
t3lib/class.gzip_encode.php
t3lib/class.t3lib_arraybrowser.php
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_cs.php
t3lib/class.t3lib_div.php
t3lib/class.t3lib_foldertree.php
t3lib/class.t3lib_fullsearch.php
t3lib/class.t3lib_htmlmail.php
t3lib/class.t3lib_iconworks.php
t3lib/class.t3lib_install.php
t3lib/class.t3lib_loadmodules.php
t3lib/class.t3lib_modsettings.php
t3lib/class.t3lib_page.php
t3lib/class.t3lib_parsehtml.php
t3lib/class.t3lib_parsehtml_proc.php
t3lib/class.t3lib_querygenerator.php
t3lib/class.t3lib_readmail.php
t3lib/class.t3lib_rteapi.php
t3lib/class.t3lib_softrefproc.php
t3lib/class.t3lib_sqlparser.php
t3lib/class.t3lib_stdgraphic.php
t3lib/class.t3lib_superadmin.php
t3lib/class.t3lib_syntaxhl.php
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tcemain.php
t3lib/class.t3lib_transferdata.php
t3lib/class.t3lib_treeview.php
t3lib/class.t3lib_tsparser_ext.php
t3lib/class.t3lib_tsstyleconfig.php
t3lib/class.t3lib_tstemplate.php
t3lib/class.t3lib_userauthgroup.php
t3lib/class.t3lib_xml.php
t3lib/config_default.php
t3lib/thumbs.php
typo3/alt_clickmenu.php
typo3/class.browse_links.php
typo3/class.db_list.inc
typo3/class.db_list_extra.inc
typo3/class.filelistfoldertree.php
typo3/cli_dispatch.phpsh
typo3/mod/tools/em/class.nusoap.php
typo3/show_item.php
typo3/sysext/beuser/mod/index.php
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_gifbuilder.php
typo3/sysext/cms/tslib/class.tslib_pagegen.php
typo3/sysext/cms/tslib/class.tslib_pibase.php
typo3/sysext/cms/tslib/class.tslib_search.php
typo3/sysext/cms/tslib/media/scripts/fe_adminLib.inc
typo3/sysext/cms/tslib/media/scripts/plaintextLib.inc
typo3/sysext/cms/tslib/media/scripts/wapversionLib.inc
typo3/sysext/cms/tslib/publish.php
typo3/sysext/dbal/class.ux_db_list_extra.php
typo3/sysext/dbal/handlers/class.tx_dbal_handler_xmldb.php
typo3/sysext/fe_edit/view/class.tx_feedit_editpanel.php
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php
typo3/sysext/impexp/app/index.php
typo3/sysext/impexp/class.tx_impexp.php
typo3/sysext/indexed_search/class.crawler.php
typo3/sysext/indexed_search/class.doublemetaphone.php
typo3/sysext/indexed_search/class.external_parser.php
typo3/sysext/indexed_search/class.indexer.php
typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/lowlevel/clmods/class.lost_files.php
typo3/sysext/lowlevel/clmods/class.rte_images.php
typo3/sysext/lowlevel/dbint/index.php
typo3/sysext/openid/lib/php-openid/Auth/OpenID/PAPE.php
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/sys_action/class.tx_sysaction.php
typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php
typo3/template.php
typo3/view_help.php
typo3/wizard_forms.php
typo3/wizard_table.php
typo3/wizard_tsconfig.php

index c336e7d..e1285fe 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-16  Karsten Dambekalns  <karsten@typo3.org>
+
+       * Fixed bug #9994: ereg* is deprecated in PHP 5.3 alpha3
+
 2009-05-16  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #10165: FlexForms: wrong mm-relations after copy and localize (thanks to Peter Kuehn)
index 52b1b5d..f4d3c1a 100644 (file)
@@ -364,7 +364,7 @@ class gzip_encode {
        function freebsd_loadavg() {
                $buffer= `uptime`;
                $load = array();
-               ereg("averag(es|e): ([0-9][.][0-9][0-9]), ([0-9][.][0-9][0-9]), ([0-9][.][0-9][0-9]*)", $buffer, $load);
+               preg_match('/averag(es|e): ([0-9][.][0-9][0-9]), ([0-9][.][0-9][0-9]), ([0-9][.][0-9][0-9]*)/', $buffer, $load);
 
                return max((float)$load[2], (float)$load[3], (float)$load[4]);
        }
index 0920645..cb6dbe9 100644 (file)
@@ -203,7 +203,7 @@ class t3lib_arrayBrowser    {
                        $deeper = is_array($keyArr[$key]);
 
                        if ($this->regexMode)   {
-                               if (ereg($searchString,$keyArr[$key]) || ($this->searchKeysToo && ereg($searchString,$key)))    {       $this->searchKeys[$depth]=1;    }
+                               if (preg_match('/'.$searchString.'/',$keyArr[$key]) || ($this->searchKeysToo && preg_match('/'.$searchString.'/',$key)))        {       $this->searchKeys[$depth]=1;    }
                        } else {
                                if (stristr($keyArr[$key],$searchString) || ($this->searchKeysToo && stristr($key,$searchString)))      {       $this->searchKeys[$depth]=1;    }
                        }
index e1f5492..5694b00 100644 (file)
@@ -1009,7 +1009,7 @@ final class t3lib_BEfunc {
                if (count($specConfParts)) {
                        foreach($specConfParts as $k2 => $v2) {
                                unset($specConfParts[$k2]);
-                               if (ereg('(.*)\[(.*)\]', $v2, $reg)) {
+                               if (preg_match('/(.*)\[(.*)\]/', $v2, $reg)) {
                                        $specConfParts[trim($reg[1])] = array(
                                                'parameters' => t3lib_div::trimExplode('|', $reg[2], 1)
                                        );
@@ -1824,7 +1824,7 @@ final class t3lib_BEfunc {
                                $parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']);
                        }
                }
-               if ($row['nav_hide'])   $parts[] = ereg_replace(':$', '', $LANG->sL($TCA['pages']['columns']['nav_hide']['label']));
+               if ($row['nav_hide'])   $parts[] = rtrim($LANG->sL($TCA['pages']['columns']['nav_hide']['label']), ':');
                if ($row['hidden'])     $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
                if ($row['starttime'])  $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['starttime'], -1, 'date');
                if ($row['endtime'])    $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['endtime'], -1, 'date');
@@ -3241,7 +3241,7 @@ final class t3lib_BEfunc {
                                if (is_array($dRec)) {
                                        reset($dRec);
                                        $dRecord = current($dRec);
-                                       return ereg_replace('\/$', '', $dRecord['domainName']);
+                                       return rtrim($dRecord['domainName'], '/');
                                }
                        }
                }
@@ -3258,9 +3258,9 @@ final class t3lib_BEfunc {
        public static function getDomainStartPage($domain, $path = '') {
                if (t3lib_extMgm::isLoaded('cms')) {
                        $domain = explode(':', $domain);
-                       $domain = strtolower(ereg_replace('\.$', '', $domain[0]));
+                       $domain = strtolower(preg_replace('/\.$/', '', $domain[0]));
                                // path is calculated.
-                       $path = trim(ereg_replace('\/[^\/]*$', '', $path));
+                       $path = trim(preg_replace('/\/[^\/]*$/', '', $path));
                                // stuff:
                        $domain.=$path;
 
@@ -3393,7 +3393,7 @@ final class t3lib_BEfunc {
 
                foreach($keyList as $val) {
                        $reg = array();
-                       if (ereg('^([[:alnum:]_-]+)\[(.*)\]$', $val, $reg)) {
+                       if (preg_match('/^([[:alnum:]_-]+)\[(.*)\]$/', $val, $reg)) {
                                $output[$reg[1]] = t3lib_div::trimExplode(';', $reg[2], 1);
                        } else {
                                $output[$val] = '';
index 96250b9..4ead83a 100644 (file)
  * - trim/ltrim/rtrim: the second parameter 'charlist' won't work for characters not contained in 7-bit ASCII
  * - strpos/strrpos: they return the BYTE position, if you need the CHARACTER position use utf8_strpos/utf8_strrpos
  * - htmlentities: charset support for UTF-8 only since PHP 4.3.0
+ * - preg_*: Support compiled into PHP by default nowadays, but could be unavailable, need to use modifier
  *
  * Functions NOT working on UTF-8 strings:
  *
  * - stripos
  * - substr
  * - strrev
- * - ereg/eregi
  * - split/spliti
- * - preg_*
  * - ...
  *
  */
@@ -806,7 +805,7 @@ class t3lib_cs {
                }
 
                $token = md5(microtime());
-               $parts = explode($token,ereg_replace('(&([#[:alnum:]]*);)',$token.'\2'.$token,$str));
+               $parts = explode($token,preg_replace('/(&([#[:alnum:]]*);)/',$token.'\2'.$token,$str));
                foreach($parts as $k => $v)     {
                        if ($k%2)       {
                                if (substr($v,0,1)=='#')        {       // Dec or hex entities:
@@ -998,13 +997,13 @@ class t3lib_cs {
 
                                                                // Detect type if not done yet: (Done on first real line)
                                                                // The "whitespaced" type is on the syntax      "0x0A   0x000A  #LINE FEED"     while   "ms-token" is like              "B9 = U+00B9 : SUPERSCRIPT ONE"
-                                                       if (!$detectedType)             $detectedType = ereg('[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+',$value) ? 'whitespaced' : 'ms-token';
+                                                       if (!$detectedType)             $detectedType = preg_match('/[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+/',$value) ? 'whitespaced' : 'ms-token';
 
                                                        if ($detectedType=='ms-token')  {
                                                                list($hexbyte, $utf8) = preg_split('/[=:]/', $value, 3);
                                                        } elseif ($detectedType=='whitespaced') {
                                                                $regA=array();
-                                                               ereg('[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+',$value,$regA);
+                                                               preg_match('/[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+/',$value,$regA);
                                                                $hexbyte = $regA[1];
                                                                $utf8 = 'U+'.$regA[2];
                                                        }
@@ -1108,7 +1107,7 @@ class t3lib_cs {
 
                                // accented Latin letters without "official" decomposition
                        $match = array();
-                       if (ereg('^LATIN (SMALL|CAPITAL) LETTER ([A-Z]) WITH',$name,$match) && !$decomp)        {
+                       if (preg_match('/^LATIN (SMALL|CAPITAL) LETTER ([A-Z]) WITH/',$name,$match) && !$decomp)        {
                                $c = ord($match[2]);
                                if ($match[1] == 'SMALL')       $c += 32;
 
@@ -1117,7 +1116,7 @@ class t3lib_cs {
                        }
 
                        $match = array();
-                       if (ereg('(<.*>)? *(.+)',$decomp,$match))       {
+                       if (preg_match('/(<.*>)? *(.+)/',$decomp,$match))       {
                                switch($match[1])       {
                                        case '<circle>':        // add parenthesis as circle replacement, eg (1)
                                                $match[2] = '0028 '.$match[2].' 0029';
@@ -1128,7 +1127,7 @@ class t3lib_cs {
                                                break;
 
                                        case '<compat>':        // ignore multi char decompositions that start with a space
-                                               if (ereg('^0020 ',$match[2]))   continue 2;
+                                               if (preg_match('/^0020 /',$match[2]))   continue 2;
                                                break;
 
                                                // ignore Arabic and vertical layout presentation decomposition
index 9fee6be..a1f6a6d 100644 (file)
@@ -1087,7 +1087,7 @@ final class t3lib_div {
         */
        public static function split_fileref($fileref)  {
                $reg = array();
-               if (    ereg('(.*/)(.*)$',$fileref,$reg)        )       {
+               if (preg_match('/(.*\/)(.*)$/',$fileref,$reg)   )       {
                        $info['path'] = $reg[1];
                        $info['file'] = $reg[2];
                } else {
@@ -1095,7 +1095,7 @@ final class t3lib_div {
                        $info['file'] = $fileref;
                }
                $reg='';
-               if (    ereg('(.*)\.([^\.]*$)',$info['file'],$reg)      )       {
+               if (    preg_match('/(.*)\.([^\.]*$)/',$info['file'],$reg)      )       {
                        $info['filebody'] = $reg[1];
                        $info['fileext'] = strtolower($reg[2]);
                        $info['realFileext'] = $reg[2];
@@ -1171,7 +1171,7 @@ final class t3lib_div {
         * @return      string
         */
        public static function rm_endcomma($string)     {
-               return ereg_replace(',$','',$string);
+               return rtrim($string, ',');
        }
 
        /**
@@ -1315,7 +1315,7 @@ final class t3lib_div {
         * @see calcParenthesis()
         */
        public static function calcPriority($string)    {
-               $string=ereg_replace('[[:space:]]*','',$string);        // removing all whitespace
+               $string=preg_replace('/[[:space:]]*/','',$string);      // removing all whitespace
                $string='+'.$string;    // Ensuring an operator for the first entrance
                $qm='\*\/\+-^%';
                $regex = '(['.$qm.'])(['.$qm.']?[0-9\.]*)';
@@ -1398,7 +1398,7 @@ final class t3lib_div {
         * @return      string          Converted result.
         */
        public static function deHSCentities($str)      {
-               return ereg_replace('&amp;([#[:alnum:]]*;)','&\1',$str);
+               return preg_replace('/&amp;([#[:alnum:]]*;)/','&\1',$str);
        }
 
        /**
@@ -2082,7 +2082,7 @@ final class t3lib_div {
                                                $name = '';
                                        }
                                } else {
-                                       if ($key = strtolower(ereg_replace('[^a-zA-Z0-9]','',$val)))    {
+                                       if ($key = strtolower(preg_replace('/[^a-zA-Z0-9]/','',$val)))  {
                                                $attributes[$key] = '';
                                                $name = $key;
                                        }
@@ -2104,9 +2104,9 @@ final class t3lib_div {
         * @return      array           Array with the attribute values.
         */
        public static function split_tag_attributes($tag)       {
-               $tag_tmp = trim(eregi_replace ('^<[^[:space:]]*','',trim($tag)));
+               $tag_tmp = trim(preg_replace('/^<[^[:space:]]*/','',trim($tag)));
                        // Removes any > in the end of the string
-               $tag_tmp = trim(eregi_replace ('>$','',$tag_tmp));
+               $tag_tmp = trim(rtrim($tag_tmp, '>'));
 
                $value = array();
                while (strcmp($tag_tmp,''))     {       // Compared with empty string instead , 030102
@@ -2373,7 +2373,7 @@ final class t3lib_div {
                        }
 
                                // The tag name is cleaned up so only alphanumeric chars (plus - and _) are in there and not longer than 100 chars either.
-                       $tagName = substr(ereg_replace('[^[:alnum:]_-]','',$tagName),0,100);
+                       $tagName = substr(preg_replace('/[^[:alnum:]_-]/','',$tagName),0,100);
 
                                // If the value is an array then we will call this function recursively:
                        if (is_array($v))       {
@@ -2896,7 +2896,7 @@ final class t3lib_div {
                                                        // Checking if the "subdir" is found:
                                                $subdir = substr($fI['dirname'],strlen($dirName));
                                                if ($subdir)    {
-                                                       if (ereg('^[[:alnum:]_]+\/$',$subdir) || ereg('^[[:alnum:]_]+\/[[:alnum:]_]+\/$',$subdir))      {
+                                                       if (preg_match('/^[[:alnum:]_]+\/$/',$subdir) || preg_match('/^[[:alnum:]_]+\/[[:alnum:]_]+\/$/',$subdir))      {
                                                                $dirName.= $subdir;
                                                                if (!@is_dir($dirName)) {
                                                                        t3lib_div::mkdir_deep(PATH_site.'typo3temp/', $subdir);
@@ -3031,7 +3031,7 @@ final class t3lib_div {
                        // Initialize variabels:
                $filearray = array();
                $sortarray = array();
-               $path = ereg_replace('\/$','',$path);
+               $path = rtrim($path, '/');
 
                        // Find files+directories:
                if (@is_dir($path))     {
@@ -3492,7 +3492,7 @@ final class t3lib_div {
 
                $pString = t3lib_div::implodeArrayForUrl('', $params);
 
-               return $pString ? $parts . '?' . ereg_replace('^&', '', $pString) : $parts;
+               return $pString ? $parts . '?' . preg_replace('/^&/', '', $pString) : $parts;
        }
 
        /**
@@ -3632,7 +3632,7 @@ final class t3lib_div {
                                        list($v,$n) = explode('|',$GLOBALS['TYPO3_CONF_VARS']['SYS']['requestURIvar']);
                                        $retVal = $GLOBALS[$v][$n];
                                } elseif (!$_SERVER['REQUEST_URI'])     {       // This is for ISS/CGI which does not have the REQUEST_URI available.
-                                       $retVal = '/'.ereg_replace('^/','',t3lib_div::getIndpEnv('SCRIPT_NAME')).
+                                       $retVal = '/'.ltrim(t3lib_div::getIndpEnv('SCRIPT_NAME'), '/').
                                                ($_SERVER['QUERY_STRING']?'?'.$_SERVER['QUERY_STRING']:'');
                                } else {
                                        $retVal = $_SERVER['REQUEST_URI'];
@@ -3858,11 +3858,11 @@ final class t3lib_div {
                                break;
                                case 'msie':
                                        $tmp = strstr($useragent,'MSIE');
-                                       $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,4)));
+                                       $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,4)));
                                break;
                                case 'opera':
                                        $tmp = strstr($useragent,'Opera');
-                                       $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,5)));
+                                       $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,5)));
                                break;
                                case 'konqu':
                                        $tmp = strstr($useragent,'Konqueror/');
@@ -4031,7 +4031,7 @@ final class t3lib_div {
         */
        public static function verifyFilenameAgainstDenyPattern($filename)      {
                if (strcmp($filename,'') && strcmp($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'],''))    {
-                       $result = eregi($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'],$filename);
+                       $result = preg_match('/'.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'].'/i',$filename);
                        if ($result)    return false;   // so if a matching filename is found, return false;
                }
                return true;
@@ -5475,12 +5475,12 @@ final class t3lib_div {
                        if($quoteActive > -1)   {
                                $paramsArr[$quoteActive] .= ' '.$v;
                                unset($paramsArr[$k]);
-                               if(ereg('"$', $v))      { $quoteActive = -1; }
+                               if(preg_match('/"$/', $v))      { $quoteActive = -1; }
 
                        } elseif(!trim($v))     {
                                unset($paramsArr[$k]);  // Remove empty elements
 
-                       } elseif(ereg('^"', $v))        {
+                       } elseif(preg_match('/^"/', $v))        {
                                $quoteActive = $k;
                        }
                }
index 6754555..a041ce0 100644 (file)
@@ -266,7 +266,7 @@ class t3lib_folderTree extends t3lib_treeView  {
                                $treeKey = key($this->tree);    // Get the key for this space
                                $LN = ($a==$c)?'blank':'line';
 
-                               $val = ereg_replace('^\./','',$val);
+                               $val = preg_replace('/^\.\//','',$val);
                                $title = $val;
                                $path = $files_path.$val.'/';
                                $webpath=t3lib_BEfunc::getPathType_web_nonweb($path);
index 9d8027f..7903381 100644 (file)
@@ -672,15 +672,15 @@ class t3lib_fullsearch {
                        $fields = $fC['config'];
                        $fields['exclude'] = $fC['exclude'];
                        if (is_array($fC) && $fC['label'])      {
-                               $fields['label'] = ereg_replace(":$", '', trim($GLOBALS['LANG']->sL($fC['label'])));
+                               $fields['label'] = preg_replace('/:$/', '', trim($GLOBALS['LANG']->sL($fC['label'])));
 
                                switch ($fields['type'])        {
                                        case 'input':
-                                               if (eregi('int|year', $fields['eval'])) {
+                                               if (preg_match('/int|year/i', $fields['eval'])) {
                                                        $fields['type'] = 'number';
-                                               } elseif (eregi('time', $fields['eval']))       {
+                                               } elseif (preg_match('/time/i', $fields['eval']))       {
                                                        $fields['type'] = 'time';
-                                               } elseif (eregi('date', $fields['eval']))       {
+                                               } elseif (preg_match('/date/i', $fields['eval']))       {
                                                        $fields['type'] = 'date';
                                                } else {
                                                        $fields['type'] = 'text';
index e791841..179ab43 100644 (file)
@@ -942,7 +942,7 @@ class t3lib_htmlmail {
                for ($i = 1; $i < $pieces; $i++) {
                        $tag = strtolower(strtok(substr($html_code,$len+1,10),' '));
                        $len += strlen($tag)+strlen($codepieces[$i])+2;
-                       $dummy = eregi("[^>]*", $codepieces[$i], $reg);
+                       $dummy = preg_match('/[^>]*/', $codepieces[$i], $reg);
                        $attributes = $this->get_tag_attributes($reg[0]);       // Fetches the attributes for the tag
                        $imageData = array();
 
@@ -969,7 +969,7 @@ class t3lib_htmlmail {
                $codepieces = preg_split($attribRegex, $html_code);
                $pieces = count($codepieces);
                for ($i = 1; $i < $pieces; $i++) {
-                       $dummy = eregi("[^>]*", $codepieces[$i], $reg);
+                       $dummy = preg_match('/[^>]*/', $codepieces[$i], $reg);
                                // fetches the attributes for the tag
                        $attributes = $this->get_tag_attributes($reg[0]);
                        $imageData = array();
@@ -991,11 +991,11 @@ class t3lib_htmlmail {
                        // fixes javascript rollovers
                $codepieces = preg_split('/' . quotemeta(".src") . '/', $html_code);
                $pieces = count($codepieces);
-               $expr = "^[^".quotemeta("\"").quotemeta("'")."]*";
+               $expr = '/^[^'.quotemeta('"'.quotemeta("'").']*/';
                for($i = 1; $i < $pieces; $i++) {
                        $temp = $codepieces[$i];
-                       $temp = trim(ereg_replace("=","",trim($temp)));
-                       ereg($expr,substr($temp,1,strlen($temp)),$reg);
+                       $temp = trim(str_replace('=','',trim($temp)));
+                       preg_match($expr,substr($temp,1,strlen($temp)),$reg);
                        $imageData['ref'] = $reg[0];
                        $imageData['quotes'] = substr($temp,0,1);
                                // subst_str is the string to look for, when substituting lateron
@@ -1032,7 +1032,7 @@ class t3lib_htmlmail {
                        $tag = strtolower(strtok(substr($html_code,$len+1,10)," "));
                        $len += strlen($tag) + strlen($codepieces[$i]) + 2;
 
-                       $dummy = eregi("[^>]*", $codepieces[$i], $reg);
+                       $dummy = preg_match('/[^>]*/', $codepieces[$i], $reg);
                                // Fetches the attributes for the tag
                        $attributes = $this->get_tag_attributes($reg[0]);
                        $hrefData = array();
@@ -1084,7 +1084,7 @@ class t3lib_htmlmail {
                        $codepieces = preg_split($attribRegex, $htmlCode, 1000000);
                        $pieces = count($codepieces);
                        for($i = 1; $i < $pieces; $i++) {
-                               $dummy = eregi("[^>]*", $codepieces[$i], $reg);
+                               $dummy = preg_match('/[^>]*/', $codepieces[$i], $reg);
                                        // Fetches the attributes for the tag
                                $attributes = $this->get_tag_attributes($reg[0]);
                                $frame = array();
@@ -1166,8 +1166,7 @@ class t3lib_htmlmail {
                        $len = strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
                        if (trim(substr($textstr,-1)) == '' && $len) {
                                $lastChar = substr($textpieces[$i],$len-1,1);
-                               if (!ereg("[A-Za-z0-9\/#]",$lastChar)) {
-                                       // Included "\/" 3/12
+                               if (!preg_match('/[A-Za-z0-9\/#]/',$lastChar)) {
                                        $len--;
                                }
 
@@ -1205,11 +1204,11 @@ class t3lib_htmlmail {
 
                foreach($items as $key => $part) {
                        $sub = substr($part, 0, 200);
-                       if (ereg("cid:part[^ \"']*",$sub,$reg)) {
+                       if (preg_match('/cid:part[^ "\']*/',$sub,$reg)) {
                                        // The position of the string
                                $thePos = strpos($part,$reg[0]);
                                        // Finds the id of the media...
-                               ereg("cid:part([^\.]*).*",$sub,$reg2);
+                               preg_match('/cid:part([^\.]*).*/',$sub,$reg2);
                                $theSubStr = $this->theParts['html']['media'][intval($reg2[1])]['absRef'];
                                if ($thePos && $theSubStr) {
                                        // ... and substitutes the javaScript rollover image with this instead
@@ -1369,7 +1368,7 @@ class t3lib_htmlmail {
                $info = parse_url($ref);
                if ($info['scheme']) {
                        return $ref;
-               } elseif (eregi("^/",$ref)) {
+               } elseif (preg_match('/^\//',$ref)) {
                        $addr = parse_url($this->theParts['html']['path']);
                        return  $addr['scheme'].'://'.$addr['host'].($addr['port']?':'.$addr['port']:'').$ref;
                } else {
@@ -1387,7 +1386,7 @@ class t3lib_htmlmail {
         */
        public function split_fileref($fileref) {
                $info = array();
-               if (ereg("(.*/)(.*)$", $fileref, $reg)) {
+               if (preg_match('/(.*/)(.*)$/', $fileref, $reg)) {
                        $info['path'] = $reg[1];
                        $info['file'] = $reg[2];
                } else  {
@@ -1395,7 +1394,7 @@ class t3lib_htmlmail {
                        $info['file'] = $fileref;
                }
                $reg = '';
-               if (ereg("(.*)\.([^\.]*$)", $info['file'], $reg)) {
+               if (preg_match('/(.*)\.([^\.]*$)/', $info['file'], $reg)) {
                        $info['filebody'] = $reg[1];
                        $info['fileext'] = strtolower($reg[2]);
                        $info['realFileext'] = $reg[2];
@@ -1415,7 +1414,7 @@ class t3lib_htmlmail {
         */
        public function extParseUrl($path) {
                $res = parse_url($path);
-               ereg("(.*/)([^/]*)$", $res['path'], $reg);
+               preg_match('/(.*\/)([^\/]*)$/', $res['path'], $reg);
                $res['filepath'] = $reg[1];
                $res['filename'] = $reg[2];
                return $res;
@@ -1450,7 +1449,7 @@ class t3lib_htmlmail {
         */
        public function get_tag_attributes($tag) {
                $attributes = array();
-               $tag = ltrim(eregi_replace ("^<[^ ]*","",trim($tag)));
+               $tag = ltrim(preg_replace('/^<[^ ]*/','',trim($tag)));
                $tagLen = strlen($tag);
                $safetyCounter = 100;
                        // Find attribute
@@ -1469,7 +1468,7 @@ class t3lib_htmlmail {
                                        $value = $reg[0];
                                } else {
                                                // No quotes around value
-                                       ereg("^([^[:space:]>]*)(.*)",$tag,$reg);
+                                       preg_match('/^([^[:space:]>]*)(.*)/',$tag,$reg);
                                        $value = trim($reg[1]);
                                        $tag = ltrim($reg[2]);
                                        if (substr($tag,0,1) == '>') {
index d19d278..c732b10 100644 (file)
@@ -241,13 +241,13 @@ final class t3lib_iconWorks       {
                        }
 
                                // Create tagged icon file name:
-                       $iconFileName_stateTagged = ereg_replace('.([[:alnum:]]+)$', '__'.$flags.'.\1', basename($iconfile));
+                       $iconFileName_stateTagged = preg_replace('/.([[:alnum:]]+)$/', '__'.$flags.'.\1', basename($iconfile));
 
                                // Check if tagged icon file name exists (a tagget icon means the icon base name with the flags added between body and extension of the filename, prefixed with underscore)
                        if (@is_file(dirname($absfile).'/'.$iconFileName_stateTagged))  {       // Look for [iconname]_xxxx.[ext]
                                return dirname($iconfile).'/'.$iconFileName_stateTagged;
                        } elseif ($doNotGenerateIcon)   {               // If no icon generation can be done, try to look for the _X icon:
-                               $iconFileName_X = ereg_replace('.([[:alnum:]]+)$', '__x.\1', basename($iconfile));
+                               $iconFileName_X = preg_replace('/.([[:alnum:]]+)$/', '__x.\1', basename($iconfile));
                                if (@is_file(dirname($absfile).'/'.$iconFileName_X)) {
                                        return dirname($iconfile).'/'.$iconFileName_X;
                                } else {
@@ -277,7 +277,7 @@ final class t3lib_iconWorks {
        public static function skinImg($backPath, $src, $wHattribs = '', $outputMode = 0)       {
 
                        // Setting source key. If the icon is refered to inside an extension, we homogenize the prefix to "ext/":
-               $srcKey = ereg_replace('^(\.\.\/typo3conf\/ext|sysext|ext)\/', 'ext/', $src);
+               $srcKey = preg_replace('/^(\.\.\/typo3conf\/ext|sysext|ext)\//', 'ext/', $src);
 #if ($src!=$srcKey)debug(array($src, $srcKey));
 
                        // LOOKING for alternative icons:
@@ -288,7 +288,7 @@ final class t3lib_iconWorks {
                                // Search for alternative icon automatically:
                        $fExt = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['forceFileExtension'];
                        $scaleFactor = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['scaleFactor'] ? $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['scaleFactor'] : 1;   // Scaling factor
-                       $lookUpName = $fExt ? ereg_replace('\.[[:alnum:]]+$', '', $srcKey).'.'.$fExt : $srcKey; // Set filename to look for
+                       $lookUpName = $fExt ? preg_replace('/\.[[:alnum:]]+$/', '', $srcKey).'.'.$fExt : $srcKey;       // Set filename to look for
         
                        if ($fExt && !@is_file($GLOBALS['TBE_STYLES']['skinImgAutoCfg']['absDir'] . $lookUpName)) {
                                // fallback to original filename if icon with forced extension doesn't exists
@@ -308,7 +308,7 @@ final class t3lib_iconWorks {
                }
 
                        // DEBUG: This doubles the size of all icons - for testing/debugging:
-#              if (ereg('^width="([0-9]+)" height="([0-9]+)"$', $wHattribs, $reg))     $wHattribs='width="'.($reg[1]*2).'" height="'.($reg[2]*2).'"';
+#              if (preg_match('/^width="([0-9]+)" height="([0-9]+)"$/', $wHattribs, $reg))     $wHattribs='width="'.($reg[1]*2).'" height="'.($reg[2]*2).'"';
 
 
                        // rendering disabled (greyed) icons using _i (inactive) as name suffix ("_d" is already used)
index dc0e89f..725fb79 100644 (file)
@@ -806,7 +806,7 @@ class t3lib_install {
                        }
                        if (substr(trim($lineContent),-1)==';') {
                                if (isset($statementArray[$statementArrayPointer])) {
-                                       if (!trim($statementArray[$statementArrayPointer]) || ($query_regex && !eregi($query_regex,trim($statementArray[$statementArrayPointer])))) {
+                                       if (!trim($statementArray[$statementArrayPointer]) || ($query_regex && !preg_match('/'.$query_regex.'/i',trim($statementArray[$statementArrayPointer])))) {
                                                unset($statementArray[$statementArrayPointer]);
                                        }
                                }
@@ -832,7 +832,7 @@ class t3lib_install {
                $insertCount = array();
                foreach ($statements as $line => $lineContent) {
                        $reg = array();
-                       if (eregi('^create[[:space:]]*table[[:space:]]*[`]?([[:alnum:]_]*)[`]?',substr($lineContent,0,100),$reg)) {
+                       if (preg_match('/^create[[:space:]]*table[[:space:]]*[`]?([[:alnum:]_]*)[`]?/i',substr($lineContent,0,100),$reg)) {
                                $table = trim($reg[1]);
                                if ($table)     {
                                                // table names are always lowercase on Windows!
@@ -848,7 +848,7 @@ class t3lib_install {
                                        $lineContent = implode(chr(10), $sqlLines);
                                        $crTables[$table] = $lineContent;
                                }
-                       } elseif ($insertCountFlag && eregi('^insert[[:space:]]*into[[:space:]]*[`]?([[:alnum:]_]*)[`]?',substr($lineContent,0,100),$reg)) {
+                       } elseif ($insertCountFlag && preg_match('/^insert[[:space:]]*into[[:space:]]*[`]?([[:alnum:]_]*)[`]?/i',substr($lineContent,0,100),$reg)) {
                                $nTable = trim($reg[1]);
                                $insertCount[$nTable]++;
                        }
index 7d743bc..231c212 100644 (file)
@@ -368,7 +368,7 @@ class t3lib_loadModules {
                global $TYPO3_LOADED_EXT;
 
                if (isset($this->absPathArray[$name]))  {
-                       return ereg_replace ('\/$', '', substr($this->absPathArray[$name],strlen(PATH_site)));
+                       return rtrim(substr($this->absPathArray[$name],strlen(PATH_site)), '/');
                }
        }
 
@@ -385,7 +385,7 @@ class t3lib_loadModules {
         */
        function checkMod($name, $fullpath)     {
                $modconf=Array();
-               $path = ereg_replace ('/[^/.]+/\.\./', '/', $fullpath); // because 'path/../path' does not work
+               $path = preg_replace('/\/[^\/.]+\/\.\.\//', '/', $fullpath); // because 'path/../path' does not work
                if (@is_dir($path) && file_exists($path.'/conf.php'))   {
                        $MCONF = array();
                        $MLANG = array();
@@ -562,8 +562,8 @@ class t3lib_loadModules {
                        return './';
                }
 
-               $baseDir = ereg_replace ('^/', '', $baseDir);   // remove beginning
-               $destDir = ereg_replace ('^/', '', $destDir);
+               $baseDir = ltrim($baseDir, '/');        // remove beginning
+               $destDir = ltrim($destDir, '/');
 
                $found = true;
                $slash_pos=0;
index 8d8d8b3..dbbbce1 100644 (file)
@@ -249,7 +249,7 @@ class t3lib_modSettings {
 
                reset($SOBE->MOD_SETTINGS);
                while(list($key)=each($SOBE->MOD_SETTINGS))     {
-                       if (ereg('^'.$prefix,$key)) {
+                       if (preg_match('/^'.$prefix.'/',$key)) {
                                $this->storeList[$key]=$key;
                        }
                }
index 1766e89..1e86cde 100644 (file)
@@ -502,12 +502,12 @@ class t3lib_pageSelect {
         */
        function getDomainStartPage($domain, $path='',$request_uri='')  {
                $domain = explode(':',$domain);
-               $domain = strtolower(ereg_replace('\.$','',$domain[0]));
+               $domain = strtolower(preg_replace('/\.$/','',$domain[0]));
                        // Removing extra trailing slashes
-               $path = trim(ereg_replace('\/[^\/]*$','',$path));
+               $path = trim(preg_replace('/\/[^\/]*$/','',$path));
                        // Appending to domain string
                $domain.= $path;
-               $domain = ereg_replace('\/*$','',$domain);
+               $domain = preg_replace('/\/*$/','',$domain);
 
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                        'pages.uid,sys_domain.redirectTo,sys_domain.redirectHttpStatusCode,sys_domain.prepend_params',
@@ -526,8 +526,8 @@ class t3lib_pageSelect {
                        if ($row['redirectTo']) {
                                $redirectUrl = $row['redirectTo'];
                                if ($row['prepend_params'])     {
-                                       $redirectUrl = ereg_replace('\/$', '', $redirectUrl);
-                                       $prependStr = ereg_replace('^\/','',substr($request_uri,strlen($path)));
+                                       $redirectUrl = rtrim($redirectUrl, '/');
+                                       $prependStr = ltrim(substr($request_uri,strlen($path)), '/');
                                        $redirectUrl .= '/' . $prependStr;
                                }
 
index 8446ba4..566c663 100644 (file)
@@ -1028,7 +1028,7 @@ class t3lib_parsehtml     {
                        $parts = $this->splitIntoBlock('style',$content);
                        foreach($parts as $k => $v)     {
                                if ($k%2)       {
-                                       $parts[$k] = eregi_replace('(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))','\1'.$prefix.'\2'.$suffix.'\3',$parts[$k]);
+                                       $parts[$k] = preg_replace('/(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))/i','\1'.$prefix.'\2'.$suffix.'\3',$parts[$k]);
                                }
                        }
                        $content = implode('',$parts);
index 7169b1a..bdd6a8b 100644 (file)
@@ -150,8 +150,8 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
         */
        function setRelPath($path)      {
                $path = trim($path);
-               $path = ereg_replace('^/','',$path);
-               $path = ereg_replace('/$','',$path);
+               $path = preg_replace('/^\//','',$path);
+               $path = preg_replace('/\/$/','',$path);
                if ($path)      {
                        $this->relPath = $path;
                        $this->relBackPath = '';
@@ -692,7 +692,7 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                $siteUrl = $this->siteUrl();
                                        // Parsing the typolink data. This parsing is roughly done like in tslib_content->typolink()
                                if(strstr($link_param,'@'))     {               // mailadr
-                                       $href = 'mailto:'.eregi_replace('^mailto:','',$link_param);
+                                       $href = 'mailto:'.preg_replace('/^mailto:/i','',$link_param);
                                } elseif (substr($link_param,0,1)=='#') {       // check if anchor
                                        $href = $siteUrl.$link_param;
                                } else {
@@ -705,7 +705,7 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                        if (trim($rootFileDat) && !strstr($link_param,'/') && (@is_file(PATH_site.$rootFileDat) || t3lib_div::inList('php,html,htm',strtolower($rFD_fI['extension'])))) {
                                                $href = $siteUrl.$link_param;
                                        } elseif($urlChar && (strstr($link_param,'//') || !$fileChar || $urlChar<$fileChar))    {       // url (external): If doubleSlash or if a '.' comes before a '/'.
-                                               if (!ereg('^[a-z]*://',trim(strtolower($link_param))))  {$scheme='http://';} else {$scheme='';}
+                                               if (!preg_match('/^[a-z]*:\/\//',trim(strtolower($link_param))))        {$scheme='http://';} else {$scheme='';}
                                                $href = $scheme.$link_param;
                                        } elseif($fileChar)     {       // file (internal)
                                                $href = $siteUrl.$link_param;
@@ -983,8 +983,8 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                        case 'typolist':        // Transform typolist blocks into OL/UL lists. Type 1 is expected to be numerical block
                                                if (!isset($this->procOptions['typolist']) || $this->procOptions['typolist'])   {
                                                        $tListContent = $this->removeFirstAndLastTag($blockSplit[$k]);
-                                                       $tListContent = ereg_replace('^[ ]*'.chr(10),'',$tListContent);
-                                                       $tListContent = ereg_replace(chr(10).'[ ]*$','',$tListContent);
+                                                       $tListContent = preg_replace('/^[ ]*'.chr(10).'/','',$tListContent);
+                                                       $tListContent = preg_replace('/'.chr(10).'[ ]*$/','',$tListContent);
                                                        $lines = explode(chr(10),$tListContent);
                                                        $typ = $attribArray['type']==1 ? 'ol' : 'ul';
                                                        $blockSplit[$k] = '<'.$typ.'>'.chr(10).
@@ -1005,12 +1005,12 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                                }
                                        break;
                                }
-                               $blockSplit[$k+1] = ereg_replace('^[ ]*'.chr(10),'',$blockSplit[$k+1]); // Removing linebreak if typohead
+                               $blockSplit[$k+1] = preg_replace('/^[ ]*'.chr(10).'/','',$blockSplit[$k+1]);    // Removing linebreak if typohead
                        } else {        // NON-block:
                                $nextFTN = $this->getFirstTagName($blockSplit[$k+1]);
                                $singleLineBreak = $blockSplit[$k]==chr(10);
                                if (t3lib_div::inList('TABLE,BLOCKQUOTE,TYPOLIST,TYPOHEAD,'.($this->procOptions['preserveDIVSections']?'DIV,':'').$this->blockElementList,$nextFTN))    {       // Removing linebreak if typolist/typohead
-                                       $blockSplit[$k] = ereg_replace(chr(10).'[ ]*$','',$blockSplit[$k]);
+                                       $blockSplit[$k] = preg_replace('/'.chr(10).'[ ]*$/','',$blockSplit[$k]);
                                }
                                        // If $blockSplit[$k] is blank then unset the line. UNLESS the line happend to be a single line break.
                                if (!strcmp($blockSplit[$k],'') && !$singleLineBreak)   {
@@ -1297,7 +1297,7 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                                }
 
                                                        // Remove any line break char (10 or 13)
-                                               $subLines[$sk]=ereg_replace(chr(10).'|'.chr(13),'',$subLines[$sk]);
+                                               $subLines[$sk]=preg_replace('/'.chr(10).'|'.chr(13).'/','',$subLines[$sk]);
 
                                                        // If there are any attributes or if we are supposed to remap the tag, then do so:
                                                if (count($newAttribs) && strcmp($remapParagraphTag,'1'))               {
@@ -1500,10 +1500,10 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                        $regex='[[:space:]]*:[[:space:]]*([0-9]*)[[:space:]]*px';
                                // Width
                        $reg = array();
-                       eregi('width'.$regex,$style,$reg);
+                       preg_match('/width'.$regex.'/i',$style,$reg);
                        $w = intval($reg[1]);
                                // Height
-                       eregi('height'.$regex,$style,$reg);
+                       preg_match('/height'.$regex.'/i',$style,$reg);
                        $h = intval($reg[1]);
                }
                if (!$w)        {
index aa3e244..c2a7527 100644 (file)
@@ -289,14 +289,14 @@ class t3lib_queryGenerator        {
                                $this->fields[$fN] = $fC['config'];
                                $this->fields[$fN]['exclude'] = $fC['exclude'];
                                if (is_array($fC) && $fC['label'])      {
-                                       $this->fields[$fN]['label'] = ereg_replace(':$','',trim($GLOBALS['LANG']->sL($fC['label'])));
+                                       $this->fields[$fN]['label'] = rtrim(trim($GLOBALS['LANG']->sL($fC['label'])), ':');
                                        switch ($this->fields[$fN]['type'])     {
                                                case 'input':
-                                                       if (eregi('int|year', $this->fields[$fN]['eval']))      {
+                                                       if (preg_match('/int|year/i', $this->fields[$fN]['eval']))      {
                                                                $this->fields[$fN]['type']='number';
-                                                       } elseif (eregi('time', $this->fields[$fN]['eval']))    {
+                                                       } elseif (preg_match('/time/i', $this->fields[$fN]['eval']))    {
                                                                $this->fields[$fN]['type'] = 'time';
-                                                       } elseif (eregi('date', $this->fields[$fN]['eval']))    {
+                                                       } elseif (preg_match('/date/i', $this->fields[$fN]['eval']))    {
                                                                $this->fields[$fN]['type']='date';
                                                        } else {
                                                                $this->fields[$fN]['type']='text';
index 8722eb8..332820f 100644 (file)
@@ -178,7 +178,7 @@ class t3lib_readmail {
                while(list(,$ppstr)=each($parts))       {
                        $mparts = explode('=',$ppstr,2);
                        if (count($mparts)>1)   {
-                               $cTypes[strtolower(trim($mparts[0]))]=ereg_replace('^"','',trim(ereg_replace('"$','',trim($mparts[1]))));
+                               $cTypes[strtolower(trim($mparts[0]))]=preg_replace('/^"/','',trim(preg_replace('/"$/','',trim($mparts[1]))));
                        } else {
                                $cTypes[]=$ppstr;
                        }
@@ -201,11 +201,11 @@ class t3lib_readmail {
                        $parts = explode('>:',$c,2);
                        $cp['reason_text']=trim($parts[1]);
                        $cp['mailserver']='Qmail';
-                       if (eregi('550|no mailbox|account does not exist',$cp['reason_text']))  {
+                       if (preg_match('/550|no mailbox|account does not exist/i',$cp['reason_text']))  {
                                $cp['reason']=550;      // 550 Invalid recipient
                        } elseif (stristr($cp['reason_text'],'couldn\'t find any host named')) {
                                $cp['reason']=2;        // Bad host
-                       } elseif (eregi('Error in Header|invalid Message-ID header',$cp['reason_text'])) {
+                       } elseif (preg_match('/Error in Header|invalid Message-ID header/i',$cp['reason_text'])) {
                                $cp['reason']=554;
                        } else {
                                $cp['reason']=-1;
@@ -228,11 +228,11 @@ class t3lib_readmail {
                        $cp['content']=trim($c);
                        $cp['reason_text']=trim(substr($c,0,1000));
                        $cp['mailserver']='unknown';
-                       if (eregi('Unknown Recipient|Delivery failed 550|Receiver not found|User not listed|recipient problem|Delivery to the following recipients failed|User unknown|recipient name is not recognized',$cp['reason_text']))   {
+                       if (preg_match('/Unknown Recipient|Delivery failed 550|Receiver not found|User not listed|recipient problem|Delivery to the following recipients failed|User unknown|recipient name is not recognized/i',$cp['reason_text']))   {
                                $cp['reason']=550;      // 550 Invalid recipient, User unknown
-                       } elseif (eregi('over quota|mailbox full',$cp['reason_text']))  {
+                       } elseif (preg_match('/over quota|mailbox full/i',$cp['reason_text']))  {
                                $cp['reason']=551;
-                       } elseif (eregi('Error in Header',$cp['reason_text']))  {
+                       } elseif (preg_match('/Error in Header/i',$cp['reason_text']))  {
                                $cp['reason']=554;
                        } else {
                                $cp['reason']=-1;
@@ -281,7 +281,7 @@ class t3lib_readmail {
 
                        // Email:
                $reg='';
-               ereg('<([^>]*)>',$str,$reg);
+               preg_match('/<([^>]*)>/',$str,$reg);
                if (t3lib_div::validEmail($str)) {
                        $outArr['email']=$str;
                } elseif ($reg[1] && t3lib_div::validEmail($reg[1]))    {
@@ -290,7 +290,7 @@ class t3lib_readmail {
                        list($namePart)=explode($reg[0],$str);
                        if (trim($namePart))    {
                                $reg='';
-                               ereg('"([^"]*)"',$str,$reg);
+                               preg_match('/"([^"]*)"/',$str,$reg);
                                if (trim($reg[1]))      {
                                        $outArr['name']=trim($reg[1]);
                                } else $outArr['name']=trim($namePart);
@@ -314,7 +314,7 @@ class t3lib_readmail {
                next($cTypeParts);
                while(list(,$v)=Each($cTypeParts))      {
                        $reg='';
-                       eregi('([^=]*)="(.*)"',$v,$reg);
+                       preg_match('/([^=]*)="(.*)"/i',$v,$reg);
                        if (trim($reg[1]) && trim($reg[2]))     {
                                $outValue[strtolower($reg[1])] = $reg[2];
                        }
index 5a5975c..5e8a2dc 100644 (file)
@@ -196,7 +196,7 @@ class t3lib_rteapi {
         */
        function triggerField($fieldName)       {
 
-               $triggerFieldName = ereg_replace('\[([^]]+)\]$','[_TRANSFORM_\1]', $fieldName);
+               $triggerFieldName = preg_replace('/\[([^]]+)\]$/','[_TRANSFORM_\1]', $fieldName);
                return '<input type="hidden" name="'.htmlspecialchars($triggerFieldName).'" value="RTE" />';
        }
 }
index 07aa730..3aa2530 100644 (file)
@@ -236,7 +236,7 @@ class t3lib_softrefproc {
                                        $elements[$k]['matchString'] = $v;
 
                                                // If the image seems to be from fileadmin/ folder or an RTE image, then proceed to set up substitution token:
-                                       if (t3lib_div::isFirstPartOfStr($srcRef,$this->fileAdminDir.'/') || (t3lib_div::isFirstPartOfStr($srcRef,'uploads/') && ereg('^RTEmagicC_',basename($srcRef)))) {
+                                       if (t3lib_div::isFirstPartOfStr($srcRef,$this->fileAdminDir.'/') || (t3lib_div::isFirstPartOfStr($srcRef,'uploads/') && preg_match('/^RTEmagicC_/',basename($srcRef)))) {
                                                        // Token and substitute value:
                                                if (strstr($splitContent[$k], $attribs[0]['src']))      {       // Make sure the value we work on is found and will get substituted in the content (Very important that the src-value is not DeHSC'ed)
                                                        $splitContent[$k] = str_replace($attribs[0]['src'], '{softref:'.$tokenID.'}', $splitContent[$k]);       // Substitute value with token (this is not be an exact method if the value is in there twice, but we assume it will not)
@@ -324,7 +324,7 @@ class t3lib_softrefproc {
                $elements = array();
                foreach($linkTags as $k => $foundValue) {
                        if ($k%2)       {
-                               $typolinkValue = eregi_replace('<LINK[[:space:]]+','',substr($foundValue,0,-1));
+                               $typolinkValue = preg_replace('/<LINK[[:space:]]+/i','',substr($foundValue,0,-1));
                                $tLP = $this->getTypoLinkParts($typolinkValue);
                                $linkTags[$k] = '<LINK '.$this->setTypoLinkPartsElement($tLP, $elements, $typolinkValue, $k).'>';
                        }
@@ -644,7 +644,7 @@ class t3lib_softrefproc {
 
                        // Detecting the kind of reference:
                if(strstr($link_param,'@') && !$pU['scheme'])   {               // If it's a mail address:
-                       $link_param = eregi_replace('^mailto:','',$link_param);
+                       $link_param = preg_replace('/^mailto:/i','',$link_param);
 
                        $finalTagParts['LINK_TYPE'] = 'mailto';
                        $finalTagParts['url'] = trim($link_param);
index 4ac3d75..ab71b8f 100644 (file)
@@ -193,7 +193,7 @@ class t3lib_sqlparser {
 
                        // Removing SELECT:
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr($parseString,6)); // REMOVE eregi_replace('^SELECT[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr($parseString,6));
 
                        // Init output variable:
                $result = array();
@@ -262,7 +262,7 @@ class t3lib_sqlparser {
 
                        // Removing UPDATE
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr($parseString,6)); // REMOVE eregi_replace('^UPDATE[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr($parseString,6));
 
                        // Init output variable:
                $result = array();
@@ -316,7 +316,7 @@ class t3lib_sqlparser {
 
                        // Removing INSERT
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr(ltrim(substr($parseString,6)),4)); // REMOVE eregi_replace('^INSERT[[:space:]]+INTO[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr(ltrim(substr($parseString,6)),4));
 
                        // Init output variable:
                $result = array();
@@ -376,7 +376,7 @@ class t3lib_sqlparser {
 
                        // Removing DELETE
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr(ltrim(substr($parseString,6)),4)); // REMOVE eregi_replace('^DELETE[[:space:]]+FROM[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr(ltrim(substr($parseString,6)),4));
 
                        // Init output variable:
                $result = array();
@@ -414,7 +414,7 @@ class t3lib_sqlparser {
 
                        // Removing EXPLAIN
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr($parseString,6)); // REMOVE eregi_replace('^EXPLAIN[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr($parseString,6));
 
                        // Init output variable:
                $result = $this->parseSELECT($parseString);
@@ -436,7 +436,7 @@ class t3lib_sqlparser {
 
                        // Removing CREATE TABLE
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr(ltrim(substr($parseString,6)),5)); // REMOVE eregi_replace('^CREATE[[:space:]]+TABLE[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr(ltrim(substr($parseString,6)),5));
 
                        // Init output variable:
                $result = array();
@@ -515,7 +515,7 @@ class t3lib_sqlparser {
 
                        // Removing ALTER TABLE
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr(ltrim(substr($parseString,5)),5)); // REMOVE eregi_replace('^ALTER[[:space:]]+TABLE[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr(ltrim(substr($parseString,5)),5));
 
                        // Init output variable:
                $result = array();
@@ -584,7 +584,7 @@ class t3lib_sqlparser {
 
                        // Removing DROP TABLE
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr(ltrim(substr($parseString,4)),5)); // eregi_replace('^DROP[[:space:]]+TABLE[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr(ltrim(substr($parseString,4)),5));
 
                        // Init output variable:
                $result = array();
@@ -617,7 +617,7 @@ class t3lib_sqlparser {
 
                        // Removing CREATE DATABASE
                $parseString = $this->trimSQL($parseString);
-               $parseString = ltrim(substr(ltrim(substr($parseString,6)),8)); // eregi_replace('^CREATE[[:space:]]+DATABASE[[:space:]]+','',$parseString);
+               $parseString = ltrim(substr(ltrim(substr($parseString,6)),8));
 
                        // Init output variable:
                $result = array();
@@ -1131,8 +1131,7 @@ class t3lib_sqlparser {
                        $buffer.=$v;
 
                        $reg = array();
-                       //preg_match('/[\]*$/',$v,$reg); // does not work. what is the *exact* meaning of the next line?
-                       ereg('[\]*$',$v,$reg);
+                       preg_match('/\\*$/',$v,$reg);
                        if ($reg AND strlen($reg[0])%2) {
                                $buffer.=$quote;
                        } else {
@@ -1194,7 +1193,6 @@ return $str;
         */
        function trimSQL($str)  {
                return trim(rtrim($str, "; \r\n\t")).' ';
-               //return trim(ereg_replace('[[:space:];]*$','',$str)).' ';
        }
 
 
index 9607ed7..df30f0d 100644 (file)
@@ -2090,12 +2090,12 @@ class t3lib_stdGraphic  {
                        // Finding the RGB definitions of the color:
                $string=$cParts[0];
                if (strstr($string,'#'))        {
-                       $string = ereg_replace('[^A-Fa-f0-9]*','',$string);
+                       $string = preg_replace('/[^A-Fa-f0-9]*/','',$string);
                        $col[]=HexDec(substr($string,0,2));
                        $col[]=HexDec(substr($string,2,2));
                        $col[]=HexDec(substr($string,4,2));
                } elseif (strstr($string,','))  {
-                       $string = ereg_replace('[^,0-9]*','',$string);
+                       $string = preg_replace('/[^,0-9]*/','',$string);
                        $strArr = explode(',',$string);
                        $col[]=intval($strArr[0]);
                        $col[]=intval($strArr[1]);
@@ -2357,7 +2357,7 @@ class t3lib_stdGraphic    {
         * @see imageMagickConvert(), tslib_cObj::getImgResource()
         */
        function getImageDimensions($imageFile) {
-               ereg('([^\.]*)$',$imageFile,$reg);
+               preg_match('/([^\.]*)$/',$imageFile,$reg);
                if (file_exists($imageFile) && t3lib_div::inList($this->imageFileExt,strtolower($reg[0])))      {
                        if ($returnArr = $this->getCachedImageDimensions($imageFile))   {
                                return $returnArr;
@@ -2416,7 +2416,7 @@ class t3lib_stdGraphic    {
                global $TYPO3_DB;
                        // Create a md5 hash of the filename
                $md5Hash = md5_file($imageFile);
-               ereg('([^\.]*)$',$imageFile,$reg);
+               preg_match('/([^\.]*)$/',$imageFile,$reg);
                $res = $TYPO3_DB->exec_SELECTquery ('md5hash, imagewidth, imageheight', 'cache_imagesizes', 'md5filename='.$TYPO3_DB->fullQuoteStr(md5($imageFile),'cache_imagesizes'));
                if ($res) {
                        if ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
@@ -2618,7 +2618,7 @@ class t3lib_stdGraphic    {
                        $splitstring=$returnVal[0];
                        $this->IM_commands[] = Array ('identify',$cmd,$returnVal[0]);
                        if ($splitstring)       {
-                               ereg('([^\.]*)$',$imagefile,$reg);
+                               preg_match('/([^\.]*)$/',$imagefile,$reg);
                                $splitinfo = explode(' ', $splitstring);
                                while (list($key,$val) = each($splitinfo))      {
                                        $temp = '';
@@ -2821,7 +2821,7 @@ class t3lib_stdGraphic    {
        function output($file)  {
                if ($file)      {
                        $reg = array();
-                       ereg('([^\.]*)$',$file,$reg);
+                       preg_match('/([^\.]*)$/',$file,$reg);
                        $ext=strtolower($reg[0]);
                        switch($ext)    {
                                case 'gif':
index 9d5bcc9..e7870e0 100644 (file)
@@ -445,8 +445,8 @@ class t3lib_superadmin {
                $content = '';
 
                foreach($this->parentDirs as $k => $v)  {
-                       $dir = ereg_replace('/$','',$v['dir']);
-                       $baseUrl=ereg_replace('/$','',$v['url']);
+                       $dir = rtrim($v['dir'], '/');
+                       $baseUrl=rtrim($v['url'], '/');
                        $content.='<br /><br /><br />';
                        $content.=$this->headerParentDir($dir);
                        if (@is_dir($dir))      {
index d54182a..be556f9 100644 (file)
@@ -380,7 +380,7 @@ class t3lib_syntaxhl {
                $token = md5(microtime());
 
                        // Markup all tag names with token.
-               $markUpStr = ereg_replace('<([[:alnum:]_]+)[^>]*>',$token.'\1'.$token,$str);
+               $markUpStr = preg_replace('/<([[:alnum:]_]+)[^>]*>/',$token.'\1'.$token,$str);
 
                        // Splitting by token:
                $parts = explode($token,$markUpStr);
index f54579f..5778a44 100644 (file)
@@ -4295,7 +4295,7 @@ class t3lib_TCEforms      {
                                $recursivityLevels = isset($fieldValue['config']['fileFolder_recursions']) ? t3lib_div::intInRange($fieldValue['config']['fileFolder_recursions'],0,99) : 99;
 
                                        // Get files:
-                               $fileFolder = ereg_replace('\/$','',$fileFolder).'/';
+                               $fileFolder = rtrim($fileFolder, '/').'/';
                                $fileArr = t3lib_div::getAllFilesAndFoldersInPath(array(),$fileFolder,$extList,0,$recursivityLevels);
                                $fileArr = t3lib_div::removePrefixPathFromList($fileArr, $fileFolder);
 
@@ -4372,7 +4372,7 @@ class t3lib_TCEforms      {
 
                                                        // Item configuration:
                                                $items[] = array(
-                                                       ereg_replace(':$','',$theTypeArrays[0]),
+                                                       rtrim($theTypeArrays[0], ':'),
                                                        $theTypeArrays[1],
                                                        '',
                                                        $descr
@@ -4403,7 +4403,7 @@ class t3lib_TCEforms      {
                                                                        // Add item to be selected:
                                                                $items[] = array(
                                                                        '['.$itemContent[2].'] '.$itemContent[1],
-                                                                       $tableFieldKey.':'.ereg_replace('[:|,]','',$itemValue).':'.$itemContent[0],
+                                                                       $tableFieldKey.':'.preg_replace('/[:|,]/','',$itemValue).':'.$itemContent[0],
                                                                        $icons[$itemContent[0]]
                                                                );
                                                        }
@@ -4436,7 +4436,7 @@ class t3lib_TCEforms      {
                                                                                // Add item to be selected:
                                                                        $items[] = array(
                                                                                $GLOBALS['LANG']->sl($itemCfg[0]),
-                                                                               $coKey.':'.ereg_replace('[:|,]','',$itemKey),
+                                                                               $coKey.':'.preg_replace('/[:|,]/','',$itemKey),
                                                                                $icon,
                                                                                $GLOBALS['LANG']->sl($itemCfg[2]),
                                                                        );
index ce81bb6..0d63f23 100644 (file)
@@ -2022,7 +2022,7 @@ class t3lib_TCEmain       {
                                                        break;
                                                }
                                        }
-                                       $theDec = ereg_replace('[^0-9]','',$theDec).'00';
+                                       $theDec = preg_replace('/[^0-9]/','',$theDec).'00';
                                        $value = intval(str_replace(' ','',$value)).'.'.substr($theDec,0,2);
                                break;
                                case 'md5':
@@ -2059,16 +2059,16 @@ class t3lib_TCEmain     {
                                        $value = str_replace(' ','',$value);
                                break;
                                case 'alpha':
-                                       $value = ereg_replace('[^a-zA-Z]','',$value);
+                                       $value = preg_replace('/[^a-zA-Z]/','',$value);
                                break;
                                case 'num':
-                                       $value = ereg_replace('[^0-9]','',$value);
+                                       $value = preg_replace('/[^0-9]/','',$value);
                                break;
                                case 'alphanum':
-                                       $value = ereg_replace('[^a-zA-Z0-9]','',$value);
+                                       $value = preg_replace('/[^a-zA-Z0-9]/','',$value);
                                break;
                                case 'alphanum_x':
-                                       $value = ereg_replace('[^a-zA-Z0-9_-]','',$value);
+                                       $value = preg_replace('/[^a-zA-Z0-9_-]/','',$value);
                                break;
                                default:
                                        if (substr($func, 0, 3) == 'tx_')       {
@@ -3230,7 +3230,7 @@ class t3lib_TCEmain       {
                                if (t3lib_div::isFirstPartOfStr($filename,'RTEmagicC_'))        {
 
                                        $fileInfo['exists'] = @is_file(PATH_site.$rec['ref_string']);
-                                       $fileInfo['original'] = substr($rec['ref_string'],0,-strlen($filename)).'RTEmagicP_'.ereg_replace('\.[[:alnum:]]+$','',substr($filename,10));
+                                       $fileInfo['original'] = substr($rec['ref_string'],0,-strlen($filename)).'RTEmagicP_'.preg_replace('/\.[[:alnum:]]+$/','',substr($filename,10));
                                        $fileInfo['original_exists'] = @is_file(PATH_site.$fileInfo['original']);
 
                                        // CODE from tx_impexp and class.rte_images.php adapted for use here:
@@ -6268,7 +6268,7 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
         * @return      string          Output string with any comma in the end removed, if any.
         */
        function rmComma($input)        {
-               return ereg_replace(',$','',$input);
+               return rtrim($input, ',');
        }
 
        /**
@@ -6279,7 +6279,7 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
         */
        function convNumEntityToByteValue($input)       {
                $token = md5(microtime());
-               $parts = explode($token,ereg_replace('(&#([0-9]+);)',$token.'\2'.$token,$input));
+               $parts = explode($token,preg_replace('/(&#([0-9]+);)/',$token.'\2'.$token,$input));
 
                foreach($parts as $k => $v)     {
                        if ($k%2)       {
@@ -6667,8 +6667,8 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
         */
        function clearPrefixFromValue($table,$value)    {
                global $TCA;
-               $regex = sprintf(quotemeta($this->prependLabel($table)),'[0-9]*').'$';
-               return @ereg_replace($regex,'',$value);
+               $regex = '/'.sprintf(quotemeta($this->prependLabel($table)),'[0-9]*').'$/';
+               return @preg_replace($regex,'',$value);
        }
 
        /**
@@ -7115,7 +7115,7 @@ State was change by %s (username: %s)
                                                // Clearing additional cache tables:
                                        if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables']))        {
                                                foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'] as $tableName)        {
-                                                       if (!ereg('[^[:alnum:]_]',$tableName) && substr($tableName,-5)=='cache')        {
+                                                       if (!preg_match('/[^[:alnum:]_]/',$tableName) && substr($tableName,-5)=='cache')        {
                                                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($tableName,'');
                                                        } else {
                                                                die('Fatal Error: Trying to flush table "'.$tableName.'" with "Clear All Cache"');
index 448e53e..8f2d714 100644 (file)
@@ -752,7 +752,7 @@ class t3lib_transferData {
                                        foreach($theExcludeFields as $theExcludeFieldsArrays)   {
                                                foreach($elements as $eKey => $value)   {
                                                        if (!strcmp($theExcludeFieldsArrays[1],$value)) {
-                                                               $dataAcc[$eKey]=rawurlencode($value).'|'.rawurlencode(ereg_replace(':$','',$theExcludeFieldsArrays[0]));
+                                                               $dataAcc[$eKey]=rawurlencode($value).'|'.rawurlencode(rtrim($theExcludeFieldsArrays[0], ':'));
                                                        }
                                                }
                                        }
index cbfa9c9..ce5d026 100644 (file)
@@ -537,7 +537,7 @@ class t3lib_treeView {
         * @return      string          Image tag, modified with $attr attributes added.
         */
        function addTagAttributes($icon,$attr)  {
-               return ereg_replace(' ?\/?>$','',$icon).' '.$attr.' />';
+               return preg_replace('/ ?\/?>$/','',$icon).' '.$attr.' />';
        }
 
        /**
index 9fbdf79..c27a22c 100644 (file)
@@ -367,7 +367,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                $keyArr_alpha=array();
                while (list($key,)=each($arr))  {
                        if (substr($key,-2)!='..')      {       // Don't do anything with comments / linenumber registrations...
-                               $key=ereg_replace('\.$','',$key);
+                               $key=preg_replace('/\.$/','',$key);
                                if (substr($key,-1)!='.')       {
                                        if (t3lib_div::testInt($key))   {
                                                $keyArr_num[$key]=$arr[$key];
@@ -509,7 +509,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                reset($arr);
                $keyArr=array();
                while (list($key,)=each($arr))  {
-                       $key=ereg_replace('\.$','',$key);
+                       $key=preg_replace('/\.$/','',$key);
                        if (substr($key,-1)!='.')       {
                                $keyArr[$key]=1;
                        }
@@ -522,13 +522,13 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
                        $deeper = is_array($arr[$key.'.']);
 
                        if ($this->regexMode)   {
-                               if (ereg($searchString,$arr[$key]))     {       // The value has matched
+                               if (preg_match('/'.$searchString.'/',$arr[$key]))       {       // The value has matched
                                        $this->tsbrowser_searchKeys[$depth]+=2;
                                }
-                               if (ereg($searchString,$key))   {               // The key has matched
+                               if (preg_match('/'.$searchString.'/',$key))     {               // The key has matched
                                        $this->tsbrowser_searchKeys[$depth]+=4;
                                }
-                               if (ereg($searchString,$depth_in))      {       // Just open this subtree if the parent key has matched the search
+                               if (preg_match('/'.$searchString.'/',$depth_in))        {       // Just open this subtree if the parent key has matched the search
                                        $this->tsbrowser_searchKeys[$depth]=1;
                                }
                        } else {
@@ -582,7 +582,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                reset($arr);
                $keyArr=array();
                while (list($key,)=each($arr))  {
-                       $key=ereg_replace('\.$','',$key);
+                       $key=preg_replace('/\.$/','',$key);
                        if (substr($key,-1)!='.')       {
                                $keyArr[$key]=1;
                        }
@@ -684,7 +684,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                }
 
                if ($syntaxHL)  {
-                       $all = ereg_replace('^[^'.chr(10).']*.','',$all);
+                       $all = preg_replace('/^[^'.chr(10).']*./','',$all);
                        $all = chop($all);
                        $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
                        $tsparser->lineNumberOffset=$this->ext_lineNumberOffset+1;
@@ -737,7 +737,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
         * @return      [type]          ...
         */
        function ext_formatTS($input, $ln, $comments=1, $crop=0)        {
-               $input = ereg_replace('^[^'.chr(10).']*.','',$input);
+               $input = preg_replace('/^[^'.chr(10).']*./','',$input);
                $input = chop($input);
                $cArr = explode(chr(10),$input);
 
@@ -824,7 +824,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                                $comment = trim($this->flatSetup[$const.'..']);
                                $c_arr = explode(chr(10),$comment);
                                while(list($k,$v)=each($c_arr)) {
-                                       $line=trim(ereg_replace('^[#\/]*','',$v));
+                                       $line=trim(preg_replace('/^[#\/]*/','',$v));
                                        if ($line)      {
                                                $parts = explode(';', $line);
                                                while(list(,$par)=each($parts))         {
@@ -941,7 +941,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                        if (t3lib_div::inList('int,options,file,boolean,offset,user', $retArr['type'])) {
                                $p=trim(substr($type,$m));
                                $reg = array();
-                               ereg('\[(.*)\]',$p,$reg);
+                               preg_match('/\[(.*)\]/',$p,$reg);
                                $p=trim($reg[1]);
                                if ($p) {
                                        $retArr['paramstr']=$p;
@@ -1077,7 +1077,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
        function ext_readDirResources($path)    {
                $path=trim($path);
                if ($path && substr($path,0,10)=='fileadmin/')  {
-                       $path = ereg_replace('\/$','',$path);
+                       $path = rtrim($path, '/');
                        $this->readDirectory(PATH_site.$path);
                }
        }
@@ -1117,7 +1117,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
        function ext_fNandV($params)    {
                $fN='data['.$params['name'].']';
                $fV=$params['value'];
-               if (ereg('^{[\$][a-zA-Z0-9\.]*}$',trim($fV),$reg))      {               // Values entered from the constantsedit cannot be constants!   230502; removed \{ and set {
+               if (preg_match('/^{[\$][a-zA-Z0-9\.]*}$/',trim($fV),$reg))      {               // Values entered from the constantsedit cannot be constants!   230502; removed \{ and set {
                        $fV='';
                }
                $fV=htmlspecialchars($fV);
@@ -1590,7 +1590,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
                                                        case 'color':
                                                                $col=array();
                                                                if($var && !t3lib_div::inList($this->HTMLcolorList,strtolower($var)))   {
-                                                                       $var = ereg_replace('[^A-Fa-f0-9]*','',$var);
+                                                                       $var = preg_replace('/[^A-Fa-f0-9]*/','',$var);
                                                                        $useFullHex = strlen($var) > 3;
 
                                                                        $col[]=HexDec(substr($var,0,1));
@@ -1764,7 +1764,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
         */
        function ext_setStar($val)      {
                $fParts = explode('.',strrev($val),2);
-               $val=ereg_replace('_[0-9][0-9]$','',strrev($fParts[1])).'*.'.strrev($fParts[0]);
+               $val=preg_replace('/_[0-9][0-9]$/','',strrev($fParts[1])).'*.'.strrev($fParts[0]);
                return $val;
        }
 
index 23d807d..52b4d10 100644 (file)
@@ -249,7 +249,7 @@ class t3lib_tsStyleConfig extends t3lib_tsparser_ext        {
                        $fV="";
                }
                $fV=htmlspecialchars($fV);
-#debug(array($params,$fN,$fV,isset($this->ext_realValues[$params["name"]])));
+
                return array($fN,$fV,$params);
        }
 
@@ -262,7 +262,7 @@ class t3lib_tsStyleConfig extends t3lib_tsparser_ext        {
        function ext_loadResources($absPath)    {
                $this->ext_readDirResources($GLOBALS["TYPO3_CONF_VARS"]["MODS"]["web_ts"]["onlineResourceDir"]);
                if (is_dir($absPath))   {
-                       $absPath = ereg_replace("\/$","",$absPath);
+                       $absPath = rtrim($absPath, '/');
                        $this->readDirectory($absPath);
                }
                $this->ext_resourceDims();
index 976ae7d..2c40d6c 100644 (file)
@@ -651,7 +651,7 @@ class t3lib_TStemplate      {
                                if (substr($ISF_file,0,4)=='EXT:')      {
                                        list($ISF_extKey,$ISF_localPath) = explode('/',substr($ISF_file,4),2);
                                        if (strcmp($ISF_extKey,'') && t3lib_extMgm::isLoaded($ISF_extKey) && strcmp($ISF_localPath,'')) {
-                                               $ISF_localPath = ereg_replace('\/$','',$ISF_localPath).'/';
+                                               $ISF_localPath = rtrim($ISF_localPath, '/').'/';
                                                $ISF_filePath = t3lib_extMgm::extPath($ISF_extKey).$ISF_localPath;
                                                if (@is_dir($ISF_filePath))     {
                                                        $mExtKey = str_replace('_','',$ISF_extKey.'/'.$ISF_localPath);
@@ -1227,7 +1227,7 @@ class t3lib_TStemplate    {
                        $c=count($fileparts);
                        $files = t3lib_div::trimExplode(',', $res);
                        foreach ($files as $file) {
-                               if (ereg('^'.quotemeta($fileparts[0]).'.*'.quotemeta($fileparts[$c-1]).'$', $file)) {
+                               if (preg_match('/^'.quotemeta($fileparts[0]).'.*'.quotemeta($fileparts[$c-1]).'$/', $file)) {
                                        $outFile = $file;
                                        break;
                                }
index 8199238..e6a0b57 100644 (file)
@@ -473,7 +473,7 @@ class t3lib_userAuthGroup extends t3lib_userAuth {
                if (!strcmp($value,'')) return TRUE;
 
                        // Certain characters are not allowed in the value
-               if (ereg('[:|,]',$value))       {
+               if (preg_match('/[:|,]/',$value))       {
                        return FALSE;
                }
 
index e89f1a3..c62c35e 100644 (file)
@@ -279,7 +279,7 @@ class t3lib_xml {
         * @return      string          Processed input value
         */
        function substNewline($string)  {
-               return ereg_replace(chr(10),'<newline/>',$string);
+               return str_replace(chr(10),'<newline/>',$string);
        }
 
        /**
index 535c615..03b5438 100644 (file)
@@ -221,7 +221,7 @@ $TYPO3_CONF_VARS = Array(
                        'ftpspace' => array('allow'=>'*', 'deny'=>'')
                ),
                'customPermOptions' => array(),                 // Array with sets of custom permission options. Syntax is; 'key' => array('header' => 'header string, language splitted', 'items' => array('key' => array('label, language splitted', 'icon reference', 'Description text, language splitted'))). Keys cannot contain ":|," characters.
-               'fileDenyPattern' => FILE_DENY_PATTERN_DEFAULT ,        // A regular expression that - if it matches a filename - will deny the file upload/rename or whatever in the webspace. For security reasons, files with multiple extensions have to be denied on an Apache environment with mod_alias, if the filename contains a valid php handler in an arbitary position. Also, ".htaccess" files have to be denied. Matching with eregi() (case-insensitive). Default value is stored in constant FILE_DENY_PATTERN_DEFAULT
+               'fileDenyPattern' => FILE_DENY_PATTERN_DEFAULT ,        // A perl-compatible regular expression (without delimiters!) that - if it matches a filename - will deny the file upload/rename or whatever in the webspace. For security reasons, files with multiple extensions have to be denied on an Apache environment with mod_alias, if the filename contains a valid php handler in an arbitary position. Also, ".htaccess" files have to be denied. Matching is done case-insensitive. Default value is stored in constant FILE_DENY_PATTERN_DEFAULT
                'interfaces' => 'backend',                                      // This determines which interface options is available in the login prompt and in which order (All options: ",backend,backend_old,frontend")
                'useOnContextMenuHandler' => 1,                 // Boolean. If set, the context menus (clickmenus) in the backend are activated on right-click - although this is not a XHTML attribute!
                'loginLabels' => 'Username|Password|Interface|Log In|Log Out|Backend,Front End,Traditional Backend|Administration Login on ###SITENAME###|(Note: Cookies and JavaScript must be enabled!)|Important Messages:|Your login attempt did not succeed. Make sure to spell your username and password correctly, including upper/lowercase characters.',              // Language labels of the login prompt.
index 8278dd1..e902e54 100644 (file)
@@ -65,7 +65,7 @@ error_reporting (E_ALL ^ E_NOTICE);
 define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
 define('TYPO3_MODE','BE');
 if(!defined('PATH_thisScript')) define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));
-if(!defined('PATH_site'))              define('PATH_site', ereg_replace('[^/]*.[^/]*$','',PATH_thisScript));           // the path to the website folder (see init.php)
+if(!defined('PATH_site'))              define('PATH_site', preg_replace('/[^\/]*.[^\/]*$/','',PATH_thisScript));               // the path to the website folder (see init.php)
 if(!defined('PATH_t3lib'))             define('PATH_t3lib', PATH_site.'t3lib/');
 define('PATH_typo3conf', PATH_site.'typo3conf/');
 define('TYPO3_mainDir', 'typo3/');             // This is the directory of the backend administration for the sites of this TYPO3 installation.
@@ -188,7 +188,7 @@ class SC_t3lib_thumbs {
 
                                // Check file extension:
                        $reg = array();
-                       if (ereg('(.*)\.([^\.]*$)',$this->input,$reg))  {
+                       if (preg_match('/(.*)\.([^\.]*$)/',$this->input,$reg))  {
                                $ext=strtolower($reg[2]);
                                $ext=($ext=='jpeg')?'jpg':$ext;
                                if ($ext=='ttf')        {
index f4b1455..5502783 100644 (file)
@@ -1283,9 +1283,9 @@ class clickMenu {
                                        </tr>';
                        } else {        // Just make normal element:
                                $onClick=$i[3];
-                               $onClick=eregi_replace('return[[:space:]]+hideCM\(\)[[:space:]]*;','',$onClick);
-                               $onClick=eregi_replace('return[[:space:]]+false[[:space:]]*;','',$onClick);
-                               $onClick=eregi_replace('hideCM\(\);','',$onClick);
+                               $onClick=preg_replace('/return[[:space:]]+hideCM\(\)[[:space:]]*;/i','',$onClick);
+                               $onClick=preg_replace('/return[[:space:]]+false[[:space:]]*;/i','',$onClick);
+                               $onClick=preg_replace('/hideCM\(\);/i','',$onClick);
                                if (!$i[5])     $onClick.='Clickmenu.hideAll();';
 
                                if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'])   {
index 9c6eac8..a02b5bb 100644 (file)
@@ -2481,7 +2481,7 @@ class browse_links {
         * @return      boolean         If the input path is found in PATH_site then it returns true.
         */
        function isWebFolder($folder)   {
-               $folder = ereg_replace('\/$','',$folder).'/';
+               $folder = rtrim($folder, '/').'/';
                return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
        }
 
@@ -2492,7 +2492,7 @@ class browse_links {
         * @return      boolean         If the input path is found in the backend users filemounts, then return true.
         */
        function checkFolder($folder)   {
-               return $this->fileProcessor->checkPathAgainstMounts(ereg_replace('\/$', '', $folder) . '/') ? true : false;
+               return $this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/') ? true : false;
        }
 
        /**
@@ -2502,7 +2502,7 @@ class browse_links {
         * @return      boolean         If the input path is found in the backend users filemounts and if the filemount is of type readonly, then return true.
         */
        function isReadOnlyFolder($folder) {
-               return ($GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(ereg_replace('\/$', '', $folder) . '/')]['type'] == 'readonly');
+               return ($GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/')]['type'] == 'readonly');
        }
 
        /**
index e1e8da7..c7dcce7 100644 (file)
@@ -534,7 +534,7 @@ class recordList extends t3lib_recordList {
 
                                // Traverse the configured columns and add all columns that can be searched:
                        foreach($TCA[$table]['columns'] as $fieldName => $info) {
-                               if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !ereg('date|time|int',$info['config']['eval'])))    {
+                               if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !preg_match('/date|time|int/',$info['config']['eval'])))    {
                                        $sfields[]=$fieldName;
                                }
                        }
index acfd8cf..83abb88 100644 (file)
@@ -875,7 +875,7 @@ class localRecordList extends recordList {
                                                        $editIdList = implode(',',$currentIdList);
                                                        if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
                                                        $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.$fCol.'&disHelp=1';
-                                                       $iTitle = sprintf($LANG->getLL('editThisColumn'),ereg_replace(':$','',trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol)))));
+                                                       $iTitle = sprintf($LANG->getLL('editThisColumn'),rtrim(trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol))),':'));
                                                        $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
                                                                                        '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
                                                                                        '</a>';
@@ -1484,7 +1484,7 @@ class localRecordList extends recordList {
                $opt=array();
                $opt[] = '<option value=""></option>';
                foreach($fields as $fN) {
-                       $fL = is_array($TCA[$table]['columns'][$fN]) ? ereg_replace(':$','',$LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '['.$fN.']';    // Field label
+                       $fL = is_array($TCA[$table]['columns'][$fN]) ? rtrim($LANG->sL($TCA[$table]['columns'][$fN]['label']),':') : '['.$fN.']';       // Field label
                        $opt[] = '
                                                                                        <option value="'.$fN.'"'.(in_array($fN,$setFields)?' selected="selected"':'').'>'.htmlspecialchars($fL).'</option>';
                }
index dcc1ed0..538e679 100644 (file)
@@ -380,7 +380,7 @@ class filelistFolderTree extends t3lib_folderTree {
                        end($this->tree);
                        $treeKey = key($this->tree);    // Get the key for this space
 
-                       $val = ereg_replace('^\./','',$val);
+                       $val = preg_replace('/^\.\//','',$val);
                        $title = $val;
                        $path = $files_path.$val.'/';
 
index 2165050..b2ebf09 100755 (executable)
@@ -93,7 +93,7 @@ if ($relativePath) {
        $workingDirectory = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd();
        if ($workingDirectory) {
                $temp_PATH_thisScript =
-                       $workingDirectory.'/'.ereg_replace('\.\/','',$temp_PATH_thisScript);
+                       $workingDirectory.'/'.preg_replace('/\.\//','',$temp_PATH_thisScript);
                if (!@is_file($temp_PATH_thisScript)) {
                        die ('Relative path found, but an error occured during resolving of the absolute path: '.$temp_PATH_thisScript.chr(10));
                }
index cabfab1..0199c28 100644 (file)
@@ -500,7 +500,7 @@ class nusoap_base {
                        case (is_array($val) || $type):
                                // detect if struct or array
                                $valueType = $this->isArraySimpleOrStruct($val);
-                if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
+                if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
                                        $i = 0;
                                        if(is_array($val) && count($val)> 0){
                                                foreach($val as $v){
@@ -695,7 +695,7 @@ class nusoap_base {
        */
        function expandQname($qname){
                // get element prefix
-               if(strpos($qname,':') && !ereg('^http://',$qname)){
+               if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
                        // get unqualified name
                        $name = substr(strstr($qname,':'),1);
                        // get ns prefix
@@ -823,7 +823,7 @@ class nusoap_base {
 function timestamp_to_iso8601($timestamp,$utc=true){
        $datestr = date('Y-m-d\TH:i:sO',$timestamp);
        if($utc){
-               $eregStr =
+               $pattern = '/'.
                '([0-9]{4})-'.  // centuries & years CCYY-
                '([0-9]{2})-'.  // months MM-
                '([0-9]{2})'.   // days DD
@@ -831,9 +831,10 @@ function timestamp_to_iso8601($timestamp,$utc=true){
                '([0-9]{2}):'.  // hours hh:
                '([0-9]{2}):'.  // minutes mm:
                '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
-               '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
+               '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
+               '/';
 
-               if(ereg($eregStr,$datestr,$regs)){
+               if(preg_match($pattern,$datestr,$regs)){
                        return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
                }
                return false;
@@ -849,7 +850,7 @@ function timestamp_to_iso8601($timestamp,$utc=true){
 * @access   public
 */
 function iso8601_to_timestamp($datestr){
-       $eregStr =
+       $pattern = '/'.
        '([0-9]{4})-'.  // centuries & years CCYY-
        '([0-9]{2})-'.  // months MM-
        '([0-9]{2})'.   // days DD
@@ -857,8 +858,10 @@ function iso8601_to_timestamp($datestr){
        '([0-9]{2}):'.  // hours hh:
        '([0-9]{2}):'.  // minutes mm:
        '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
-       '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
-       if(ereg($eregStr,$datestr,$regs)){
+       '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
+       '/';
+
+       if(preg_match($pattern,$datestr,$regs)){
                // not utc
                if($regs[8] != 'Z'){
                        $op = substr($regs[8],0,1);
@@ -1162,7 +1165,7 @@ class XMLSchema extends nusoap_base  {
         if(count($attrs) > 0){
                foreach($attrs as $k => $v){
                 // if ns declarations, add to class level array of valid namespaces
-                               if(ereg("^xmlns",$k)){
+                               if(preg_match('/^xmlns/',$k)){
                        //$this->xdebug("$k: $v");
                        //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
                        if($ns_prefix = substr(strrchr($k,':'),1)){
@@ -1272,7 +1275,7 @@ class XMLSchema extends nusoap_base  {
                                        //                        minOccurs="0" maxOccurs="unbounded" />
                                        //                </sequence>
                                        //            </complexType>
-                                       if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
+                                       if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
                                                $this->xdebug('complexType is unusual array');
                                                $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                                        } else {
@@ -1291,7 +1294,7 @@ class XMLSchema extends nusoap_base  {
                                        //                        minOccurs="0" maxOccurs="unbounded" />
                                        //                </sequence>
                                        //            </complexType>
-                                       if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
+                                       if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
                                                $this->xdebug('complexType is unusual array');
                                                $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                                        } else {
@@ -1689,7 +1692,7 @@ class XMLSchema extends nusoap_base  {
                } elseif(isset($this->attributes[$type])){
                        $this->xdebug("in getTypeDef, found attribute $type");
                        return $this->attributes[$type];
-               } elseif (ereg('_ContainedType$', $type)) {
+               } elseif (preg_match('/_ContainedType$/', $type)) {
                        $this->xdebug("in getTypeDef, have an untyped element $type");
                        $typeDef['typeClass'] = 'simpleType';
                        $typeDef['phpType'] = 'scalar';
@@ -2024,7 +2027,7 @@ class soap_transport_http extends nusoap_base {
        function soap_transport_http($url){
                parent::nusoap_base();
                $this->setURL($url);
-               ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+               preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
                $this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
                $this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
        }
@@ -2563,7 +2566,7 @@ class soap_transport_http extends nusoap_base {
                                }
                        }
                        // remove 100 header
-                       if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
+                       if(isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)){
                                unset($lb);
                                $data = '';
                        }//
@@ -2716,7 +2719,7 @@ class soap_transport_http extends nusoap_base {
                curl_close($this->ch);
 
                // remove 100 header(s)
-               while (ereg('^HTTP/1.1 100',$data)) {
+               while (preg_match('/^HTTP\/1.1 100/',$data)) {
                        if ($pos = strpos($data,"\r\n\r\n")) {
                                $data = ltrim(substr($data,$pos));
                        } elseif($pos = strpos($data,"\n\n") ) {
@@ -3282,7 +3285,7 @@ class wsdl extends nusoap_base {
             $this->currentSchema->schemaStartElement($parser, $name, $attrs);
             $this->appendDebug($this->currentSchema->getDebug());
             $this->currentSchema->clearDebug();
-        } elseif (ereg('schema$', $name)) {
+        } elseif (preg_match('/schema$/', $name)) {
                $this->debug('Parsing WSDL schema');
             // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
             $this->status = 'schema';
@@ -3301,7 +3304,7 @@ class wsdl extends nusoap_base {
             if (count($attrs) > 0) {
                                // register namespace declarations
                 foreach($attrs as $k => $v) {
-                    if (ereg("^xmlns", $k)) {
+                    if (preg_match('/^xmlns/', $k)) {
                         if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
                             $this->namespaces[$ns_prefix] = $v;
                         } else {
@@ -3326,7 +3329,7 @@ class wsdl extends nusoap_base {
                 $attrs = array();
             }
             // get element prefix, namespace and name
-            if (ereg(':', $name)) {
+            if (preg_match('/:/', $name)) {
                 // get ns prefix
                 $prefix = substr($name, 0, strpos($name, ':'));
                 // get ns
@@ -3491,7 +3494,7 @@ class wsdl extends nusoap_base {
        */
        function end_element($parser, $name){
                // unset schema status
-               if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
+               if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
                        $this->status = "";
             $this->appendDebug($this->currentSchema->getDebug());
             $this->currentSchema->clearDebug();
@@ -4936,7 +4939,7 @@ class soap_parser extends nusoap_base {
                        $key_localpart = $this->getLocalPart($key);
                        // if ns declarations, add to class level array of valid namespaces
             if($key_prefix == 'xmlns'){
-                               if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
+                               if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
                                        $this->XMLSchemaVersion = $value;
                                        $this->namespaces['xsd'] = $this->XMLSchemaVersion;
                                        $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
@@ -4960,7 +4963,7 @@ class soap_parser extends nusoap_base {
                                // should do something here with the namespace of specified type?
                        } elseif($key_localpart == 'arrayType'){
                                $this->message[$pos]['type'] = 'array';
-                               /* do arrayType ereg here
+                               /* do arrayType preg_match here
                                [1]    arrayTypeValue    ::=    atype asize
                                [2]    atype    ::=    QName rank*
                                [3]    rank    ::=    '[' (',')* ']'
@@ -4968,8 +4971,8 @@ class soap_parser extends nusoap_base {
                                [5]    length    ::=    nextDimension* Digit+
                                [6]    nextDimension    ::=    Digit+ ','
                                */
-                               $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
-                               if(ereg($expr,$value,$regs)){
+                               $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
+                               if(preg_match($expr,$value,$regs)){
                                        $this->message[$pos]['typePrefix'] = $regs[1];
                                        $this->message[$pos]['arrayTypePrefix'] = $regs[1];
                        if (isset($this->namespaces[$regs[1]])) {
@@ -5682,7 +5685,7 @@ class soapclient extends nusoap_base  {
                // detect transport
                switch(true){
                        // http(s)
-                       case ereg('^http',$this->endpoint):
+                       case preg_match('/^http/',$this->endpoint):
                                $this->debug('transporting via HTTP');
                                if($this->persistentConnection == true && is_object($this->persistentConnection)){
                                        $http =& $this->persistentConnection;
@@ -5704,10 +5707,10 @@ class soapclient extends nusoap_base  {
                                        $http->setEncoding($this->http_encoding);
                                }
                                $this->debug('sending message, length='.strlen($msg));
-                               if(ereg('^http:',$this->endpoint)){
+                               if(preg_match('/^http:/',$this->endpoint)){
                                //if(strpos($this->endpoint,'http:')){
                                        $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
-                               } elseif(ereg('^https',$this->endpoint)){
+                               } elseif(preg_match('/^https/',$this->endpoint)){
                                //} elseif(strpos($this->endpoint,'https:')){
                                        //if(phpversion() == '4.3.0-dev'){
                                                //$response = $http->send($msg,$timeout,$response_timeout);
@@ -5765,7 +5768,7 @@ class soapclient extends nusoap_base  {
                if (strpos($headers['content-type'], '=')) {
                        $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
                        $this->debug('Got response encoding: ' . $enc);
-                       if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+                       if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
                                $this->xml_encoding = strtoupper($enc);
                        } else {
                                $this->xml_encoding = 'US-ASCII';
index 2c72bd2..ac3650c 100644 (file)
@@ -196,7 +196,7 @@ class SC_show_item {
                } else  {
                        // if the filereference $this->file is relative, we correct the path
                        if (substr($this->table,0,3)=='../')    {
-                               $this->file = PATH_site.ereg_replace('^\.\./','',$this->table);
+                               $this->file = PATH_site.preg_replace('/^\.\.\//','',$this->table);
                        } else {
                                $this->file = $this->table;
                        }
index ac11afb..6218529 100755 (executable)
@@ -673,7 +673,7 @@ class local_beUserAuth extends t3lib_beUserAuth {
                                                                        $pout[]='<span class="nobr">'.t3lib_iconWorks::getIconImage($table,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title']).'</span>';
                                                                }
                                                                if ($GLOBALS['TCA'][$table]['columns'][$field]) {
-                                                                       $pout[]='<span class="nobr"> - '.ereg_replace(':$','',$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label'])).'</span>';
+                                                                       $pout[]='<span class="nobr"> - '.rtrim($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']), ':').'</span>';
                                                                }
                                                        }
                                                }
index e717f88..beae2bc 100755 (executable)
@@ -318,7 +318,7 @@ class tx_cms_layout extends recordList {
                        foreach($this->fieldArray as $field)    {
                                if ($editIdList && isset($TCA['pages']['columns'][$field]) && $field!='uid' && !$this->pages_noEditColumns)     {
                                        $params='&edit[pages]['.$editIdList.']=edit&columnsOnly='.$field.'&disHelp=1';
-                                       $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'),ereg_replace(':$','',trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$field)))));
+                                       $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'),rtrim(trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$field))), ':'));
                                        $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'.
                                                        '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
                                                        '</a>';
index 22d147b..a9db221 100644 (file)
@@ -1793,7 +1793,7 @@ class tslib_cObj {
                                $confData['type'] = trim(strtolower(end($typeParts)));
                                if (count($typeParts)==1)       {
                                        $confData['fieldname'] = $this->cleanFormName($parts[0]);
-                                       if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email')        {$confData['fieldname']='email';}
+                                       if (strtolower(preg_replace('/[^[:alnum:]]/','',$confData['fieldname']))=='email')      {$confData['fieldname']='email';}
                                                // Duplicate fieldnames resolved
                                        if (isset($fieldname_hashArray[md5($confData['fieldname'])]))   {
                                                $confData['fieldname'].='_'.$cc;
@@ -2881,7 +2881,7 @@ class tslib_cObj {
         */
        function linkWrap($content,$wrap)       {
                $wrapArr = explode('|', $wrap);
-               if (ereg("\{([0-9]*)\}",$wrapArr[0],$reg))      {
+               if (preg_match('/\{([0-9]*)\}/',$wrapArr[0],$reg))      {
                        if ($uid = $GLOBALS['TSFE']->tmpl->rootLine[$reg[1]]['uid'])    {
                                $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]);
                        }
@@ -3416,10 +3416,10 @@ class tslib_cObj {
                                }
 
                                if ($conf['doubleBrTag']) {
-                                       $content=ereg_replace("\r?\n[\t ]*\r?\n",$conf['doubleBrTag'],$content);
+                                       $content=preg_replace("/\r?\n[\t ]*\r?\n/",$conf['doubleBrTag'],$content);
                                }
                                if ($conf['br']) {$content=nl2br($content);}
-                               if ($conf['brTag']) {$content= ereg_replace(chr(10),$conf['brTag'],$content);}
+                               if ($conf['brTag']) {$content= str_replace(chr(10),$conf['brTag'],$content);}
                                if ($conf['encapsLines.']) {$content=$this->encaps_lineSplit($content,$conf['encapsLines.']);}
                                if ($conf['keywords']) {$content= $this->keywords($content);}
                                if ($conf['innerWrap'] || $conf['innerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap'], $conf['innerWrap.']));}
@@ -3560,7 +3560,7 @@ class tslib_cObj {
                }
                $temp = explode($char,$content);
                $last = ''.(count($temp)-1);
-               $index=$this->calc(eregi_replace('last',$last,$listNum));
+               $index=$this->calc(str_ireplace('last',$last,$listNum));
                return $temp[$index];
        }
 
@@ -3721,7 +3721,7 @@ class tslib_cObj {
         */
        function clean_directory($theDir)       {
                if (t3lib_div::validPathStr($theDir))   {               // proceeds if no '//', '..' or '\' is in the $theFile
-                       $theDir = ereg_replace("[\/\. ]*$",'',$theDir);         // Removes all dots, slashes and spaces after a path...
+                       $theDir = preg_replace('/[\/\. ]*$/','',$theDir);               // Removes all dots, slashes and spaces after a path...
                        if (!t3lib_div::isAbsPath($theDir) && @is_dir($theDir)) {
                                return $theDir;
                        }
@@ -3896,7 +3896,7 @@ class tslib_cObj {
                                "'<\w+.*?(onabort|onbeforeunload|onblur|onchange|onclick|ondblclick|ondragdrop|onerror|onfilterchange|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onmove|onreadystatechange|onreset|onresize|onscroll|onselect|onselectstart|onsubmit|onunload).*?>'si",
                        ), '', $text);
 
-                       $text = eregi_replace('<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*','',$text);
+                       $text = preg_replace('/<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*/i','',$text);
 
                        // Return clean content
                return $text;
@@ -4107,7 +4107,7 @@ class tslib_cObj {
                        }
 
                                // Wrapping file label
-                       if ($conf['removePrependedNumbers']) $theValue=ereg_replace('_[0-9][0-9](\.[[:alnum:]]*)$','\1',$theValue);
+                       if ($conf['removePrependedNumbers']) $theValue=preg_replace('/_[0-9][0-9](\.[[:alnum:]]*)$/','\1',$theValue);
                        $theValue = $this->stdWrap($theValue,$conf['labelStdWrap.']);
 
                                // Wrapping file
@@ -4298,10 +4298,10 @@ class tslib_cObj {
                                        $tagName=strtolower($htmlParser->getFirstTagName($v));
                                        $cfg=$conf['externalBlocks.'][$tagName.'.'];
                                        if ($cfg['stripNLprev'] || $cfg['stripNL'])     {
-                                               $parts[$k-1]=ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $parts[$k-1]);
+                                               $parts[$k-1]=preg_replace('/'.chr(13).'?'.chr(10).'[ ]*$/', '', $parts[$k-1]);
                                        }
                                        if ($cfg['stripNLnext'] || $cfg['stripNL'])     {
-                                               $parts[$k+1]=ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $parts[$k+1]);
+                                               $parts[$k+1]=preg_replace('/^[ ]*'.chr(13).'?'.chr(10).'/', '', $parts[$k+1]);
                                        }
                                }
                        }
@@ -4424,7 +4424,7 @@ class tslib_cObj {
                                $data = substr($theValue,$pointer,$len);        // $data is the content until the next <tag-start or end is detected. In case of a currentTag set, this would mean all data between the start- and end-tags
                                if ($data!='')  {
                                        if ($stripNL)   {               // If the previous tag was set to strip NewLines in the beginning of the next data-chunk.
-                                               $data = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $data);
+                                               $data = preg_replace('/^[ ]*'.chr(13).'?'.chr(10).'/', '', $data);
                                        }
 
                                        if (!is_array($currentTag))     {                       // These operations should only be performed on code outside the tags...
@@ -4529,9 +4529,9 @@ class tslib_cObj {
                                                }
                                                $this->parameters['allParams']=trim($currentTag[1]);
                                                if ($stripNL)   {       // Removes NL in the beginning and end of the tag-content AND at the end of the currentTagBuffer. $stripNL depends on the configuration of the current tag
-                                                       $contentAccum[$contentAccumP-1] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP-1]);
-                                                       $contentAccum[$contentAccumP] = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $contentAccum[$contentAccumP]);
-                                                       $contentAccum[$contentAccumP] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP]);
+                                                       $contentAccum[$contentAccumP-1] = preg_replace('/'.chr(13).'?'.chr(10).'[ ]*$/', '', $contentAccum[$contentAccumP-1]);
+                                                       $contentAccum[$contentAccumP] = preg_replace('/^[ ]*'.chr(13).'?'.chr(10).'/', '', $contentAccum[$contentAccumP]);
+                                                       $contentAccum[$contentAccumP] = preg_replace('/'.chr(13).'?'.chr(10).'[ ]*$/', '', $contentAccum[$contentAccumP]);
                                                }
                                                $this->data[$this->currentValKey] = $contentAccum[$contentAccumP];
                                                $newInput=$this->cObjGetSingle($theName,$theConf,'/parseFunc/.tags.'.$tag[0]);  // fetch the content object
@@ -4684,7 +4684,7 @@ class tslib_cObj {
                        if (trim(substr($textstr,-1))=='' && $len)      {
 
                                $lastChar=substr($textpieces[$i],$len-1,1);
-                               if (!ereg('[A-Za-z0-9\/#_-]',$lastChar)) {$len--;}              // Included '\/' 3/12
+                               if (!preg_match('/[A-Za-z0-9\/#_-]/',$lastChar)) {$len--;}              // Included '\/' 3/12
 
                                $parts[0]=substr($textpieces[$i],0,$len);
                                $parts[1]=substr($textpieces[$i],$len);
@@ -4753,11 +4753,11 @@ class tslib_cObj {
                        $len = strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
                        if (trim(substr($textstr,-1))=='' && $len)      {
                                $lastChar = substr($textpieces[$i],$len-1,1);
-                               if (!ereg('[A-Za-z0-9]',$lastChar)) {$len--;}
+                               if (!preg_match('/[A-Za-z0-9]/',$lastChar)) {$len--;}
 
                                $parts[0] = substr($textpieces[$i],0,$len);
                                $parts[1] = substr($textpieces[$i],$len);
-                               $linktxt = ereg_replace('\?.*','',$parts[0]);
+                               $linktxt = preg_replace('/\?.*/','',$parts[0]);
                                list($mailToUrl,$linktxt) = $this->getMailTo($parts[0],$linktxt,$initP);
                                $mailToUrl = $GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii'?$mailToUrl:htmlspecialchars($mailToUrl);
                                $res = '<a href="'.$mailToUrl.'"'.$aTagParams.'>';
@@ -4826,7 +4826,7 @@ class tslib_cObj {
                                                        $gifCreator->init();
 
                                                        if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'])     {
-                                                               $gifCreator->filenamePrefix = $GLOBALS['TSFE']->fileNameASCIIPrefix(ereg_replace('\.[[:alnum:]]+$','',basename($theImage)),intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']),'_');
+                                                               $gifCreator->filenamePrefix = $GLOBALS['TSFE']->fileNameASCIIPrefix(preg_replace('/\.[[:alnum:]]+$/','',basename($theImage)),intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']),'_');
                                                        }
 
                                                        if ($fileArray['sample'])       {
@@ -5346,7 +5346,7 @@ class tslib_cObj {
                        $JSwindowParts = array();
                        $JSwindowParams = '';
                        $onClick = '';
-                       if ($forceTarget && ereg('^([0-9]+)x([0-9]+)(:(.*)|.*)$',$forceTarget,$JSwindowParts))  {
+                       if ($forceTarget && preg_match('/^([0-9]+)x([0-9]+)(:(.*)|.*)$/',$forceTarget,$JSwindowParts))  {
                                        // Take all pre-configured and inserted parameters and compile parameter list, including width+height:
                                $JSwindow_tempParamsArr = t3lib_div::trimExplode(',',strtolower($conf['JSwindow_params'].','.$JSwindowParts[4]),1);
                                $JSwindow_paramsArr=array();
@@ -5375,7 +5375,7 @@ class tslib_cObj {
 
                                // Detecting kind of link:
                        if(strstr($link_param,'@') && (!$pU['scheme'] || $pU['scheme']=='mailto'))      {               // If it's a mail address:
-                               $link_param = eregi_replace('^mailto:','',$link_param);
+                               $link_param = preg_replace('/^mailto:/i','',$link_param);
                                list($this->lastTypoLinkUrl,$linktxt) = $this->getMailTo($link_param,$linktxt,$initP);
                                $finalTagParts['url']=$this->lastTypoLinkUrl;
                                $finalTagParts['TYPE']='mailto';
@@ -7102,8 +7102,8 @@ class tslib_cObj {
                                        $GLOBALS['TT']->setTSlogMessage($error);
                                } else {
                                        $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
-                                       $conf['max'] = eregi_replace('total', $row[0], $conf['max']);
-                                       $conf['begin'] = eregi_replace('total', $row[0], $conf['begin']);
+                                       $conf['max'] = str_ireplace('total', $row[0], $conf['max']);
+                                       $conf['begin'] = str_ireplace('total', $row[0], $conf['begin']);
                                }
                                $GLOBALS['TYPO3_DB']->sql_free_result($res);
                        }
@@ -7175,7 +7175,7 @@ class tslib_cObj {
                );
 
                if (trim($conf['uidInList']))   {
-                       $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['uidInList']));  // str_replace instead of ereg_replace 020800
+                       $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['uidInList']));
                        if (count($listArr)==1) {
                                $query.=' AND '.$table.'.uid='.intval($listArr[0]);
                        } else {
@@ -7188,7 +7188,7 @@ class tslib_cObj {
                        $pid_uid_flag++;
                }
                if (strcmp(trim($conf['pidInList']), '')) {
-                       $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['pidInList']));      // str_replace instead of ereg_replace 020800
+                       $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['pidInList']));
                                // removes all pages which are not visible for the user!
                        $listArr = $this->checkPidArray($listArr, $table);
                        if (count($listArr))    {
index 158da87..0a88798 100644 (file)
@@ -1704,7 +1704,7 @@ require_once (PATH_t3lib.'class.t3lib_lock.php');
                                        $message = 'You logged out from Workspace preview mode. Click this link to <a href="%1$s">go back to the website</a>';
                                }
                                die(sprintf($message,
-                                       htmlspecialchars(ereg_replace('\&?ADMCMD_prev=[[:alnum:]]+','',t3lib_div::_GET('returnUrl')))
+                                       htmlspecialchars(preg_replace('/\&?ADMCMD_prev=[[:alnum:]]+/','',t3lib_div::_GET('returnUrl')))
                                        ));
                        }
 
index b7883e7..c6e31e4 100644 (file)
@@ -218,7 +218,7 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
                                                case 'IMAGE':
                                                        $fileInfo = $this->getResource($conf['file'],$conf['file.']);
                                                        if ($fileInfo)  {
-                                                               $this->combinedFileNames[] = ereg_replace('\.[[:alnum:]]+$','',basename($fileInfo[3]));
+                                                               $this->combinedFileNames[] = preg_replace('/\.[[:alnum:]]+$/','',basename($fileInfo[3]));
                                                                $this->setup[$theKey.'.']['file'] = $fileInfo[3];
                                                                $this->setup[$theKey.'.']['BBOX'] = $fileInfo;
                                                                $this->objBB[$theKey] = $fileInfo;
index d6795ab..b8b609f 100644 (file)
@@ -179,7 +179,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                        }
                                }
                        }
-                       $GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx);
+                       $GLOBALS['TSFE']->sWordRegEx = preg_replace('/\|$/','',$GLOBALS['TSFE']->sWordRegEx);
                }
 
                        // linkVars
@@ -829,7 +829,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                if (!$defBT)    $defBT = $GLOBALS['TSFE']->defaultBodyTag;
                $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
                if ($bgImg=$GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'],$GLOBALS['TSFE']->pSetup['bgImg.']))        {
-                       $bodyTag = ereg_replace('>$','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix.$bgImg[3].'">';
+                       $bodyTag = preg_replace('/>$/','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix.$bgImg[3].'">';
                }
 
                if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']))  {
@@ -837,16 +837,16 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                        if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS'])      {
                                // Setting margins in CSS, see above
                        } else {
-                               $bodyTag = ereg_replace('>$','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
+                               $bodyTag = preg_replace('/>$/','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
                        }
                }
 
                if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']))       {
-                       $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']).'>';
+                       $bodyTag = preg_replace('/>$/','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']).'>';
                }
 
                if (count($JSef[1]))    {       // Event functions:
-                       $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
+                       $bodyTag = preg_replace('/>$/','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
                }
                $GLOBALS['TSFE']->content.= chr(10).$bodyTag;
 
index 55bd7e1..09f8e29 100644 (file)
@@ -393,7 +393,7 @@ class tslib_pibase {
         * @return      string          The processed input string, modified IF a <a> tag was found
         */
        function pi_openAtagHrefInJSwindow($str,$winName='',$winParams='width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1')      {
-               if (eregi('(.*)(<a[^>]*>)(.*)',$str,$match))    {
+               if (preg_match('/(.*)(<a[^>]*>)(.*)/i',$str,$match))    {
                        $aTagContent = t3lib_div::get_tag_attributes($match[2]);
                        $match[2]='<a href="#" onclick="'.
                                htmlspecialchars('vHWin=window.open(\''.$GLOBALS['TSFE']->baseUrlWrap($aTagContent['href']).'\',\''.($winName?$winName:md5($aTagContent['href'])).'\',\''.$winParams.'\');vHWin.focus();return false;').
index 347880d..92ff3e2 100644 (file)
@@ -226,33 +226,32 @@ class tslib_search {
        function split($origSword, $specchars='+-', $delchars='+.,-')   {
                $sword = $origSword;
                $specs = '['.$this->quotemeta($specchars).']';
-               $delchars = '['.$this->quotemeta($delchars).']';
 
                        // As long as $sword is true (that means $sword MUST be reduced little by little until its empty inside the loop!)
                while ($sword)  {
-                       if (ereg('^"',$sword))  {               // There was a double-quote and we will then look for the ending quote.
-                               $sword = ereg_replace('^"','',$sword);          // Removes first double-quote
-                               ereg('^[^"]*',$sword,$reg);  // Removes everything till next double-quote
+                       if (preg_match('/^"/',$sword))  {               // There was a double-quote and we will then look for the ending quote.
+                               $sword = preg_replace('/^"/','',$sword);                // Removes first double-quote
+                               preg_match('/^[^"]*/',$sword,$reg);  // Removes everything till next double-quote
                                $value[] = $reg[0];  // reg[0] is the value, should not be trimmed
-                               $sword = ereg_replace('^'.$this->quotemeta($reg[0]),'',$sword);
-                               $sword = trim(ereg_replace('^"','',$sword));            // Removes last double-quote
-                       } elseif (ereg('^'.$specs,$sword,$reg)) {
+                               $sword = preg_replace('/^'.$this->quotemeta($reg[0]).'/','',$sword);
+                               $sword = trim(preg_replace('/^"/','',$sword));          // Removes last double-quote
+                       } elseif (preg_match('/^'.$specs.'/',$sword,$reg)) {
                                $value[] = $reg[0];
-                               $sword = trim(ereg_replace('^'.$specs,'',$sword));              // Removes = sign
-                       } elseif (ereg('[\+\-]',$sword)) {      // Check if $sword contains + or -
+                               $sword = trim(preg_replace('/^'.$specs.'/','',$sword));         // Removes = sign
+                       } elseif (preg_match('/[\+\-]/',$sword)) {      // Check if $sword contains + or -
                                        // + and - shall only be interpreted as $specchars when there's whitespace before it
                                        // otherwise it's included in the searchword (e.g. "know-how")
                                $a_sword = explode(' ',$sword); // explode $sword to single words
                                $word = array_shift($a_sword);  // get first word
-                               $word = ereg_replace($delchars.'$','',$word);           // Delete $delchars at end of string
+                               $word = rtrim($word, $delchars);                // Delete $delchars at end of string
                                $value[] = $word;       // add searchword to values
                                $sword = implode(' ',$a_sword); // re-build $sword
                        } else {
                                        // There are no double-quotes around the value. Looking for next (space) or special char.
-                               ereg('^[^ '.$this->quotemeta($specchars).']*',$sword,$reg);
-                               $word = ereg_replace($delchars.'$','',trim($reg[0]));           // Delete $delchars at end of string
+                               preg_match('/^[^ '.$this->quotemeta($specchars).']*/',$sword,$reg);
+                               $word = rtrim(trim($reg[0]), $delchars);                // Delete $delchars at end of string
                                $value[] = $word;
-                               $sword = trim(ereg_replace('^'.$this->quotemeta($reg[0]),'',$sword));
+                               $sword = trim(preg_replace('/^'.$this->quotemeta($reg[0]).'/','',$sword));
                        }
                }
 
index 8c88567..0680e31 100755 (executable)
@@ -445,16 +445,16 @@ class user_feAdmin        {
                                                        $this->dataArr[$theField] = str_replace(' ', '', $this->dataArr[$theField]);
                                                break;
                                                case 'alpha':
-                                                       $this->dataArr[$theField] = ereg_replace('[^a-zA-Z]','',$this->dataArr[$theField]);
+                                                       $this->dataArr[$theField] = preg_replace('/[^a-zA-Z]/','',$this->dataArr[$theField]);
                                                break;
                                                case 'num':
-                                                       $this->dataArr[$theField] = ereg_replace('[^0-9]','',$this->dataArr[$theField]);
+                                                       $this->dataArr[$theField] = preg_replace('/[^0-9]/','',$this->dataArr[$theField]);
                                                break;
                                                case 'alphanum':
-                                                       $this->dataArr[$theField] = ereg_replace('[^a-zA-Z0-9]','',$this->dataArr[$theField]);
+                                                       $this->dataArr[$theField] = preg_replace('/[^a-zA-Z0-9]/','',$this->dataArr[$theField]);
                                                break;
                                                case 'alphanum_x':
-                                                       $this->dataArr[$theField] = ereg_replace('[^a-zA-Z0-9_-]','',$this->dataArr[$theField]);
+                                                       $this->dataArr[$theField] = preg_replace('/[^a-zA-Z0-9_-]/','',$this->dataArr[$theField]);
                                                break;
                                                case 'trim':
                                                        $this->dataArr[$theField] = trim($this->dataArr[$theField]);
@@ -497,8 +497,8 @@ class user_feAdmin  {
                                                        $hashArray=array();
                                                        while(list(,$fN)=each($otherFields))    {
                                                                $vv = $this->dataArr[$fN];
-                                                               $vv = ereg_replace('[[:space:]]','',$vv);
-                                                               $vv = ereg_replace('[^[:alnum:]]','',$vv);
+                                                               $vv = preg_replace('/[[:space:]]/','',$vv);
+                                                               $vv = preg_replace('/[^[:alnum:]]/','',$vv);
                                                                $vv = strtolower($vv);
                                                                $hashArray[]=$vv;
                                                        }
index c6016c2..dea49a2 100644 (file)
@@ -208,7 +208,7 @@ class user_plaintext {
         */
        function getMenuSitemap()       {
                $str = $this->cObj->cObjGetSingle($this->conf['menu'],$this->conf['menu.']);
-               $str = $this->breakBulletlist(trim(strip_tags(eregi_replace('<br[ /]*>',chr(10),$this->parseBody($str)))));
+               $str = $this->breakBulletlist(trim(strip_tags(preg_replace('/<br[ \/]*>/i',chr(10),$this->parseBody($str)))));
                return $str;
        }
 
@@ -229,7 +229,7 @@ class user_plaintext {
         * @return      string          Content
         */
        function getHTML($str=array())  {
-               return $this->breakContent(strip_tags(eregi_replace('<br[ /]*>',chr(10),$this->parseBody(is_string($str)?$str:$this->cObj->data['bodytext']))));
+               return $this->breakContent(strip_tags(preg_replace('/<br[ \/]*>/i',chr(10),$this->parseBody(is_string($str)?$str:$this->cObj->data['bodytext']))));
        }
 
        /**
@@ -261,7 +261,7 @@ class user_plaintext {
         */
        function parseBody($str)        {
                        // First, regular parsing:
-               $str = eregi_replace('<br[ /]*>',' ',$str);
+               $str = preg_replace('/<br[ \/]*>/i',' ',$str);
                $str = $this->cObj->stdWrap($str,$this->conf['bodytext.']['stdWrap.']);
                        // Then all a-tags:
                $aConf = array();
index f1528fa..3719053 100755 (executable)
@@ -301,7 +301,7 @@ class user_wapversion {
         * @return      string          The processed value returned.
         */
        function nl2br($str)    {
-               return ereg_replace(chr(10),'<br/>',$str);
+               return str_replace(chr(10),'<br/>',$str);
        }
 
        /**
index e8775c9..e0376a8 100644 (file)
@@ -121,7 +121,7 @@ while(list(,$temp_publish_id)=each($temp_publish_pages))    {
 // ***************************
 $publishDir = $TYPO3_CONF_VARS['FE']['publish_dir'];
 if ($publishDir && @is_dir($publishDir))       {
-       $publishDir = ereg_replace('/*$','',$publishDir).'/';
+       $publishDir = rtrim($publishDir, '/').'/';
        debug('Publishing in: '.$publishDir,1);
        reset($temp_publish_array);
        while(list($key,$val)=each($temp_publish_array))        {
index 680386f..2984c90 100755 (executable)
@@ -76,7 +76,7 @@ class ux_localRecordList extends localRecordList {
                                foreach($TCA[$table]['columns'] as $fieldName => $info) {
                                        if ($GLOBALS['TYPO3_DB']->cache_fieldType[$table][$fieldName]['metaType'] == 'B') {
                                                // skip, LIKE is not supported on BLOB columns...
-                                       } elseif ($info['config']['type']=='text' || ($info['config']['type']=='input' && !ereg('date|time|int',$info['config']['eval']))) {
+                                       } elseif ($info['config']['type']=='text' || ($info['config']['type']=='input' && !preg_match('/date|time|int/',$info['config']['eval']))) {
                                                $queryPart .= $or.$fieldName.' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table).'%\'';
                                                $or = ' OR ';
                                        }
@@ -84,7 +84,7 @@ class ux_localRecordList extends localRecordList {
                        } else {
                                        // Traverse the configured columns and add all columns that can be searched
                                foreach($TCA[$table]['columns'] as $fieldName => $info) {
-                                       if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !ereg('date|time|int',$info['config']['eval']))) {
+                                       if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !preg_match('/date|time|int/',$info['config']['eval']))) {
                                                $sfields[]=$fieldName;
                                        }
                                }
index 2a9dbf9..52c6aa5 100644 (file)
 /**
  * Example DBAL handler class
  * Stores data in XML, not a database.
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage tx_dbal
  */
 class tx_dbal_handler_xmldb extends t3lib_sqlengine {
 
-       var $config = array();  
-       var $pObj;      // Set from DBAL class. 
-       
+       var $config = array();
+       var $pObj;      // Set from DBAL class.
+
        // Database Storage directory:
        var $DBdir = '';
        var $DBstructure = array(
                'tables' => array()
        );
-       
+
        /**
         * Initialize handler
-        * 
+        *
         * @param       array           Configuration from DBAL
         * @param       object          Parent object
-        * @return      void            
+        * @return      void
         */
        function init($config, &$pObj)  {
                $this->config = $config['config'];
-               
+
                $dbStorage = t3lib_div::getFileAbsFileName($this->config['DBstorageDir']);
-               if ($dbStorage && @is_dir($dbStorage) && ($dbStorage{strlen($dbStorage)-1} == '/')) { //ereg('/$',$dbStorage))  {
+               if ($dbStorage && @is_dir($dbStorage) && ($dbStorage{strlen($dbStorage)-1} == '/')) {
                        $this->DBdir = $dbStorage;
-                       
+
                                // Read structure file:
                        if (@is_file($this->DBdir.'_STRUCTURE.xml'))    {
                                $this->xmlDB_readStructure();
index d8b5c47..0a6e7e2 100644 (file)
@@ -207,7 +207,7 @@ class tx_feedit_editpanel {
                        $cBuf = rtrim($content);
                        $securCount = 30;
                        while($securCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '</a>') {
-                               $cBuf = rtrim(ereg_replace('<[^<]*>$', '', $cBuf));
+                               $cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
                                $securCount--;
                        }
                        $content = (strlen($cBuf) && $securCount) ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : $content = $icon . $content;
index 9479ee8..3f68d55 100644 (file)
@@ -377,7 +377,7 @@ class tx_felogin_pi1 extends tslib_pibase {
                                                case 'referer':
                                                        $redirect_url = t3lib_div::getIndpEnv('HTTP_REFERER');
                                                                // avoid forced logout, when trying to login immediatly after a logout
-                                                       $redirect_url = ereg_replace("[&?]logintype=[a-z]+", '', $redirect_url);
+                                                       $redirect_url = preg_replace('/[&?]logintype=[a-z]+/', '', $redirect_url);
                                                break;
                                                case 'refererDomains':
                                                                // Auto redirect.
@@ -388,11 +388,11 @@ class tx_felogin_pi1 extends tslib_pibase {
                                                                $redirect_url = t3lib_div::getIndpEnv('HTTP_REFERER');
                                                                        // is referring url allowed to redirect?
                                                                $match = array();
-                                                               if (ereg('^http://([[:alnum:]._-]+)/', $redirect_url, $match)) {
+                                                               if (preg_match('/^http://([[:alnum:]._-]+)//', $redirect_url, $match)) {
                                                                        $redirect_domain = $match[1];
                                                                        $found = false;
                                                                        foreach(split(',', $this->conf['domains']) as $d) {
-                                                                               if (ereg('(^|\.)'.$d.'$', $redirect_domain)) {
+                                                                               if (preg_match('/(^|\.)/'.$d.'$', $redirect_domain)) {
                                                                                        $found = true;
                                                                                        break;
                                                                                }
@@ -403,7 +403,7 @@ class tx_felogin_pi1 extends tslib_pibase {
                                                                }
 
                                                                        // Avoid forced logout, when trying to login immediatly after a logout
-                                                               $redirect_url = ereg_replace("[&?]logintype=[a-z]+", "", $redirect_url);
+                                                               $redirect_url = preg_replace('/[&?]logintype=[a-z]+/', '', $redirect_url);
                                                        }
                                                break;
                                        }
index c569d96..f717e8d 100755 (executable)
@@ -433,7 +433,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                $inData['pagetree']['maxNumber'] = t3lib_div::intInRange($inData['pagetree']['maxNumber'],1,10000,100);
                $inData['listCfg']['maxNumber'] = t3lib_div::intInRange($inData['listCfg']['maxNumber'],1,10000,100);
                $inData['maxFileSize'] = t3lib_div::intInRange($inData['maxFileSize'],1,10000,1000);
-               $inData['filename'] = trim(ereg_replace('[^[:alnum:]./_-]*','',ereg_replace('\.(t3d|xml)$','',$inData['filename'])));
+               $inData['filename'] = trim(preg_replace('/[^[:alnum:]./_-]*/','',preg_replace('/\.(t3d|xml)$/','',$inData['filename'])));
                if (strlen($inData['filename']))        {
                        $inData['filename'].= $inData['filetype']=='xml' ? '.xml' : '.t3d';
                }
@@ -594,7 +594,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        }
 
                                // Filename:
-                       $dlFile = $inData['filename'] ? $inData['filename'] : 'T3D_'.substr(ereg_replace('[^[:alnum:]_]','-',$inData['download_export_name']),0,20).'_'.date('d-m-H-i-s').$fExt;
+                       $dlFile = $inData['filename'] ? $inData['filename'] : 'T3D_'.substr(preg_replace('/[^[:alnum:]_]/','-',$inData['download_export_name']),0,20).'_'.date('d-m-H-i-s').$fExt;
 
                                // Export for download:
                        if ($inData['download_export']) {
index 36da635..e7e4063 100755 (executable)
@@ -844,7 +844,7 @@ class tx_impexp {
                                                $uniquePrefix = '###'.md5(time()).'###';
 
                                                if (strtolower($html_fI['extension'])==='css')  {
-                                                       $prefixedMedias = explode($uniquePrefix, eregi_replace('(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))', '\1'.$uniquePrefix.'\2'.$uniquePrefix.'\3', $fileRec['content']));
+                                                       $prefixedMedias = explode($uniquePrefix, preg_replace('/(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))/i', '\1'.$uniquePrefix.'\2'.$uniquePrefix.'\3', $fileRec['content']));
                                                } else {        // html, htm:
                                                        $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
                                                        $prefixedMedias = explode($uniquePrefix, $htmlParser->prefixResourcePath($uniquePrefix,$fileRec['content'],array(),$uniquePrefix));
@@ -1725,16 +1725,15 @@ class tx_impexp {
        function remapListedDBRecords_flexFormCallBack($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2, $path)  {
 
                        // Extract parameters:
-               list($table,$uid,$field,$config)        = $pParams;
+               list($table,$uid,$field,$config) = $pParams;
 
                        // In case the $path is used as index without a trailing slash we will remove that
-               if (!is_array($config['flexFormRels']['db'][$path]) && is_array($config['flexFormRels']['db'][ereg_replace('\/$','',$path)]))   {
-                       $path = ereg_replace('\/$','',$path);
+               if (!is_array($config['flexFormRels']['db'][$path]) && is_array($config['flexFormRels']['db'][rtrim($path, '/')]))      {
+                       $path = rtrim($path, '/');
                }
                if (is_array($config['flexFormRels']['db'][$path]))     {
                        $valArray = $this->setRelations_db($config['flexFormRels']['db'][$path]);
                        $dataValue = implode(',',$valArray);
-#      debug(array('value' => $dataValue));
                }
 
                if (is_array($config['flexFormRels']['file'][$path]))   {
@@ -1744,7 +1743,6 @@ class tx_impexp {
                        $dataValue = implode(',',$valArr);
                }
 
-                       // Return
                return array('value' => $dataValue);
        }
 
@@ -2079,7 +2077,7 @@ class tx_impexp {
                                                }
                                        } else {
                                                        // Create the resouces directory name (filename without extension, suffixed "_FILES")
-                                               $resourceDir = dirname($newName).'/'.ereg_replace('\.[^.]*$','',basename($newName)).'_FILES';
+                                               $resourceDir = dirname($newName).'/'.preg_replace('/\.[^.]*$/','',basename($newName)).'_FILES';
                                                if (t3lib_div::mkdir($resourceDir))     {
                                                        foreach($fileHeaderInfo['EXT_RES_ID'] as $res_fileID)   {
                                                                if ($this->dat['files'][$res_fileID]['filename'])       {
index 66971a1..e72da76 100755 (executable)
@@ -578,7 +578,7 @@ class tx_indexedsearch_crawler {
         * @return      string          Returls the URL if OK, otherwise false
         */
        function checkUrl($url,$urlLog,$baseUrl)        {
-               $url = ereg_replace('\/\/$','/',$url);
+               $url = preg_replace('/\/\/$/','/',$url);
                list($url) = explode('#',$url);
 
                if (!strstr($url,'../'))        {
index 134e22a..c22da83 100755 (executable)
@@ -1011,7 +1011,7 @@ class user_DoubleMetaPhone
         * @return      [type]          ...
         */
   function IsVowel($string, $pos) {
-    return ereg("[AEIOUY]", substr($string, $pos, 1));
+    return preg_match('/[AEIOUY]/', substr($string, $pos, 1));
   }
 
        /**
@@ -1021,7 +1021,7 @@ class user_DoubleMetaPhone
         * @return      [type]          ...
         */
   function SlavoGermanic($string) {
-    return ereg("W|K|CZ|WITZ", $string);
+    return preg_match('/W|K|CZ|WITZ/', $string);
   }
 } // end of class MetaPhone
 ?>
\ No newline at end of file
index 90f38e7..83f52f1 100755 (executable)
@@ -121,7 +121,7 @@ class tx_indexed_search_extparse {
                        case 'pdf':
                                        // PDF
                                if ($indexerConfig['pdftools']) {
-                                       $pdfPath = ereg_replace("\/$",'',$indexerConfig['pdftools']).'/';
+                                       $pdfPath = rtrim($indexerConfig['pdftools'], '/').'/';
                                        if (ini_get('safe_mode') || (@is_file($pdfPath.'pdftotext'.$exe) && @is_file($pdfPath.'pdfinfo'.$exe))) {
                                                $this->app['pdfinfo'] = $pdfPath.'pdfinfo'.$exe;
                                                $this->app['pdftotext'] = $pdfPath.'pdftotext'.$exe;
@@ -134,7 +134,7 @@ class tx_indexed_search_extparse {
                        case 'doc':
                                        // Catdoc
                                if ($indexerConfig['catdoc'])   {
-                                       $catdocPath = ereg_replace("\/$",'',$indexerConfig['catdoc']).'/';
+                                       $catdocPath = rtrim($indexerConfig['catdoc'], '/').'/';
                                        if (ini_get('safe_mode') || @is_file($catdocPath.'catdoc'.$exe))        {
                                                $this->app['catdoc'] = $catdocPath.'catdoc'.$exe;
                                                $extOK = TRUE;
@@ -145,7 +145,7 @@ class tx_indexed_search_extparse {
                        case 'ppt':             // MS PowerPoint
                                        // ppthtml
                                if ($indexerConfig['ppthtml'])  {
-                                       $ppthtmlPath = ereg_replace('\/$','',$indexerConfig['ppthtml']).'/';
+                                       $ppthtmlPath = rtrim($indexerConfig['ppthtml'], '/').'/';
                                        if (ini_get('safe_mode') || @is_file($ppthtmlPath.'ppthtml'.$exe)){
                                                $this->app['ppthtml'] = $ppthtmlPath.'ppthtml'.$exe;
                                                $extOK = TRUE;
@@ -155,7 +155,7 @@ class tx_indexed_search_extparse {
                        case 'xls':             // MS Excel
                                        // Xlhtml
                                if ($indexerConfig['xlhtml'])   {
-                                       $xlhtmlPath = ereg_replace('\/$','',$indexerConfig['xlhtml']).'/';
+                                       $xlhtmlPath = rtrim($indexerConfig['xlhtml'], '/').'/';
                                        if (ini_get('safe_mode') || @is_file($xlhtmlPath.'xlhtml'.$exe)){
                                                $this->app['xlhtml'] = $xlhtmlPath.'xlhtml'.$exe;
                                                $extOK = TRUE;
@@ -169,7 +169,7 @@ class tx_indexed_search_extparse {
                        case 'odp':             // Oasis OpenDocument Presentation
                        case 'odt':             // Oasis OpenDocument Text
                                if ($indexerConfig['unzip'])    {
-                                       $unzipPath = preg_replace('/\/$/','',$indexerConfig['unzip']).'/';
+                                       $unzipPath = rtrim($indexerConfig['unzip'], '/').'/';
                                        if (ini_get('safe_mode') || @is_file($unzipPath.'unzip'.$exe))  {
                                                $this->app['unzip'] = $unzipPath.'unzip'.$exe;
                                                $extOK = TRUE;
@@ -179,7 +179,7 @@ class tx_indexed_search_extparse {
                        case 'rtf':
                                        // Catdoc
                                if ($indexerConfig['unrtf'])    {
-                                       $unrtfPath = ereg_replace("\/$",'',$indexerConfig['unrtf']).'/';
+                                       $unrtfPath = rtrim($indexerConfig['unrtf'], '/').'/';
                                        if (ini_get('safe_mode') || @is_file($unrtfPath.'unrtf'.$exe))  {
                                                $this->app['unrtf'] = $unrtfPath.'unrtf'.$exe;
                                                $extOK = TRUE;
@@ -532,7 +532,7 @@ class tx_indexed_search_extparse {
                                $fileContent = t3lib_div::getUrl($absFile);
 
                                        // Finding charset:
-                               eregi('^[[:space:]]*<\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']',substr($fileContent,0,200),$reg);
+                               preg_match('/^[[:space:]]*<\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']/i',substr($fileContent,0,200),$reg);
                                $charset = $reg[1] ? $this->pObj->csObj->parse_charset($reg[1]) : 'utf-8';
 
                                        // Converting content:
@@ -637,7 +637,7 @@ class tx_indexed_search_extparse {
         * @return      string          String
         */
        function removeEndJunk($string) {
-               return trim(ereg_replace('['.chr(10).chr(12).']*$','',$string));
+               return trim(preg_replace('/['.chr(10).chr(12).']*$/','',$string));
        }
 
 
index 197acfe..48a76e5 100755 (executable)
@@ -661,8 +661,8 @@ class tx_indexedsearch_indexer {
         * @return      string          The charset value if found.
         */
        function getHTMLcharset($content)       {
-               if (eregi('<meta[[:space:]]+[^>]*http-equiv[[:space:]]*=[[:space:]]*["\']CONTENT-TYPE["\'][^>]*>',$content,$reg))       {
-                       if (eregi('charset[[:space:]]*=[[:space:]]*([[:alnum:]-]+)',$reg[0],$reg2))     {
+               if (preg_match('/<meta[[:space:]]+[^>]*http-equiv[[:space:]]*=[[:space:]]*["\']CONTENT-TYPE["\'][^>]*>/i',$content,$reg))       {
+                       if (preg_match('/charset[[:space:]]*=[[:space:]]*([[:alnum:]-]+)/i',$reg[0],$reg2))     {
                                return $reg2[1];
                        }
                }
index bf740c1..18a0f4e 100755 (executable)
@@ -2024,17 +2024,17 @@ class tx_indexedsearch extends tslib_pibase {
                                        // Possibly shorten string:
                                if (!$k)        {       // First entry at all (only cropped on the frontside)
                                        if ($strLen > $postPreLgd)      {
-                                               $output[$k] = $divider.ereg_replace('^[^[:space:]]+[[:space:]]','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],-($postPreLgd-$postPreLgd_offset)));
+                                               $output[$k] = $divider.preg_replace('/^[^[:space:]]+[[:space:]]/','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],-($postPreLgd-$postPreLgd_offset)));
                                        }
                                } elseif ($summaryLgd > $summaryMax || !isset($parts[$k+1])) {  // In case summary length is exceed OR if there are no more entries at all:
                                        if ($strLen > $postPreLgd)      {
-                                               $output[$k] = ereg_replace('[[:space:]][^[:space:]]+$','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],$postPreLgd-$postPreLgd_offset)).$divider;
+                                               $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],$postPreLgd-$postPreLgd_offset)).$divider;
                                        }
                                } else {        // In-between search words:
                                        if ($strLen > $postPreLgd*2)    {
-                                               $output[$k] = ereg_replace('[[:space:]][^[:space:]]+$','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],$postPreLgd-$postPreLgd_offset)).
+                                               $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],$postPreLgd-$postPreLgd_offset)).
                                                                                $divider.
-                                                                               ereg_replace('^[^[:space:]]+[[:space:]]','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],-($postPreLgd-$postPreLgd_offset)));
+                                                                               preg_replace('/^[^[:space:]]+[[:space:]]/','',$GLOBALS['TSFE']->csConvObj->crop('utf-8',$parts[$k],-($postPreLgd-$postPreLgd_offset)));
                                        }
                                }
                                $summaryLgd+= $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $output[$k]);;
@@ -2265,7 +2265,7 @@ class tx_indexedsearch extends tslib_pibase {
        function getFirstSysDomainRecordForPage($id)    {
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('domainName', 'sys_domain', 'pid='.intval($id).$this->cObj->enableFields('sys_domain'), '', 'sorting');
                $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
-               return ereg_replace('\/$','',$row['domainName']);
+               return rtrim($row['domainName'], '/');
        }
 
        /**
index a702a67..646c074 100755 (executable)
@@ -1097,7 +1097,7 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                $tmap=array('day'=>1, 'week'=>7, 'month'=>30);
                $tt = $this->INSTALL['typo3temp_delete'];
                $subdir = $this->INSTALL['typo3temp_subdir'];
-               if (strlen($subdir) && !ereg('^[[:alnum:]_]+/$',$subdir))       die('subdir "'.$subdir.'" was not allowed!');
+               if (strlen($subdir) && !preg_match('/^[[:alnum:]_]+\/$/',$subdir))      die('subdir "'.$subdir.'" was not allowed!');
                $action = $this->INSTALL['typo3temp_action'];
                $d = @dir($this->typo3temp_path.$subdir);
                if (is_object($d))      {
@@ -1117,7 +1117,7 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                                        }
                                        if ($ok)        {
                                                $hashPart=substr(basename($theFile),-14,10);
-                                               if (!ereg('[^a-f0-9]',$hashPart) || substr($theFile,-6)==='.cache' || substr($theFile,-4)==='.tbl' || substr(basename($theFile),0,8)==='install_')      {               // This is a kind of check that the file being deleted has a 10 char hash in it
+                                               if (!preg_match('/[^a-f0-9]/',$hashPart) || substr($theFile,-6)==='.cache' || substr($theFile,-4)==='.tbl' || substr(basename($theFile),0,8)==='install_')      {               // This is a kind of check that the file being deleted has a 10 char hash in it
                                                        if ($action && $deleteCounter<$action)  {
                                                                $deleteCounter++;
                                                                unlink($theFile);
@@ -1830,7 +1830,7 @@ From sub-directory:
                reset($paths);
                while(list($k,$v)=each($paths)) {
                        reset($programs);
-                       if (!ereg('[\\\/]$',$v)) $v.='/';
+                       if (!preg_match('/[\\/]$/',$v)) $v.='/';
                        while(list(,$filename)=each($programs)) {
                                if (ini_get('open_basedir') || (file_exists($v)&&@is_file($v.$filename.$isExt))) {
                                        $version = $this->_checkImageMagick_getVersion($filename,$v);
@@ -2119,7 +2119,7 @@ From sub-directory:
 #debug($this->INSTALL);
                                        if (trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME'])) {
                                                $newdbname=trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME']);
-                                               if (!ereg('[^[:alnum:]_-]',$newdbname)) {
+                                               if (!preg_match('/[^[:alnum:]_-]/',$newdbname)) {
                                                        if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
                                                                if ($GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE '.$newdbname)) {
                                                                        $this->INSTALL['localconf.php']['typo_db'] = $newdbname;
@@ -2177,7 +2177,7 @@ From sub-directory:
                                                        break;
                                                        case 'im_path':
                                                                list($value,$version) = explode('|',$value);
-                                                               if (!ereg('[[:space:]]',$value,$reg) && strlen($value)<100)     {
+                                                               if (!preg_match('/[[:space:]]/',$value,$reg) && strlen($value)<100)     {
                                                                        if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key], $value)) {
                                                                                $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'' . $key . '\']', $value);
                                                                        }
@@ -2198,7 +2198,7 @@ From sub-directory:
                                                        break;
                                                        case 'im_path_lzw':
                                                                list($value) = explode('|',$value);
-                                                               if (!ereg('[[:space:]]',$value) && strlen($value)<100)  {
+                                                               if (!preg_match('/[[:space:]]/',$value) && strlen($value)<100)  {
                                                                        if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key], $value)) {
                                                                                $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'' . $key . '\']', $value);
                                                                        }
@@ -4390,7 +4390,7 @@ From sub-directory:
                $out='';
                switch($fieldInfo['config']['type'])    {
                        case 'input':
-                               if (ereg('date|time|int|year',$fieldInfo['config']['eval']))    {
+                               if (preg_match('/date|time|int|year/',$fieldInfo['config']['eval']))    {
                                        $out = "int(11) NOT NULL default '0'";
                                } else {
                                        $max = intval($fieldInfo['config']['max']);
index 9ef0e8b..2cdfe85 100644 (file)
@@ -167,7 +167,7 @@ Will report lost files.';
                                                }
                                        } else {
                                                        // When here it means the file was not found. So we test if it has a RTEmagic-image name and if so, we allow it:
-                                               if (ereg('^RTEmagic[P|C]_',basename($value)))   {
+                                               if (preg_match('/^RTEmagic[P|C]_/',basename($value)))   {
                                                        unset($fileArr[$key])   ;
                                                        $resultArray['RTEmagicFiles'][$shortKey] = $value;
                                                } else {
index 8c2ccfd..179a207 100644 (file)
@@ -135,7 +135,7 @@ Reports problems with RTE images';
                        foreach($recs as $rec)  {
                                $filename = basename($rec['ref_string']);
                                if (t3lib_div::isFirstPartOfStr($filename,'RTEmagicC_'))        {
-                                       $original = 'RTEmagicP_'.ereg_replace('\.[[:alnum:]]+$','',substr($filename,10));
+                                       $original = 'RTEmagicP_'.preg_replace('/\.[[:alnum:]]+$/','',substr($filename,10));
                                        $infoString = $this->infoStr($rec);
 
                                                // Build index:
index 8cd6927..6b9e680 100755 (executable)
@@ -650,7 +650,7 @@ class SC_mod_tools_dbint_index {
                if (is_array($files))   {
                        $files_searched+=count($files);
                        foreach ($files as $value) {
-                               if (eregi($pattern,basename($value)))   $matching_files[]=substr($value,strlen(PATH_site));
+                               if (preg_match('/'.$pattern.'/i',basename($value)))     $matching_files[]=substr($value,strlen(PATH_site));
                        }
                }
 
index 62cba8a..313f963 100644 (file)
@@ -21,7 +21,7 @@ define('PAPE_AUTH_PHISHING_RESISTANT',
        'http://schemas.openid.net/pape/policies/2007/06/phishing-resistant');
 
 define('PAPE_TIME_VALIDATOR',
-       '^[0-9]{4,4}-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]Z$');
+       '/^[0-9]{4,4}-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]Z$/');
 /**
  * A Provider Authentication Policy request, sent from a relying party
  * to a provider
@@ -262,7 +262,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
 
         $auth_time = Auth_OpenID::arrayGet($args, 'auth_time');
         if ($auth_time !== null) {
-            if (ereg(PAPE_TIME_VALIDATOR, $auth_time)) {
+            if (preg_match(PAPE_TIME_VALIDATOR, $auth_time)) {
                 $this->auth_time = $auth_time;
             } else if ($strict) {
                 return false;
@@ -287,7 +287,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
         }
 
         if ($this->auth_time !== null) {
-            if (!ereg(PAPE_TIME_VALIDATOR, $this->auth_time)) {
+            if (!preg_match(PAPE_TIME_VALIDATOR, $this->auth_time)) {
                 return false;
             }
 
index 6a59bb9..7d85a85 100644 (file)
@@ -230,7 +230,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
 
                                // Element ID + pid
                        $this->elementId = $PA['itemFormElName']; // Form element name
-                       $this->elementParts = explode('][',ereg_replace('\]$','',ereg_replace('^(TSFE_EDIT\[data\]\[|data\[)','',$this->elementId)));
+                       $this->elementParts = explode('][',preg_replace('/\]$/','',preg_replace('/^(TSFE_EDIT\[data\]\[|data\[)/','',$this->elementId)));
 
                                // Find the page PIDs:
                        list($this->tscPID,$this->thePid) = t3lib_BEfunc::getTSCpid(trim($this->elementParts[0]),trim($this->elementParts[1]),$thePidValue);
@@ -1430,19 +1430,19 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                break;
                                case 'gecko':
                                        $tmp = strstr($useragent,'rv:');
-                                       $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,3)));
+                                       $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,3)));
                                break;
                                case 'msie':
                                        $tmp = strstr($useragent,'MSIE');
-                                       $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,4)));
+                                       $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,4)));
                                break;
                                case 'safari':
                                        $tmp = strstr($useragent,'Safari/');
-                                       $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,3)));
+                                       $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,3)));
                                break;
                                case 'opera':
                                        $tmp = strstr($useragent,'Opera');
-                                       $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,5)));
+                                       $bInfo['VERSION'] = doubleval(preg_replace('/^[^0-9]*/','',substr($tmp,5)));
                                break;
                                case 'konqu':
                                        $tmp = strstr($useragent,'Konqueror/');
index c374f7b..928f673 100755 (executable)
@@ -365,7 +365,7 @@ class tx_sysaction extends mod_user_task {
        function fixUsername($username,$prefix) {
                $username=trim($username);
                $prefix=trim($prefix);
-               $username=ereg_replace("^".quotemeta($prefix),"",$username);
+               $username=preg_replace('/^'.quotemeta($prefix).'/','',$username);
 
                if ($username)  {
                        return $prefix.$username;
index 1080654..cb9a2d3 100644 (file)
@@ -229,7 +229,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                                        }
                                        if ($POST["add_property"])      {
                                                $property = trim($POST["data"][$name]["name"]);
-                                               if (ereg_replace("[^a-zA-Z0-9_\.]*","",$property)!=$property)   {
+                                               if (preg_replace('/[^a-zA-Z0-9_\.]*/','',$property)!=$property) {
                                                        $theOutput.=$this->pObj->doc->spacer(10);
                                                        $theOutput .= $this->pObj->doc->section($GLOBALS["TBE_TEMPLATE"]->rfw("BAD PROPERTY!"), 'You must enter a property with characters a-z, A-Z and 0-9, no spaces!<br />Nothing was updated!', 0, 0, 0, 1);
                                                } else {
index a04b7ba..6f21ecb 100644 (file)
@@ -238,15 +238,15 @@ class template {
 
                        // Setting default scriptID:
                if (($temp_M = (string) t3lib_div::_GET('M')) && $GLOBALS['TBE_MODULES']['_PATHS'][$temp_M]) {
-                       $this->scriptID = ereg_replace('^.*\/(sysext|ext)\/', 'ext/', $GLOBALS['TBE_MODULES']['_PATHS'][$temp_M] . 'index.php');
+                       $this->scriptID = preg_replace('/^.*\/(sysext|ext)\//', 'ext/', $GLOBALS['TBE_MODULES']['_PATHS'][$temp_M] . 'index.php');
                } else {
-                       $this->scriptID = ereg_replace('^.*\/(sysext|ext)\/', 'ext/', substr(PATH_thisScript, strlen(PATH_site)));
+                       $this->scriptID = preg_replace('/^.*\/(sysext|ext)\//', 'ext/', substr(PATH_thisScript, strlen(PATH_site)));
                }
                if (TYPO3_mainDir!='typo3/' && substr($this->scriptID,0,strlen(TYPO3_mainDir)) == TYPO3_mainDir)        {
                        $this->scriptID = 'typo3/'.substr($this->scriptID,strlen(TYPO3_mainDir));       // This fixes if TYPO3_mainDir has been changed so the script ids are STILL "typo3/..."
                }
 
-               $this->bodyTagId = ereg_replace('[^[:alnum:]-]','-',$this->scriptID);
+               $this->bodyTagId = preg_replace('/[^A-Za-z0-9-]/','-',$this->scriptID);
 
                        // Individual configuration per script? If so, make a recursive merge of the arrays:
                if (is_array($TBE_STYLES['scriptIDindex'][$this->scriptID]))    {
@@ -453,7 +453,7 @@ class template {
                $pathInfo = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
 
                        // Add the module identifier automatically if typo3/mod.php is used:
-               if (ereg('typo3/mod\.php$', $pathInfo['path']) && isset($GLOBALS['TBE_MODULES']['_PATHS'][$modName])) {
+               if (preg_match('/typo3\/mod\.php$/', $pathInfo['path']) && isset($GLOBALS['TBE_MODULES']['_PATHS'][$modName])) {
                        $storeUrl = '&M='.$modName.$storeUrl;
                }
 
index 80077c5..29b8fb5 100644 (file)
@@ -719,7 +719,7 @@ class SC_view_help {
 
                        $tableName = is_array($TCA_DESCR[$table]['columns']['']) && $TCA_DESCR[$table]['columns']['']['alttitle'] ?
                                                        $TCA_DESCR[$table]['columns']['']['alttitle'] :
-                                                       (isset($TCA[$table]) ? $TCA[$table]['ctrl']['title'] : ereg_replace('^_MOD_','',$table));
+                                                       (isset($TCA[$table]) ? $TCA[$table]['ctrl']['title'] : preg_replace('/^_MOD_/','',$table));
                        $fieldName = is_array($TCA_DESCR[$table]['columns'][$field]) && $TCA_DESCR[$table]['columns'][$field]['alttitle'] ?
                                                        $TCA_DESCR[$table]['columns'][$field]['alttitle'] :
                                                        (isset($TCA[$table])&&isset($TCA[$table]['columns'][$field]) ? $TCA[$table]['columns'][$field]['label'] : $field);
@@ -743,7 +743,7 @@ class SC_view_help {
 
                        // Create label:
                $labelStr = $LANG->sL($tableName).
-                                       ($field ? $mergeToken.ereg_replace(':$','', trim($LANG->sL($fieldName))):'');
+                                       ($field ? $mergeToken.rtrim(trim($LANG->sL($fieldName)), ':'):'');
 
                return $labelStr;
        }
index 97ad8d7..7090cd0 100644 (file)
@@ -811,7 +811,7 @@ class SC_wizard_forms {
                                }
 
                                        // Compile the final line:
-                               $inLines[]=ereg_replace("[\n\r]*",'',implode(' | ',$thisLine));
+                               $inLines[]=preg_replace("/[\n\r]*/",'',implode(' | ',$thisLine));
                        }
                }
                        // Finally, implode the lines into a string, and return it:
@@ -857,7 +857,7 @@ class SC_wizard_forms {
 
                                if ($confData['type'])  {
                                        if (count($typeParts)==1)       {
-                                               $confData['fieldname'] = substr(ereg_replace('[^a-zA-Z0-9_]','',str_replace(' ','_',trim($parts[0]))),0,30);
+                                               $confData['fieldname'] = substr(preg_replace('/[^a-zA-Z0-9_]/','',str_replace(' ','_',trim($parts[0]))),0,30);
 
                                                        // Attachment names...
                                                if ($confData['type']=='file')  {
index 6d2b89d..35b7ae2 100644 (file)
@@ -360,7 +360,7 @@ class SC_wizard_table {
                                        if ($this->inputStyle)  {
                                                $cells[]='<input type="text"'.$this->doc->formWidth(20).' name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']" value="'.htmlspecialchars($cellContent).'" />';
                                        } else {
-                                               $cellContent=eregi_replace('<br[ ]?[\/]?>',chr(10),$cellContent);
+                                               $cellContent=preg_replace('/<br[ ]?[\/]?>/i',chr(10),$cellContent);
                                                $cells[]='<textarea '.$this->doc->formWidth(20).' rows="5" name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']">'.t3lib_div::formatForTextarea($cellContent).'</textarea>';
                                        }
 
index f707db9..8ff65ec 100644 (file)
@@ -569,7 +569,7 @@ class SC_wizard_tsconfig {
 
                                        // Generally "->[something]"
                                $reg=array();
-                               ereg('->[[:alnum:]_]*',$dataType,$reg);
+                               preg_match('/->[[:alnum:]_]*/',$dataType,$reg);
                                if ($reg[0] && is_array($objTree[$reg[0]]))     {
                                        $dataType = str_replace($reg[0],'<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree[$reg[0]][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">'.htmlspecialchars($reg[0]).'</a>',$dataType);
                                }