From 3006a3db31e05f3cb469ce6fe3162266279c2645 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 20 Jul 2003 16:23:45 +0000 Subject: [PATCH] store or download git-svn-id: file:///svn/phpbb/trunk@4294 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_styles.php | 136 ++++++++++++++++++++++++++++++------- 1 file changed, 112 insertions(+), 24 deletions(-) diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php index 205a226ceb..3f2495ae66 100644 --- a/phpBB/adm/admin_styles.php +++ b/phpBB/adm/admin_styles.php @@ -1859,37 +1859,125 @@ function csspreview() trigger_error($user->lang['NO_THEME']); } $db->sql_freeresult($result); - - $theme_config = "'; - $zip = new archive_zip('w', $phpbb_root_path . 'store/theme_' . $theme_path . '.zip'); - // If we have the css in the DB we'll use that in preference to the one on the - // filesystem. We will also create an appropriate cfg file - if ($css_storedb) + if (isset($_POST['update'])) { - $zip->add_file('styles/themes/' . $theme_path . '/', 'styles/themes/', $theme_path . '.css,theme.cfg'); - $zip->add_data($css_data, $theme_path . '/' . $theme_path . '.css'); + $theme_config = "'; + + switch ($_POST['format']) + { + case 'zip': + if (!extension_loaded('zlib')) + { + $error[] = $user->lang['NO_SUPPORT_ZIP']; + break; + } + + if (!($zip = new archive_zip('w', $phpbb_root_path . 'store/theme_' . $theme_path . '.zip'))) + { + trigger_error($user->lang['STORE_UNWRITEABLE']); + } + + // If we have the css in the DB we'll use that in preference to the one on the + // filesystem. We will also create an appropriate cfg file + if ($css_storedb) + { + $zip->add_file('styles/themes/' . $theme_path . '/', 'styles/themes/', $theme_path . '.css,theme.cfg'); + $zip->add_data($css_data, $theme_path . '/' . $theme_path . '.css'); + } + else + { + $zip->add_file('styles/themes/' . $theme_path . '/', 'styles/themes/', 'theme.cfg'); + } + $zip->add_data($theme_config, $theme_path . '/theme.cfg'); + + $zip->close(); + + $ext = 'zip'; + break; + + case 'tar': + $ext = 'tar'; + break; + + case 'gz': + if (!extension_loaded('zlib')) + { + $error[] = $user->lang['NO_SUPPORT_GZ']; + break; + } + $ext = 'tar.gz'; + break; + + case 'bz2': + if (!extension_loaded('bzip2')) + { + $error[] = $user->lang['NO_SUPPORT_BZ2']; + break; + } + $ext = 'tar.bz2'; + break; + + default: + trigger_error($user->lang['NO_SUPPORT_ARCHIVE']); + } + + unset($theme_config); + unset($css_data); + + if (empty($_POST['store'])) + { + header("Pragma: no-cache"); + header("Content-Type: application/zip; name=\"theme_$theme_path.$ext\""); + header("Content-disposition: attachment; filename=theme_$theme_path.$ext"); + + echo implode('', file("{$phpbb_root_path}store/theme_$theme_path.$ext")); + @unlink("{$phpbb_root_path}store/theme_$theme_path.$ext"); + exit; + } + + add_log('admin', 'LOG_EXPORT_THEME', $theme_name); + trigger_error(sprintf($user->lang['THEME_EXPORTED'], 'store/theme_' . $theme_path . '.zip')); } - else - { - $zip->add_file('styles/themes/' . $theme_path . '/', 'styles/themes/', 'theme.cfg'); - } - $zip->add_data($theme_config, $theme_path . '/theme.cfg'); - $zip->close(); + // Output list of themes + adm_page_header($user->lang['THEMES_EXPORT']); - unset($theme_config); - unset($css_data); +?> +

lang['THEMES_EXPORT']; ?>

- add_log('admin', 'LOG_EXPORT_THEME', $theme_name); - trigger_error(sprintf($user->lang['THEME_EXPORTED'], 'store/theme_' . $theme_path . '.zip')); +

lang['THEMES_EXPORT_EXPLAIN']; ?>

+ +
"> + + + + + + + + + + + + + + + + + +
lang['THEMES_EXPORT']; ?> +
lang['THEME_NAME']; ?>:
lang['DOWNLOAD_STORE']; ?>:
lang['DOWNLOAD_STORE_EXPLAIN']; ?>
Store   Download
lang['ARCHIVE_FORMAT']; ?>: .zip   .tar   .tar.gz   .tar.bz2  
  
+