Modified for modification to templates/themes

git-svn-id: file:///svn/phpbb/trunk@1020 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-09-09 23:56:04 +00:00
parent c342a3c365
commit 6e81d5fd96
2 changed files with 160 additions and 152 deletions

View file

@ -36,15 +36,37 @@ if(!$result = $db->sql_query($sql))
} }
else else
{ {
while($row = $db->sql_fetchrow($result)) while( $row = $db->sql_fetchrow($result) )
{ {
$config_name = $row['config_name']; $config_name = $row['config_name'];
$config_value = $row['config_value']; $config_value = $row['config_value'];
$default_config[$config_name] = $config_value; $default_config[$config_name] = $config_value;
$new[$config_name] = (isset($HTTP_POST_VARS[$config_name])) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name]; $new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
if($HTTP_POST_VARS['submit']) if( isset($HTTP_POST_VARS['submit']) )
{
if( isset($HTTP_POST_VARS['board_style']) )
{
$default_template = substr($HTTP_POST_VARS['board_style'], 0, strrpos($HTTP_POST_VARS['board_style'], "_"));
$default_theme = substr($HTTP_POST_VARS['board_style'], strrpos($HTTP_POST_VARS['board_style'], "_") + 1);
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '$default_template'
WHERE config_name = 'board_template'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update general configuration for board_template", "", __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '$default_theme'
WHERE config_name = 'default_theme'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update general configuration for default_theme", "", __LINE__, __FILE__, $sql);
}
}
else
{ {
$sql = "UPDATE " . CONFIG_TABLE . " SET $sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '".$new[$config_name]."' config_value = '".$new[$config_name]."'
@ -55,14 +77,15 @@ else
} }
} }
} }
}
if($HTTP_POST_VARS['submit']) if($HTTP_POST_VARS['submit'])
{ {
message_die(GENERAL_MESSAGE, $lang['Config_updated']); message_die(GENERAL_MESSAGE, $lang['Config_updated']);
} }
} }
$template_select = template_select($new['board_template'], 'board_template', "../templates"); $style_select = style_select($new['board_template'], $new['default_theme'], 'board_style', "../templates");
$theme_select = theme_select($new['default_theme'], 'default_theme');
$lang_select = language_select($new['default_lang'], 'default_lang', "../language"); $lang_select = language_select($new['default_lang'], 'default_lang', "../language");
$timezone_select = tz_select($new['board_timezone'], 'board_timezone'); $timezone_select = tz_select($new['board_timezone'], 'board_timezone');
@ -89,8 +112,6 @@ $avatars_upload_no = (!$new['allow_avatar_upload']) ? "checked=\"checked\"" : ""
$smtp_yes = ($new['smtp_delivery']) ? "checked=\"checked\"" : ""; $smtp_yes = ($new['smtp_delivery']) ? "checked=\"checked\"" : "";
$smtp_no = (!$new['smtp_delivery']) ? "checked=\"checked\"" : ""; $smtp_no = (!$new['smtp_delivery']) ? "checked=\"checked\"" : "";
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/admin_config_body.tpl") "body" => "admin/admin_config_body.tpl")
); );
@ -104,8 +125,7 @@ $template->assign_vars(array(
"TOPICS_PER_PAGE" => $new['topics_per_page'], "TOPICS_PER_PAGE" => $new['topics_per_page'],
"POSTS_PER_PAGE" => $new['posts_per_page'], "POSTS_PER_PAGE" => $new['posts_per_page'],
"HOT_TOPIC" => $new['hot_threshold'], "HOT_TOPIC" => $new['hot_threshold'],
"TEMPLATE_SELECT" => $template_select, "STYLE_SELECT" => $style_select,
"THEME_SELECT" => $theme_select,
"LANG_SELECT" => $lang_select, "LANG_SELECT" => $lang_select,
"L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'], "L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'],
"DEFAULT_DATEFORMAT" => $new['default_dateformat'], "DEFAULT_DATEFORMAT" => $new['default_dateformat'],

View file

@ -4,11 +4,7 @@
<p>The form below will allow you to customize all the general board options. For User and Forum configurations use the related links on the left hand side.</p> <p>The form below will allow you to customize all the general board options. For User and Forum configurations use the related links on the left hand side.</p>
<form action="{S_CONFIG_ACTION}" method="POST"> <form action="{S_CONFIG_ACTION}" method="POST"><table width="99%" cellpadding="4" cellspacing="1" border="0" align="center">
<table width="99%" cellpadding="1" cellspacing="0" border="0" align="center">
<tr>
<td class="tablebg" width="100%"><table width="100%" cellpadding="4" cellspacing="1" border="0">
<tr> <tr>
<td class="cat" colspan="2"><span class="cattitle">General Board Settings</span></td> <td class="cat" colspan="2"><span class="cattitle">General Board Settings</span></td>
</tr> </tr>
@ -37,12 +33,8 @@
<td class="row2"><input type="text" name="hot_threshold" size="3" maxlength="4" value="{HOT_TOPIC}"></td> <td class="row2"><input type="text" name="hot_threshold" size="3" maxlength="4" value="{HOT_TOPIC}"></td>
</tr> </tr>
<tr> <tr>
<td class="row1">Default Template:</td> <td class="row1">Default Style:</td>
<td class="row2">{TEMPLATE_SELECT}</td> <td class="row2">{STYLE_SELECT}</td>
</tr>
<tr>
<td class="row1">Default Theme:</td>
<td class="row2">{THEME_SELECT}</td>
</tr> </tr>
<tr> <tr>
<td class="row1">Default Language:</td> <td class="row1">Default Language:</td>
@ -137,10 +129,6 @@
<input type="submit" name="submit" value="Save Settings"> <input type="submit" name="submit" value="Save Settings">
</td> </td>
</tr> </tr>
</table></td> </table></form>
</tr>
</table>
</form>
<br clear="all"> <br clear="all">