Index: typo3/alt_clickmenu.php =================================================================== --- typo3/alt_clickmenu.php (revision 4809) +++ typo3/alt_clickmenu.php (working copy) @@ -1283,9 +1283,9 @@ '; } 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: typo3/show_item.php =================================================================== --- typo3/show_item.php (revision 4809) +++ typo3/show_item.php (working copy) @@ -196,7 +196,7 @@ } 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: typo3/class.filelistfoldertree.php =================================================================== --- typo3/class.filelistfoldertree.php (revision 4809) +++ typo3/class.filelistfoldertree.php (working copy) @@ -375,7 +375,7 @@ 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.'/'; @@ -409,7 +409,7 @@ $icon = 'gfx/i/_icon_' .$webpath . 'folders' . ($type == 'readonly' ? '_ro' : '') . '.gif'; if ($val == '_temp_') { $icon = 'gfx/i/sysf.gif'; - $row['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true); + $row['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true); $row['_title'] = '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true) . ''; } if ($val == '_recycler_') { Index: typo3/mod/tools/em/class.nusoap.php =================================================================== --- typo3/mod/tools/em/class.nusoap.php (revision 4809) +++ typo3/mod/tools/em/class.nusoap.php (working copy) @@ -500,7 +500,7 @@ 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 @@ */ 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 @@ 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 @@ '([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 @@ * @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 @@ '([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 @@ 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 @@ // minOccurs="0" maxOccurs="unbounded" /> // // - 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 @@ // minOccurs="0" maxOccurs="unbounded" /> // // - 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 @@ } 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 @@ function soap_transport_http($url){ parent::nusoap_base(); $this->setURL($url); - ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev); + preg_match('/\$Revision$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 @@ } } // 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 @@ 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 @@ $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 @@ 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 @@ $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 @@ */ 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 @@ $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 @@ // 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 @@ [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 @@ // 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 @@ $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 @@ 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: typo3/sysext/lowlevel/clmods/class.rte_images.php =================================================================== --- typo3/sysext/lowlevel/clmods/class.rte_images.php (revision 4809) +++ typo3/sysext/lowlevel/clmods/class.rte_images.php (working copy) @@ -135,7 +135,7 @@ 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: typo3/sysext/lowlevel/clmods/class.lost_files.php =================================================================== --- typo3/sysext/lowlevel/clmods/class.lost_files.php (revision 4809) +++ typo3/sysext/lowlevel/clmods/class.lost_files.php (working copy) @@ -167,7 +167,7 @@ } } 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: typo3/sysext/lowlevel/dbint/index.php =================================================================== --- typo3/sysext/lowlevel/dbint/index.php (revision 4809) +++ typo3/sysext/lowlevel/dbint/index.php (working copy) @@ -645,7 +645,7 @@ 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: typo3/sysext/cms/tslib/publish.php =================================================================== --- typo3/sysext/cms/tslib/publish.php (revision 4809) +++ typo3/sysext/cms/tslib/publish.php (working copy) @@ -122,7 +122,7 @@ // *************************** $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: typo3/sysext/cms/tslib/class.tslib_search.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_search.php (revision 4809) +++ typo3/sysext/cms/tslib/class.tslib_search.php (working copy) @@ -226,33 +226,32 @@ 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: typo3/sysext/cms/tslib/class.tslib_pibase.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_pibase.php (revision 4809) +++ typo3/sysext/cms/tslib/class.tslib_pibase.php (working copy) @@ -393,7 +393,7 @@ * @return string The processed input string, modified IF a tag was found */ function pi_openAtagHrefInJSwindow($str,$winName='',$winParams='width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1') { - if (eregi('(.*)(]*>)(.*)',$str,$match)) { + if (preg_match('/(.*)(]*>)(.*)/i',$str,$match)) { $aTagContent = t3lib_div::get_tag_attributes($match[2]); $match[2]='tmpl->rootLine[$reg[1]]['uid']) { $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]); } @@ -3388,10 +3388,10 @@ } 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.']));} @@ -3532,7 +3532,7 @@ } $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]; } @@ -3693,7 +3693,7 @@ */ 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; } @@ -3868,7 +3868,7 @@ "'<\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(']*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*','',$text); + $text = preg_replace('/]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*/i','',$text); // Return clean content return $text; @@ -4079,7 +4079,7 @@ } // 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 @@ -4270,10 +4270,10 @@ $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]); } } } @@ -4396,7 +4396,7 @@ $data = substr($theValue,$pointer,$len); // $data is the content until the next 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 @@ -4656,7 +4656,7 @@ 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); @@ -4723,11 +4723,11 @@ $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 = ''; @@ -4796,7 +4796,7 @@ $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']) { @@ -5293,7 +5293,7 @@ $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(); @@ -5322,7 +5322,7 @@ // 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'; @@ -7047,8 +7047,8 @@ $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); } @@ -7120,7 +7120,7 @@ ); 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 { @@ -7133,7 +7133,7 @@ $pid_uid_flag++; } if (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); if (count($listArr)) { Index: typo3/sysext/cms/tslib/class.tslib_pagegen.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_pagegen.php (revision 4809) +++ typo3/sysext/cms/tslib/class.tslib_pagegen.php (working copy) @@ -179,7 +179,7 @@ } } } - $GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx); + $GLOBALS['TSFE']->sWordRegEx = preg_replace('/\|$/','',$GLOBALS['TSFE']->sWordRegEx); } // linkVars @@ -825,7 +825,7 @@ 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'])) { @@ -833,16 +833,16 @@ 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: typo3/sysext/cms/tslib/class.tslib_fe.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_fe.php (revision 4809) +++ typo3/sysext/cms/tslib/class.tslib_fe.php (working copy) @@ -1708,7 +1708,7 @@ $message = 'You logged out from Workspace preview mode. Click this link to go back to the website'; } die(sprintf($message, - htmlspecialchars(ereg_replace('\&?ADMCMD_prev=[[:alnum:]]+','',t3lib_div::_GET('returnUrl'))) + htmlspecialchars(preg_replace('/\&?ADMCMD_prev=[[:alnum:]]+/','',t3lib_div::_GET('returnUrl'))) )); } Index: typo3/sysext/cms/tslib/class.tslib_gifbuilder.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_gifbuilder.php (revision 4809) +++ typo3/sysext/cms/tslib/class.tslib_gifbuilder.php (working copy) @@ -218,7 +218,7 @@ 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: typo3/sysext/cms/layout/class.tx_cms_layout.php =================================================================== --- typo3/sysext/cms/layout/class.tx_cms_layout.php (revision 4809) +++ typo3/sysext/cms/layout/class.tx_cms_layout.php (working copy) @@ -318,7 +318,7 @@ 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= ''. 'backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'. ''; Index: typo3/sysext/impexp/app/index.php =================================================================== --- typo3/sysext/impexp/app/index.php (revision 4809) +++ typo3/sysext/impexp/app/index.php (working copy) @@ -433,7 +433,7 @@ $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 @@ } // 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: typo3/sysext/impexp/class.tx_impexp.php =================================================================== --- typo3/sysext/impexp/class.tx_impexp.php (revision 4809) +++ typo3/sysext/impexp/class.tx_impexp.php (working copy) @@ -844,7 +844,7 @@ $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 @@ 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 @@ $dataValue = implode(',',$valArr); } - // Return return array('value' => $dataValue); } @@ -2079,7 +2077,7 @@ } } 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: typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php =================================================================== --- typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (revision 4809) +++ typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (working copy) @@ -231,7 +231,7 @@ // 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); @@ -1533,19 +1533,19 @@ 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: typo3/sysext/openid/lib/php-openid/Auth/OpenID/PAPE.php =================================================================== --- typo3/sysext/openid/lib/php-openid/Auth/OpenID/PAPE.php (revision 4809) +++ typo3/sysext/openid/lib/php-openid/Auth/OpenID/PAPE.php (working copy) @@ -21,7 +21,7 @@ '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 @@ $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 @@ } 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: typo3/sysext/fe_edit/view/class.tx_feedit_editpanel.php =================================================================== --- typo3/sysext/fe_edit/view/class.tx_feedit_editpanel.php (revision 4809) +++ typo3/sysext/fe_edit/view/class.tx_feedit_editpanel.php (working copy) @@ -207,7 +207,7 @@ $cBuf = rtrim($content); $securCount = 30; while($securCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '') { - $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: typo3/sysext/install/mod/class.tx_install.php =================================================================== --- typo3/sysext/install/mod/class.tx_install.php (revision 4809) +++ typo3/sysext/install/mod/class.tx_install.php (working copy) @@ -1116,7 +1116,7 @@ $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)) { @@ -1136,7 +1136,7 @@ } 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); @@ -1851,7 +1851,7 @@ 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); @@ -2137,7 +2137,7 @@ #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; @@ -2195,7 +2195,7 @@ 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); } @@ -2214,7 +2214,7 @@ 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); } @@ -4399,7 +4399,7 @@ $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: typo3/sysext/beuser/mod/index.php =================================================================== --- typo3/sysext/beuser/mod/index.php (revision 4809) +++ typo3/sysext/beuser/mod/index.php (working copy) @@ -677,7 +677,7 @@ $pout[]=''.t3lib_iconWorks::getIconImage($table,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title']).''; } if ($GLOBALS['TCA'][$table]['columns'][$field]) { - $pout[]=' - '.ereg_replace(':$','',$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label'])).''; + $pout[]=' - '.rtrim($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']), ':').''; } } } Index: typo3/sysext/sys_action/class.tx_sysaction.php =================================================================== --- typo3/sysext/sys_action/class.tx_sysaction.php (revision 4809) +++ typo3/sysext/sys_action/class.tx_sysaction.php (working copy) @@ -365,7 +365,7 @@ 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: typo3/sysext/indexed_search/class.external_parser.php =================================================================== --- typo3/sysext/indexed_search/class.external_parser.php (revision 4809) +++ typo3/sysext/indexed_search/class.external_parser.php (working copy) @@ -121,7 +121,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ $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 @@ * @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: typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php =================================================================== --- typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php (revision 4809) +++ typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php (working copy) @@ -2024,17 +2024,17 @@ // 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 @@ 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: typo3/sysext/indexed_search/class.indexer.php =================================================================== --- typo3/sysext/indexed_search/class.indexer.php (revision 4809) +++ typo3/sysext/indexed_search/class.indexer.php (working copy) @@ -661,8 +661,8 @@ * @return string The charset value if found. */ function getHTMLcharset($content) { - if (eregi(']*http-equiv[[:space:]]*=[[:space:]]*["\']CONTENT-TYPE["\'][^>]*>',$content,$reg)) { - if (eregi('charset[[:space:]]*=[[:space:]]*([[:alnum:]-]+)',$reg[0],$reg2)) { + if (preg_match('/]*http-equiv[[:space:]]*=[[:space:]]*["\']CONTENT-TYPE["\'][^>]*>/i',$content,$reg)) { + if (preg_match('/charset[[:space:]]*=[[:space:]]*([[:alnum:]-]+)/i',$reg[0],$reg2)) { return $reg2[1]; } } Index: typo3/sysext/indexed_search/class.doublemetaphone.php =================================================================== --- typo3/sysext/indexed_search/class.doublemetaphone.php (revision 4809) +++ typo3/sysext/indexed_search/class.doublemetaphone.php (working copy) @@ -1011,7 +1011,7 @@ * @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 @@ * @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: typo3/sysext/indexed_search/class.crawler.php =================================================================== --- typo3/sysext/indexed_search/class.crawler.php (revision 4809) +++ typo3/sysext/indexed_search/class.crawler.php (working copy) @@ -578,7 +578,7 @@ * @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: typo3/sysext/dbal/handlers/class.tx_dbal_handler_xmldb.php =================================================================== --- typo3/sysext/dbal/handlers/class.tx_dbal_handler_xmldb.php (revision 4809) +++ typo3/sysext/dbal/handlers/class.tx_dbal_handler_xmldb.php (working copy) @@ -66,36 +66,36 @@ /** * Example DBAL handler class * Stores data in XML, not a database. - * + * * @author Kasper Skaarhoj * @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: typo3/sysext/dbal/class.ux_db_list_extra.php =================================================================== --- typo3/sysext/dbal/class.ux_db_list_extra.php (revision 4809) +++ typo3/sysext/dbal/class.ux_db_list_extra.php (working copy) @@ -76,7 +76,7 @@ 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 @@ } 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: typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php =================================================================== --- typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (revision 4809) +++ typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (working copy) @@ -377,7 +377,7 @@ 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 @@ $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 @@ } // 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: typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php =================================================================== --- typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php (revision 4809) +++ typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php (working copy) @@ -228,7 +228,7 @@ } 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!
Nothing was updated!',0,0,0,1); } else { @@ -503,7 +503,7 @@ -    '.t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_browser_regexsearch]",$this->pObj->MOD_SETTINGS["ts_browser_regexsearch"],'','','id="checkTs_browser_regexsearch"').' +    '.t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_browser_regexsearch]",$this->pObj->MOD_SETTINGS["ts_browser_regexsearch"],'','','id="checkTs_browser_regexsearch"').'   Index: typo3/class.browse_links.php =================================================================== --- typo3/class.browse_links.php (revision 4809) +++ typo3/class.browse_links.php (working copy) @@ -2481,7 +2481,7 @@ * @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 @@ * @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 @@ * @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: typo3/wizard_forms.php =================================================================== --- typo3/wizard_forms.php (revision 4809) +++ typo3/wizard_forms.php (working copy) @@ -811,7 +811,7 @@ } // 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 @@ 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: typo3/wizard_table.php =================================================================== --- typo3/wizard_table.php (revision 4809) +++ typo3/wizard_table.php (working copy) @@ -360,7 +360,7 @@ if ($this->inputStyle) { $cells[]='doc->formWidth(20).' name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']" value="'.htmlspecialchars($cellContent).'" />'; } else { - $cellContent=eregi_replace('',chr(10),$cellContent); + $cellContent=preg_replace('//i',chr(10),$cellContent); $cells[]=''; } Index: typo3/view_help.php =================================================================== --- typo3/view_help.php (revision 4809) +++ typo3/view_help.php (working copy) @@ -719,7 +719,7 @@ $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 @@ // Create label: $labelStr = $LANG->sL($tableName). - ($field ? $mergeToken.ereg_replace(':$','', trim($LANG->sL($fieldName))):''); + ($field ? $mergeToken.rtrim(trim($LANG->sL($fieldName)), ':'):''); return $labelStr; } Index: typo3/wizard_tsconfig.php =================================================================== --- typo3/wizard_tsconfig.php (revision 4809) +++ typo3/wizard_tsconfig.php (working copy) @@ -569,7 +569,7 @@ // 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],''.htmlspecialchars($reg[0]).'',$dataType); } Index: typo3/template.php =================================================================== --- typo3/template.php (revision 4809) +++ typo3/template.php (working copy) @@ -229,15 +229,15 @@ // 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])) { @@ -444,7 +444,7 @@ $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: t3lib/class.t3lib_treeview.php =================================================================== --- t3lib/class.t3lib_treeview.php (revision 4809) +++ t3lib/class.t3lib_treeview.php (working copy) @@ -537,7 +537,7 @@ * @return string Image tag, modified with $attr attributes added. */ function addTagAttributes($icon,$attr) { - return ereg_replace(' ?\/?>$','',$icon).' '.$attr.' />'; + return preg_replace('/ ?\/?>$/','',$icon).' '.$attr.' />'; } /** Index: t3lib/class.t3lib_page.php =================================================================== --- t3lib/class.t3lib_page.php (revision 4809) +++ t3lib/class.t3lib_page.php (working copy) @@ -496,12 +496,12 @@ */ 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', @@ -520,8 +520,8 @@ 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: t3lib/thumbs.php =================================================================== --- t3lib/thumbs.php (revision 4809) +++ t3lib/thumbs.php (working copy) @@ -65,7 +65,7 @@ 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 @@ // 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: t3lib/class.t3lib_foldertree.php =================================================================== --- t3lib/class.t3lib_foldertree.php (revision 4809) +++ t3lib/class.t3lib_foldertree.php (working copy) @@ -266,7 +266,7 @@ $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: t3lib/class.t3lib_syntaxhl.php =================================================================== --- t3lib/class.t3lib_syntaxhl.php (revision 4809) +++ t3lib/class.t3lib_syntaxhl.php (working copy) @@ -380,7 +380,7 @@ $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: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (revision 4809) +++ t3lib/class.t3lib_befunc.php (working copy) @@ -1009,7 +1009,7 @@ 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 @@ $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'); @@ -3204,7 +3204,7 @@ if (is_array($dRec)) { reset($dRec); $dRecord = current($dRec); - return ereg_replace('\/$', '', $dRecord['domainName']); + return rtrim($dRecord['domainName'], '/'); } } } @@ -3221,9 +3221,9 @@ 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; @@ -3356,7 +3356,7 @@ 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: t3lib/class.t3lib_tcemain.php =================================================================== --- t3lib/class.t3lib_tcemain.php (revision 4809) +++ t3lib/class.t3lib_tcemain.php (working copy) @@ -2020,7 +2020,7 @@ 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': @@ -2057,16 +2057,16 @@ $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_') { @@ -3227,7 +3227,7 @@ 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: @@ -6257,7 +6257,7 @@ * @return string Output string with any comma in the end removed, if any. */ function rmComma($input) { - return ereg_replace(',$','',$input); + return rtrim($input, ','); } /** @@ -6268,7 +6268,7 @@ */ 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) { @@ -6650,8 +6650,8 @@ */ 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); } /** @@ -7067,7 +7067,7 @@ // 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: t3lib/config_default.php =================================================================== --- t3lib/config_default.php (revision 4809) +++ t3lib/config_default.php (working copy) @@ -215,7 +215,7 @@ '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: t3lib/class.t3lib_readmail.php =================================================================== --- t3lib/class.t3lib_readmail.php (revision 4809) +++ t3lib/class.t3lib_readmail.php (working copy) @@ -178,7 +178,7 @@ 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 @@ $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 @@ $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 @@ // 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 @@ 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 @@ 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: t3lib/class.t3lib_fullsearch.php =================================================================== --- t3lib/class.t3lib_fullsearch.php (revision 4809) +++ t3lib/class.t3lib_fullsearch.php (working copy) @@ -674,15 +674,15 @@ $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: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 4809) +++ t3lib/class.t3lib_div.php (working copy) @@ -1077,7 +1077,7 @@ */ 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 { @@ -1085,7 +1085,7 @@ $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]; @@ -1161,7 +1161,7 @@ * @return string */ public static function rm_endcomma($string) { - return ereg_replace(',$','',$string); + return rtrim($string, ','); } /** @@ -1301,7 +1301,7 @@ * @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\.]*)'; @@ -1384,7 +1384,7 @@ * @return string Converted result. */ public static function deHSCentities($str) { - return ereg_replace('&([#[:alnum:]]*;)','&\1',$str); + return preg_replace('/&([#[:alnum:]]*;)/','&\1',$str); } /** @@ -2014,7 +2014,7 @@ $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; } @@ -2036,9 +2036,9 @@ * @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 @@ -2303,7 +2303,7 @@ } // 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)) { @@ -2826,7 +2826,7 @@ // 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); @@ -2961,7 +2961,7 @@ // Initialize variabels: $filearray = array(); $sortarray = array(); - $path = ereg_replace('\/$','',$path); + $path = rtrim($path, '/'); // Find files+directories: if (@is_dir($path)) { @@ -3377,7 +3377,7 @@ $pString = t3lib_div::implodeArrayForUrl('',$params); - return $pString ? $parts.'?'.ereg_replace('^&','',$pString) : $parts; + return $pString ? $parts.'?'.preg_replace('/^&/','',$pString) : $parts; } /** @@ -3516,7 +3516,7 @@ 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']; @@ -3739,11 +3739,11 @@ 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/'); @@ -3912,7 +3912,7 @@ */ 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; @@ -5248,12 +5248,12 @@ 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: t3lib/class.t3lib_arraybrowser.php =================================================================== --- t3lib/class.t3lib_arraybrowser.php (revision 4809) +++ t3lib/class.t3lib_arraybrowser.php (working copy) @@ -203,7 +203,7 @@ $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: t3lib/class.t3lib_modsettings.php =================================================================== --- t3lib/class.t3lib_modsettings.php (revision 4809) +++ t3lib/class.t3lib_modsettings.php (working copy) @@ -249,7 +249,7 @@ 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: t3lib/class.t3lib_tsparser_ext.php =================================================================== --- t3lib/class.t3lib_tsparser_ext.php (revision 4809) +++ t3lib/class.t3lib_tsparser_ext.php (working copy) @@ -367,7 +367,7 @@ $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 @@ 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 @@ $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 @@ 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 @@ } 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 @@ * @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 @@ $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)) { @@ -933,7 +933,7 @@ 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; @@ -1069,7 +1069,7 @@ 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); } } @@ -1109,7 +1109,7 @@ 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); @@ -1582,7 +1582,7 @@ 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)); @@ -1756,7 +1756,7 @@ */ 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: t3lib/class.t3lib_xml.php =================================================================== --- t3lib/class.t3lib_xml.php (revision 4809) +++ t3lib/class.t3lib_xml.php (working copy) @@ -279,7 +279,7 @@ * @return string Processed input value */ function substNewline($string) { - return ereg_replace(chr(10),'',$string); + return str_replace(chr(10),'',$string); } /** Index: t3lib/class.t3lib_parsehtml.php =================================================================== --- t3lib/class.t3lib_parsehtml.php (revision 4809) +++ t3lib/class.t3lib_parsehtml.php (working copy) @@ -1028,7 +1028,7 @@ $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: t3lib/class.t3lib_install.php =================================================================== --- t3lib/class.t3lib_install.php (revision 4809) +++ t3lib/class.t3lib_install.php (working copy) @@ -807,7 +807,7 @@ } 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]); } } @@ -833,7 +833,7 @@ $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! @@ -849,7 +849,7 @@ $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: t3lib/class.t3lib_sqlparser.php =================================================================== --- t3lib/class.t3lib_sqlparser.php (revision 4809) +++ t3lib/class.t3lib_sqlparser.php (working copy) @@ -193,7 +193,7 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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(); @@ -1132,7 +1132,8 @@ $reg = array(); //preg_match('/[\]*$/',$v,$reg); // does not work. what is the *exact* meaning of the next line? - ereg('[\]*$',$v,$reg); + //ereg('[\]*$',$v,$reg); + preg_match('/\\*$/',$v,$reg); if ($reg AND strlen($reg[0])%2) { $buffer.=$quote; } else { @@ -1194,7 +1195,6 @@ */ function trimSQL($str) { return trim(rtrim($str, "; \r\n\t")).' '; - //return trim(ereg_replace('[[:space:];]*$','',$str)).' '; } Index: t3lib/class.t3lib_parsehtml_proc.php =================================================================== --- t3lib/class.t3lib_parsehtml_proc.php (revision 4809) +++ t3lib/class.t3lib_parsehtml_proc.php (working copy) @@ -150,8 +150,8 @@ */ 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 @@ $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 @@ 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 @@ 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 @@ } 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 @@ } // 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 @@ $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: t3lib/class.gzip_encode.php =================================================================== --- t3lib/class.gzip_encode.php (revision 4809) +++ t3lib/class.gzip_encode.php (working copy) @@ -364,7 +364,7 @@ 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: t3lib/class.t3lib_rteapi.php =================================================================== --- t3lib/class.t3lib_rteapi.php (revision 4809) +++ t3lib/class.t3lib_rteapi.php (working copy) @@ -196,7 +196,7 @@ */ function triggerField($fieldName) { - $triggerFieldName = ereg_replace('\[([^]]+)\]$','[_TRANSFORM_\1]', $fieldName); + $triggerFieldName = preg_replace('/\[([^]]+)\]$/','[_TRANSFORM_\1]', $fieldName); return ''; } } Index: t3lib/class.t3lib_cs.php =================================================================== --- t3lib/class.t3lib_cs.php (revision 4809) +++ t3lib/class.t3lib_cs.php (working copy) @@ -111,6 +111,7 @@ * - 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: * @@ -119,9 +120,7 @@ * - stripos * - substr * - strrev - * - ereg/eregi * - split/spliti - * - preg_* * - ... * */ @@ -795,7 +794,7 @@ } $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: @@ -987,13 +986,13 @@ // 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) = 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]; } @@ -1097,7 +1096,7 @@ // 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; @@ -1106,7 +1105,7 @@ } $match = array(); - if (ereg('(<.*>)? *(.+)',$decomp,$match)) { + if (preg_match('/(<.*>)? *(.+)/',$decomp,$match)) { switch($match[1]) { case '': // add parenthesis as circle replacement, eg (1) $match[2] = '0028 '.$match[2].' 0029'; @@ -1117,7 +1116,7 @@ break; case '': // 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: t3lib/class.t3lib_tsstyleconfig.php =================================================================== --- t3lib/class.t3lib_tsstyleconfig.php (revision 4809) +++ t3lib/class.t3lib_tsstyleconfig.php (working copy) @@ -249,7 +249,7 @@ $fV=""; } $fV=htmlspecialchars($fV); -#debug(array($params,$fN,$fV,isset($this->ext_realValues[$params["name"]]))); + return array($fN,$fV,$params); } @@ -262,7 +262,7 @@ 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: t3lib/class.t3lib_loadmodules.php =================================================================== --- t3lib/class.t3lib_loadmodules.php (revision 4809) +++ t3lib/class.t3lib_loadmodules.php (working copy) @@ -368,7 +368,7 @@ 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 @@ */ 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 @@ 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: t3lib/class.t3lib_transferdata.php =================================================================== --- t3lib/class.t3lib_transferdata.php (revision 4809) +++ t3lib/class.t3lib_transferdata.php (working copy) @@ -752,7 +752,7 @@ 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: t3lib/class.t3lib_userauthgroup.php =================================================================== --- t3lib/class.t3lib_userauthgroup.php (revision 4809) +++ t3lib/class.t3lib_userauthgroup.php (working copy) @@ -473,7 +473,7 @@ if (!strcmp($value,'')) return TRUE; // Certain characters are not allowed in the value - if (ereg('[:|,]',$value)) { + if (preg_match('/[:|,]/',$value)) { return FALSE; } Index: t3lib/class.t3lib_tstemplate.php =================================================================== --- t3lib/class.t3lib_tstemplate.php (revision 4809) +++ t3lib/class.t3lib_tstemplate.php (working copy) @@ -651,7 +651,7 @@ 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); @@ -1214,7 +1214,7 @@ $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: t3lib/class.t3lib_htmlmail.php =================================================================== --- t3lib/class.t3lib_htmlmail.php (revision 4809) +++ t3lib/class.t3lib_htmlmail.php (working copy) @@ -930,7 +930,7 @@ 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(); @@ -957,7 +957,7 @@ $codepieces = 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(); @@ -979,11 +979,11 @@ // fixes javascript rollovers $codepieces = 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 @@ -1020,7 +1020,7 @@ $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(); @@ -1072,7 +1072,7 @@ $codepieces = 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(); @@ -1154,8 +1154,7 @@ $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--; } @@ -1193,11 +1192,11 @@ 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 @@ -1357,7 +1356,7 @@ $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 { @@ -1375,7 +1374,7 @@ */ 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 { @@ -1383,7 +1382,7 @@ $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]; @@ -1403,7 +1402,7 @@ */ 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; @@ -1438,7 +1437,7 @@ */ 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 @@ -1457,7 +1456,7 @@ $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: t3lib/class.t3lib_softrefproc.php =================================================================== --- t3lib/class.t3lib_softrefproc.php (revision 4809) +++ t3lib/class.t3lib_softrefproc.php (working copy) @@ -236,7 +236,7 @@ $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 @@ $elements = array(); foreach($linkTags as $k => $foundValue) { if ($k%2) { - $typolinkValue = eregi_replace('getTypoLinkParts($typolinkValue); $linkTags[$k] = 'setTypoLinkPartsElement($tLP, $elements, $typolinkValue, $k).'>'; } @@ -644,7 +644,7 @@ // 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: t3lib/class.t3lib_superadmin.php =================================================================== --- t3lib/class.t3lib_superadmin.php (revision 4809) +++ t3lib/class.t3lib_superadmin.php (working copy) @@ -445,8 +445,8 @@ $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.='


'; $content.=$this->headerParentDir($dir); if (@is_dir($dir)) { Index: t3lib/class.t3lib_stdgraphic.php =================================================================== --- t3lib/class.t3lib_stdgraphic.php (revision 4809) +++ t3lib/class.t3lib_stdgraphic.php (working copy) @@ -1959,12 +1959,12 @@ // 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]); @@ -2226,7 +2226,7 @@ * @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; @@ -2285,7 +2285,7 @@ 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)) { @@ -2487,7 +2487,7 @@ $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 = ''; @@ -2690,7 +2690,7 @@ function output($file) { if ($file) { $reg = array(); - ereg('([^\.]*)$',$file,$reg); + preg_match('/([^\.]*)$/',$file,$reg); $ext=strtolower($reg[0]); switch($ext) { case 'gif': Index: t3lib/class.t3lib_iconworks.php =================================================================== --- t3lib/class.t3lib_iconworks.php (revision 4809) +++ t3lib/class.t3lib_iconworks.php (working copy) @@ -241,13 +241,13 @@ } // 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 @@ 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 @@ // 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 @@ } // 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: t3lib/class.t3lib_tceforms.php =================================================================== --- t3lib/class.t3lib_tceforms.php (revision 4809) +++ t3lib/class.t3lib_tceforms.php (working copy) @@ -2612,7 +2612,7 @@ // Kasper's comment (kept for history): Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works... $this->additionalJS_post = $additionalJS_post_saved; $this->additionalJS_submit = $additionalJS_submit_saved; - $new = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new', 1); + $new = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new', 1); $newElementsLinks[]= ' backPath,'gfx/new_el.gif','width="11" height="12"').' alt="' . $new . '" title="' . $new . '" align="absmiddle" />' . htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($nCfg['tx_templavoila']['title']),30)) . ''; @@ -2626,7 +2626,7 @@ $output.= '
- backPath,'gfx/pil2right.gif','width="7" height="12"').' align="absmiddle" alt="' . + backPath,'gfx/pil2right.gif','width="7" height="12"').' align="absmiddle" alt="' . $toggleAll . '" title="' . $toggleAll . '" /> backPath,'gfx/pil2right.gif','width="7" height="12"').' align="absmiddle" alt="' . $toggleAll . '" title="' . $toggleAll . '" />' . $toggleAll . ' @@ -4287,7 +4287,7 @@ $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); @@ -4364,7 +4364,7 @@ // Item configuration: $items[] = array( - ereg_replace(':$','',$theTypeArrays[0]), + rtrim($theTypeArrays[0], ':'), $theTypeArrays[1], '', $descr @@ -4395,7 +4395,7 @@ // 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]] ); } @@ -4428,7 +4428,7 @@ // 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: t3lib/class.t3lib_querygenerator.php =================================================================== --- t3lib/class.t3lib_querygenerator.php (revision 4809) +++ t3lib/class.t3lib_querygenerator.php (working copy) @@ -289,14 +289,14 @@ $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';