PHP Classes

File: config-dist.php

Recommend this page to a friend!
  Packages of Chris Ravenscroft   NBBS Wizard   config-dist.php   Download  
File: config-dist.php
Role: Example script
Content type: text/plain
Description: Sample configuration file
Class: NBBS Wizard
Create installation wizard pages
Author: By
Last change:
Date: 21 years ago
Size: 2,399 bytes
 

 

Contents

Class file image Download
<?php
/*
The Next BBS - Forums Software
Copyright (C) 2004 Chris F. Ravenscroft

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Questions? We can be reached at http://forums.sf.net
*/

require_once "tidbit.php";

$configloaded = true;

class Config {

function Config()
{
    // Overall settings: cannot go in the database
    $this->debuglevel = 4;
    $this->phpext = "php";
    $this->server = 1;
    // Database settings
    $this->dblayer  = '{db_layer}';
        $this->dbengine = '{db_engine}';
        $this->dbhost = '{db_hostname}';
        $this->dbuser = '{db_user}';
        $this->dbpass = '{db_pass}';
        $this->dbname = '{db_name}';
        $this->dbprfx = '{db_prefix}';
    // # of groups a user may belong to
    $this->user->groups = 4;
}

/**
 * Expert-mode settings: disregard unless you really want to do smart stuff with the software
 * @todo Check these guys!!
 */
function expertSettings()
{
    // Host multi boards?
    $this->master->multisites    = 0;
        // If so, is it based on subdomain? (Variable otherwise...)
        $this->master->usesubdomain    = 1;
        // If multi boards, do we automatically disable pages evaluating? (security risk!)
        $this->master->disableeval    = 1;
        // If multi boards, cripple smarty?
        $this->master->disableparser    = 1;
}

function bootstrap()
{
    global $DB;

    $this->expertSettings();
    $sql = "SELECT config_key,config_value FROM {$this->dbprfx}config WHERE server='{$this->server}'";
    $res = $DB->query($sql);
    $configtxt = '';
    while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
    {
        $row['config_key'] = str_replace('"', '\"', $row['config_key']);
        $row['config_value'] = str_replace('"', '\"', $row['config_value']);
        $configtxt .= '$this->'.$row['config_key'].' = "'.$row['config_value']."\";\n";
    }
    eval($configtxt);
    // All done!
}

}

?>