diff --git a/admin/controllers/configure-plugin.php b/admin/controllers/configure-plugin.php index 1eb1c411..d1c1c9f4 100644 --- a/admin/controllers/configure-plugin.php +++ b/admin/controllers/configure-plugin.php @@ -31,6 +31,11 @@ if($_Plugin===false) { Redirect::page('admin', 'plugins'); } +// Check if the plugin has the method form() +if($_Plugin->form()===false) { + Redirect::page('admin', 'plugins'); +} + // ============================================================================ // POST Method // ============================================================================ 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 new file mode 100644 index 00000000..300d326c --- /dev/null +++ b/admin/controllers/themes.php @@ -0,0 +1,47 @@ +role()!=='admin') { + Alert::set($Language->g('you-do-not-have-sufficient-permissions')); + Redirect::page('admin', 'dashboard'); +} + +// ============================================================================ +// POST Method +// ============================================================================ + +// ============================================================================ +// Main +// ============================================================================ + +$themes = array(); +$themesPaths = Filesystem::listDirectories(PATH_THEMES); + +// Load each plugin clasess +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 fcff5495..a8d4dca0 100644 --- a/admin/themes/default/css/default.css +++ b/admin/themes/default/css/default.css @@ -12,6 +12,10 @@ body { background-color: #f9f9f9; } +div.unit-80 { + margin-left: 1% !important; +} + /* ----------- FONTS AWESOME ----------- */ .fa-right { margin-right: 5px; @@ -63,7 +67,14 @@ body { } #sidebar li { - + +} + +/* ----------- FOOTER ----------- */ +#footer { + color: #777; + font-size: 0.9em; + text-align: center; } /* ----------- ALERT ----------- */ @@ -151,7 +162,32 @@ div.dashboardBox h2 { padding: 10px 20px; } +div.dashboardBox ul.menu { + list-style-type: none; + margin: 0; + padding: 0; + text-align: center; +} +div.dashboardBox ul.menu a { + color: #2672ec; +} + +div.dashboardBox ul.menu li.title { + +} + +div.dashboardBox ul.menu li.description { + border-bottom: 1px dashed #ddd; + margin-bottom: 10px; + padding-bottom: 10px; + color: #555; +} + +div.dashboardBox ul.menu li.description:last-child { + border-bottom: 0 !important; + margin-bottom: 0 !important; +} /* ----------- FORMS ----------- */ @@ -214,6 +250,49 @@ a.btn-red:hover { margin-left: 10px; } +/* ----------- THEMES ----------- */ + +div.themeBox { + box-shadow: 0 1px 2px rgba(0,0,0,.26); + background-color: #fff; + border-radius: 2px; + box-sizing: border-box; + padding: 15px 20px; + width: 70%; + margin-bottom: 20px; + overflow: auto; +} + +div.themeBoxInstalled { + background-color: #f1f1f1; +} + +div.themeBox p { + margin-bottom: 6px; +} + +div.themeBox p.name { + border-bottom: 1px dashed #ccc; +} + +div.themeBox a.btn-smaller { + padding: 4px 10px; + margin-right: 10px; +} + +div.themeBox span.author { + color: #777; + margin-left: 10px; + float: right; + font-size: 0.9em; +} + +div.themeBox span.version { + color: #777; + margin-left: 10px; + float: right; + font-size: 0.9em; +} /* ----------- PLUGINS ----------- */ div.pluginBox { @@ -221,18 +300,37 @@ div.pluginBox { background-color: #fff; border-radius: 2px; box-sizing: border-box; - padding: 20px; + padding: 15px 20px; width: 70%; margin-bottom: 20px; + overflow: auto; } div.pluginBox p { - margin-bottom: 10px; + margin-bottom: 6px; +} + +div.pluginBox p.name { + border-bottom: 1px dashed #ccc; +} + +div.pluginBox a.btn-smaller { + padding: 4px 10px; + margin-right: 10px; +} + +div.pluginBox span.author { + color: #777; + margin-left: 10px; + float: right; + font-size: 0.9em; } div.pluginBox span.version { - color: #ccc; + color: #777; margin-left: 10px; + float: right; + font-size: 0.9em; } /* ----------- PLUGINS FORM ----------- */ 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() { -'; -?> +
+