? MDL20821trunkpatch.txt ? config.php Index: auth/shibboleth/logout.php =================================================================== RCS file: /cvsroot/moodle/moodle/auth/shibboleth/logout.php,v retrieving revision 1.6 diff -u -r1.6 logout.php --- auth/shibboleth/logout.php 1 Nov 2009 11:55:15 -0000 1.6 +++ auth/shibboleth/logout.php 16 Nov 2009 09:22:52 -0000 @@ -139,7 +139,7 @@ while (($file = readdir($dh)) !== false) { // Check if it is a file if (is_file($dir.'/'.$file)){ - $session_key = ereg_replace('sess_', '', $file); + $session_key = preg_replace('/sess_/', '', $file); // Read session file data $data = file($dir.'/'.$file); Index: filter/tex/filter.php =================================================================== RCS file: /cvsroot/moodle/moodle/filter/tex/filter.php,v retrieving revision 1.30 diff -u -r1.30 filter.php --- filter/tex/filter.php 1 Nov 2009 13:01:58 -0000 1.30 +++ filter/tex/filter.php 16 Nov 2009 09:23:25 -0000 @@ -147,7 +147,7 @@ $texexp = str_replace('','',$texexp); $texexp = str_replace('','',$texexp); $texexp = str_replace('','',$texexp); - $texexp = eregi_replace("", '', $texexp); //dlnsk + $texexp = preg_replace("//i", '', $texexp); //dlnsk $align = "middle"; if (preg_match('/^align=bottom /',$texexp)) { $align = "text-bottom"; Index: lib/wiki_to_markdown.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/wiki_to_markdown.php,v retrieving revision 1.15 diff -u -r1.15 wiki_to_markdown.php --- lib/wiki_to_markdown.php 1 Nov 2009 11:31:18 -0000 1.15 +++ lib/wiki_to_markdown.php 16 Nov 2009 09:24:22 -0000 @@ -90,14 +90,14 @@ // BODGE: replace inline $mark characters in places where we want them ignored // they will be put back after main substitutue, stops problems with eg, and/or $bodge = chr(1); - $line = eregi_replace( '([[:alnum:]])'.$mark.'([[:alnum:]])', '\\1'.$bodge.'\\2',$line ); + $line = preg_replace( '/([[:alnum:]])'.$mark.'([[:alnum:]])/i', '\\1'.$bodge.'\\2',$line ); - $regex = '(^| |[(.,])'.$mark.'([^'.$mark.']*)'.$mark.'([^[:alnum:]]|$)'; + $regex = '/(^| |[(.,])'.$mark.'([^'.$mark.']*)'.$mark.'([^[:alnum:]]|$)/i'; $replace = '\\1<'.$tag.'>\\2\\3'; - $line = eregi_replace( $regex, $replace, $line ); + $line = preg_replace( $regex, $replace, $line ); // BODGE: back we go - $line = eregi_replace( $bodge, $mark, $line ); + $line = preg_replace( '/'.$bodge.'/i', $mark, $line ); return $line; } @@ -111,14 +111,14 @@ // BODGE: replace inline $mark characters in places where we want them ignored // they will be put back after main substitutue, stops problems with eg, and/or $bodge = chr(1); - $line = eregi_replace( '([[:alnum:]])'.$mark.'([[:alnum:]])', '\\1'.$bodge.'\\2',$line ); + $line = preg_replace( '/([[:alnum:]])'.$mark.'([[:alnum:]])/i', '\\1'.$bodge.'\\2',$line ); - $regex = '(^| |[(.,])'.$mark.'([^'.$mark.']*)'.$mark.'([^[:alnum:]]|$)'; + $regex = '/(^| |[(.,])'.$mark.'([^'.$mark.']*)'.$mark.'([^[:alnum:]]|$)/i'; $replace = '\\1'.$tag.'\\2'.$tag.'\\3'; - $line = eregi_replace( $regex, $replace, $line ); + $line = preg_replace( $regex, $replace, $line ); // BODGE: back we go - $line = eregi_replace( $bodge, $mark, $line ); + $line = preg_replace( '/'.$bodge.'/i', $mark, $line ); return $line; } @@ -128,10 +128,10 @@ // do regex for subscript and superscript (slightly different) // $mark is the magic character and $tag the HTML tag to insert - $regex = $mark.'([^'.$mark.']*)'.$mark; + $regex = '/'.$mark.'([^'.$mark.']*)'.$mark.'/i'; $replace = '<'.$tag.'>\\1'; - return eregi_replace( $regex, $replace, $line ); + return preg_replace( $regex, $replace, $line ); } function do_list( $line, $blank=false ) { @@ -146,7 +146,7 @@ else { $listchar = $line{0}; $count = strspn( $line, $listchar ); - $line = eregi_replace( "^[".$listchar."]+ ", "", $line ); + $line = preg_replace( "/^[".$listchar."]+ /i", "", $line ); } // find what sort of list this character represents @@ -246,7 +246,7 @@ $line = str_replace( "1/4", "¼", $line ); $line = str_replace( "1/2", "½", $line ); $line = str_replace( "3/4", "¾", $line ); - $line = eregi_replace( "([[:digit:]]+[[:space:]]*)x([[:space:]]*[[:digit:]]+)", "\\1×\\2", $line ); // (digits) x (digits) - multiply + $line = preg_replace( "/([[:digit:]]+[[:space:]]*)x([[:space:]]*[[:digit:]]+)/i", "\\1×\\2", $line ); // (digits) x (digits) - multiply // do formatting tags // NOTE: The / replacement *has* to be first, or it will screw the // HTML tags that are added by the other ones @@ -262,48 +262,48 @@ // convert urls into proper link with optional link text URL(text) // MARDOWN: HTML conversion should work fine - $line = eregi_replace("([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)", + $line = preg_replace("/([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)/i", "\\1[\\5](\\2://\\3\\4)", $line); - $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)", + $line = preg_replace("/([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)/i", "\\1[\\5](http://www.\\2\\3)", $line); // make urls (with and without httpd) into proper links - $line = eregi_replace("([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", + $line = preg_replace("/([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])/i", "\\1<\\2://\\3\\4>", $line); - $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])", + $line = preg_replace("/([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])/i", "\\1", $line); // make email addresses into mailtos.... // MARKDOWN doesn't quite support this, so do as html - $line = eregi_replace("([[:space:]]|^)([[:alnum:]._-]+@[[:alnum:]._-]+)\(([^)]+)\)", + $line = preg_replace("/([[:space:]]|^)([[:alnum:]._-]+@[[:alnum:]._-]+)\(([^)]+)\)/i", "\\1\\3", $line); // !# at the beginning of any lines means a heading // MARKDOWN: value (1-6) becomes number of hashes - if (eregi( "^!([1-6]) (.*)$", $line, $regs )) { + if (preg_match( "/^!([1-6]) (.*)$/i", $line, $regs )) { $depth = substr( $line, 1, 1 ); $out = substr( '##########', 0, $depth); - $line = eregi_replace( "^!([1-6]) (.*)$", "$out \\2", $line ); + $line = preg_replace( "/^!([1-6]) (.*)$/i", "$out \\2", $line ); } // acronym handing, example HTML(Hypertext Markyp Language) // MARKDOWN: no equiv. so just leave as HTML - $line = ereg_replace( "([A-Z]+)\(([^)]+)\)", "\\1", $line ); + $line = preg_replace( "/([A-Z]+)\(([^)]+)\)/", "\\1", $line ); // Replace resource link >>##(Description Text) // MARKDOWN: change to MD web link style - $line = eregi_replace( " ([a-zA-Z]+):([0-9]+)\(([^)]+)\)", + $line = preg_replace("/ ([a-zA-Z]+):([0-9]+)\(([^)]+)\)/i", " [\\3](".$CFG->wwwroot."/mod/\\1/view.php?id=\\2) ", $line ); require_once($CFG->libdir.'/filelib.php'); $coursefileurl = get_file_url($this->courseid); // Replace picture resource link - $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)", + $line = preg_replace("#/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)#i", "![\\3](".$coursefileurl."/\\1\\2)", $line ); // Replace file resource link - $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)", + $line = preg_replace("#file:/([[:alnum:]/._-]+)\(([^)]+)\)#i", "[\\2](".$coursefileurl."/\\1)", $line ); return $line; @@ -359,7 +359,7 @@ if (eregi("^\% ",$line) ) { // preformatted text - no processing // MARKDOWN: this is MD code form of a paragraph - $buffer = $buffer . " " . eregi_replace( "^\%","",$line) . "\n"; + $buffer = $buffer . " " . preg_replace( "/^\%/i","",$line) . "\n"; $this->block_state = STATE_NOTIKI; } else { Index: lib/htmlpurifier/HTMLPurifier/AttrDef/Lang.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/htmlpurifier/HTMLPurifier/AttrDef/Lang.php,v retrieving revision 1.6 diff -u -r1.6 Lang.php --- lib/htmlpurifier/HTMLPurifier/AttrDef/Lang.php 19 Jul 2009 11:57:03 -0000 1.6 +++ lib/htmlpurifier/HTMLPurifier/AttrDef/Lang.php 16 Nov 2009 09:24:58 -0000 @@ -10,7 +10,7 @@ public function validate($string, $config, $context) { // moodle change - we use special lang strings unfortunatelly - return ereg_replace('[^0-9a-zA-Z_-]', '', $string); + return preg_replace('/[^0-9a-zA-Z_-]/', '', $string); // moodle change end $string = trim($string); Index: lib/packer/file_archive.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/packer/file_archive.php,v retrieving revision 1.3 diff -u -r1.3 file_archive.php --- lib/packer/file_archive.php 1 Nov 2009 11:45:29 -0000 1.3 +++ lib/packer/file_archive.php 16 Nov 2009 09:25:02 -0000 @@ -136,7 +136,7 @@ } } - $result = ereg_replace('\.\.+', '', $result); + $result = preg_replace('/\.\.+/', '', $result); $result = ltrim($result); // no leadin / if ($result === '.') { Index: lib/typo3/class.t3lib_cs.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/typo3/class.t3lib_cs.php,v retrieving revision 1.9 diff -u -r1.9 class.t3lib_cs.php --- lib/typo3/class.t3lib_cs.php 4 Nov 2009 19:54:08 -0000 1.9 +++ lib/typo3/class.t3lib_cs.php 16 Nov 2009 09:25:23 -0000 @@ -794,8 +794,8 @@ $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES)); // Getting them in iso-8859-1 - but thats ok since this is observed below. } - $token = md5(microtime()); - $parts = explode($token,ereg_replace('(&([#[:alnum:]]*);)',$token.'\2'.$token,$str)); + $token = 'a'.md5(microtime());//token must start with a letter or preg_replace substitution won't work + $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: Index: lib/typo3/class.t3lib_div.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/typo3/class.t3lib_div.php,v retrieving revision 1.4 diff -u -r1.4 class.t3lib_div.php --- lib/typo3/class.t3lib_div.php 4 Nov 2009 19:54:08 -0000 1.4 +++ lib/typo3/class.t3lib_div.php 16 Nov 2009 09:25:26 -0000 @@ -1147,7 +1147,7 @@ * @return string */ public static function rm_endcomma($string) { - return ereg_replace(',$','',$string); + return preg_replace('/,$/','',$string); } /** @@ -1287,7 +1287,7 @@ * @see calcParenthesis() */ public static function calcPriority($string) { - $string=ereg_replace('[[:space:]]*','',$string); // removing all whitespace + $string=preg_replace('/[ ]*/','',$string); // removing all whitespace $string='+'.$string; // Ensuring an operator for the first entrance $qm='\*\/\+-^%'; $regex = '(['.$qm.'])(['.$qm.']?[0-9\.]*)'; @@ -1370,7 +1370,7 @@ * @return string Converted result. */ public static function deHSCentities($str) { - return ereg_replace('&([#[:alnum:]]*;)','&\1',$str); + return preg_replace('/&([#A-Za-z0-9]*;)/','&\1',$str); } /** @@ -1894,7 +1894,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; } @@ -1917,9 +1917,9 @@ * @internal */ public static function split_tag_attributes($tag) { - $tag_tmp = trim(eregi_replace ('^<[^[:space:]]*','',trim($tag))); + $tag_tmp = trim(preg_replace ('/^<[^[:space:]]*/i','',trim($tag))); // Removes any > in the end of the string - $tag_tmp = trim(eregi_replace ('>$','',$tag_tmp)); + $tag_tmp = trim(preg_replace ('/>$/i','',$tag_tmp)); $value = array(); while (strcmp($tag_tmp,'')) { // Compared with empty string instead , 030102 @@ -2184,7 +2184,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)) { @@ -2848,7 +2848,7 @@ // Initialize variabels: $filearray = array(); $sortarray = array(); - $path = ereg_replace('\/$','',$path); + $path = preg_replace('#\/$#','',$path); // Find files+directories: if (@is_dir($path)) { @@ -3266,7 +3266,7 @@ $pString = t3lib_div::implodeArrayForUrl('',$params); - return $pString ? $parts.'?'.ereg_replace('^&','',$pString) : $parts; + return $pString ? $parts.'?'.preg_replace('/^&/','',$pString) : $parts; } /** @@ -3389,7 +3389,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 = '/'.preg_replace('#^/#','',t3lib_div::getIndpEnv('SCRIPT_NAME')). ($_SERVER['QUERY_STRING']?'?'.$_SERVER['QUERY_STRING']:''); } else { $retVal = $_SERVER['REQUEST_URI']; @@ -3612,11 +3612,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/'); Index: lib/xmldb/xmldb_object.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/xmldb/xmldb_object.php,v retrieving revision 1.5 diff -u -r1.5 xmldb_object.php --- lib/xmldb/xmldb_object.php 1 Nov 2009 11:47:47 -0000 1.5 +++ lib/xmldb/xmldb_object.php 16 Nov 2009 09:25:27 -0000 @@ -164,7 +164,7 @@ function checkName () { $result = true; - if ($this->name != eregi_replace('[^a-z0-9_ -]', '', $this->name)) { + if ($this->name != preg_replace('/[^a-z0-9_ -]/i', '', $this->name)) { $result = false; } return $result;