bludit/kernel/admin/controllers/themes.php

50 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-10-07 02:37:32 +02:00
// Check if exists locale language
if( Sanitize::pathFile($langLocaleFile) ) {
$database = new dbJSON($langLocaleFile, false);
$databaseArray['theme-data'] = array_merge($databaseArray['theme-data'], $database->db['theme-data']);
}
2015-08-03 00:05:20 +02:00
$databaseArray['theme-data']['dirname'] = basename($themePath);
// Theme data
array_push($themes, $databaseArray['theme-data']);
}
}