Some sort of theme/homepage start

This commit is contained in:
Savetheinternet 2011-04-13 23:47:47 +10:00
parent b895102563
commit 459f442b57
6 changed files with 242 additions and 0 deletions

View file

@ -208,6 +208,13 @@
//$config['dir']['static'] = $config['root'] . 'static/';
// Where to store the .html templates. This folder and templates must exist or fatal errors will be thrown.
$config['dir']['template'] = getcwd() . '/templates';
// For the homepage generation files (themes, etc.)
$config['dir']['homepage'] = getcwd() . '/templates/homepage';
// Same as above, but a URI (accessable by web interface, not locally)
$config['dir']['homepage_uri'] = 'templates/homepage';
// Homepage directory
$config['dir']['home'] = '';
// Static images
// These can be URLs OR base64 (data URI scheme)
//$config['image_sticky'] = $config['dir']['static'] . 'sticky.gif';
@ -393,6 +400,8 @@
$config['mod']['noticeboard_delete'] = ADMIN;
// Public ban messages; attached to posts
$config['mod']['public_ban'] = MOD;
// Manage and install themes for homepage
$config['mod']['themes'] = ADMIN;
// Mod links (full HTML)
// Correspond to above permission directives

View file

@ -93,6 +93,25 @@
}
}
function loadThemeConfig($_theme) {
global $config;
// Load theme information into $theme
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
return $theme;
}
function themeSettings() {
$query = query("SELECT * FROM `theme_settings`") or error(db_error());
$settings = Array();
while($s = $query->fetch()) {
$settings[$s['name']] = $s['value'];
}
return $settings;
}
function sprintf3($str, $vars, $delim = '%') {
$replaces = array();
foreach($vars as $k => $v) {