public function Action() { $db = JFactory::getDBO(); $app = JFactory::getApplication(); $list = array(); if (empty($_POST['micro_integrations'])) { return null; } foreach ($_POST['micro_integrations'] as $mi_id) { $mi = new microIntegration(); $mi->load($mi_id); $mi->id = 0; $mi->clear(); $list[] = clone $mi; } // Generate somewhat unique filename $fname = 'aec_mi_export_' . date('Y_m_d', (int) gmdate('U')) . '_' . ((int) gmdate('U') - strtotime(date('Y_m_d'))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header('Content-Disposition: inline; filename="' . $fname . '.mi"'); echo base64_encode(serialize($list)); exit; }