From b4842dc55fd1bfc6d83bbc2c6e1e00d23ad4db8c Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 28 Apr 2003 18:06:18 +0000 Subject: [PATCH] implemented get*Profiles functions --- lam/lib/profiles.inc | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/lam/lib/profiles.inc b/lam/lib/profiles.inc index 57d36a8c..e9273f1d 100644 --- a/lam/lib/profiles.inc +++ b/lam/lib/profiles.inc @@ -23,16 +23,55 @@ $Id$ // profiles.inc provides functions to load and save profiles for users/groups/hosts +include_once("config.inc"); + + // returns an array of String with all available user profiles function getUserProfiles() { + $dir = dir(getLAMPath() . "/config/profiles/users"); + $ret = array(); + $pos = 0; + while ($entry = $dir->read()){ + $ext = substr($entry, strlen($entry)-4, 4); + $name = substr($entry, 0, strlen($entry)-4); + if ($ext == ".pru") { + $ret[$pos] = $name; + $pos ++; + } + } + return $ret; } // returns an array of String with all available group profiles function getGroupProfiles() { + $dir = dir(getLAMPath() . "/config/profiles/groups"); + $ret = array(); + $pos = 0; + while ($entry = $dir->read()){ + $ext = substr($entry, strlen($entry)-4, 4); + $name = substr($entry, 0, strlen($entry)-4); + if ($ext == ".prg") { + $ret[$pos] = $name; + $pos ++; + } + } + return $ret; } // returns an array of String with all available host profiles function getHostProfiles() { + $dir = dir(getLAMPath() . "/config/profiles/hosts"); + $ret = array(); + $pos = 0; + while ($entry = $dir->read()){ + $ext = substr($entry, strlen($entry)-4, 4); + $name = substr($entry, 0, strlen($entry)-4); + if ($ext == ".prh") { + $ret[$pos] = $name; + $pos ++; + } + } + return $ret; } // loads an user profile with name $profile @@ -65,4 +104,4 @@ function saveGroupProfile($account, $profile) { function saveHostProfile($account, $profile) { } -?> \ No newline at end of file +?>