/** * Gera um arquivo ZIP contendo as classes geradas * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @return void */ private function generateZip() { Lumine_Log::debug('Gerando arquivo ZIP'); $raiz = $this->cfg->getProperty('class_path') . '/'; $zipname = $this->cfg->getProperty('class_path') . '/lumine.zip'; if (!is_writable($raiz)) { Lumine_Log::error('Nao e possivel criar arquivos em "' . $raiz . '". Verifique as permissoes.'); exit; } $zip = new dZip($zipname); $sufix = $this->cfg->getOption('class_sufix'); if (!empty($sufix)) { $sufix = '.' . $sufix; } $filename = str_replace('.', DIRECTORY_SEPARATOR, $this->cfg->getProperty('package')); $filename .= DIRECTORY_SEPARATOR; reset($this->files); foreach ($this->files as $classname => $content) { Lumine_Log::debug('Adicionando ' . $classname . ' ao ZIP'); $name = $filename . $classname . $sufix . '.php'; $zip->addFile($content, $name, 'Lumine Reverse', $content); } // adiciona os dto's reset($this->dto_files); // 2010-11-05 // permite configurar a pasta para gravar os dto's $dtopath = ''; if ($this->cfg->getOption('dto_package') != '') { $dtopath = str_replace('.', '/', $this->cfg->getOption('dto_package')); } foreach ($this->dto_files as $classname => $content) { Lumine_Log::debug('Adicionando DTO ' . $classname . ' ao ZIP'); $name = $filename . 'dto/' . $dtopath . $classname . $sufix . '.php'; $zip->addFile($content, $name, 'Lumine Reverse DTO', $content); } // models $path = $this->cfg->getOption('model_path') . '/'; foreach ($this->models as $item) { Lumine_Log::debug('Adicionando Model ' . $classname . ' ao ZIP'); $filename = $path . $item->getFileName(); $content = $item->getContent(); $zip->addFile($content, $filename, 'Lumine Reverse Model', $content); } // adiciona os controles $path = 'controls' . DIRECTORY_SEPARATOR; foreach ($this->controls as $classname => $content) { Lumine_Log::debug('Adicionando controle ' . $classname . ' ao ZIP'); $name = $path . $classname . '.php'; $zip->addFile($content, $name, 'Lumine Reverse Control', $content); } $zip->addFile($this->config, 'lumine-conf.php', 'Configuration File', $this->config); $zip->save(); // altera as permissoes do arquivo chmod($zipname, 0777); Lumine_Log::debug('Arquivo ZIP gerado com sucesso em ' . $zipname); /* $fp = @fopen($zipname, "wb+"); if($fp) { fwrite($fp, $zip->getZippedfile()); fclose($fp); chmod($zipname, 0777); Lumine_Log::debug('Arquivo ZIP gerado com sucesso em '.$zipname); } else { Lumine_Log::error('Falha ao gerar ZIP em '.$obj->getClassname().'. Verifique se a pasta existe e se tem direito de escrita.'); exit; } */ }
fwrite($fp, $structure); // get data from table $result = mysql_query("SELECT * FROM `{$table}`", $mysql_link); while (($row = mysql_fetch_assoc($result)) !== FALSE) { $row = array_map('format_insert_value', $row); $sql = "INSERT INTO `{$table}` VALUES (" . implode(',', $row) . ");\n"; fwrite($fp, $sql); } mysql_free_result($result); } fclose($fp); // zipfile require_once 'dZip.inc.php'; // change this if you put dZip.inc.php on other place $zip = new dZip($file); $zip->addFile("backup/db_backup.sql", "db_backup.sql"); $zip->save(); // $ZipName = "MyFiles/MyZip.zip"; // require_once("dZip.inc.php"); // include Class // $zip = new dZip($ZipName); // New Class // $zip->addFile("thaicreate1.txt", "thaicreate1.txt"); // Source,Destination // $zip->addFile("thaicreate2.txt", "thaicreate2.txt"); // $zip->addDir("MySub"); // Add Folder // $zip->addFile("thaicreate3.txt", "MySub/thaicreate3.txt"); // Add file to Sub // $zip->addFile("thaicreate4.txt", "MySub/thaicreate4.txt"); // $zip->save(); // echo "Zip Successful Click <a href=$ZipName>here</a> to Download"; @unlink($sql_file) or die("Database backup finished"); ?> <body> <TABLE cellSpacing=0 cellPadding=0 width=820 border=0>
fclose($objFopen43);*/ //-------------------- Close file provider ä¿Åì·Õè 43 --------------------// ?> <? //-------------------- Add to zip --------------------// $f43="F43_11512_"; $default="090000"; $dbfname ="$f43$newyear$default"; $subfolder ="$f43$newyear$default"; $ZipName = "43files/$dbfname.zip"; require_once("dZip.inc.php"); // include Class $zip = new dZip($ZipName); // New Class $zip->addDir($subfolder); // Add Folder $zip->addFile($strFileName1, $subfolder."/".$strFileName1); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName2, $subfolder."/".$strFileName2); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName3, $subfolder."/".$strFileName3); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName4, $subfolder."/".$strFileName4); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName5, $subfolder."/".$strFileName5); // µé¹·Ò§,»ÅÒ·ҧ //$zip->addFile($strFileName6, $subfolder."/".$strFileName6); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName7, $subfolder."/".$strFileName7); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName8, $subfolder."/".$strFileName8); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName9, $subfolder."/".$strFileName9); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName10, $subfolder."/".$strFileName10); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName11, $subfolder."/".$strFileName11); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName12, $subfolder."/".$strFileName12); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName13, $subfolder."/".$strFileName13); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName14, $subfolder."/".$strFileName14); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName15, $subfolder."/".$strFileName15); // µé¹·Ò§,»ÅÒ·ҧ $zip->addFile($strFileName16, $subfolder."/".$strFileName16); // µé¹·Ò§,»ÅÒ·ҧ
$strFileName2 = "billdisp$thiyr$yrmonth$yrdate.txt"; $objFopen2 = fopen($strFileName2, 'a'); fwrite($objFopen2, $strText25); if($objFopen2){ /*echo "File writed.";*/ }else{ /*echo "File can not write";*/ } fclose($objFopen2); //-------------------- Close create file diag --------------------// ?> <? //-------------------- Add to zip --------------------// $dbfname =$yrmonthdate; $ZipName = "cscd/$dbfname.zip"; require_once("dZip.inc.php"); // include Class $zip = new dZip($ZipName); // New Class $zip->addFile($strFileName1, $strFileName1); // Source,Destination $zip->addFile($strFileName2, $strFileName2); // Source,Destination $zip->save(); echo "´ÒǹìâËÅ´¢éÍÁÙÅàºÔ¡ CSCD... <a href=$ZipName>¤ÅÔ¡·Õè¹Õè</a> <br>"; echo "<a href='../exportcscd_data.php'><< ¡ÅѺ˹éÒà´ÔÁ</a>"; //-------------------- Close add to zip --------------------// include("unconnect.inc"); ?>
)); dbase_close($db16); } //if db } // while } // while //---------------End Dataset16---------------// $dbfname =$day."-".$mm."-".$newyear; $ZipName = "opd/$dbfname.zip"; require_once("dZip.inc.php"); // include Class $zip = new dZip($ZipName); // New Class $zip->addFile($dbname1, $dbname1); // Source,Destination $zip->addFile($dbname2, $dbname2); // Source,Destination $zip->addFile($dbname3, $dbname3); // Source,Destination $zip->addFile($dbname4, $dbname4); // Source,Destination $zip->addFile($dbname5, $dbname5); // Source,Destination $zip->addFile($dbname6, $dbname6); // Source,Destination $zip->addFile($dbname7, $dbname7); // Source,Destination $zip->addFile($dbname8, $dbname8); // Source,Destination $zip->addFile($dbname9, $dbname9); // Source,Destination $zip->addFile($dbname10, $dbname10); // Source,Destination $zip->addFile($dbname11, $dbname11); // Source,Destination $zip->addFile($dbname12, $dbname12); // Source,Destination $zip->addFile($dbname13, $dbname13); // Source,Destination $zip->addFile($dbname14, $dbname14); // Source,Destination $zip->addFile($dbname15, $dbname15); // Source,Destination $zip->addFile($dbname16, $dbname16); // Source,Destination
// ���ҧ zip ��� $main_folder = 'F43_11512_'.$thiyr.$rptmo.'01090000'; $zipName = 'export/'.$main_folder.'.zip'; $zipNameQOF = 'export/QOF_'.$main_folder.'.zip'; require_once("libs/dZip.inc.php"); // include Class $zip = new dZip($zipName); foreach( $zipLists as $key => $list){ // match ����Ъ������ preg_match('/\/(\w+\.txt)/', $list, $file); // $zip->addFile(path���Ѩ�غѹ, ��������������ҧ�zip����); $zip->addFile($list, $main_folder.'/'.$file['1']); } $zip->save(); // ���ҧ zip ����Ѻ�� QOF ��� �ʨ $zip = new dZip($zipNameQOF); foreach( $qofLists as $key => $list){ preg_match('/\/(\w+\.txt)/', $list, $file); $filename = str_replace('qof_', '', $file['1']); // ź��Ҥ� qof_ �͡ $zip->addFile($list, $main_folder.'/'.$filename); } $zip->save(); echo '<p><a href="'.$zipName.'">�����Ŵ���</a></p>'; echo '<p><a href="'.$zipNameQOF.'">�����Ŵ�������Ѻ QOF</a></p>'; echo '<p><a href="export_new43.php"><< ��Ѻ�˹����¡��</a></p>'; }