8453adb7c6cb598b3601b80803220aa3c81706de
[gnucomo.git] / src / gcm_daemon / classes / gnucomo_config.class.php
1 <?php
2 /**************************************************************************
3 **  (c) Copyright 2002, Andromeda Technology & Automation
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************/
7
8 require_once('configuration.class.php');
9
10 /*
11 ///////////////////////////////////////////////////////////////////////////
12 //  NAME           : gnucomo_config
13 //  BASECLASS      : configuration
14 //  MEMBERS        : 
15 //  OPERATORS      :
16 //  METHODS        : Database - Obtain the database access string
17 //
18 //  DESCRIPTION    : Provides Gnucomo-specific configuration functions
19 //
20 //  RELATIONS      :
21 //  SEE ALSO       :
22 //  LAST MODIFIED  : Sep 26, 2002
23 ///////////////////////////////////////////////////////////////////////////
24 */
25
26 class gnucomo_config extends configuration
27 {
28
29    // Return the database access string.
30
31    function Database()
32    {
33       $access_string = "";
34
35       $param = $this->find_parameter("database", "name");
36       if ($param != "")
37       {
38          $access_string .= "dbname=" . $param;
39       }
40
41       $param = $this->find_parameter("database", "user");
42       if ($param != "")
43       {
44          $access_string .= " user=" . $param;
45       }
46
47       $param = $this->find_parameter("database", "password");
48       if ($param != "")
49       {
50          $access_string .= " password=" . $param;
51       }
52
53       $param = $this->find_parameter("database", "host");
54       if ($param != "")
55       {
56          $access_string .= " host=" . $param;
57       }
58
59       $param = $this->find_parameter("database", "port");
60       if ($param != "")
61       {
62          $access_string .= " port=" . $param;
63       }
64       return $access_string;
65    }
66 };
67 ?>