$tplset_handler =& xoops_gethandler('tplset'); $tplsetobj =& $tplset_handler->getByName($tplset); $xml = "<" . "?xml version=\"1.0\"?" . ">\r\n<tplset>\r\n <name>" . $tplset . "</name>\r\n <dateCreated>" . $tplsetobj->getVar('tplset_created') . "</dateCreated>\r\n <credits>\r\n" . $tplsetobj->getVar('tplset_credits') . "\r\n </credits>\r\n <generator>" . XOOPS_VERSION . "</generator>\r\n <templates>"; $tpltpl_handler =& xoops_gethandler('tplfile'); $files =& $tpltpl_handler->getObjects(new Criteria('tpl_tplset', $tplset), true); $fcount = count($files); if ($fcount > 0) { for ($i = 0; $i < $fcount; $i++) { if ($files[$i]->getVar('tpl_type') == 'block') { $path = $tplset . '/templates/' . $files[$i]->getVar('tpl_module') . '/blocks/' . $files[$i]->getVar('tpl_file'); $xml .= "\r\n <template name=\"" . $files[$i]->getVar('tpl_file') . "\">\r\n <module>" . $files[$i]->getVar('tpl_module') . "</module>\r\n <type>block</type>\r\n <lastModified>" . $files[$i]->getVar('tpl_lastmodified') . "</lastModified>\r\n </template>"; } elseif ($files[$i]->getVar('tpl_type') == 'module') { $path = $tplset . '/templates/' . $files[$i]->getVar('tpl_module') . '/' . $files[$i]->getVar('tpl_file'); $xml .= "\r\n <template name=\"" . $files[$i]->getVar('tpl_file') . "\">\r\n <module>" . $files[$i]->getVar('tpl_module') . "</module>\r\n <type>module</type>\r\n <lastModified>" . $files[$i]->getVar('tpl_lastmodified') . "</lastModified>\r\n </template>"; } $downloader->addFileData($files[$i]->getVar('tpl_source'), $path, $files[$i]->getVar('tpl_lastmodified')); } $xml .= "\r\n </templates>"; /* $xml ." "\r\n <images>"; $image_handler =& xoops_gethandler('imagesetimg'); $criteria = new CriteriaCompo(new Criteria('l.tplset_name', $tplset)); $criteria->add(new Criteria('s.imgset_refid', 0)); $ifiles =& $image_handler->getObjects($criteria); $fcount = count($ifiles); for ($i = 0; $i < $fcount; $i++) { $dummyimage = XOOPS_CACHE_PATH.'/_dummyimage'.$i.time(); $fp = @fopen($dummyimage, 'wb'); @fwrite($fp, $ifiles[$i]->getVar('imgsetimg_body')); @fclose($fp); $downloader->addBinaryFile($dummyimage, $tplset.'/images/'.$ifiles[$i]->getVar('imgsetimg_file'));
} // end if } // end for $export_string .= "INSERT INTO `{$table}` VALUES (" . implode(', ', $values) . ");\n"; unset($values); } // end while mysql_free_result($result); } $sqlfile_name = $prefix . '_' . date('YmdHis') . '.sql'; //by domifara for add action zip ,ta.gzdownload if (!empty($_POST['download_zip'])) { require_once XOOPS_ROOT_PATH . '/class/zipdownloader.php'; $downloader = new XoopsZipDownloader(); $downloader->addFileData($export_string, $sqlfile_name, time()); $downloader->download($sqlfile_name, true); exit; } else { if (!empty($_POST['download_tgz'])) { require_once XOOPS_ROOT_PATH . '/class/tardownloader.php'; $downloader = new XoopsTarDownloader(); $downloader->addFileData($export_string, $sqlfile_name, time()); $downloader->download($sqlfile_name, true); exit; } } //fix for mb_http_output setting and for add any browsers if (function_exists('mb_http_output')) { mb_http_output('pass'); }