theme install functions
This commit is contained in:
parent
517167ea6f
commit
cec63231cf
@ -155,7 +155,7 @@
|
|||||||
global $config, $_theme;
|
global $config, $_theme;
|
||||||
$_theme = $theme;
|
$_theme = $theme;
|
||||||
|
|
||||||
$theme = loadThemeConfig($_theme, $action);
|
$theme = loadThemeConfig($_theme);
|
||||||
|
|
||||||
if(file_exists($config['dir']['themes'] . '/' . $_theme . '/theme.php')) {
|
if(file_exists($config['dir']['themes'] . '/' . $_theme . '/theme.php')) {
|
||||||
require_once $config['dir']['themes'] . '/' . $_theme . '/theme.php';
|
require_once $config['dir']['themes'] . '/' . $_theme . '/theme.php';
|
||||||
@ -169,7 +169,7 @@
|
|||||||
// List themes
|
// List themes
|
||||||
$query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
|
$query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
|
||||||
while($theme = $query->fetch()) {
|
while($theme = $query->fetch()) {
|
||||||
rebuildTheme($theme['theme']);
|
rebuildTheme($theme['theme'], $action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
mod.php
15
mod.php
@ -360,13 +360,21 @@
|
|||||||
$query->bindValue(':theme', $_theme);
|
$query->bindValue(':theme', $_theme);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
|
$body = '';
|
||||||
|
if(isset($theme['install_callback'])) {
|
||||||
|
$ret = $theme['install_callback']($theme['config']);
|
||||||
|
if($ret && !empty($ret))
|
||||||
|
$body .= '<div style="border:1px dashed maroon;padding:20px;margin:auto;max-width:800px">' . $ret . '</div>';
|
||||||
|
}
|
||||||
|
$body .= '<p style="text-align:center">Successfully installed and built theme.</p>';
|
||||||
|
|
||||||
// Build themes
|
// Build themes
|
||||||
rebuildThemes('all');
|
rebuildThemes('all');
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', Array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Installed "' . htmlentities($theme['name']) . '"',
|
'title'=>'Installed "' . htmlentities($theme['name']) . '"',
|
||||||
'body'=>'<p style="text-align:center">Successfully installed and built theme.</p>',
|
'body'=>$body,
|
||||||
'mod'=>true
|
'mod'=>true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -382,7 +390,10 @@
|
|||||||
switch($c['type']) {
|
switch($c['type']) {
|
||||||
case 'text':
|
case 'text':
|
||||||
default:
|
default:
|
||||||
$body .= '<input type="text" name="' . $c['name'] . '" />';
|
$body .= '<input type="text" name="' . htmlentities($c['name']) . '" ' .
|
||||||
|
(isset($c['default']) ? 'value="' . htmlentities($c['default']) . '" ' :'') .
|
||||||
|
(isset($c['size']) ? 'size="' . (int)$c['size'] . '" ' :'') .
|
||||||
|
'/>';
|
||||||
}
|
}
|
||||||
if(isset($c['comment']))
|
if(isset($c['comment']))
|
||||||
$body .= ' <span class="unimportant">' . $c['comment'] . '</span>';
|
$body .= ' <span class="unimportant">' . $c['comment'] . '</span>';
|
||||||
|
Loading…
Reference in New Issue
Block a user