Ok, I think thats the last of the theme admin stuff. Hopefully its bug free

git-svn-id: file:///svn/phpbb/trunk@1302 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-11-12 11:57:25 +00:00
parent 6a506ae3e0
commit 489039ba54
2 changed files with 159 additions and 4 deletions

View file

@ -293,10 +293,70 @@ switch($mode)
}
//
// Do names stuff here!
// Check if there's a names table entry for this style
//
$sql = "SELECT themes_id FROM " . THEMES_NAME_TABLE . " WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get data from themes_name table", "Error", __LINE__, __FILE__, $sql);
}
if($db->sql_numrows($result) > 0)
{
$sql = "UPDATE " . THEMES_NAME_TABLE . " SET ";
$count = 0;
while(list($key, $val) = each($updated_name))
{
if($count != 0)
{
$sql .= ", ";
}
$sql .= "$key = '$val'";
$count++;
}
$sql .= " WHERE themes_id = $style_id";
}
else
{
// Nope, no names entry so we create a new one.
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, ";
while(list($key, $val) = each($updated_name))
{
$fields[] = $key;
$vals[] = $val;
}
for($i = 0; $i < count($fields); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= $fields[$i];
}
$sql .= ") VALUES ($style_id, ";
for($i = 0; $i < count($vals); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= "'" . $vals[$i] . "'";
}
$sql .= ")";
}
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not update themes name table!", "Error", __LINE__, __FILE__, $sql);
}
message_die(GENERAL_MESSAGE, $lang['Theme_updated'], $lang['Success']);
}
else
@ -341,9 +401,42 @@ switch($mode)
message_die(GENERAL_ERROR, "Could not update themes table!", "Error", __LINE__, __FILE__, $sql);
}
$style_id = $db->sql_nextid();
//
// Insert names data
//
// Do names stuff here!
//
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, ";
while(list($key, $val) = each($updated_name))
{
$fields[] = $key;
$vals[] = $val;
}
for($i = 0; $i < count($fields); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= $fields[$i];
}
$sql .= ") VALUES ($style_id, ";
for($i = 0; $i < count($vals); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= "'" . $vals[$i] . "'";
}
$sql .= ")";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not insert themes name table!", "Error", __LINE__, __FILE__, $sql);
}
message_die(GENERAL_MESSAGE, $lang['Theme_created'], $lang['Success']);
@ -376,7 +469,20 @@ switch($mode)
message_die(GENERAL_ERROR, "Could not get data from themes table", "Error", __LINE__, __FILE__, $sql);
}
$selected = $db->sql_fetchrow($result);
$selected_values = $db->sql_fetchrow($result);
//
// Fetch the Themes Name data
//
$sql = "SELECT * FROM " . THEMES_NAME_TABLE . " WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get data from themes name table", "Error", __LINE__, __FILE__, $sql);
}
$selected_names = $db->sql_fetchrow($result);
$selected = array_merge($selected_values, $selected_names);
$s_hidden_fields = '<input type="hidden" name="style_id" value="' . $style_id . '" />';
}

View file

@ -0,0 +1,49 @@
<?php
//
// phpBB 2.x auto-generated theme config file for subSilver
// Do not change anything in this file!
//
$subSilver[0]['template_name'] = "subSilver";
$subSilver[0]['style_name'] = "subSilver";
$subSilver[0]['head_stylesheet'] = "";
$subSilver[0]['body_background'] = "";
$subSilver[0]['body_bgcolor'] = "E5E5E5";
$subSilver[0]['body_text'] = "000000";
$subSilver[0]['body_link'] = "006699";
$subSilver[0]['body_vlink'] = "5584AA";
$subSilver[0]['body_alink'] = "FF9933";
$subSilver[0]['body_hlink'] = "EDF2F2";
$subSilver[0]['tr_color1'] = "EFEFEF";
$subSilver[0]['tr_color2'] = "DEE3E7";
$subSilver[0]['tr_color3'] = "c2cdd6";
$subSilver[0]['tr_class1'] = "";
$subSilver[0]['tr_class2'] = "";
$subSilver[0]['tr_class3'] = "";
$subSilver[0]['th_color1'] = "CBD3D9";
$subSilver[0]['th_color2'] = "BCBCBC";
$subSilver[0]['th_color3'] = "1B7CAD";
$subSilver[0]['th_class1'] = "";
$subSilver[0]['th_class2'] = "";
$subSilver[0]['th_class3'] = "";
$subSilver[0]['td_color1'] = "AEBDC4";
$subSilver[0]['td_color2'] = "006699";
$subSilver[0]['td_color3'] = "FFFFFF";
$subSilver[0]['td_class1'] = "row1";
$subSilver[0]['td_class2'] = "row2";
$subSilver[0]['td_class3'] = "";
$subSilver[0]['fontface1'] = "Verdana,Arial,Helvetica,sans-serif";
$subSilver[0]['fontface2'] = "Verdana,Arial,Helvetica,sans-serif";
$subSilver[0]['fontface3'] = "courier";
$subSilver[0]['fontsize1'] = "0";
$subSilver[0]['fontsize2'] = "0";
$subSilver[0]['fontsize3'] = "0";
$subSilver[0]['fontcolor1'] = "004c75";
$subSilver[0]['fontcolor2'] = "004c75";
$subSilver[0]['fontcolor3'] = "004c75";
$subSilver[0]['span_class1'] = "";
$subSilver[0]['span_class2'] = "";
$subSilver[0]['span_class3'] = "";
?>