removed getLAMPath() function

This commit is contained in:
Roland Gruber 2003-05-01 11:37:46 +00:00
parent 77e9204844
commit 03d647f94b
2 changed files with 8 additions and 19 deletions

View File

@ -69,7 +69,7 @@ class Config {
// reloads preferences from ../config/lam.conf // reloads preferences from ../config/lam.conf
function reload() { function reload() {
$conffile = getLAMPath() . "/config/lam.conf"; $conffile = substr(__FILE__, 0, strlen(__FILE__) - 14) . "/config/lam.conf";
if (is_file($conffile) == True) { if (is_file($conffile) == True) {
$file = fopen($conffile, "r"); $file = fopen($conffile, "r");
while (!feof($file)) { while (!feof($file)) {
@ -492,15 +492,4 @@ class Config {
} }
// Get path of LAM directory without "/" at the end
function getLAMPath() {
$lampath = "";
$path = getcwd();
$path = explode("/", substr($path,1));
for($i = 0; $i <= array_search("lam", $path); $i++) {
$lampath .= "/" . $path[$i];
}
return $lampath;
}
?> ?>

View File

@ -29,7 +29,7 @@ include_once("account.inc");
// returns an array of String with all available user profiles (without .pru) // returns an array of String with all available user profiles (without .pru)
function getUserProfiles() { function getUserProfiles() {
$dir = dir(getLAMPath() . "/config/profiles/users"); $dir = dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/users");
$ret = array(); $ret = array();
$pos = 0; $pos = 0;
while ($entry = $dir->read()){ while ($entry = $dir->read()){
@ -45,7 +45,7 @@ function getUserProfiles() {
// returns an array of String with all available group profiles (without .prg) // returns an array of String with all available group profiles (without .prg)
function getGroupProfiles() { function getGroupProfiles() {
$dir = dir(getLAMPath() . "/config/profiles/groups"); $dir = dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/groups");
$ret = array(); $ret = array();
$pos = 0; $pos = 0;
while ($entry = $dir->read()){ while ($entry = $dir->read()){
@ -61,7 +61,7 @@ function getGroupProfiles() {
// returns an array of String with all available host profiles (without .prh) // returns an array of String with all available host profiles (without .prh)
function getHostProfiles() { function getHostProfiles() {
$dir = dir(getLAMPath() . "/config/profiles/hosts"); $dir = dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/hosts");
$ret = array(); $ret = array();
$pos = 0; $pos = 0;
while ($entry = $dir->read()){ while ($entry = $dir->read()){
@ -79,7 +79,7 @@ function getHostProfiles() {
// the return value is an account object // the return value is an account object
function loadUserProfile($profile) { function loadUserProfile($profile) {
$acc = new account(); $acc = new account();
$file = getLAMPath() . "/config/profiles/users/" . $profile . ".pru"; $file = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/users/" . $profile . ".pru";
if (is_file($file) == True) { if (is_file($file) == True) {
$file = fopen($file, "r"); $file = fopen($file, "r");
while (!feof($file)) { while (!feof($file)) {
@ -193,7 +193,7 @@ function loadGroupProfile($profile) {
// the return value is an account object // the return value is an account object
function loadHostProfile($profile) { function loadHostProfile($profile) {
$acc = new account(); $acc = new account();
$file = getLAMPath() . "/config/profiles/hosts/" . $profile . ".prh"; $file = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/hosts/" . $profile . ".prh";
if (is_file($file) == True) { if (is_file($file) == True) {
$file = fopen($file, "r"); $file = fopen($file, "r");
while (!feof($file)) { while (!feof($file)) {
@ -277,7 +277,7 @@ function loadHostProfile($profile) {
// file is created, if needed // file is created, if needed
function saveUserProfile($account, $profile) { function saveUserProfile($account, $profile) {
if (!is_object($account)) {echo _("saveUserProfile: \$account has wrong type!"); exit;} if (!is_object($account)) {echo _("saveUserProfile: \$account has wrong type!"); exit;}
$path = getLAMPath() . "/config/profiles/users/" . $profile . ".pru"; $path = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/users/" . $profile . ".pru";
$file = fopen($path, "w"); $file = fopen($path, "w");
// write attributes // write attributes
if ($account->general_group) fputs($file, "general_group: " . $account->general_group . "\n"); if ($account->general_group) fputs($file, "general_group: " . $account->general_group . "\n");
@ -316,7 +316,7 @@ function saveGroupProfile($account, $profile) {
// file is created, if needed // file is created, if needed
function saveHostProfile($account, $profile) { function saveHostProfile($account, $profile) {
if (!is_object($account)) {echo _("saveHostProfile: \$account has wrong type!"); exit;} if (!is_object($account)) {echo _("saveHostProfile: \$account has wrong type!"); exit;}
$path = getLAMPath() . "/config/profiles/hosts/" . $profile . ".prh"; $path = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/hosts/" . $profile . ".prh";
$file = fopen($path, "w"); $file = fopen($path, "w");
// write attributes // write attributes
if ($account->general_group) fputs($file, "general_group: " . $account->general_group . "\n"); if ($account->general_group) fputs($file, "general_group: " . $account->general_group . "\n");