Bug fixed, compatible version

This commit is contained in:
dignajar 2016-06-20 22:06:52 -03:00
parent a3a9f418b7
commit dadac9348e
1 changed files with 13 additions and 19 deletions

View File

@ -28,7 +28,7 @@ function buildThemes()
$database = file_get_contents($languageFilename); $database = file_get_contents($languageFilename);
$database = json_decode($database, true); $database = json_decode($database, true);
if(empty($database)) { if(empty($database)) {
Log::set('99.themes.php'.LOG_SEP.'JSON Error on theme '.$themePath); Log::set('99.themes.php'.LOG_SEP.'Language file error on theme '.$themePath);
break; break;
} }
@ -43,26 +43,20 @@ function buildThemes()
{ {
$metadataString = file_get_contents($filenameMetadata); $metadataString = file_get_contents($filenameMetadata);
$metadata = json_decode($metadataString, true); $metadata = json_decode($metadataString, true);
if(empty($metadata)) {
Log::set('99.themes.php'.LOG_SEP.'JSON Error on theme '.$themePath); if( !empty($metadata['compatible']) ) {
break;
$explode = explode(',', $metadata['compatible']);
if(in_array(BLUDIT_VERSION, $explode)) {
$database = $database + $metadata;
array_push($themes, $database);
}
}
else {
Log::set('99.themes.php'.LOG_SEP.'Metadata file error on theme '.$themePath);
} }
// Check if the theme is compatible
if(empty($metadata['compatible'])) {
Log::set('99.themes.php'.LOG_SEP.'Metadata error, field compatible invalid '.$themePath);
break;
}
$explode = explode(',', $metadata['compatible']);
if(!in_array(BLUDIT_VERSION, $explode)) {
Log::set('99.themes.php'.LOG_SEP.'Theme incompatible '.$themePath);
break;
}
// Theme data
$database = $database + $metadata;
array_push($themes, $database);
} }
} }
} }