both gcm_daemon and the web interface are now in the directory src/phpclasses.
+++ /dev/null
-<?php
-/**************************************************************************
-** (c) Copyright 2002, Andromeda Technology & Automation
-** This is free software; you can redistribute it and/or modify it under the
-** terms of the GNU General Public License, see the file COPYING.
-***************************************************************************/
-
-
-/*
-///////////////////////////////////////////////////////////////////////////
-// NAME : configuration
-// BASECLASS :
-// MEMBERS :
-// OPERATORS :
-// METHODS : read
-//
-// DESCRIPTION : Handle configurational parameters for the application.
-// Many applications need some permanently stored configurational
-// data. The information is usually stored in two places: A system-
-// wide configuration file and a configuration file per user.
-// The content of the configuration file is in XML format.
-// The configuration base class takes care of finding the configuration
-// files, e.g. in /etc/app.conf or in /usr/loca/etc/app.conf
-// The config files are parsed with the gnome XML parser and a
-// framework is provided to find configurational items.
-//
-// RELATIONS :
-// SEE ALSO :
-// LAST MODIFIED : Jul 29, 2002
-///////////////////////////////////////////////////////////////////////////
-*/
-
-
-class configuration
-{
- var $system, $user;
-
- function configuration()
- {
- $system = false;
- $user = false;
- }
-
- function xmlFindTag($node, $tag)
- {
- $element = false;
- $i = 0;
-
- while (!$element && $i < sizeof($node))
- {
- if ($node[$i]->type == XML_ELEMENT_NODE && $node[$i]->tagname == $tag)
- {
- $element = $node[$i];
- }
- $i++;
- }
-
- return $element;
- }
-
- function read($app_name)
- {
- $filename = "/etc/" . $app_name . ".conf";
- $this->system = xmldocfile($filename);
-
- if (!$this->system)
- {
- $filename = "/usr/local/etc/" . $app_name . ".conf";
- $this->system = xmldocfile($filename);
- }
-
- if ($this->system)
- {
- $root = $this->system->root();
-
- if ($root->tagname != $app_name)
- {
- print("Configuration error: Wrong configuration file.<br>");
- $this->system = false;
- }
- }
- else
- {
- print("Configuration error: Configuration file for $app_name not found.<br>");
- }
- }
-
- function find_parameter($section, $parameter)
- {
- $param_value = "";
-
- if ($this->system)
- {
- $root_node = $this->system->root();
- $section_node = $this->xmlFindTag($root_node->children(), $section);
- if ($section_node)
- {
- $param_node = $this->xmlFindTag($section_node->children(), $parameter);
- if ($param_node)
- {
- $param_node = $param_node->children();
- }
- if ($param_node && $param_node[0]->type == XML_TEXT_NODE)
- {
- $param_value = $param_node[0]->content;
- }
- }
- }
-
- return $param_value;
- }
-}
-
-?>
+++ /dev/null
-<?php
-/**************************************************************************
-** (c) Copyright 2002, Andromeda Technology & Automation
-** This is free software; you can redistribute it and/or modify it under the
-** terms of the GNU General Public License, see the file COPYING.
-***************************************************************************/
-
-require_once('configuration.class.php');
-
-/*
-///////////////////////////////////////////////////////////////////////////
-// NAME : gnucomo_config
-// BASECLASS : configuration
-// MEMBERS :
-// OPERATORS :
-// METHODS : Database - Obtain the database access string
-//
-// DESCRIPTION : Provides Gnucomo-specific configuration functions
-//
-// RELATIONS :
-// SEE ALSO :
-// LAST MODIFIED : Sep 26, 2002
-///////////////////////////////////////////////////////////////////////////
-*/
-
-class gnucomo_config extends configuration
-{
-
- // Return the database access string.
-
- function Database()
- {
- $access_string = "";
-
- $param = $this->find_parameter("database", "name");
- if ($param != "")
- {
- $access_string .= "dbname=" . $param;
- }
-
- $param = $this->find_parameter("database", "user");
- if ($param != "")
- {
- $access_string .= " user=" . $param;
- }
-
- $param = $this->find_parameter("database", "password");
- if ($param != "")
- {
- $access_string .= " password=" . $param;
- }
-
- $param = $this->find_parameter("database", "host");
- if ($param != "")
- {
- $access_string .= " host=" . $param;
- }
-
- $param = $this->find_parameter("database", "port");
- if ($param != "")
- {
- $access_string .= " port=" . $param;
- }
- return $access_string;
- }
-};
-?>
+++ /dev/null
-<?php
-/**************************************************************************
-** (c) Copyright 2002, Andromeda Technology & Automation
-** This is free software; you can redistribute it and/or modify it under the
-** terms of the GNU General Public License, see the file COPYING.
-***************************************************************************/
-
-
-/*
-///////////////////////////////////////////////////////////////////////////
-// NAME : configuration
-// BASECLASS :
-// MEMBERS :
-// OPERATORS :
-// METHODS : read
-//
-// DESCRIPTION : Handle configurational parameters for the application.
-// Many applications need some permanently stored configurational
-// data. The information is usually stored in two places: A system-
-// wide configuration file and a configuration file per user.
-// The content of the configuration file is in XML format.
-// The configuration base class takes care of finding the configuration
-// files, e.g. in /etc/app.conf or in /usr/loca/etc/app.conf
-// The config files are parsed with the gnome XML parser and a
-// framework is provided to find configurational items.
-//
-// RELATIONS :
-// SEE ALSO :
-// LAST MODIFIED : Jul 29, 2002
-///////////////////////////////////////////////////////////////////////////
-*/
-
-
-class configuration
-{
- var $system, $user;
-
- function configuration()
- {
- $system = false;
- $user = false;
- }
-
- function xmlFindTag($node, $tag)
- {
- $element = false;
- $i = 0;
-
- while (!$element && $i < sizeof($node))
- {
- if ($node[$i]->type == XML_ELEMENT_NODE && $node[$i]->tagname == $tag)
- {
- $element = $node[$i];
- }
- $i++;
- }
-
- return $element;
- }
-
- function read($app_name)
- {
- $filename = "/etc/" . $app_name . ".conf";
- if (!is_readable($filename))
- {
- $filename = "/usr/local/etc/" . $app_name . ".conf";
- }
- if (is_readable($filename))
- {
-
- $this->system = xmldocfile($filename);
-
- if ($this->system)
- {
- $root = $this->system->root();
-
- if ($root->tagname != $app_name)
- {
- print("Configuration error: Wrong configuration file.<br>");
- $this->system = false;
- }
- }
- }
- else
- {
- print("Configuration error: Configuration file for $app_name not found.<br>");
- }
- }
-
- function find_parameter($section, $parameter)
- {
- $param_value = "";
-
- if ($this->system)
- {
- $root_node = $this->system->root();
- $section_node = $this->xmlFindTag($root_node->children(), $section);
- if ($section_node)
- {
- $param_node = $this->xmlFindTag($section_node->children(), $parameter);
- if ($param_node)
- {
- $param_node = $param_node->children();
- }
- if ($param_node && $param_node[0]->type == XML_TEXT_NODE)
- {
- $param_value = $param_node[0]->content;
- }
- }
- }
-
- return $param_value;
- }
-}
-
-?>
+++ /dev/null
-<?php
-/**************************************************************************
-** (c) Copyright 2002, Andromeda Technology & Automation
-** This is free software; you can redistribute it and/or modify it under the
-** terms of the GNU General Public License, see the file COPYING.
-***************************************************************************/
-
-require_once('configuration.class.php');
-
-/*
-///////////////////////////////////////////////////////////////////////////
-// NAME : gnucomo_config
-// BASECLASS : configuration
-// MEMBERS :
-// OPERATORS :
-// METHODS : Database - Obtain the database access string
-//
-// DESCRIPTION : Provides Gnucomo-specific configuration functions
-//
-// RELATIONS :
-// SEE ALSO :
-// LAST MODIFIED : Nov 21, 2002
-///////////////////////////////////////////////////////////////////////////
-*/
-
-class gnucomo_config extends configuration
-{
-
- // Return the database access string.
-
- function Database($usr = "", $pw = "")
- {
- $access_string = "";
-
- $param = $this->find_parameter("database", "name");
- if ($param != "")
- {
- $access_string .= "dbname=" . $param;
- }
-
- if ($usr == "")
- {
- $param = $this->find_parameter("database", "user");
- if ($param != "")
- {
- $access_string .= " user=" . $param;
- }
- }
- else
- {
- $access_string .= " user=" . $usr;
- }
-
- if ($pw == "")
- {
- $param = $this->find_parameter("database", "password");
- if ($param != "")
- {
- $access_string .= " password=" . $param;
- }
- }
- else
- {
- $access_string .= " password=" . $pw;
- }
-
- $param = $this->find_parameter("database", "host");
- if ($param != "")
- {
- $access_string .= " host=" . $param;
- }
-
- $param = $this->find_parameter("database", "port");
- if ($param != "")
- {
- $access_string .= " port=" . $param;
- }
- return $access_string;
- }
-};
-?>