diff --git a/inc/functions.php b/inc/functions.php index 144cdec1..fd00dc9f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -101,6 +101,16 @@ 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() { $query = query("SELECT * FROM `theme_settings`") or error(db_error()); $settings = Array(); diff --git a/mod.php b/mod.php index f6ed73d2..ef77e6ea 100644 --- a/mod.php +++ b/mod.php @@ -458,6 +458,8 @@ $query->bindValue(':id', $match[1], PDO::PARAM_INT); $query->execute() or error(db_error($query)); + rebuildTheme(); + header('Location: ?/news', true, $config['redirect_http']); } elseif(preg_match('/^\/news$/', $query)) { $body = ''; @@ -478,13 +480,15 @@ markup($_POST['body']); $query->bindValue(':body', $_POST['body']); $query->execute() or error(db_error($query)); + + rebuildTheme(); } $body .= '
New post
' . '' . - '' . + '' . ($mod['type'] >= $config['mod']['news_custom'] ? - '' + '' : '') . '' . @@ -1336,6 +1340,9 @@ $body = '

Rebuilding…

'; + $body .= 'Regenerating theme files…
'; + rebuildTheme(); + $body .= 'Generating Javascript file…
'; buildJavascript();

Name' . $mod['username'] . '