function pm_export_messages($messages_array, $options_array = array()) { if (!is_array($messages_array)) { return false; } $messages_array = array_filter($messages_array, 'is_numeric'); if (sizeof($messages_array) < 1) { return false; } if (!is_array($options_array)) { $options_array = array(); } $logon = mb_strtolower(session::get_value('LOGON')); if (!isset($options_array['PM_EXPORT_TYPE'])) { $options_array['PM_EXPORT_TYPE'] = session::get_value('PM_EXPORT_TYPE'); } if (!isset($options_array['PM_EXPORT_STYLE'])) { $options_array['PM_EXPORT_STYLE'] = session::get_value('PM_EXPORT_STYLE'); } $zip_file = new zip_file(); if ($options_array['PM_EXPORT_STYLE'] == "Y" && @file_exists("styles/style.css")) { $zip_file->add_file(file_get_contents("styles/style.css"), "styles/style.css"); } switch ($options_array['PM_EXPORT_TYPE']) { case PM_EXPORT_HTML: if (!pm_export_html($messages_array, $zip_file, $options_array)) { return false; } break; case PM_EXPORT_XML: if (!pm_export_xml($messages_array, $zip_file, $options_array)) { return false; } break; case PM_EXPORT_CSV: if (!pm_export_csv($messages_array, $zip_file, $options_array)) { return false; } break; } header("Content-Type: application/zip"); header("Expires: " . gmdate('D, d M Y H:i:s') . " GMT"); header("Content-Disposition: attachment; filename=\"pm_backup_{$logon}.zip\""); header("Pragma: no-cache"); echo $zip_file->output_zip(); exit; }