Skip to content

Commit 1571ad8

Browse files
author
Pascal Dreissen
committed
Only load dashlets classes with .php extension
1 parent 06f5bd5 commit 1571ad8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

interface/web/dashboard/dashboard.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,13 @@
160160
$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
161161
while ($file = @readdir($handle)) {
162162
if ($file != '.' && $file != '..' && !is_dir(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file)) {
163-
$dashlet_name = substr($file, 0, -4);
164-
$dashlet_class = 'dashlet_'.$dashlet_name;
165-
include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file;
166-
$dashlet_list[$dashlet_name] = new $dashlet_class;
163+
$splitfilename = explode('.', $file);
164+
if (end($splitfilename) == 'php') { // only allow .php files
165+
$dashlet_name = substr($file, 0, -4);
166+
$dashlet_class = 'dashlet_'.$dashlet_name;
167+
include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file;
168+
$dashlet_list[$dashlet_name] = new $dashlet_class;
169+
}
167170
}
168171
}
169172

0 commit comments

Comments
 (0)