]> git.ipfire.org Git - people/stevee/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>
Tue, 3 Aug 2021 17:25:54 +0000 (19:25 +0200)
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 65e2a77f5b8e6f812afbc76d67f241c036ccec26..8698842357856605d88d89299cb286a5b47d83e3 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.
 #