Skip to content

Commit 0b0e164

Browse files
committed
Bail early on invalid ajax requests
1 parent 880f648 commit 0b0e164

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Dashboard.module

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class Dashboard extends Process implements Module
220220
$page = $this->getDashboardPageInNav();
221221
if ($page) {
222222
$this->session->redirect($page->url);
223+
return;
223224
}
224225
}
225226

@@ -229,11 +230,16 @@ class Dashboard extends Process implements Module
229230
// Load panel instances from hook
230231
$this->panels = $this->getPanels();
231232

232-
// Ajax request? Render requested panel directly
233-
if ($this->config->ajax && $this->input->post->dashboard) {
234-
$key = $this->input->post->key;
235-
$panel = $this->input->post->panel;
236-
return $this->renderInstanceByKey($key, $panel);
233+
if ($this->config->ajax) {
234+
if ($this->input->post->dashboard) {
235+
// Ajax request? (Re)render a single requested panel
236+
$key = $this->input->post->key;
237+
$panel = $this->input->post->panel;
238+
return $this->renderInstanceByKey($key, $panel);
239+
} else {
240+
// Disregard all other ajax requests
241+
return;
242+
}
237243
}
238244

239245
// Set browser title

0 commit comments

Comments
 (0)