Location: PHPKode > projects > KvCMS Content Management System > kvframework/kvframework/config.php
<?php
/**
 * Main framework configuration file.  Loads framework files and application configurations.
 * @package KvFramework
 * @author Greg McWhirter <hide@address.com>
 * @copyright Copyright &copy; 2006, Greg McWhirter
 * @license BSD License
 * @version 1.0
 */

ob_start("ob_gzhandler");
session_start();

/**
 * Holds the backlogs for files loaded before the logger starts
 * @global array $BACKLOGS
 */
$BACKLOGS = array ();

// +----------------------------------------------------------------------
// |Settings and configuration
// +----------------------------------------------------------------------

/**
 * Application filesystem root directory constant
 */
define("ROOTDIR", dirname(__FILE__) . "/..");
 /**
  * Framwork filesystem directory constant
  */
define("KVF_FRAMEWORK_DIR", ROOTDIR."/kvframework"); //no trailing slash
/**
 * Application includes filesystem directory constant
 */
define("KVF_INCLUDES", ROOTDIR."/includes"); //no trailing slash
/**
 * Application modules filesystem directory constant
 */
define("KVF_MODULES", KVF_INCLUDES."/modules");
/**
 * Application layouts filesystem directory constant
 */
define("KVF_LAYOUTS_DIR", KVF_INCLUDES."/layouts");

//Logger variables
define_syslog_variables();
/**#@+
 * Logger level constant
 */
define ("KVF_LOG_LEMERG", LOG_EMERG);
define ("KVF_LOG_LALERT", LOG_ALERT);
define ("KVF_LOG_LCRITICAL", LOG_CRIT);
define ("KVF_LOG_LERROR", LOG_ERR);
define ("KVF_LOG_LWARNING", LOG_WARNING);
define ("KVF_LOG_LNOTICE", LOG_NOTICE);
define ("KVF_LOG_LINFO", LOG_INFO);
define ("KVF_LOG_LDEBUG", LOG_DEBUG);
/**#@- */

// +----------------------------------------------------------------------
// |Startup actions
// +----------------------------------------------------------------------

// Load Base and things required for logging
/**
 * Get the KvFramwork base class
 */
//require_once ROOTDIR . "/kvframework/kvframework_base.class.php";
//start backlogging

load_file(KVF_FRAMEWORK_DIR . "/ext/struct.class.php", true);
load_file(KVF_FRAMEWORK_DIR . "/logger/kvframework_log.class.php", true);

/**
 * Holds the user-defined logger information.
 * @global kvframework_loginfo_struct $LOGINFO
 */
$LOGINFO = new kvframework_loginfo_struct();
load_file(KVF_INCLUDES . "/configs/log.config.php", true);
kvframework_log :: start_logger($LOGINFO, $BACKLOGS);
//start real logging

load_file(KVF_FRAMEWORK_DIR.  "/kvframework_base.class.php");
load_file(KVF_FRAMEWORK_DIR . "/lib/nakor_core.class.php");
load_file(KVF_FRAMEWORK_DIR . "/sitehandler/kvframework_site.class.php");
load_file(KVF_FRAMEWORK_DIR . "/mailhandler/kvframework_mailer.class.php");
load_file(KVF_FRAMEWORK_DIR . "/dbhandler/kvframework_dbtype.class.php");
load_file(KVF_FRAMEWORK_DIR . "/dbhandler/dbtypes/kvframework_dbtype_mysql.class.php");
#require other db adapters

//load user configs
/**
 * Holds the database connection info.
 * global array $DBINFO
 */
$DBINFO = array ();
load_file(KVF_INCLUDES . "/configs/app.config.php");
load_file(KVF_INCLUDES . "/configs/db.config.php");

/**
 * A wrapper for requiring files and logging such.
 * @global kvframework_loginfo_struct $LOGINFO
 * @global array $BACKLOGS
 * @global array $DBINFO
 * @param string $filename
 * @param boolean $backlog Write log to $BACKLOG instead of using the logger (for files loaded before logger starup)
 * @return boolean Always returns true
 *
 */
function load_file($filename, $backlog = false) {
  global $LOGINFO;
  global $BACKLOGS;
  global $DBINFO;
  require_once $filename;
  $msg = "Loaded file: " . $filename;
  if ($backlog) {
    $BACKLOGS[] = array (
      $msg,
      KVF_LOG_LDEBUG
    );
  } else {
    kvframework_log :: write_log($msg, KVF_LOG_LDEBUG);
  }

  return true;
}

/**
 * PHP Magic autoload function for classes.  Set to only work on site_class files.
 * @param string $class Name of the site_class to be loaded.
 * @return boolean Return the result of the load_file call or false if the requested class was not a site_class
 */
function __autoload($class){
  $class = strtolower($class);
  if(substr($class,-10) == "site_class"){
    return load_file(KVF_MODULES."/".substr($class,0,-11).".module/".substr($class,0,-11).".site_class.php");
  } else {
    return false;
  }
}

/**
 * Holds the database connection globally.
 * @global kvframework_dbtype $db
 */
$db = new kvframework_dbtype_mysql($DBINFO[CONFIG::DB_MODE]);
$temp = CONFIG::RENDER_ENGINE;
$engine = new $temp();
kvframework_base :: startup_base($db);
kvframework_site :: startup($engine);

$SITE_CLASS = null;
?>
Return current item: KvCMS Content Management System