diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-07-20 16:23:45 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-07-20 16:23:45 +0000 |
| commit | 3006a3db31e05f3cb469ce6fe3162266279c2645 (patch) | |
| tree | 6658303567ba3aadbf7e7ddb08317eda3b98a8ff /phpBB | |
| parent | 5561e8652941384955d8d89a4cd46cced7f38941 (diff) | |
| download | forums-3006a3db31e05f3cb469ce6fe3162266279c2645.tar forums-3006a3db31e05f3cb469ce6fe3162266279c2645.tar.gz forums-3006a3db31e05f3cb469ce6fe3162266279c2645.tar.bz2 forums-3006a3db31e05f3cb469ce6fe3162266279c2645.tar.xz forums-3006a3db31e05f3cb469ce6fe3162266279c2645.zip | |
store or download
git-svn-id: file:///svn/phpbb/trunk@4294 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/adm/admin_styles.php | 140 |
1 files changed, 114 insertions, 26 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 = "<?php\n"; - $theme_config .= "//phpBB 2.2 auto-generated theme config file for $theme_name\n"; - $theme_config .= "// Do not change anything in this file!\n"; - $theme_config .= "\$themecfg['name'] = '" . addslashes($theme_name) . "';\n"; - $theme_config .= "\$themecfg['copyright'] = '" . addslashes($theme_copyright) . "';\n"; - $theme_config .= "\$themecfg['phpbbversion'] = '" . addslashes($config['version']) . "';\n"; - $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) - { - $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 + + + if (isset($_POST['update'])) { - $zip->add_file('styles/themes/' . $theme_path . '/', 'styles/themes/', 'theme.cfg'); + $theme_config = "<?php\n"; + $theme_config .= "//phpBB 2.2 auto-generated theme config file for $theme_name\n"; + $theme_config .= "// Do not change anything in this file!\n"; + $theme_config .= "\$themecfg['name'] = '" . addslashes($theme_name) . "';\n"; + $theme_config .= "\$themecfg['copyright'] = '" . addslashes($theme_copyright) . "';\n"; + $theme_config .= "\$themecfg['phpbbversion'] = '" . addslashes($config['version']) . "';\n"; + $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')); } - $zip->add_data($theme_config, $theme_path . '/theme.cfg'); - $zip->close(); + // Output list of themes + adm_page_header($user->lang['THEMES_EXPORT']); + +?> +<h1><?php echo $user->lang['THEMES_EXPORT']; ?></h1> + +<p><?php echo $user->lang['THEMES_EXPORT_EXPLAIN']; ?></p> - unset($theme_config); - unset($css_data); +<form name="style" method="post" action="<?php echo "admin_styles.$phpEx$SID&mode=$mode&action=$action&id=$theme_id"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> + <tr> + <th colspan="2"><?php echo $user->lang['THEMES_EXPORT']; ?></td> + </tr> + <tr> + <td class="row1" width="40%"><b><?php echo $user->lang['THEME_NAME']; ?>:</b></td> + <td class="row2"><b><?php echo $theme_name; ?></b></td> + </tr> + <tr> + <td class="row1" width="40%"><b><?php echo $user->lang['DOWNLOAD_STORE']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['DOWNLOAD_STORE_EXPLAIN']; ?></span></td> + <td class="row2"><input type="radio" name="store" value="1" checked="checked" /> Store <input type="radio" name="store" value="0" /> Download</td> + </tr> + <tr> + <td class="row1" width="40%"><b><?php echo $user->lang['ARCHIVE_FORMAT']; ?>:</b></td> + <td class="row2"><input type="radio" name="format" value="zip" checked="checked" /> .zip <input type="radio" name="format" value="tar" disabled="disabled" /> .tar <input type="radio" name="format" value="gz" disabled="disabled" /> .tar.gz <input type="radio" name="format" value="bz2" disabled="disabled" /> .tar.bz2 </td> + </tr> + <tr> + <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>"; /> <input class="btnlite" type="submit" name="cancel" value="<?php echo $user->lang['CANCEL']; ?>"; /></td> + </tr> +</table></form> +<?php - add_log('admin', 'LOG_EXPORT_THEME', $theme_name); - trigger_error(sprintf($user->lang['THEME_EXPORTED'], 'store/theme_' . $theme_path . '.zip')); + adm_page_footer(); } break; |
