From 5979e37cd80ccd1a6b8220ab14d7f7ae582c01e2 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 25 Jul 2003 23:50:49 +0000 Subject: Bits I just want to dump in CVS for now git-svn-id: file:///svn/phpbb/trunk@4330 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_styles.php | 150 +++++++++++++++++++++++++++++++-------------- 1 file changed, 103 insertions(+), 47 deletions(-) (limited to 'phpBB/adm') diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php index e7f707a5fc..d7798d950f 100644 --- a/phpBB/adm/admin_styles.php +++ b/phpBB/adm/admin_styles.php @@ -1768,6 +1768,8 @@ function viewsource(url) case 'details': case 'install': + $l_prefix = ($action == 'add') ? 'ADD' : (($action == 'details') ? 'EDIT_DETAILS' : 'INSTALL'); + // Do we want to edit an existing theme or are we creating a new theme // or submitting an existing one? if ($theme_id && empty($_POST['update'])) @@ -1885,22 +1887,36 @@ function viewsource(url) $css_data = ''; if ($action == 'install') { - if (!is_writeable("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css")) + if (!is_writeable("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css")) { - $css_data = implode('', file("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css")); + $css_data = implode('', file("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css")); } else { $css_storedb = 0; } } - else if (!$safe_mode && is_writeable("{$phpbb_root_path}styles/themes") && $action == 'add') + else if (!$safe_mode && is_writeable("{$phpbb_root_path}styles") && $action == 'add') { - umask(0); - if (@mkdir("{$phpbb_root_path}styles/themes/$theme_path", 0777)) + if (!empty($_FILES['upload_file'])) + { + } + else if (!empty($_POST['import_file'])) { - $css_storedb = 0; - @chmod("{$phpbb_root_path}styles/themes/$theme_path", 0777); + } + else + { + umask(0); + if (@mkdir("{$phpbb_root_path}styles/$theme_path", 0777)) + { + @chmod("{$phpbb_root_path}styles/$theme_path", 0777); + } + + if (@mkdir("{$phpbb_root_path}styles/$theme_path/theme/", 0777)) + { + $css_storedb = 0; + @chmod("{$phpbb_root_path}styles/themes/$theme_path", 0777); + } } if (!empty($_POST['theme_basis']) && !$css_storedb) @@ -1914,30 +1930,30 @@ function viewsource(url) { $css_data = ($row['css_storedb']) ? $row['css_data'] : implode('', file($phpbb_root_path . 'styles/themes/' . $row['theme_path'] . '/' . $row['theme_path'] . '.css')); - if (!$css_storedb && ($fp = @fopen("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css", 'wb'))) + if (!$css_storedb && ($fp = @fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'wb'))) { $css_storedb = (fwrite($fp, $css_data)) ? 0 : 1; if (!$css_storedb) { // Get a list of all files and folders in the basis themes folder - $filelist = filelist($phpbb_root_path . 'styles/themes/' . $row['theme_path'], '', '*'); + $filelist = filelist($phpbb_root_path . 'styles/' . $row['theme_path'] . '/themes', '', '*'); // Copy every file bar the original stylesheet foreach ($filelist as $path => $file_ary) { foreach ($file_ary as $file) { - if ($file == $row['theme_path'] . '.css') + if ($file == 'stylesheet.css') { continue; } - if (!file_exists("{$phpbb_root_path}styles/themes/$theme_path/$path")) + if (!file_exists("{$phpbb_root_path}styles/$theme_path/theme/$path")) { - @mkdir("{$phpbb_root_path}styles/themes/$theme_path/$path"); + @mkdir("{$phpbb_root_path}styles/$theme_path/theme/$path"); } - @copy("{$phpbb_root_path}styles/themes/" . $row['theme_path'] . "/$path/$file", "{$phpbb_root_path}styles/themes/$theme_path/$path/$file"); + @copy("{$phpbb_root_path}styles/" . $row['theme_path'] . "/theme/$path/$file", "{$phpbb_root_path}styles/$theme_path/theme/$path/$file"); } } unset($filelist); @@ -1983,18 +1999,17 @@ function viewsource(url) // Output the page - adm_page_header($user->lang['EDIT_THEME']); + adm_page_header($user->lang[$l_prefix . '_THEME']); ?> -

lang['EDIT_THEME']; ?>

+

lang[$l_prefix . '_THEME']; ?>

-

lang['EDIT_THEME_EXPLAIN']; ?>

+

lang[$l_prefix . '_THEME_EXPLAIN']; ?>

-
" onsubmit="return csspreview()"> +" onsubmit="return csspreview()">
- - + + + + + 'zlib', 'tar' => '', 'tar.gz' => 'zlib', 'tar.bz2' => 'bz2') as $type => $module) + { + if ($module && !extension_loaded($module)) + { + break; + } + $archive_types .= (($archive_types != '') ? ', ' : '') . ".$type"; + $archive_preg .= (($archive_preg != '') ? '|' : '') . '\.' . preg_quote($type); + } + + $store_options = ''; + $dp = opendir("{$phpbb_root_path}store"); + while ($file = readdir($dp)) + { + if ($file{0} != '.' && preg_match('#(' . $archive_preg . ')$#i', $file)) + { + $store_options .= ""; + } + } + closedir($dp); + + $store_options = '' . $store_options; + + $sql = 'SELECT theme_id, theme_name + FROM ' . STYLES_CSS_TABLE; + $result = $db->sql_query($sql); + + $basis_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = (!empty($_POST['theme_basis']) && $_POST['theme_basis'] == $row['theme_id']) ? ' selected="selected"' : ''; + $basis_options .= ''; + } + $db->sql_freeresult($result); ?> + + - + + + - - - + + + + + + @@ -2127,11 +2183,11 @@ function viewsource(url) } else { - if (!($fp = fopen("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css", 'rb'))) + if (!($fp = fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'rb'))) { trigger_error($user->lang['NO_THEME']); } - $stylesheet = fread($fp, filesize("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css")); + $stylesheet = fread($fp, filesize("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css")); fclose($fp); } @@ -2212,10 +2268,10 @@ function viewsource(url) // Where is the CSS stored? - if (is_writeable("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css") && !$css_storedb) + if (is_writeable("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css") && !$css_storedb) { // Grab template data - if (!($fp = fopen("{$phpbb_root_path}styles/themes/$theme_path/$theme_path.css", 'wb'))) + if (!($fp = fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'wb'))) { trigger_error($user->lang['NO_THEME']); } @@ -2608,6 +2664,13 @@ function csspreview() export('theme', $theme_id, $theme_name, $theme_path, $files, $data); } + break; + + case 'import': + case 'upload': + + + break; } @@ -2715,6 +2778,7 @@ function front($type, $options) { $new_ary[$i]['path'] = $file; $new_ary[$i]['name'] = $name; + $i++; } } } @@ -2726,11 +2790,12 @@ function front($type, $options) { foreach ($new_ary as $key => $cfg) { + $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; ?> - - + + - +
ParameterValuelang[$l_prefix . '_THEME']; ?>
Store location:
Location of stylesheet, images are always stored on the filesystem.
/> Filesystem   />Database
Theme Basis
Use existing theme as basis:
Store location:
Location of stylesheet, images are always stored on the filesystem.
/> Filesystem   />DatabaseUpload a file:
Allowed archive types:
Import from store:
">Install">Install
Create new theme: using Create new theme:
-- cgit v1.2.1