| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,9 @@ | |||
| 32 | 32 | ||
| 33 | 33 | $config = new PluginTreeviewConfig(); | |
| 34 | 34 | if (isset($_POST['update'])) { | |
| 35 | + if (isset($_POST['target']) && !in_array($_POST['target'], ['_blank', 'right'], true)) { | ||
| 36 | + unset($_POST['target']); | ||
| 37 | + } | ||
| 35 | 38 | $config->update($_POST); | |
| 36 | 39 | Html::back(); | |
| 37 | 40 | } elseif (Plugin::isPluginActive('treeview')) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,9 @@ | |||
| 34 | 34 | ||
| 35 | 35 | //Save user preferences | |
| 36 | 36 | if (isset($_POST['plugin_treeview_user_preferences_save'])) { | |
| 37 | - $pref->update($_POST); | ||
| 37 | + if (!($own_id = $pref->checkIfPreferenceExists(Session::getLoginUserID()))) { | ||
| 38 | + $own_id = $pref->addDefaultPreference(Session::getLoginUserID()); | ||
| 39 | + } | ||
| 40 | + $pref->update(['id' => $own_id, 'show_on_load' => (int) ($_POST['show_on_load'] ?? 0)]); | ||
| 38 | 41 | Html::back(); | |
| 39 | 42 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -239,7 +239,7 @@ public function getNodesFromDb() | |||
| 239 | 239 | $closeSameLevel = $this->fields['closeSameLevel']; | |
| 240 | 240 | ||
| 241 | 241 | // Load the settings in JavaSript so that dTree script can apply them | |
| 242 | - echo "d.config.target = '" . $target . "';\n"; | ||
| 242 | + echo "d.config.target = " . json_encode($target) . ";\n"; | ||
| 243 | 243 | echo 'd.config.folderLinks = ' . $folderLinks . ";\n"; | |
| 244 | 244 | echo 'd.config.useSelection = ' . $useSelection . ";\n"; | |
| 245 | 245 | echo 'd.config.useLines = ' . $useLines . ";\n"; | |
@@ -267,7 +267,7 @@ public function getNodesFromDb() | |||
| 267 | 267 | // Is this the first time we load the page? | |
| 268 | 268 | if (isset($_GET['nodes']) && $_GET['nodes'] != '') { | |
| 269 | 269 | // If no then get all the nodes requested by the client | |
| 270 | - $nodes = array_reverse(explode('.', $_GET['nodes'])); | ||
| 270 | + $nodes = array_map('intval', array_reverse(explode('.', $_GET['nodes']))); | ||
| 271 | 271 | } else { | |
| 272 | 272 | // If yes then get only the root node | |
| 273 | 273 | $nodes[0] = 0; | |
@@ -319,7 +319,7 @@ public function getNodesFromDb() | |||
| 319 | 319 | ", true, -1,'');\n"; | |
| 320 | 320 | $dontLoad = 'true'; | |
| 321 | 321 | // Then add aloso its items | |
| 322 | - foreach (self::$types as $type) { | ||
| 322 | + foreach (self::getTypes() as $type) { | ||
| 323 | 323 | ||
| 324 | 324 | if (!class_exists($type) || !is_a($type, CommonDBTM::class, true)) { | |
| 325 | 325 | continue; | |
@@ -344,7 +344,7 @@ public function getNodesFromDb() | |||
| 344 | 344 | $criteria['WHERE']['is_deleted'] = 0; | |
| 345 | 345 | } | |
| 346 | 346 | ||
| 347 | - if ($this->isEntityAssign()) { | ||
| 347 | + if ($item->isEntityAssign()) { | ||
| 348 | 348 | $criteria['WHERE']['entities_id'] = $_SESSION['glpiactive_entity']; | |
| 349 | 349 | } | |
| 350 | 350 | ||
@@ -451,9 +451,9 @@ public function getNodesFromDb() | |||
| 451 | 451 | ||
| 452 | 452 | // Open the tree to the desired node | |
| 453 | 453 | if ($openedType != -1) { | |
| 454 | - echo 'd.openTo(' . htmlspecialchars((string) $openedType) . ");\n"; | ||
| 454 | + echo 'd.openTo(' . (int) $openedType . ");\n"; | ||
| 455 | 455 | } else { | |
| 456 | - echo 'd.openTo(' . $nodes[count($nodes) - 1] . ");\n"; | ||
| 456 | + echo 'd.openTo(' . (int) $nodes[count($nodes) - 1] . ");\n"; | ||
| 457 | 457 | } | |
| 458 | 458 | } | |
| 459 | 459 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments