summaryrefslogtreecommitdiff
path: root/mod.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@tinyboard.org>2011-05-28 01:43:04 +1000
committerSavetheinternet <savetheinternet@tinyboard.org>2011-05-28 01:43:04 +1000
commitd9b82cfe4f3a4c063de9035e81b0c4fbf6caeedd (patch)
tree76ad0782ad9756d18cf2139c33b93110d8236885 /mod.php
parentbb67062cd5bf9bf58e72f93799452a1a8a3fbe14 (diff)
allowed enabling multiple themes simultaneously
Diffstat (limited to 'mod.php')
-rw-r--r--mod.php27
1 files changed, 15 insertions, 12 deletions
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 .= '<fieldset><legend>New post</legend><form style="display:inline" action="" method="post"><table>' .
@@ -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 = '<div class="ban"><h2>Rebuilding…</h2><p>';
$body .= 'Regenerating theme files…<br/>';
- rebuildTheme('all');
+ rebuildThemes('all');
$body .= 'Generating Javascript file…<br/>';
buildJavascript();
@@ -1599,7 +1602,7 @@
// Build the board
buildIndex();
- rebuildTheme('boards');
+ rebuildThemes('boards');
header('Location: ?/board/' . $board['uri'], true, $config['redirect_http']);
} else {