diff --git a/admin/controllers/install-theme.php b/admin/controllers/install-theme.php new file mode 100644 index 00000000..78491a33 --- /dev/null +++ b/admin/controllers/install-theme.php @@ -0,0 +1,35 @@ +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'); \ No newline at end of file diff --git a/admin/controllers/themes.php b/admin/controllers/themes.php index c8d2a7de..300d326c 100644 --- a/admin/controllers/themes.php +++ b/admin/controllers/themes.php @@ -13,18 +13,35 @@ if($Login->role()!=='admin') { // POST Method // ============================================================================ -if( $_SERVER['REQUEST_METHOD'] == 'POST' ) -{ - $Site->set($_POST); -} - // ============================================================================ // Main // ============================================================================ -$themes = Filesystem::listDirectories(PATH_THEMES); +$themes = array(); +$themesPaths = Filesystem::listDirectories(PATH_THEMES); // Load each plugin clasess -foreach($themes as $themePath) { -// include($themePath.DS.'plugin.php'); -} \ No newline at end of file +foreach($themesPaths as $themePath) +{ + $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']); + } +} diff --git a/admin/themes/default/css/default.css b/admin/themes/default/css/default.css index bef79c3f..a8d4dca0 100644 --- a/admin/themes/default/css/default.css +++ b/admin/themes/default/css/default.css @@ -70,6 +70,13 @@ div.unit-80 { } +/* ----------- FOOTER ----------- */ +#footer { + color: #777; + font-size: 0.9em; + text-align: center; +} + /* ----------- ALERT ----------- */ #alert { top: 0 !important; @@ -253,6 +260,11 @@ div.themeBox { padding: 15px 20px; width: 70%; margin-bottom: 20px; + overflow: auto; +} + +div.themeBoxInstalled { + background-color: #f1f1f1; } div.themeBox p { @@ -291,6 +303,7 @@ div.pluginBox { padding: 15px 20px; width: 70%; margin-bottom: 20px; + overflow: auto; } div.pluginBox p { diff --git a/admin/themes/default/index.php b/admin/themes/default/index.php index 3436fd12..bf14e9aa 100644 --- a/admin/themes/default/index.php +++ b/admin/themes/default/index.php @@ -95,8 +95,7 @@ $(document).ready(function() { -'; -?> + + \ No newline at end of file diff --git a/admin/views/themes.php b/admin/views/themes.php index cd99ad29..e4a8266f 100644 --- a/admin/views/themes.php +++ b/admin/views/themes.php @@ -1,2 +1,24 @@

p('Themes') ?>

+theme()) { + $installed = 'themeBoxInstalled'; + } + + echo '
'; + + echo '

'.$theme['name'].'

'; + echo '

'.$theme['description'].'

'; + echo ''.$Language->g('Version').': '.$theme['version'].''.$Language->g('author').': '.$theme['author'].''; + + if($theme['dirname']!=$Site->theme()) { + echo 'Install theme'; + } + + echo '
'; + } + +?> \ No newline at end of file diff --git a/themes/eventually/language/en_US.json b/themes/eventually/language/en_US.json new file mode 100755 index 00000000..d1ea28fc --- /dev/null +++ b/themes/eventually/language/en_US.json @@ -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" + } +} \ No newline at end of file