diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php index 581e73cac0..da5c3850ae 100644 --- a/phpBB/adm/admin_styles.php +++ b/phpBB/adm/admin_styles.php @@ -344,10 +344,41 @@ switch ($mode) switch ($action) { + case 'export': + + if ($imageset_id) + { + $sql = 'SELECT * + FROM ' . STYLES_IMAGE_TABLE . " + WHERE imageset_id = $imageset_id"; + $result = $db->sql_query($sql); + + if (!(extract($db->sql_fetchrow($result)))) + { + trigger_error($user->lang['NO_IMAGESET']); + } + $db->sql_freeresult($result); + + $cfg = addslashes($imageset_name) . "\n"; + $cfg .= addslashes($imageset_copyright) . "\n"; + $cfg .= addslashes($config['version']) . "\n"; + + if ($css_storedb) + { + } + else + { + $files = array(array('src' => "styles/imagesets/$imageset_path/", 'prefix' => 'styles/imagesets/', 'exclude' => 'tpl.cfg')); + $data = array(array('src' => $cfg, 'prefix' => "$imageset_path/imgset.cfg")); + } + + export('imageset', $imageset_id, $imageset_name, $imageset_path, $files, $data); + } + break; + case 'add': case 'details': - adm_page_header($user->lang['EDIT_IMAGESET']); ?> @@ -611,7 +642,42 @@ switch ($mode) // Lights, Camera ... switch ($action) { + + + case 'export': + + if ($template_id) + { + $sql = 'SELECT * + FROM ' . STYLES_TPL_TABLE . " + WHERE template_id = $template_id"; + $result = $db->sql_query($sql); + + if (!(extract($db->sql_fetchrow($result)))) + { + trigger_error($user->lang['NO_TEMPLATE']); + } + $db->sql_freeresult($result); + + $cfg = addslashes($template_name) . "\n"; + $cfg .= addslashes($template_copyright) . "\n"; + $cfg .= addslashes($config['version']) . "\n"; + + if ($css_storedb) + { + } + else + { + $files = array(array('src' => "styles/templates/$template_path/", 'prefix' => 'styles/templates/', 'exclude' => 'tpl.cfg')); + $data = array(array('src' => $cfg, 'prefix' => "$template_path/tpl.cfg")); + } + + export('template', $template_id, $template_name, $template_path, $files, $data); + } + break; + case 'cache': + $sql = 'SELECT * FROM ' . STYLES_TPL_TABLE . " WHERE template_id = $template_id"; @@ -1741,10 +1807,10 @@ function csspreview()
lang['THEMES_EXPORT_EXPLAIN']; ?>
- - -lang['NO_SUPPORT_ZIP']); + } + $ext = 'zip'; + $mimetype = 'zip'; + $compress = 'compress_zip'; + break; + + case 'tar.gz': + if (!extension_loaded('zlib')) + { + trigger_error($user->lang['NO_SUPPORT_GZ']); + } + $ext = 'tar.gz'; + $mimetype = 'x-gzip'; + $compress = 'compress_tar'; + break; + + case 'tar.bz2': + if (!extension_loaded('bz2')) + { + trigger_error($user->lang['NO_SUPPORT_BZ2']); + } + $ext = 'tar.bz2'; + $mimetype = 'x-bzip2'; + $compress = 'compress_tar'; + break; + + default: + $error[] = $user->lang[$l_prefix . '_ERR_ARCHIVE']; + } + + if (!sizeof($error)) + { + if (!($zip = new $compress('w', "{$phpbb_root_path}store/{$mode}_$path.$ext"))) + { + trigger_error($user->lang['STORE_UNWRITEABLE']); + } + + if ($files) + { + foreach ($files as $file_ary) + { + $zip->add_file($file_ary['src'], $file_ary['prefix'], $file_ary['exclude']); + } + } + + if ($data) + { + foreach ($data as $data_ary) + { + $zip->add_data($data_ary['src'], $data_ary['prefix']); + } + } + + $zip->close(); + unset($cfg); + + if (empty($_POST['store'])) + { + header('Pragma: no-cache'); + header("Content-Type: application/$mimetype; name=\"{$type}_$path.$ext\""); + header("Content-disposition: attachment; filename={$type}_$path.$ext"); + + echo implode('', file("{$phpbb_root_path}store/{$type}_$path.$ext")); + @unlink("{$phpbb_root_path}store/{$type}_$path.$ext"); + exit; + } + + add_log('admin', 'LOG_EXPORT_' . $l_prefix, $name); + trigger_error(sprintf($user->lang[$l_prefix . '_EXPORTED'], "store/{$type}_$path.$ext")); + } + } + + // Output list of themes + adm_page_header($user->lang[$l_prefix . '_EXPORT']); + +?> +lang[$l_prefix . '_EXPORT_EXPLAIN']; ?>
+ + +