From d9b82cfe4f3a4c063de9035e81b0c4fbf6caeedd Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sat, 28 May 2011 01:43:04 +1000 Subject: allowed enabling multiple themes simultaneously --- mod.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'mod.php') diff --git a/mod.php b/mod.php index bd0cb334..b6f01ec6 100644 --- a/mod.php +++ b/mod.php @@ -344,21 +344,24 @@ } // Clear previous settings - query("TRUNCATE TABLE `theme_settings`") or error(db_error()); + $query = prepare("DELETE FROM `theme_settings` WHERE `theme` = :theme"); + $query->bindValue(':theme', $_theme); + $query->execute() or error(db_error($query)); foreach($theme['config'] as &$c) { - $query = prepare("INSERT INTO `theme_settings` VALUES(:name, :value)"); + $query = prepare("INSERT INTO `theme_settings` VALUES(:theme, :name, :value)"); + $query->bindValue(':theme', $_theme); $query->bindValue(':name', $c['name']); $query->bindValue(':value', $_POST[$c['name']]); $query->execute() or error(db_error($query)); } - $query = prepare("INSERT INTO `theme_settings` VALUES('theme', :value)"); - $query->bindValue(':value', $_theme); + $query = prepare("INSERT INTO `theme_settings` VALUES(:theme, NULL, NULL)"); + $query->bindValue(':theme', $_theme); $query->execute() or error(db_error($query)); - // Build theme - rebuildTheme('all'); + // Build themes + rebuildThemes('all'); echo Element('page.html', Array( 'config'=>$config, @@ -545,7 +548,7 @@ $query->bindValue(':id', $match[1], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - rebuildTheme('news'); + rebuildThemes('news'); header('Location: ?/news', true, $config['redirect_http']); } elseif(preg_match('/^\/news$/', $query)) { @@ -568,7 +571,7 @@ $query->bindValue(':body', $_POST['body']); $query->execute() or error(db_error($query)); - rebuildTheme('news'); + rebuildThemes('news'); } $body .= '
New post
' . @@ -1260,7 +1263,7 @@ $query->bindValue(':id', $board['id'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - rebuildTheme('boards'); + rebuildThemes('boards'); header('Location: ?/', true, $config['redirect_http']); } else { @@ -1276,7 +1279,7 @@ $query->bindValue(':id', $board['id'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - rebuildTheme('boards'); + rebuildThemes('boards'); openBoard($board['uri']); } @@ -1453,7 +1456,7 @@ $body = '

Rebuilding…

'; $body .= 'Regenerating theme files…
'; - rebuildTheme('all'); + rebuildThemes('all'); $body .= 'Generating Javascript file…
'; buildJavascript(); @@ -1599,7 +1602,7 @@ // Build the board buildIndex(); - rebuildTheme('boards'); + rebuildThemes('boards'); header('Location: ?/board/' . $board['uri'], true, $config['redirect_http']); } else { -- cgit v1.3