Minor changes

This commit is contained in:
dignajar 2015-08-02 19:05:20 -03:00
parent 519826ddac
commit a4fe50a162
6 changed files with 110 additions and 12 deletions

View File

@ -0,0 +1,35 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
// Main
// ============================================================================
$themeDirname = $layout['parameters'];
if( Sanitize::pathFile(PATH_THEMES.$themeDirname) )
{
$Site->set(array('theme'=>$themeDirname));
Alert::set($Language->g('The changes have been saved'));
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to install the theme: '.$themeDirname);
}
Redirect::page('admin', 'themes');

View File

@ -13,18 +13,35 @@ if($Login->role()!=='admin') {
// POST Method // POST Method
// ============================================================================ // ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$Site->set($_POST);
}
// ============================================================================ // ============================================================================
// Main // Main
// ============================================================================ // ============================================================================
$themes = Filesystem::listDirectories(PATH_THEMES); $themes = array();
$themesPaths = Filesystem::listDirectories(PATH_THEMES);
// Load each plugin clasess // Load each plugin clasess
foreach($themes as $themePath) { foreach($themesPaths as $themePath)
// include($themePath.DS.'plugin.php'); {
} $langLocaleFile = $themePath.DS.'language'.DS.$Site->locale().'.json';
$langDefaultFile = $themePath.DS.'language'.DS.'en_US.json';
$database = false;
// Check if exists locale language
if( Sanitize::pathFile($langLocaleFile) ) {
$database = new dbJSON($langLocaleFile, false);
}
// Check if exists default language
elseif( Sanitize::pathFile($langDefaultFile) ) {
$database = new dbJSON($langDefaultFile, false);
}
if($database!==false)
{
$databaseArray = $database->db;
$databaseArray['theme-data']['dirname'] = basename($themePath);
// Theme data
array_push($themes, $databaseArray['theme-data']);
}
}

View File

@ -70,6 +70,13 @@ div.unit-80 {
} }
/* ----------- FOOTER ----------- */
#footer {
color: #777;
font-size: 0.9em;
text-align: center;
}
/* ----------- ALERT ----------- */ /* ----------- ALERT ----------- */
#alert { #alert {
top: 0 !important; top: 0 !important;
@ -253,6 +260,11 @@ div.themeBox {
padding: 15px 20px; padding: 15px 20px;
width: 70%; width: 70%;
margin-bottom: 20px; margin-bottom: 20px;
overflow: auto;
}
div.themeBoxInstalled {
background-color: #f1f1f1;
} }
div.themeBox p { div.themeBox p {
@ -291,6 +303,7 @@ div.pluginBox {
padding: 15px 20px; padding: 15px 20px;
width: 70%; width: 70%;
margin-bottom: 20px; margin-bottom: 20px;
overflow: auto;
} }
div.pluginBox p { div.pluginBox p {

View File

@ -95,8 +95,7 @@ $(document).ready(function() {
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('onAdminBodyEnd') ?> <?php Theme::plugins('onAdminBodyEnd') ?>
<?php <div id="footer">Bludit <?php echo BLUDIT_VERSION ?> | Load time <?php echo (microtime(true) - $loadTime) ?></div>
echo "DEBUG: Load time: ".(microtime(true) - $loadTime).'<br>';
?>
</body> </body>
</html> </html>

View File

@ -1,2 +1,24 @@
<h2 class="title"><i class="fa fa-adjust"></i> <?php $Language->p('Themes') ?></h2> <h2 class="title"><i class="fa fa-adjust"></i> <?php $Language->p('Themes') ?></h2>
<?php
foreach($themes as $theme)
{
$installed = '';
if($theme['dirname']==$Site->theme()) {
$installed = 'themeBoxInstalled';
}
echo '<div class="themeBox '.$installed.'">';
echo '<p class="name">'.$theme['name'].'</p>';
echo '<p>'.$theme['description'].'</p>';
echo '<span class="version">'.$Language->g('Version').': '.$theme['version'].'</span><span class="author">'.$Language->g('author').': '.$theme['author'].'</span>';
if($theme['dirname']!=$Site->theme()) {
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'" class="btn btn-red btn-smaller">Install theme</a>';
}
echo '</div>';
}
?>

View File

@ -0,0 +1,12 @@
{
"theme-data":
{
"name": "Eventually",
"description": "Eventually is design by HTML5 UP. Website http://html5up.net",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-02"
}
}