1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-24 20:17:58 +02:00

More styling stuff ... activate, deactivate styles ... deactivated styles can still be used in forum/board styling selectors

git-svn-id: file:///svn/phpbb/trunk@4253 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2003-07-13 23:29:22 +00:00
parent 2c400376a1
commit 7668388b4e
4 changed files with 30 additions and 19 deletions

View File

@ -208,7 +208,7 @@ switch ($mode)
case 'default':
$style_select = style_select($new['default_style']);
$style_select = style_select($new['default_style'], true);
$lang_select = language_select($new['default_lang']);
$timezone_select = tz_select($new['board_timezone']);

View File

@ -316,7 +316,7 @@ switch ($mode)
$forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_type) ? ' selected="selected"' : '') . '>' . $user->lang['TYPE_' . $lang] . '</option>';
}
$styles_list = style_select($forum_style);
$styles_list = style_select($forum_style, true);
$statuslist = '<option value="' . ITEM_UNLOCKED . '"' . (($forum_status == ITEM_UNLOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . ITEM_LOCKED . '"' . (($forum_status == ITEM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>';

View File

@ -44,6 +44,14 @@ switch ($mode)
switch ($action)
{
case 'activate':
case 'deactivate':
$sql = 'UPDATE ' . STYLES_TABLE . '
SET style_active = ' . (($action == 'activate') ? 1 : 0) . '
WHERE style_id = ' . $style_id;
$db->sql_query($sql);
break;
case 'preview':
break;
@ -168,7 +176,7 @@ switch ($mode)
}
$db->sql_freeresult($result);
$sql = 'SELECT style_id, style_name
$sql = 'SELECT style_id, style_name, style_active
FROM ' . STYLES_TABLE;
$result = $db->sql_query($sql);
@ -178,11 +186,13 @@ switch ($mode)
{
$row_class = ($row_class != 'row1') ? 'row1' : 'row2';
$stylevis = (!$row['style_active']) ? 'activate' : 'deactivate';
?>
<tr>
<td class="<?php echo $row_class; ?>" width="100%"><a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=edit&amp;id=" . $row['style_id']; ?>"><?php echo $row['style_name']; ?></a><?php echo ($config['default_style'] == $row['style_id']) ? ' *' : ''; ?></td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo (!empty($style_count[$row['style_id']])) ? $style_count[$row['style_id']] : '0'; ?></td>
<td class="<?php echo $row_class; ?>" nowrap="nowrap">&nbsp;<a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=deactivate&amp;id=" . $row['style_id']; ?>">Deactivate</a> | <a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=delete&amp;id=" . $row['style_id']; ?>">Delete</a> | <a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=export&amp;id=" . $row['style_id']; ?>">Export</a> | <a href="<?php echo "{$phpbb_root_path}index.$phpEx$SID&amp;style=" . $row['style_id']; ?>" target="_stylepreview">Preview</a>&nbsp;</td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap">&nbsp;<a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=$stylevis&amp;id=" . $row['style_id']; ?>"><?php echo $user->lang['STYLE_' . strtoupper($stylevis)]; ?></a> | <a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=delete&amp;id=" . $row['style_id']; ?>">Delete</a> | <a href="<?php echo "admin_styles.$phpEx$SID&amp;mode=$mode&amp;action=export&amp;id=" . $row['style_id']; ?>">Export</a> | <a href="<?php echo "{$phpbb_root_path}index.$phpEx$SID&amp;style=" . $row['style_id']; ?>" target="_stylepreview">Preview</a>&nbsp;</td>
</tr>
<?php

View File

@ -56,9 +56,9 @@ function get_userdata($user)
{
global $db;
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE ";
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ';
$sql .= ((is_integer($user)) ? "user_id = $user" : "username = '" . $db->sql_escape($user) . "'") . " AND user_id <> " . ANONYMOUS;
$result = $db->sql_query($sql);
@ -318,14 +318,15 @@ function language_select($default = '')
}
// Pick a template/theme combo,
function style_select($default = '')
function style_select($default = '', $all = false)
{
global $db;
$sql_where = (!$all) ? 'WHERE style_active = 1 ' : '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . '
WHERE style_active = 1
ORDER BY style_name';
FROM ' . STYLES_TABLE . "
$sql_where
ORDER BY style_name";
$result = $db->sql_query($sql);
$style_options = '';
@ -735,8 +736,8 @@ function obtain_word_list(&$censors)
}
else
{
$sql = "SELECT word, replacement
FROM " . WORDS_TABLE;
$sql = 'SELECT word, replacement
FROM ' . WORDS_TABLE;
$result = $db->sql_query($sql);
$censors = array();
@ -769,9 +770,9 @@ function obtain_icons(&$icons)
else
{
// Topic icons
$sql = "SELECT *
FROM " . ICONS_TABLE . "
ORDER BY icons_order";
$sql = 'SELECT *
FROM ' . ICONS_TABLE . '
ORDER BY icons_order';
$result = $db->sql_query($sql);
$icons = array();
@ -843,10 +844,10 @@ function obtain_attach_extensions(&$extensions)
else
{
// Don't count on forbidden extensions table, because it is not allowed to allow forbidden extensions at all
$sql = "SELECT e.extension, g.*
FROM " . EXTENSIONS_TABLE . " e, " . EXTENSION_GROUPS_TABLE . " g
$sql = 'SELECT e.extension, g.*
FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
WHERE e.group_id = g.group_id
AND g.allow_group = 1";
AND g.allow_group = 1';
$result = $db->sql_query($sql);
$extensions = array();