1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-14 10:57:38 +01:00

rebuild themes

This commit is contained in:
Savetheinternet 2011-04-14 17:03:12 +10:00
parent 30f0145ea0
commit 1bd14ef1d2
2 changed files with 19 additions and 2 deletions

View File

@ -101,6 +101,16 @@
return $theme; return $theme;
} }
function rebuildTheme() {
$query = query("SELECT `value` AS `theme` FROM `theme_settings` WHERE `name` = 'theme'") or error(db_error());
if($theme = $query->fetch()) {
// A theme is installed
$theme = loadThemeConfig($theme['theme']);
$theme['build_function'](themeSettings());
}
}
function themeSettings() { function themeSettings() {
$query = query("SELECT * FROM `theme_settings`") or error(db_error()); $query = query("SELECT * FROM `theme_settings`") or error(db_error());
$settings = Array(); $settings = Array();

11
mod.php
View File

@ -458,6 +458,8 @@
$query->bindValue(':id', $match[1], PDO::PARAM_INT); $query->bindValue(':id', $match[1], PDO::PARAM_INT);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
rebuildTheme();
header('Location: ?/news', true, $config['redirect_http']); header('Location: ?/news', true, $config['redirect_http']);
} elseif(preg_match('/^\/news$/', $query)) { } elseif(preg_match('/^\/news$/', $query)) {
$body = ''; $body = '';
@ -478,13 +480,15 @@
markup($_POST['body']); markup($_POST['body']);
$query->bindValue(':body', $_POST['body']); $query->bindValue(':body', $_POST['body']);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
rebuildTheme();
} }
$body .= '<fieldset><legend>New post</legend><form style="display:inline" action="" method="post"><table>' . $body .= '<fieldset><legend>New post</legend><form style="display:inline" action="" method="post"><table>' .
'<tr>' . '<tr>' .
'<th><label for="subject">Name</label></th>' . '<th>Name</th>' .
($mod['type'] >= $config['mod']['news_custom'] ? ($mod['type'] >= $config['mod']['news_custom'] ?
'<td><input type="text" size="55" name="subject" id="subject" value="' . htmlentities($mod['username']) . '" /></td>' '<td><input type="text" size="55" name="name" id="name" value="' . htmlentities($mod['username']) . '" /></td>'
: :
'<td>' . $mod['username'] . '</td>') . '<td>' . $mod['username'] . '</td>') .
'</tr><tr>' . '</tr><tr>' .
@ -1336,6 +1340,9 @@
$body = '<div class="ban"><h2>Rebuilding…</h2><p>'; $body = '<div class="ban"><h2>Rebuilding…</h2><p>';
$body .= 'Regenerating theme files…<br/>';
rebuildTheme();
$body .= 'Generating Javascript file…<br/>'; $body .= 'Generating Javascript file…<br/>';
buildJavascript(); buildJavascript();