(file) Return to Configuration.class.php CVS log (file) (dir) Up to [Development] / advokit-installer-bak

File: [Development] / advokit-installer-bak / Configuration.class.php (download) / (as text)
Revision: 1.2, Thu Jul 8 12:58:55 2004 UTC (6 years, 2 months ago) by travislow
Branch: MAIN
CVS Tags: r1-1-1-alpha-00, r1-1-0-alpha-00, r0-9-5, r0-9-0, r-0-8-5, r-0-8-2, r-0-8-1, r-0-8-0, HEAD
Changes since 1.1: +22 -7 lines
adding license.

<?
# ======================================================================
# AdvoKit -- a campaign managment tool
# Copyright (C) 2004  OrchidSuites, Inc. (info@orchidsuites.net)
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the AFFERO GENERAL PUBLIC LICENSE
# as published by Affero, Inc.; either version 1
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# AFFERO GENERAL PUBLIC LICENSE for more details.
# 
# You should have received a copy of the AFFERO GENERAL PUBLIC LICENSE
# along with this program; if not, write to Affero, Inc. at
# 510 Third Street - Suite 225, San Francisco, CA 94107, USA
# or visit <http://www.affero.org>.
# ======================================================================

# ======================================================================
# This class encapsulates all configuration information.  Its just
# a bunch of key-value pairs from an INI file.
#
# You can modify these in the course of request processing.
# But you probably shouldn't.
# ======================================================================
class Configuration
{
    var $info = array();

    #.................................................. Configuration
    #
    # Constructor.  Pass in the path to the ini file.
    #
    function Configuration( $configs )
    {
        foreach( $configs as $ini )
        {
            if( ! $ini )
            {
                error_log( date( "M d H:i:s" )." TURBAN PANIC! Configuration file not specified!!! Unable to create Configuration object!", 0 );
                return NULL;
            }
            if( ! file_exists( $ini ) )
            {
                error_log( date( "M d H:i:s" )." TURBAN PANIC! Configuration file '$ini' does not exist!!! Unable to create Configuration object!", 0 );
                return NULL;
            }
            $this->info = array_merge( $this->info, parse_ini_file( $ini ) );
        }
    }
    #.................................................. get
    #
    # Return value from info array, if it exists.
    #
    function get( $key )
    {
        if( isset( $key ) && "" != $key && isset( $this->info[$key] ) )
        {
            return $this->info[$key];
        }
        return NULL;
    }
}
?>

cvsadmin@voter2voter.org
CVS Snapshots (updated daily)