This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/application/classes/config.php
Deon George 130a87aa9a Major work to domain and hosting
Minor updates for ADSL services
Updates to Sort::MAsort()
Move core OSB items under application/
Moved ACCOUNT functions under application
Minor updates to task
2012-01-12 19:53:55 +11:00

56 lines
1.4 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for access system configuration.
*
* @package OSB
* @subpackage Config
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Config extends lnApp_Config {
// Our setup object
public $so;
/**
* Load our site configuration from the DB
*
* We cant do this in __construct(), since Kohana hasn't been fully initialised yet.
*/
public function loadsite() {
// Anti-loop, if we have loaded our record, just return;
if ($this->so AND $this->so->loaded())
return $this;
$this->so = ORM::factory('setup',array('nonssl_url'=>URL::base('http')));
if (! $this->so->loaded())
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
return $this;
}
/**
* Find a list of all database enabled modules
*
* Our available modules are defined in the DB (along with method
* security).
*/
public static function modules() {
static $return = array();
if (! count($return))
foreach (ORM::factory('module')->where('status','=',1)->find_all() as $mo)
$return[$mo->name] = MODPATH.$mo->name;
return $return;
}
public static function moduleexist($module) {
return array_key_exists($module,static::modules()) ? TRUE : FALSE;
}
}
?>