summaryrefslogtreecommitdiffstats
path: root/modules-available/baseconfig
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-16 16:14:42 +0200
committerSimon Rettberg2016-06-16 16:14:42 +0200
commit872de4e07609d8dae7660e467a73fc6f4061956a (patch)
treea0f856c659e71b1ff7e57883ad1f071e23a50e67 /modules-available/baseconfig
parentDon't need these anymore (diff)
downloadslx-admin-872de4e07609d8dae7660e467a73fc6f4061956a.tar.gz
slx-admin-872de4e07609d8dae7660e467a73fc6f4061956a.tar.xz
slx-admin-872de4e07609d8dae7660e467a73fc6f4061956a.zip
[locations] Handle machine UUID param to determine location
Diffstat (limited to 'modules-available/baseconfig')
-rw-r--r--modules-available/baseconfig/api.inc.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/modules-available/baseconfig/api.inc.php b/modules-available/baseconfig/api.inc.php
index 000015f5..877ff4a7 100644
--- a/modules-available/baseconfig/api.inc.php
+++ b/modules-available/baseconfig/api.inc.php
@@ -5,10 +5,9 @@ if (substr($ip, 0, 7) === '::ffff:') {
$ip = substr($ip, 7);
}
-// TODO: Handle UUID in appropriate modules (optional)
-$uuid = Request::post('uuid', '', 'string');
-if (strlen($uuid) !== 36) {
- // Probably invalid UUID. What to do? Set empty or ignore?
+$uuid = Request::any('uuid', false, 'string');
+if ($uuid !== false && strlen($uuid) !== 36) {
+ $uuid = false;
}
/**
@@ -31,6 +30,11 @@ function escape($string)
*/
$configVars = array();
+function handleModule($file, $ip, $uuid) // Pass ip and uuid instead of global to make them read only
+{
+ global $configVars;
+ include $file;
+}
// Handle any hooks by other modules first
// other modules should generally only populate $configVars
@@ -38,7 +42,7 @@ foreach (glob('modules/*/baseconfig/getconfig.inc.php') as $file) {
preg_match('#^modules/([^/]+)/#', $file, $out);
if (!Module::isAvailable($out[1]))
continue;
- include $file;
+ handleModule($file, $ip, $uuid);
}
// Rest is handled by module