forked from extern/egroupware
php5.2 fixes
This commit is contained in:
parent
a012a4ba22
commit
654294ae97
@ -74,7 +74,7 @@ class export_csv implements iface_export_record
|
||||
* @param array _options options for specific backends
|
||||
* @return bool
|
||||
*/
|
||||
public function __construct( $_stream, $_options ) {
|
||||
public function __construct( $_stream, array $_options ) {
|
||||
if (!is_object($GLOBALS['egw']->translation)) {
|
||||
$GLOBALS['egw']->translation = new translation();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
* @param string $_resource resource containing data. May be each valid php-stream
|
||||
* @param array $_options options for the resource array with keys: charset and fieldsep
|
||||
*/
|
||||
public function __construct( $_resource, $_options ) {
|
||||
public function __construct( $_resource, array $_options ) {
|
||||
$this->resource = $_resource;
|
||||
$this->csv_fieldsep = $_options['fieldsep'];
|
||||
$this->csv_charset = $_options['charset'];
|
||||
|
@ -128,7 +128,7 @@ class import_export_helper_functions {
|
||||
|
||||
$cat_names = is_array( $_cat_names ) ? $_cat_names : explode( ',', $_cat_names );
|
||||
foreach ( $cat_names as $cat_name ) {
|
||||
|
||||
if ( $cat_name == '' ) continue;
|
||||
if ( ( $cat_id = $cats->name2id( $cat_name ) ) == 0 ) {
|
||||
$cat_id = $cats->add( array(
|
||||
'name' => $cat_name,
|
||||
@ -183,6 +183,7 @@ class import_export_helper_functions {
|
||||
$TPre = '|T{'; $TPos = '}'; // |{_record-idx} is trimmed
|
||||
$CntlPre = '|TC{'; // Filter all cntl-chars \x01-\x1f and trim
|
||||
$CntlnCLPre = '|TCnCL{'; // Like |C{ but allowes CR and LF
|
||||
$INE = '|INE{'; // Only insert if stuff in ^^ is not empty
|
||||
|
||||
foreach ( $_conversion as $idx => $conversion_string ) {
|
||||
if ( empty( $conversion_string ) ) continue;
|
||||
@ -215,11 +216,11 @@ class import_export_helper_functions {
|
||||
);
|
||||
}
|
||||
|
||||
$val = preg_replace_callback( "/(cat|account|strtotime)\(([^)]+)\)/i", array( self, 'c2_dispatcher') , $val );
|
||||
$val = preg_replace_callback( "/(cat|account|strtotime)\(([^)]*)\)/i", array( self, 'c2_dispatcher') , $val );
|
||||
}
|
||||
}
|
||||
// clean each field
|
||||
$val = preg_replace_callback("/(\|T\{|\|TC\{|\|TCnCL\{)(.*)\}/", array( self, 'strclean'), $val );
|
||||
$val = preg_replace_callback("/(\|T\{|\|TC\{|\|TCnCL\{|\|INE\{)(.*)\}/", array( self, 'strclean'), $val );
|
||||
|
||||
$_record[$idx] = $val;
|
||||
}
|
||||
@ -253,6 +254,7 @@ class import_export_helper_functions {
|
||||
case '|T{' : return trim( $_matches[2] );
|
||||
case '|TC{' : return trim( preg_replace( '/[\x01-\x1F]+/', '', $_matches[2] ) );
|
||||
case '|TCnCL{' : return trim( preg_replace( '/[\x01-\x09\x11\x12\x14-\x1F]+/', '', $_matches[2] ) );
|
||||
case '|INE{' : return preg_match( '/\^.+\^/', $_matches[2] ) ? $_matches[2] : '';
|
||||
default:
|
||||
throw new Exception('Error in conversion string! "'. substr( $_matches[1], 0, -1 ). '" is not valid!');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user