Overhaul ADSL traffic reporting/graphing
This commit is contained in:
@@ -117,6 +117,7 @@ Kohana::modules(array(
|
||||
// 'codebench' => SMDPATH.'codebench', // Benchmarking tool
|
||||
'database' => SMDPATH.'database', // Database access
|
||||
'gchart' => MODPATH.'gchart', // Google Chart Module
|
||||
'highchart' => MODPATH.'highchart', // Highcharts Chart Module
|
||||
// 'image' => SMDPATH.'image', // Image manipulation
|
||||
'khemail' => SMDPATH.'khemail', // Email module for Kohana 3 PHP Framework
|
||||
'minion' => SMDPATH.'minion', // CLI Tasks
|
||||
|
@@ -10,6 +10,8 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Company {
|
||||
public static $instance = array();
|
||||
|
||||
// Our Company Setup object
|
||||
private $so;
|
||||
|
||||
@@ -23,7 +25,12 @@ class Company {
|
||||
}
|
||||
|
||||
public static function instance() {
|
||||
return new Company(ORM::factory('Setup',array('url'=>URL::base('http'))));
|
||||
$x = URL::base('http');
|
||||
|
||||
if (! isset(Company::$instance[$x]))
|
||||
Company::$instance[$x] = new Company(ORM::factory('Setup',array('url'=>$x)));
|
||||
|
||||
return Company::$instance[$x];
|
||||
}
|
||||
|
||||
public function admin() {
|
||||
|
@@ -136,9 +136,8 @@ abstract class ORM_OSB extends ORM {
|
||||
else
|
||||
$array[$k] = $x;
|
||||
|
||||
} else
|
||||
if (! $v)
|
||||
unset($array[$k]);
|
||||
} elseif (! $v AND $v !== 0 AND $v !== '0')
|
||||
unset($array[$k]);
|
||||
|
||||
}
|
||||
|
||||
@@ -207,15 +206,6 @@ abstract class ORM_OSB extends ORM {
|
||||
// Find any fields that have changed, and process them.
|
||||
if ($this->_changed)
|
||||
foreach ($this->_changed as $c) {
|
||||
// Convert to NULL
|
||||
if (in_array($c,$this->_nullifempty)) {
|
||||
if (is_array($this->_object[$c]))
|
||||
$this->_object[$c] = $this->_nullifempty($this->_object[$c]);
|
||||
|
||||
elseif (! $this->_object[$c])
|
||||
$this->_object[$c] = NULL;
|
||||
}
|
||||
|
||||
// Any fields that are blobs, and encode them.
|
||||
if (! is_null($this->_object[$c]) AND $this->_table_columns[$c]['data_type'] == 'blob') {
|
||||
$this->_object[$c] = $this->_blob($this->_object[$c],TRUE);
|
||||
@@ -246,6 +236,24 @@ abstract class ORM_OSB extends ORM {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the Kohana processing so we can null values if required.
|
||||
*/
|
||||
public function values(array $values,array $expected=NULL) {
|
||||
foreach ($values as $k=>$v) {
|
||||
// Convert to NULL
|
||||
if (in_array($k,$this->_nullifempty)) {
|
||||
if (is_array($v))
|
||||
$values[$k] = $this->_nullifempty($v);
|
||||
|
||||
elseif (! $v AND $v !== 0 AND $v !== '0')
|
||||
$values[$k] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::values($values,$expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
|
Reference in New Issue
Block a user