function rebuildThemes($action, $boardname = false) { global $config, $board, $current_locale, $error; // Save the global variables $_config = $config; $_board = $board; // List themes if ($themes = Cache::get("themes")) { // OK, we already have themes loaded } else { $query = query("SELECT `theme` FROM ``theme_settings`` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error()); $themes = array(); while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { $themes[] = $theme; } Cache::set("themes", $themes); } foreach ($themes as $theme) { // Restore them $config = $_config; $board = $_board; // Reload the locale if ($config['locale'] != $current_locale) { $current_locale = $config['locale']; init_locale($config['locale'], $error); } rebuildTheme($theme['theme'], $action, $boardname); } // Restore them again $config = $_config; $board = $_board; // Reload the locale if ($config['locale'] != $current_locale) { $current_locale = $config['locale']; init_locale($config['locale'], $error); } }
} $body .= '</p>'; } echo Element('page.html', array('config' => $config, 'title' => _('Moderation log'), 'body' => $body, 'mod' => true)); } elseif (preg_match('/^\\/themes\\/none$/', $query, $match)) { if (!hasPermission($config['mod']['themes'])) { error($config['error']['noaccess']); } // Clearsettings query("TRUNCATE TABLE `theme_settings`") or error(db_error()); echo Element('page.html', array('config' => $config, 'title' => 'No theme', 'body' => '<p style="text-align:center">Successfully uninstalled all themes.</p>' . '<p style="text-align:center"><a href="?/themes">Go back to themes</a>.</p>', 'mod' => true)); } elseif (preg_match('/^\\/themes\\/([\\w\\-]+)\\/rebuild$/', $query, $match)) { if (!hasPermission($config['mod']['themes'])) { error($config['error']['noaccess']); } rebuildTheme($match[1], 'all'); echo Element('page.html', array('config' => $config, 'title' => 'Rebuilt', 'body' => '<p style="text-align:center">Successfully rebuilt the <strong>' . $match[1] . '</strong> theme.</p>' . '<p style="text-align:center"><a href="?/themes">Go back to themes</a>.</p>', 'mod' => true)); } elseif (preg_match('/^\\/themes\\/(\\w+)\\/uninstall$/', $query, $match)) { if (!hasPermission($config['mod']['themes'])) { error($config['error']['noaccess']); } $query = prepare("DELETE FROM `theme_settings` WHERE `theme` = :theme"); $query->bindValue(':theme', $match[1]); $query->execute() or error(db_error($query)); echo Element('page.html', array('config' => $config, 'title' => 'Uninstalled', 'body' => '<p style="text-align:center">Successfully uninstalled the <strong>' . $match[1] . '</strong> theme.</p>' . '<p style="text-align:center"><a href="?/themes">Go back to themes</a>.</p>', 'mod' => true)); } elseif (preg_match('/^\\/themes(\\/([\\w\\-]+))?$/', $query, $match)) { if (!hasPermission($config['mod']['themes'])) { error($config['error']['noaccess']); } if (!is_dir($config['dir']['themes'])) { error(_('Themes directory doesn\'t exist!'));
<?php $_SERVER = array('REQUEST_URI' => '', 'HTTP_HOST' => '', 'SCRIPT_FILENAME' => ''); chdir(str_replace('\\', '/', dirname(__FILE__)) . '/../../../'); require 'inc/functions.php'; require 'inc/display.php'; require 'inc/template.php'; require 'inc/database.php'; require 'theme.php'; rebuildTheme('rrdtool', 'cron');
function sb_sitemap() { rebuildTheme("sitemap", "all"); return true; }
function mod_theme_rebuild($theme_name) { global $config; if (!hasPermission($config['mod']['themes'])) { error($config['error']['noaccess']); } rebuildTheme($theme_name, 'all'); mod_page(sprintf(_('Rebuilt theme: %s'), $theme_name), 'mod/theme_rebuilt.html', array('theme_name' => $theme_name)); }
function rebuildThemes($action, $board = false) { // List themes $query = query("SELECT `theme` FROM ``theme_settings`` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error()); while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { rebuildTheme($theme['theme'], $action, $board); } }
function rebuildThemes($action, $boardname = false) { global $config, $board; // Save the global variables $_config = $config; $_board = $board; // List themes $query = query("SELECT `theme` FROM ``theme_settings`` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error()); while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { rebuildTheme($theme['theme'], $action, $boardname); } // Restore them $config = $_config; $board = $_board; }
function rebuildThemes($action) { // List themes $query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error()); while ($theme = $query->fetch()) { rebuildTheme($theme['theme'], $action); } }