diff --git a/mod.php b/mod.php index 55358a13..62edac7c 100644 --- a/mod.php +++ b/mod.php @@ -315,7 +315,23 @@ echo Element('page.html', Array( 'config'=>$config, 'title'=>'No theme', - 'body'=>'
Successfully stopped using all themes.
', + 'body'=>'Successfully uninstalled all themes.
' . + '', + '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'=>'Successfully uninstalled the ' . $match[1] . ' theme.
' . + '', 'mod'=>true ) ); @@ -364,7 +380,8 @@ if($ret && !empty($ret)) $body .= 'Successfully installed and built theme.
'; + $body .= 'Successfully installed and built theme.
' . + ''; // Build themes rebuildThemes('all'); @@ -411,7 +428,13 @@ ); } } else { - + + $themes_in_use = Array(); + $query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error()); + while($theme = $query->fetch()) { + $themes_in_use[$theme['theme']] = true; + } + // Scan directory for themes $themes = Array(); while($file = readdir($dir)) { @@ -445,17 +468,22 @@ '' . '