We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 22a7ced + 00058de commit cdb1601Copy full SHA for cdb1601
device_template.php
@@ -47,8 +47,11 @@ protected function load_template_list() {
47
$list = array();
48
49
$iti = new RecursiveDirectoryIterator("Modules/device/data");
50
- foreach(new RecursiveIteratorIterator($iti) as $file){
51
- if(strpos($file ,".json") !== false){
+ foreach(new RecursiveIteratorIterator($iti) as $splinfo ){
+ $name = $splinfo->getFilename();
52
+ $file = $splinfo->getPathname();
53
+ if(strlen($name) > 5 && $name[0] != '.' &&
54
+ substr_compare ( $name, '.json', -5 ) === 0) {
55
$content = json_decode(file_get_contents($file));
56
if (json_last_error() != 0) {
57
return array('success'=>false, 'message'=>"Error reading file $file: ".json_last_error_msg());
0 commit comments