Skip to content

Commit 1a580e5

Browse files
Add error message when ZM_DIR_MODELS is not defined
1 parent 377d95c commit 1a580e5

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

web/skins/classic/views/monitor.php

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,32 +1113,36 @@ class="nav-link<?php echo ($tab == $name ? ' active' : '') . ' ' . (($name == 'z
11131113
<label><?php echo translate('Object Detection Model')?></label>
11141114
<?php
11151115
$models = ['none'=>[]];
1116-
foreach (glob(ZM_DIR_MODELS.'/*') as $model) {
1117-
$model = basename($model);
1118-
$extension = pathinfo($model, PATHINFO_EXTENSION);
1119-
if ($extension == 'dfp') {
1120-
if (defined('HAVE_MEMX')) {
1121-
if (!isset($models['memx'])) $models['memx'] = [];
1122-
$models['memx'][$model] = $model;
1116+
if (!(defined('ZM_DIR_MODELS') and ZM_DIR_MODELS)) {
1117+
echo '<span class="error">ZM_DIR_MODELS is not defined.</span>';
1118+
} else {
1119+
foreach (glob(ZM_DIR_MODELS.'/*') as $model) {
1120+
$model = basename($model);
1121+
$extension = pathinfo($model, PATHINFO_EXTENSION);
1122+
if ($extension == 'dfp') {
1123+
if (defined('HAVE_MEMX')) {
1124+
if (!isset($models['memx'])) $models['memx'] = [];
1125+
$models['memx'][$model] = $model;
1126+
}
1127+
if (defined('HAVE_MX_ACCL')) {
1128+
if (!isset($models['mx_accl'])) $models['mx_accl'] = [];
1129+
$models['mx_accl'][$model] = $model;
1130+
}
1131+
} else if ($extension == 'uxf' and defined('HAVE_UNTETHER')) {
1132+
if (!isset($models['speedai'])) $models['speedai'] = [];
1133+
$models['speedai'][$model] = $model;
1134+
} else if ($extension == 'nb' and defined('ZM_HAVE_QUADRA') and ZM_HAVE_QUADRA) {
1135+
if (!isset($models['quadra'])) $models['quadra'] = [];
1136+
$models['quadra'][$model] = $model;
1137+
} else {
1138+
ZM\Debug("Unkown extension in model $model");
11231139
}
1124-
if (defined('HAVE_MX_ACCL')) {
1125-
if (!isset($models['mx_accl'])) $models['mx_accl'] = [];
1126-
$models['mx_accl'][$model] = $model;
1140+
if ($monitor->ObjectDetection() == 'none') {
1141+
$models['none'][$model] = $model;
11271142
}
1128-
} else if ($extension == 'uxf' and defined('HAVE_UNTETHER')) {
1129-
if (!isset($models['speedai'])) $models['speedai'] = [];
1130-
$models['speedai'][$model] = $model;
1131-
} else if ($extension == 'nb' and defined('ZM_HAVE_QUADRA') and ZM_HAVE_QUADRA) {
1132-
if (!isset($models['quadra'])) $models['quadra'] = [];
1133-
$models['quadra'][$model] = $model;
1134-
} else {
1135-
ZM\Debug("Unkown extension in model $model");
1136-
}
1137-
if ($monitor->ObjectDetection() == 'none') {
1138-
$models['none'][$model] = $model;
11391143
}
1140-
}
11411144
echo htmlSelect('newMonitor[ObjectDetectionModel]', $models[$monitor->ObjectDetection()], $monitor->ObjectDetectionModel());
1145+
} # end if ZM_DIR_MODELS
11421146
?>
11431147
</li>
11441148
<li id="ObjectDetectionObjectThreshold" class="ObjectDetectionObjectThreshold">

0 commit comments

Comments
 (0)