Cannot delete if only theme left, select new theme for use by styles that use this

git-svn-id: file:///svn/phpbb/trunk@4298 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-07-20 17:46:06 +00:00
parent 6c8531befe
commit 252d56ec36

View file

@ -1850,6 +1850,23 @@ function csspreview()
if ($theme_id)
{
$sql = 'SELECT theme_id, theme_name
FROM ' . STYLES_CSS_TABLE . '
WHERE theme_id <> ' . $theme_id . '
ORDER BY theme_id';
$result = $db->sql_query($sql);
$theme_options = '';
while ($row = $db->sql_fetchrow($result))
{
$theme_options .= '<option value="' . $row['theme_id'] . '">' . $row['theme_name'] . '</option>';
}
if ($theme_options == '')
{
trigger_error($user->lang['ONLY_THEME']);
}
$sql = 'SELECT *
FROM ' . STYLES_CSS_TABLE . "
WHERE theme_id = $theme_id";
@ -1867,6 +1884,11 @@ function csspreview()
WHERE theme_id = ' . $theme_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . STYLES_TABLE . '
SET theme_id = ' . intval($_POST['newtheme']) . '
WHERE theme_id = ' . $theme_id;
$db->sql_query($sql);
$onfs = 0;
if (!empty($_POST['deletefs']) && is_writeable("{$phpbb_root_path}styles/themes/$theme_path"))
{
@ -1930,6 +1952,10 @@ function csspreview()
}
?>
<tr>
<td class="row1" width="40%"><b>Update styles to:</b><br /><span class="gensmall">Select theme to replace this one if used by styles.</span></td>
<td class="row2"><select name="newtheme"><?php echo $theme_options; ?></select></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['DELETE']; ?>"; />&nbsp;&nbsp;<input class="btnlite" type="submit" name="cancel" value="<?php echo $user->lang['CANCEL']; ?>"; /></td>
</tr>