mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Enforce export limit for csv exports
This commit is contained in:
parent
a019e94e55
commit
127976b1ef
@ -49,6 +49,11 @@ class importexport_export_csv implements importexport_iface_export_record
|
||||
*/
|
||||
protected $num_of_records = 0;
|
||||
|
||||
/**
|
||||
* @var int holds max. number of records allowed to be exported
|
||||
*/
|
||||
protected $export_limit = 0;
|
||||
|
||||
/**
|
||||
* @var stream stream resource of csv file
|
||||
*/
|
||||
@ -94,6 +99,12 @@ class importexport_export_csv implements importexport_iface_export_record
|
||||
if ( !empty( $_options ) ) {
|
||||
$this->csv_options = array_merge( $this->csv_options, $_options );
|
||||
}
|
||||
|
||||
if(!$GLOBALS['egw_info']['user']['apps']['admin']) {
|
||||
$config = config::read('phpgwapi');
|
||||
if($config['export_limit'] == 'no') throw new egw_exception_no_permission_admin('Export disabled');
|
||||
$this->export_limit = (int)$config['export_limit'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,6 +153,11 @@ class importexport_export_csv implements importexport_iface_export_record
|
||||
$mapping = $this->translation->convert( $mapping, $this->translation->charset(), $this->csv_charset );
|
||||
fputcsv( $this->handle ,$mapping ,$this->csv_options['delimiter'], $this->csv_options['enclosure'] );
|
||||
}
|
||||
|
||||
// Check for limit
|
||||
if($this->export_limit && $this->num_of_records > $this->export_limit) {
|
||||
return;
|
||||
}
|
||||
|
||||
// do conversions
|
||||
if ( !empty( $this->conversion )) {
|
||||
|
Loading…
Reference in New Issue
Block a user