bludit/admin/controllers/themes.php

48 lines
1.5 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');
}
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
// Main
// ============================================================================
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
// Load each plugin clasess
2015-08-03 00:05:20 +02:00
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']);
}
}