bludit/admin/controllers/themes.php

52 lines
1.6 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
// Load each plugin clasess
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
$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']);
}
}