Skip to content

Commit bfc5a29

Browse files
Check for existence of modal before including it.
1 parent 298c76f commit bfc5a29

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

web/ajax/modal.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@
77
$modal = detaintPath($_REQUEST['modal']);
88
$data = array();
99

10-
ZM\Debug("Including modals/$modal.php");
11-
# Shouldn't be necessary but at the moment we have last .conf file contents
12-
ob_start();
13-
@$result = include('modals/'.$modal.'.php');
14-
$data['html'] = ob_get_contents();
15-
ob_end_clean();
16-
if (!$result) {
10+
if (file_exists(dirname(__FILE__).'/modals/'.$modal.'.php')) {
11+
ZM\Debug("Including modals/$modal.php");
12+
# Shouldn't be necessary but at the moment we have last .conf file contents
13+
ob_start();
14+
@$result = include('modals/'.$modal.'.php');
15+
$data['html'] = ob_get_contents();
16+
ob_end_clean();
17+
18+
if (!$result) {
19+
ajaxError("Error including '".$modal."'");
20+
return;
21+
}
22+
} else {
1723
ajaxError("Unknown modal '".$modal."'");
1824
return;
1925
}
2026

27+
2128
ajaxResponse($data);
2229
return;
2330
?>

0 commit comments

Comments
 (0)