$files_per_step ) { if( file_put_contents($dir_contents_cache_file, implode("\n", $v_list )) == false ) { ext_Result::sendResult('archive', false, 'Failed to create a temporary list of the directory contents' ); } } } else { $file_list_string = file_get_contents($dir_contents_cache_file); if( empty( $file_list_string )) { ext_Result::sendResult('archive', false, 'Failed to retrieve the temporary list of the directory contents' ); } $v_list = explode("\n", $file_list_string ); } $cnt_filelist = count( $v_list ); // Now we go to the right range of files and "slice" the array $v_list = array_slice( $v_list, $startfrom, $files_per_step-1 ); $remove_path = $GLOBALS["home_dir"]; if( $dir ) { $remove_path .= $dir; } $remove_path = str_replace( '\\', '/', realpath($remove_path) ).'/'; $debug = 'Starting from: '.$startfrom."\n"; $debug .= 'Files to process: '.$cnt_filelist."\n"; $debug .= implode( "\n", $v_list ); //file_put_contents( 'log.txt', $debug, FILE_APPEND ); // Do some setup stuff ini_set('memory_limit', '128M'); @set_time_limit( 0 ); //error_reporting( E_ERROR | E_PARSE ); $result = extArchive::create( $archive_name, $v_list, $GLOBALS['__POST']["type"], '', $remove_path ); if( PEAR::isError( $result ) ) { ext_Result::sendResult('archive', false, $name.': '.ext_Lang::err('archive_creation_failed').' ('.$result->getMessage().$archive_name.')' ); } $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON'; $json = new $classname(); if( $cnt_filelist > $startfrom+$files_per_step ) { $response = Array( 'startfrom' => $startfrom + $files_per_step, 'totalitems' => $cnt_filelist, 'success' => true, 'action' => 'archive', 'token' => ext_getToken(), 'message' => sprintf( ext_Lang::msg('processed_x_files'), $startfrom + $files_per_step, $cnt_filelist ) ); } else { @unlink($dir_contents_cache_file); if( $GLOBALS['__POST']["type"] == 'tgz' || $GLOBALS['__POST']["type"] == 'tbz') { chmod( $archive_name, 0644 ); } $response = Array( 'action' => 'archive', 'success' => true, 'token' => ext_getToken(), 'message' => ext_Lang::msg('archive_created'), 'newlocation' => ext_make_link( 'download', $dir, basename($archive_name) ) ); } echo $json->encode( $response ); ext_exit(); } $default_archive_type = 'zip'; ?> { "xtype": "form", "id": "simpleform", "height": "200", "width": "350", "labelWidth": 125, "url":"", "dialogtitle": "", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "", "name": "name", "value": "", "width": "200" }, { "xtype": "combo", "fieldLabel": "", "store": [ ['zip', 'Zip ()'], ['tgz', 'Tar/Gz ()'], ['tar', 'Tar ()'] ], "displayField":"typename", "valueField": "type", "name": "type", "value": "", "triggerAction": "all", "hiddenName": "type", "disableKeyFilter": "true", "editable": "false", "mode": "local", "allowBlank": "false", "selectOnFocus":"true", "width": "200", "listeners": { "select": { fn: function(o, record ) { form = Ext.getCmp("simpleform").getForm(); var nameField = form.findField("name").getValue(); if( nameField.indexOf( '.' ) > 0 ) { form.findField('name').setValue( nameField.substring( 0, nameField.indexOf('.')+1 ) + o.getValue() ); } else { form.findField('name').setValue( nameField + '.'+ o.getValue()); } } } } }, { "xtype": "textfield", "fieldLabel": "", "name": "saveToDir", "value": "", "width": "200" },{ "xtype": "checkbox", "fieldLabel": "?", "name": "download", "checked": "true" } ], "buttons": [{ "text": "", "type": "submit", "handler": function() { Ext.ux.OnDemandLoad.load( "?option=com_extplorer&action=include_javascript&file=archive.js", function(options) { submitArchiveForm(0) } ); } },{ "text": "", "handler": function() { Ext.getCmp("dialog").destroy() } }] }