change_db($set['bd_code']);
$html=MYDIR . '/api/mod/' . ID . '.html';
require MYDIR . '/api/save_files.php';
$fp = fopen ( $html, 'a+' ) or die ('Нет прав на запись файла ' . $html . '! Дайте доступ на запись или обратитесь к системному администратору ');
$size = filesize ( $html );
$htm = open_text (base64_encode(gzencode (fread ( $fp, $size ))));
fclose ( $fp );
$result = mysql_query( "SELECT * FROM `mod` WHERE `mod` = '" . ID . "' LIMIT 1" );
while ( $postrow[] = mysql_fetch_array($result));
$xml='' . "\r\n";
$xml='' . ID . '' . "\r\n";
$xml.='' . $htm . '' . "\r\n";
$xml.='' . $postrow[0]['js'] . '' . "\r\n";
$xml.='' . $postrow[0]['php'] . '' . "\r\n";
$xml.='' . $postrow[0]['install'] . '' . "\r\n";
$xml.='' . $postrow[0]['news'] . '' . "\r\n";
$xml.='' . $postrow[0]['act'] . '' . "\r\n";
$xml.='' . $postrow[0]['ver'] . '' . "\r\n";
$xml.='' . base64_encode(gzencode ($postrow[0]['sql'])) . '' . "\r\n";
$xml.='' . base64_encode(gzencode ($postrow[0]['set'])) . '' . "\r\n";
$xml.='' . base64_encode(gzencode ($postrow[0]['set_form'])) . '' . "\r\n";
$xml.='' . md5($htm . $postrow[0]['js'] . $postrow[0]['php'] . $postrow[0]['act']) . $postrow[0]['ver'] . $postrow[0]['install'] . '' . "\r\n";
@mkdir(MYDIR . '/tmp', 0777);
@unlink (MYDIR . '/tmp/' . ID . '.xml');
@unlink (MYDIR . '/tmp/' . ID . '.zip');
@$fp = fopen ( MYDIR . '/tmp/' . ID . '.xml', 'w+' );
fwrite($fp, $xml);
fclose ( $fp );
chdir (MYDIR . '/tmp');
exec('zip -9 ' . ID . '.zip ' . ID . '.xml -m5');
?>