Changeset 5934 for trunk/calendar
- Timestamp:
- 04/12/12 15:18:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/calendar/csv_import.php
r5915 r5934 58 58 $PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans 59 59 $ASep = '|>'; // Assignment-Separator, separats pattern and replacesment 60 $VPre = '|#'; // Value-Prefix, is expanded to \ for ereg_replace60 $VPre = '|#'; // Value-Prefix, is expanded to \ for preg_replace 61 61 $CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field 62 62 $CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted … … 244 244 "First example: <b>1${ASep}private${PSep}public</b><br>". 245 245 "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). ". 247 247 "If, after all replacements, the value starts with an '@' the whole value is eval()'ed, so you ". 248 248 "may use all php, phpgw plus your own functions. This is quiet powerfull, but <u>circumvents all ACL</u>.<p>". … … 375 375 if (preg_match("/$pattern/",$val)) 376 376 { 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); 379 379 // echo "'$val'</p>"; 380 380 … … 462 462 { 463 463 // 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]); 465 465 // remove fractures of seconds if present at the end of the string 466 466 if (preg_match('/(.*)\.[0-9]+/',$values[$date],$parts)) $values[$date] = $parts[1];
Note: See TracChangeset
for help on using the changeset viewer.