]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids.cgi: Introduce get_provider_handle().
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 14 Apr 2021 18:18:01 +0000 (20:18 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:45 +0000 (13:23 +0100)
This function is used to get the configured provider handle by a a given ID.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index b793ecd2f56fb8911a17d0240d433533618b9138..582b9aa68165d511c157800ed185766023a1b786 100644 (file)
@@ -2021,6 +2021,24 @@ sub get_memory_usage($) {
        return;
 }
 
+#
+## Function to get the provider handle by a given ID.
+#
+sub get_provider_handle($) {
+       my ($id) = @_;
+
+       my %used_providers = ();
+
+       # Read-in provider settings file.
+       &General::readhasharray($IDS::providers_settings_file, \%used_providers);
+
+       # Obtain the provider handle for the given ID.
+       my $provider_handle = $used_providers{$cgiparams{'ID'}}[0];
+
+       # Return the handle.
+       return $provider_handle;
+}
+
 #
 ## Function to get the provider name from the language file or providers file for a given handle.
 #