if (!empty($_POST['export_check_' . $i])) { $export_list[] = intval($_POST['export_id_' . $i]); } } $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE themes_id IN (" . implode(', ', $export_list) . ") ORDER BY style_name ASC"; $db->sql_return_on_error(true); $result = $db->sql_query($sql); $db->sql_return_on_error(false); if (!$result) { xs_error($lang['xs_no_style_info'] . '<br /><br />' . $lang['xs_export_data_back'], __LINE__, __FILE__); } $style_rowset = $db->sql_fetchrowset($result); if (!sizeof($style_rowset)) { xs_error($lang['xs_no_style_info'] . '<br /><br />' . $lang['xs_export_data_back'], __LINE__, __FILE__); } $data = xs_generate_themeinfo($style_rowset, $export, $export, 0); $f = @fopen($local_filename, 'wb'); if (!$f) { xs_error(str_replace('{FILE}', $local_filename, $lang['xs_error_cannot_create_file']) . '<br /><br />' . $lang['xs_export_data_back']); } fwrite($f, $data); fclose($f); if ($write_local) { xs_message($lang['Information'], $lang['xs_export_data_saved'] . '<br /><br />' . $lang['xs_export_data_back']); } // generate ftp actions $actions = array(); // chdir to template directory $actions[] = array('command' => 'chdir', 'dir' => 'templates'); $actions[] = array('command' => 'chdir', 'dir' => $export); $actions[] = array('command' => 'upload', 'local' => $local_filename, 'remote' => 'templates/' . $export . '/theme_info.cfg');
// prepare variables for export $export = $old_name; $exportas = $new_name; // Generate theme_info.cfg $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE template_name = '{$export}' AND themes_id IN (" . implode(', ', $list) . ")"; $db->sql_return_on_error(true); $result = $db->sql_query($sql); $db->sql_return_on_error(false); if (!$result) { xs_error($lang['xs_no_theme_data'] . $lang['xs_clone_back']); } $theme_rowset = $db->sql_fetchrowset($result); if (sizeof($theme_rowset) == 0) { xs_error($lang['xs_no_themes'] . '<br /><br />' . $lang['xs_clone_back']); } $theme_data = xs_generate_themeinfo($theme_rowset, $export, $exportas, $total); // prepare to pack $pack_error = ''; $pack_list = array(); $pack_replace = array('./theme_info.cfg' => $theme_data); // pack style for ($i = 0; $i < sizeof($theme_rowset); $i++) { $id = $theme_rowset[$i]['themes_id']; $theme_name = $theme_rowset[$i]['style_name']; for ($j = 0; $j < $total; $j++) { if (!empty($_POST['export_style_name_' . $j]) && $_POST['export_style_id_' . $j] == $id) { $theme_name = stripslashes($_POST['export_style_name_' . $j]); } } $theme_rowset[$i]['style_name'] = $theme_name; }