aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/admin
diff options
context:
space:
mode:
authorJames Atkinson <thefinn@users.sourceforge.net>2001-11-12 11:57:25 +0000
committerJames Atkinson <thefinn@users.sourceforge.net>2001-11-12 11:57:25 +0000
commit489039ba5419fa689f9a75d4c9ccd605230aa38a (patch)
tree9a6252b1aa058d52ebe3b0744dc3f2904f3447e6 /phpBB/admin
parent6a506ae3e0104564170e90c9f74123d8b5b81ad1 (diff)
downloadforums-489039ba5419fa689f9a75d4c9ccd605230aa38a.tar
forums-489039ba5419fa689f9a75d4c9ccd605230aa38a.tar.gz
forums-489039ba5419fa689f9a75d4c9ccd605230aa38a.tar.bz2
forums-489039ba5419fa689f9a75d4c9ccd605230aa38a.tar.xz
forums-489039ba5419fa689f9a75d4c9ccd605230aa38a.zip
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
Diffstat (limited to 'phpBB/admin')
-rw-r--r--phpBB/admin/admin_styles.php114
1 files changed, 110 insertions, 4 deletions
diff --git a/phpBB/admin/admin_styles.php b/phpBB/admin/admin_styles.php
index aa7e017e24..4043580a4c 100644
--- a/phpBB/admin/admin_styles.php
+++ b/phpBB/admin/admin_styles.php
@@ -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 . '" />';
}