Changeset 5934 for trunk/calendar


Ignore:
Timestamp:
04/12/12 15:18:08 (12 years ago)
Author:
marcosw
Message:

Ticket #2398 - Compatibilizacao com PHP-5.3 em alguns módulos do expresso

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/csv_import.php

    r5915 r5934  
    5858        $PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans 
    5959        $ASep = '|>'; // Assignment-Separator, separats pattern and replacesment 
    60         $VPre = '|#'; // Value-Prefix, is expanded to \ for ereg_replace 
     60        $VPre = '|#'; // Value-Prefix, is expanded to \ for preg_replace 
    6161        $CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field 
    6262        $CPos = ']';  $CPosReg = '\]';  // if used together with @ (replacement is eval-ed) value gets autom. quoted 
     
    244244                        "First example: <b>1${ASep}private${PSep}public</b><br>". 
    245245                        "This will translate a '1' in the CVS field to 'private' and everything else to 'public'.<p>". 
    246                         "Patterns as well as the replacement can be regular expressions (the replacement is done via ereg_replace). ". 
     246                        "Patterns as well as the replacement can be regular expressions (the replacement is done via preg_replace). ". 
    247247                        "If, after all replacements, the value starts with an '@' the whole value is eval()'ed, so you ". 
    248248                        "may use all php, phpgw plus your own functions. This is quiet powerfull, but <u>circumvents all ACL</u>.<p>". 
     
    375375                                                if (preg_match("/$pattern/",$val)) 
    376376                                                { 
    377                                                         // echo "<p>csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",ereg_replace('$pattern','$replace','$val') = "; 
    378                                                         $val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val); 
     377                                                        // echo "<p>csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",preg_replace("/$pattern/",'$replace','$val') = "; 
     378                                                        $val = preg_replace((string) "/$pattern/",str_replace($VPre,'\\',$replace),(string) $val); 
    379379                                                        // echo "'$val'</p>"; 
    380380 
     
    462462                                        { 
    463463                                                // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format 
    464                                                 $values[$date] = ereg_replace('([0-9]{2}).([0-9]{2}).([0-9]{4})','\3-\2-\1',$values[$date]); 
     464                                                $values[$date] = preg_replace('/([0-9]{2}).([0-9]{2}).([0-9]{4})/','\3-\2-\1',$values[$date]); 
    465465                                                // remove fractures of seconds if present at the end of the string 
    466466                                                if (preg_match('/(.*)\.[0-9]+/',$values[$date],$parts)) $values[$date] = $parts[1]; 
Note: See TracChangeset for help on using the changeset viewer.