bludit/kernel/admin/controllers/themes.php

51 lines
1.7 KiB
PHP
Raw Normal View History

2015-08-02 04:47:45 +02:00
<?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');
}
2015-08-03 02:49:12 +02:00
// ============================================================================
// Main after POST
// ============================================================================
2015-08-02 04:47:45 +02:00
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
2015-08-03 02:49:12 +02:00
// Main after POST
2015-08-02 04:47:45 +02:00
// ============================================================================
2015-08-02 06:40:24 +02:00
2015-08-03 00:05:20 +02:00
$themes = array();
$themesPaths = Filesystem::listDirectories(PATH_THEMES);
2015-08-02 06:40:24 +02:00
2015-08-03 00:05:20 +02:00
foreach($themesPaths as $themePath)
{
2015-08-24 00:07:14 +02:00
$langLocaleFile = $themePath.DS.'languages'.DS.$Site->locale().'.json';
$langDefaultFile = $themePath.DS.'languages'.DS.'en_US.json';
2015-08-03 00:05:20 +02:00
// Check if exists default language
2015-10-07 02:37:32 +02:00
if( Sanitize::pathFile($langDefaultFile) )
2015-08-03 00:05:20 +02:00
{
2015-10-07 02:37:32 +02:00
$database = new dbJSON($langDefaultFile, false);
2015-08-03 00:05:20 +02:00
$databaseArray = $database->db;
2015-11-29 00:21:04 +01:00
$themeMetaData = $database->db['theme-data'];
2015-10-07 02:37:32 +02:00
// Check if exists locale language
if( Sanitize::pathFile($langLocaleFile) ) {
$database = new dbJSON($langLocaleFile, false);
2015-11-29 00:21:04 +01:00
$themeMetaData = array_merge($themeMetaData, $database->db['theme-data']);
2015-10-07 02:37:32 +02:00
}
2015-11-29 00:21:04 +01:00
$themeMetaData['dirname'] = basename($themePath);
2015-08-03 00:05:20 +02:00
// Theme data
2015-11-29 00:21:04 +01:00
array_push($themes, $themeMetaData);
2015-08-03 00:05:20 +02:00
}
}