basic beta for themes
This commit is contained in:
parent
1bd14ef1d2
commit
757b09dec9
@ -137,6 +137,7 @@
|
|||||||
$config['error']['invalidpost'] = 'That post doesn\'t exist…';
|
$config['error']['invalidpost'] = 'That post doesn\'t exist…';
|
||||||
$config['error']['404'] = 'Page not found.';
|
$config['error']['404'] = 'Page not found.';
|
||||||
$config['error']['modexists'] = 'That mod <a href="?/users/%d">already exists</a>!';
|
$config['error']['modexists'] = 'That mod <a href="?/users/%d">already exists</a>!';
|
||||||
|
$config['error']['invalidtheme'] = 'That theme doesn\'t exist!';
|
||||||
|
|
||||||
// How many reports you can create in the same request.
|
// How many reports you can create in the same request.
|
||||||
$config['report_limit'] = 2;
|
$config['report_limit'] = 2;
|
||||||
|
@ -96,6 +96,9 @@
|
|||||||
function loadThemeConfig($_theme) {
|
function loadThemeConfig($_theme) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if(!file_exists($config['dir']['homepage'] . '/' . $_theme . '/theme.php'))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Load theme information into $theme
|
// Load theme information into $theme
|
||||||
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
|
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
|
||||||
return $theme;
|
return $theme;
|
||||||
|
25
mod.php
25
mod.php
@ -80,6 +80,7 @@
|
|||||||
'Boards' => '',
|
'Boards' => '',
|
||||||
'Noticeboard' => '',
|
'Noticeboard' => '',
|
||||||
'Administration' => '',
|
'Administration' => '',
|
||||||
|
'Themes' => '',
|
||||||
'Search' => '',
|
'Search' => '',
|
||||||
'Logout' => ''
|
'Logout' => ''
|
||||||
);
|
);
|
||||||
@ -158,6 +159,10 @@
|
|||||||
$fieldset['Administration'] .= '<li><a href="?/config">Show configuration</a></li>';
|
$fieldset['Administration'] .= '<li><a href="?/config">Show configuration</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($mod['type'] >= $config['mod']['themes']) {
|
||||||
|
$fieldset['Themes'] .= '<li><a href="?/themes">Manage themes</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
if($mod['type'] >= $config['mod']['search']) {
|
if($mod['type'] >= $config['mod']['search']) {
|
||||||
$fieldset['Search'] .= '<li><form style="display:inline" action="?/search" method="post">' .
|
$fieldset['Search'] .= '<li><form style="display:inline" action="?/search" method="post">' .
|
||||||
'<label style="display:inline" for="search">Phrase:</label> ' .
|
'<label style="display:inline" for="search">Phrase:</label> ' .
|
||||||
@ -249,6 +254,19 @@
|
|||||||
'mod'=>true
|
'mod'=>true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
} elseif(preg_match('/^\/themes\/none$/', $query, $match)) {
|
||||||
|
if($mod['type'] < $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 stopped using any themes. You\'ll have to create a homepage manually if you want one.</p>',
|
||||||
|
'mod'=>true
|
||||||
|
)
|
||||||
|
);
|
||||||
} elseif(preg_match('/^\/themes(\/(\w+))?$/', $query, $match)) {
|
} elseif(preg_match('/^\/themes(\/(\w+))?$/', $query, $match)) {
|
||||||
if($mod['type'] < $config['mod']['themes']) error($config['error']['noaccess']);
|
if($mod['type'] < $config['mod']['themes']) error($config['error']['noaccess']);
|
||||||
|
|
||||||
@ -260,7 +278,9 @@
|
|||||||
if(isset($match[2])) {
|
if(isset($match[2])) {
|
||||||
$_theme = $match[2];
|
$_theme = $match[2];
|
||||||
|
|
||||||
$theme = loadThemeConfig($_theme);
|
if(!$theme = loadThemeConfig($_theme)) {
|
||||||
|
error($config['error']['invalidtheme']);
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['install'])) {
|
if(isset($_POST['install'])) {
|
||||||
// Check if everything is submitted
|
// Check if everything is submitted
|
||||||
@ -366,6 +386,9 @@
|
|||||||
}
|
}
|
||||||
$body .= '</table>';
|
$body .= '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$body .= '<p style="text-align:center"><a href="?/themes/none">Don\'t use a theme.</a></p>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', Array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Select theme',
|
'title'=>'Select theme',
|
||||||
|
Loading…
Reference in New Issue
Block a user