Пример:
Ищем файл:
<file name="admin/controller/sale/order.php">
<operation>
<search position="before ПЕРЕД">
<![CDATA[public function download() {]]> ИЩЕМ КОД
</search>
<add>ДОБАВЛЯЕМ
<![CDATA[ private function get_user_os() { $HTTP_USER_AGENT = ''; if ($this->request->server["HTTP_USER_AGENT"]) { $HTTP_USER_AGENT = $this->request->server["HTTP_USER_AGENT"]; } $global_info = array(); if (preg_match("#Win#i", $HTTP_USER_AGENT)) { $global_info['user_os'] = "WIN"; } elseif (preg_match("#Mac#i", $HTTP_USER_AGENT)) { $global_info['user_os'] = "MAC"; } else { $global_info['user_os'] = "OTHER"; } return $global_info['user_os']; } private function get_browser_info() { $HTTP_USER_AGENT = ''; if (!empty($this->request->server['HTTP_USER_AGENT'])) { $HTTP_USER_AGENT = $this->request->server['HTTP_USER_AGENT']; } $global_info = array(); if (preg_match("#MSIE ([0-9].[0-9]{1,2})#i", $HTTP_USER_AGENT, $regs)) { $global_info['browser_agent'] = "MSIE"; $global_info['browser_version'] = $regs[1]; } elseif (preg_match("#Mozilla/([0-9].[0-9]{1,2})#i", $HTTP_USER_AGENT, $regs)) { $global_info['browser_agent'] = "MOZILLA"; $global_info['browser_version'] = $regs[1]; } elseif (preg_match("#Opera(/| )([0-9].[0-9]{1,2})#i", $HTTP_USER_AGENT, $regs)) { $global_info['browser_agent'] = "OPERA"; $global_info['browser_version'] = $regs[2]; } else { $global_info['browser_agent'] = "OTHER"; $global_info['browser_version'] = 0; } return $global_info['browser_agent']; } private function fix_file_path($file_path) { if (!file_exists($file_path)) { $file_path = preg_replace("//{2,}/", "/", $this->get_document_root()."/".$file_path); } return $file_path; } private function send_file($file_name, $file_path, $mask) { @session_write_close(); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); if ($this->get_user_os() == "MAC") { header("Content-Type: application/x-unknownn"); header('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file_name)) . '"'); } elseif ($this->get_browser_info() == "MSIE") { $disposition = (!preg_match("/.zip$/i", $file_name)) ? 'attachment' : 'inline'; header('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file_name)) . '"'); header("Content-Type: application/x-ms-downloadn"); } else { header('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file_name)) . '"'); header("Content-Type: application/octet-streamn"); } $file_path = $this->fix_file_path($file_path); if (($filesize = filesize($file_path)) > 0 && !@ini_get('zlib.output_compression') && !@ini_get('output_handler')) { header("Content-Length: ".$filesize."nn"); } @readfile($file_path); } ]]>
</add>
</operation>
<operation>
<search position="replace"> ЗАМЕНЯЕМ
<![CDATA[header('Content-Description: File Transfer');]]>КОД
</search>
<add>
</add>
</operation>
<operation>
<search position="replace">
<![CDATA[header('Content-Type: application/octet-stream');]]>
</search>Ну и т.д.