diff --git a/application/bootstrap.php b/application/bootstrap.php
index dbe25e5b..e06af2f9 100644
--- a/application/bootstrap.php
+++ b/application/bootstrap.php
@@ -115,7 +115,7 @@ Kohana::$config->attach(new Config_File);
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
- 'lnapp' => MODPATH.'lnApp', // lnApp Base Application Tools
+ 'lnapp' => MODPATH.'lnapp', // lnApp Base Application Tools
'oauth' => MODPATH.'oauth', // OAuth Module for External Authentication
'auth' => SMDPATH.'auth', // Basic authentication
'cache' => SMDPATH.'cache', // Caching with multiple backends
diff --git a/application/classes/Company.php b/application/classes/Company.php
index dd0dc4f3..93de1d45 100644
--- a/application/classes/Company.php
+++ b/application/classes/Company.php
@@ -77,10 +77,6 @@ class Company {
return $this->so->language;
}
- public function logo() {
- return Config::logo();
- }
-
public function logo_file() {
list ($path,$suffix) = explode('.',Config::$logo);
@@ -119,10 +115,6 @@ class Company {
return $this->so->site_details('address2') ? implode($ln,array($this->so->site_details('address1'),$this->so->site_details('address2'))) : $this->so->site_details('address1');
}
- public function sitemode() {
- return $this->so->status;
- }
-
public function taxid() {
// Tax ID details are stored in invoice config
$mc = $this->so->module_config('invoice');
diff --git a/application/classes/Config.php b/application/classes/Config.php
index 387d864b..03732e9a 100644
--- a/application/classes/Config.php
+++ b/application/classes/Config.php
@@ -49,62 +49,10 @@ class Config extends Kohana_Config {
return Config::$_instance;
}
- /**
- * Return our caching mechanism
- */
- public static function cachetype() {
- return is_null(Kohana::$config->load('config')->cache_type) ? 'file' : Kohana::$config->load('config')->cache_type;
- }
-
public static function copywrite() {
return '(c) Open Source Billing Development Team';
}
- public static function country() {
- return Company::instance()->country();
- }
-
- /**
- * Show a date using a site configured format
- */
- public static function date($date) {
- return (is_null($date) OR ! $date) ? '' : date(Company::instance()->date_format(),$date);
- }
-
- /**
- * Show a date using a site configured format
- * @note We need this function here, since we call self:: methods, which need to resolve to the child class.
- */
- public static function datetime($date) {
- return sprintf('%s %s',self::date($date),self::time($date));
- }
-
- public static function language() {
- return Company::instance()->language();
- }
-
- /**
- * The URI to show for the login prompt.
- * Normally if the user is logged in, we can replace it with something else
- */
- public static function login_uri() {
- return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? HTML::anchor(URL::link('user','account/edit'),$ao->name()) : HTML::anchor('login',_('Login'));
- }
-
- public static function logout_uri() {
- return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? HTML::anchor('logout','Logout',array('class'=>'lnk_logout')) : '';
- }
-
- public static function logo() {
- return HTML::image(self::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
- }
-
- public static function logo_uri($protocol=NULL) {
- list ($path,$suffix) = explode('.',self::$logo);
-
- return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>self::sitename())),$protocol);
- }
-
/**
* Find a list of all database enabled modules
*
@@ -141,24 +89,6 @@ class Config extends Kohana_Config {
return array_key_exists(strtolower($module),self::modules()) ? TRUE : FALSE;
}
- /**
- * Work out our site ID for multiehosting
- */
- public static function siteid($format=FALSE) {
- return Company::instance()->site($format);
- }
-
- /**
- * Work out our site mode (dev,test,prod)
- */
- public static function sitemode() {
- return Company::instance()->sitemode();
- }
-
- public static function sitename() {
- return Company::instance()->name();
- }
-
/**
* See if our emails for the template should be sent to configured admin(s)
*
@@ -173,17 +103,5 @@ class Config extends Kohana_Config {
else
return $config[$template];
}
-
- public static function theme() {
- // If we are using user admin pages (and login), we'll choose the admin theme.
- return 'theme/'.(URL::admin_url() ? Kohana::$config->load('config')->theme_admin : Kohana::$config->load('config')->theme);
- }
-
- /**
- * Show a date using a site configured format
- */
- public static function time($date) {
- return date(Company::instance()->time_format(),($date ? $date : time()));
- }
}
?>
diff --git a/application/classes/Controller/Debug.php b/application/classes/Controller/Debug.php
deleted file mode 100644
index bf24b47c..00000000
--- a/application/classes/Controller/Debug.php
+++ /dev/null
@@ -1,36 +0,0 @@
-__METHOD__,
- 'site'=>Config::site(),
- 'siteID'=>Company::instance()->site(),
- 'siteMode'=>Config::sitemodeverbose(),
- 'modules'=>Config::appmodules(),
- ));
-
- Block::add(array(
- 'title'=>_('Site debug'),
- 'body'=>$output,
- ));
- }
-}
-?>
diff --git a/application/classes/Kohana.php b/application/classes/Kohana.php
index c8ab0e21..921e1f25 100644
--- a/application/classes/Kohana.php
+++ b/application/classes/Kohana.php
@@ -37,9 +37,9 @@ abstract class Kohana extends Kohana_Core {
$prefixes = array('');
// Our search order.
- array_unshift($prefixes,Config::theme().'/');
- array_unshift($prefixes,sprintf('site/%s/',Config::siteid()));
- array_unshift($prefixes,sprintf('site/%s/%s/',Config::siteid(),Config::theme()));
+ array_unshift($prefixes,Site::Theme().'/');
+ array_unshift($prefixes,sprintf('site/%s/',Site::ID()));
+ array_unshift($prefixes,sprintf('site/%s/%s/',Site::ID(),Site::Theme()));
foreach ($prefixes as $p)
if ($x = parent::find_file($dir,$p.$file,$ext,$array))
diff --git a/application/classes/Model/Account.php b/application/classes/Model/Account.php
index e6195980..e8fe2fdb 100644
--- a/application/classes/Model/Account.php
+++ b/application/classes/Model/Account.php
@@ -29,10 +29,10 @@ class Model_Account extends Model_Auth_UserDefault {
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_last'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
diff --git a/application/classes/Model/Account/Log.php b/application/classes/Model/Account/Log.php
index 8bd9206d..a5aa201e 100644
--- a/application/classes/Model/Account/Log.php
+++ b/application/classes/Model/Account/Log.php
@@ -20,7 +20,7 @@ class Model_Account_Log extends ORM_OSB {
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::datetime',array(':value')),
+ array('Site::Datetime',array(':value')),
),
);
}
diff --git a/application/classes/Model/Setup.php b/application/classes/Model/Setup.php
index 1bf70a67..9c68c725 100644
--- a/application/classes/Model/Setup.php
+++ b/application/classes/Model/Setup.php
@@ -22,6 +22,11 @@ class Model_Setup extends ORM_OSB {
'language'=>array('foreign_key'=>'id','far_key'=>'language_id'),
);
+ protected $_compress_column = array(
+ 'module_config',
+ 'site_details',
+ );
+
protected $_save_message = TRUE;
// Validation rules
diff --git a/application/classes/ORM/OSB.php b/application/classes/ORM/OSB.php
index 9e94ce45..f7ddc572 100644
--- a/application/classes/ORM/OSB.php
+++ b/application/classes/ORM/OSB.php
@@ -15,23 +15,6 @@ abstract class ORM_OSB extends ORM {
*/
protected $_db = 'default';
- protected $_created_column = array('column'=>'date_orig','format'=>TRUE);
- protected $_updated_column = array('column'=>'date_last','format'=>TRUE);
-
- // Our attributes used in forms.
- protected $_form = array();
-
- // Our attributes that should be converted to NULL when empty
- protected $_nullifempty = array();
-
- // Our attribute values that need to be stored as serialized
- protected $_serialize_column = array();
-
- // If we need to load any sub items on loading this model
- protected $_sub_items = array();
- protected $_sub_items_load = array();
- protected $_sub_items_sorted = FALSE;
-
// Rules to assist with site ID and getting next record ID for inserts.
public function rules() {
return array(
@@ -44,136 +27,12 @@ abstract class ORM_OSB extends ORM {
);
}
- /**
- * Retrieve and Store DB BLOB data.
- */
- private function _blob($data,$set=FALSE) {
- try {
- return $set ? gzcompress($this->_serialize($data,$set)) : $this->_serialize(gzuncompress($data));
-
- // Maybe the data isnt compressed?
- } catch (Exception $e) {
- return $this->_serialize($data,$set);
- }
- }
-
- /**
- * Auto process some data as it comes from the database
- * @see parent::__get()
- */
- public function __get($column) {
- if (array_key_exists($column,$this->_table_columns)) {
- // If the column is a blob, we'll decode it automatically
- if (
- $this->_table_columns[$column]['data_type'] == 'blob'
- AND ! is_null($this->_object[$column])
- AND ! isset($this->_changed[$column])
- AND (! isset($this->_table_columns[$column]['auto_convert']) OR ! $this->_table_columns[$column]['auto_convert'])
- ) {
-
- // In case our blob hasnt been saved as one.
- try {
- $this->_object[$column] = $this->_blob($this->_object[$column]);
- }
- catch(Exception $e) {
- HTTP_Exception::factory(501,Kohana_Exception::text($e));
- }
-
- $this->_table_columns[$column]['auto_convert'] = TRUE;
- }
-
- // If the column is a serialized object, we'll unserialize it.
- if (
- in_array($column,$this->_serialize_column)
- AND is_string($this->_object[$column])
- AND ! is_null($this->_object[$column])
- AND ! isset($this->_changed[$column])
- AND (! isset($this->_table_columns[$column]['unserialized']) OR ! $this->_table_columns[$column]['unserialized'])
- ) {
-
- // In case our object hasnt been saved as serialized.
- try {
- $this->_object[$column] = unserialize($this->_object[$column]);
- }
- catch(Exception $e) {
- HTTP_Exception::factory(501,Kohana_Exception::text($e));
- }
-
- $this->_table_columns[$column]['unserialized'] = TRUE;
- }
- }
-
- return parent::__get($column);
- }
-
- /**
- * Intercept our object load, so that we can load our subitems
- */
- protected function _load_values(array $values) {
- parent::_load_values($values);
-
- $sort = FALSE;
- if ($this->_loaded AND $this->_sub_items_load AND count($this->_sub_items_load) == 1)
- foreach ($this->_sub_items_load as $item => $sort)
- $this->_sub_items = $this->$item->find_all()->as_array();
-
- if ($sort) {
- Sort::MAsort($this->_sub_items,$sort);
- $this->_sub_items_sorted = TRUE;
- }
-
- return $this;
- }
-
- /**
- * If a column is marked to be nullified if it is empty, this is where it is done.
- */
- private function _nullifempty(array $array) {
- foreach ($array as $k=>$v) {
- if (is_array($v)) {
- if (is_null($x=$this->_nullifempty($v)))
- unset($array[$k]);
- else
- $array[$k] = $x;
-
- } elseif (! $v AND $v !== 0 AND $v !== '0')
- unset($array[$k]);
-
- }
-
- return count($array) ? $array : NULL;
- }
-
- /**
- * Try and (un)serialize our data, and if it fails, just return it.
- */
- private function _serialize($data,$set=FALSE) {
- try {
- return $set ? serialize($data) : unserialize($data);
-
- // Maybe the data serialized?
- } catch (Exception $e) {
- return $data;
- }
- }
-
public function config($key) {
$mc = Config::instance()->module_config($this->_object_name);
return empty($mc[$key]) ? '' : $mc[$key];
}
- public function dump() {
- $result = array();
-
- $result['this'] = $this->object();
-
- foreach ($this->_sub_items as $o)
- $result['sub'][] = $o->dump();
-
- return $result;
- }
-
/**
* Get Next record id
*
@@ -209,31 +68,6 @@ abstract class ORM_OSB extends ORM {
return ORM::factory('Module',array('name'=>$this->_table_name));
}
- public function save(Validation $validation=NULL) {
- // Find any fields that have changed, and process them.
- if ($this->_changed)
- foreach ($this->_changed as $c) {
- // 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);
-
- // We need to reset our auto_convert flag
- if (isset($this->_table_columns[$c]['auto_convert']))
- $this->_table_columns[$c]['auto_convert'] = FALSE;
-
- // Any fields that should be seriailzed, we'll do that.
- } elseif (is_array($this->_object[$c]) AND in_array($c,$this->_serialize_column)) {
- $this->_object[$c] = serialize($this->_object[$c]);
- }
-
- // Test if the value has still changed
- if ($this->_original_values AND $this->_object[$c] == $this->_original_values[$c])
- unset($this->_changed[$c]);
- }
-
- return parent::save($validation);
- }
-
/**
* Set the site ID attribute for each row update
*/
@@ -247,28 +81,6 @@ abstract class ORM_OSB extends ORM {
return TRUE;
}
- public function subitems() {
- return $this->_sub_items;
- }
-
- /**
- * 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
*/
diff --git a/application/classes/Period.php b/application/classes/Period.php
index ee199795..40fea494 100644
--- a/application/classes/Period.php
+++ b/application/classes/Period.php
@@ -118,7 +118,7 @@ class Period {
if ($df)
foreach (array('start','date','end') as $key)
- $result[$key] = Config::date($result[$key]);
+ $result[$key] = Site::Date($result[$key]);
return $result;
}
diff --git a/application/classes/Site.php b/application/classes/Site.php
new file mode 100644
index 00000000..59254222
--- /dev/null
+++ b/application/classes/Site.php
@@ -0,0 +1,39 @@
+date_format(),$date);
+ }
+
+ /**
+ * Work out our site ID for multihosting
+ */
+ public static function ID($format=FALSE) {
+ return Company::instance()->site($format);
+ }
+
+ public static function Theme() {
+ // If we are using user admin pages (and login), we'll choose the admin theme.
+ return 'theme/'.(URL::admin_url() ? Kohana::$config->load('config')->theme_admin : Kohana::$config->load('config')->theme);
+ }
+
+ /**
+ * Show a date using a site configured format
+ */
+ public static function Time($date) {
+ return date(Company::instance()->time_format(),($date ? $date : time()));
+ }
+}
+?>
diff --git a/application/classes/StaticList.php b/application/classes/StaticList.php
deleted file mode 100644
index b51b009f..00000000
--- a/application/classes/StaticList.php
+++ /dev/null
@@ -1,66 +0,0 @@
-_table();
-
- if (! $table)
- return 'No Table';
- elseif (! $id AND empty($table[$id]))
- return '';
- elseif (empty($table[$id]))
- return sprintf('No Value (%s)',$id);
- else
- return $table[$id];
- }
-
- /**
- * Setup our class instantiation
- * @note This must be declared in the child class due to static scope
- */
- public static function factory() {
- $x = get_called_class();
-
- return new $x;
- }
-
- /**
- * Renders form input
- *
- * @param string Form name to render
- * @param string Default value to populate in the Form input.
- */
- public static function form($name,$default='',$addblank=FALSE,array $attributes=NULL) {
- $table = self::factory()->_table();
-
- if ($addblank)
- $table = array_merge(array(''=>' '),$table);
-
- return Form::Select($name,$table,$default,$attributes);
- }
-
- /**
- * Lists our available keys
- */
- public static function keys() {
- return array_keys(self::factory()->_table());
- }
-
- public static function table() {
- return self::factory()->_table();
- }
-}
-?>
diff --git a/application/classes/StaticList/YesNo.php b/application/classes/StaticList/YesNo.php
deleted file mode 100644
index e684f0e3..00000000
--- a/application/classes/StaticList/YesNo.php
+++ /dev/null
@@ -1,29 +0,0 @@
-_('No'),
- 1=>_('Yes'),
- );
- }
-
- public static function get($value,$format=FALSE) {
- if (! $value)
- $value = 0;
-
- return $format ? View::factory(Config::theme().'/label/bool')
- ->set('label',$value ? 'label-success' : '')
- ->set('column',self::factory()->_get($value)) : $value;
- }
-}
-?>
diff --git a/application/classes/URL.php b/application/classes/URL.php
new file mode 100644
index 00000000..b469dcf3
--- /dev/null
+++ b/application/classes/URL.php
@@ -0,0 +1,42 @@
+'a',
+ 'reseller'=>'r',
+ 'affiliate'=>'f',
+ 'user'=>'u',
+ );
+
+ public static function navbar() {
+ $result = array();
+
+ foreach (array_reverse(self::$method_directory) as $k=>$v)
+ switch ($k) {
+ case 'admin': $result[$k] = array('name'=>'Administrator','icon'=>'icon-globe');
+ break;
+
+ case 'affiliate':
+ case 'reseller': $result[$k] = array('name'=>'Reseller','icon'=>'icon-th-list');
+ break;
+
+ case 'user': $result[$k] = array('name'=>Auth::instance()->get_user()->name(),'icon'=>'icon-user');
+ break;
+
+ default: $result[$k] = array('name'=>$k,'icon'=>'icon-question-sign');
+ }
+
+ return $result;
+ }
+}
+?>
diff --git a/application/config/debug.php b/application/config/debug.php
index 54d97f36..e486a0de 100644
--- a/application/config/debug.php
+++ b/application/config/debug.php
@@ -12,8 +12,6 @@
return array
(
- 'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
- 'etag'=>FALSE, // Force generating ETAGS
'checkout_notify'=>FALSE, // Test mode to test a particular checkout_notify item
'disabled_noaccess_redirect'=>FALSE, // Disable redirect when noaccess
'email_admin_only'=> array( // Override emails and send them to an admin instead
@@ -23,7 +21,6 @@ return array
// 'deon@leenooks.net'=>'Deon George',
),
'invoice'=>0, // Number of invoices to generate in a pass
- 'site'=>FALSE, // Glogal site debug
'show_errors'=>FALSE, // Show errors instead of logging in the DB.
'show_inactive'=>FALSE, // Show Inactive Items
'task_sim'=>FALSE, // Simulate running tasks
diff --git a/application/media/js/custom.js b/application/media/js/custom.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/application/views/theme/baseadmin/page.php b/application/views/theme/baseadmin/page.php
index 896a084e..41ad8b12 100644
--- a/application/views/theme/baseadmin/page.php
+++ b/application/views/theme/baseadmin/page.php
@@ -1,7 +1,7 @@
- title; ?>
+
@@ -19,12 +19,12 @@
echo HTML::style('media/theme/bootstrap/css/bootstrap-responsive.min.css');
echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css');
} else {
- echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css');
- echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css');
- echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css');
+ echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'));
+ echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'));
+ echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'));
}
- echo HTML::style($meta->secure().'fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800');
+ echo HTML::style(Site::Protocol('fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'));
echo HTML::style('media/css/ui-lightness/jquery-ui-1.10.0.custom.min.css');
echo HTML::style('media/theme/baseadmin/css/base-admin-2.css');
echo HTML::style('media/theme/baseadmin/css/base-admin-2-responsive.css');
@@ -39,13 +39,14 @@
@@ -69,15 +71,15 @@
-
- Home
+ Home
- get_user()) AND $ao->isAdmin()) : ?>
+ get_user()) AND $ao->isAdmin()) : ?>
-
- Admin
+ Admin
isReseller()) : ?>
-
- Reseller
+ Reseller
@@ -111,9 +113,9 @@
echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js');
echo HTML::script('media/js/lodash/lodash-1.2.1.min.js');
} else {
- echo HTML::script($meta->secure().'code.jquery.com/jquery-1.9.1.min.js');
- echo HTML::script($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js');
- echo HTML::script($meta->secure().'cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js');
+ echo HTML::script(Site::Protocol('code.jquery.com/jquery-1.9.1.min.js'));
+ echo HTML::script(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'));
+ echo HTML::script(Site::Protocol('cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js'));
}
echo HTML::script('media/theme/baseadmin/js/backtotop.js');
diff --git a/modules/adsl/classes/Model/Service/Plugin/Adsl.php b/modules/adsl/classes/Model/Service/Plugin/Adsl.php
index 40026975..114ac475 100644
--- a/modules/adsl/classes/Model/Service/Plugin/Adsl.php
+++ b/modules/adsl/classes/Model/Service/Plugin/Adsl.php
@@ -25,10 +25,10 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
protected $_display_filters = array(
'service_connect_date'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'service_contract_date'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
);
@@ -66,14 +66,14 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
* Calculate our contract start and end dates
*/
public function contract_date_start($format=FALSE) {
- return $format ? Config::date($this->service_contract_date) : $this->service_contract_date;
+ return $format ? Site::Date($this->service_contract_date) : $this->service_contract_date;
}
public function contract_date_end($format=FALSE) {
// ADSL Contract Terms are held in the ADSL Plan
$x = strtotime(sprintf('+%s months',$this->service->plugin()->contract_term),$this->service_contract_date);
- return $format ? Config::date($x) : $x;
+ return $format ? Site::Date($x) : $x;
}
/**
@@ -248,7 +248,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
$google = GoogleChart::factory('Legacy')
->type('vertical_bar')
- ->title(sprintf('DSL traffic usage as at %s',Config::date($data['last'])));
+ ->title(sprintf('DSL traffic usage as at %s',Site::Date($data['last'])));
foreach ($traffic_type as $k => $details)
$google->sdata(array('yl'=>($x=$this->traffic->friendly($k))),array($x=>$details));
@@ -277,7 +277,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
case 'PEAK_AVERAGE_REMAIN': $value = ((isset($data['used']['base_down_peak']) AND ($data['allow']['base_down_peak'] > $data['used']['base_down_peak']) AND $daysleft) ? round(($data['allow']['base_down_peak']-$data['used']['base_down_peak'])/$daysleft,2).' MB' : '-'); break;
case 'SERVICE_NUMBER': $value = $this->service_number; break;
- case 'USAGE_DATE': $value = Config::date($data['last']); break;
+ case 'USAGE_DATE': $value = Site::Date($data['last']); break;
case 'USER_NAME': $value = $this->service->account->name(); break;
default:
$value = '';
diff --git a/modules/charge/classes/Model/Charge.php b/modules/charge/classes/Model/Charge.php
index a09ed026..93ac17cb 100644
--- a/modules/charge/classes/Model/Charge.php
+++ b/modules/charge/classes/Model/Charge.php
@@ -36,10 +36,10 @@ class Model_Charge extends ORM_OSB implements Invoicable {
array('Currency::display',array(':value')),
),
'date_orig'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_charge'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'processed'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
diff --git a/modules/checkout/classes/Model/Checkout/Notify.php b/modules/checkout/classes/Model/Checkout/Notify.php
index 9d284d27..0950e959 100644
--- a/modules/checkout/classes/Model/Checkout/Notify.php
+++ b/modules/checkout/classes/Model/Checkout/Notify.php
@@ -17,10 +17,14 @@ class Model_Checkout_Notify extends ORM_OSB implements Invoicable {
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
);
+ protected $_compress_column = array(
+ 'data',
+ );
+
public function invoice_item($item_type) {
return sprintf('Payment Fee: %s',$this->checkout->name);
}
diff --git a/modules/domain/classes/Model/Service/Plugin/Domain.php b/modules/domain/classes/Model/Service/Plugin/Domain.php
index fbd174a8..4487b871 100644
--- a/modules/domain/classes/Model/Service/Plugin/Domain.php
+++ b/modules/domain/classes/Model/Service/Plugin/Domain.php
@@ -23,13 +23,13 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
protected $_display_filters = array(
'domain_expire'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'domain_name'=>array(
array('strtoupper',array(':value')),
),
'registrar_lastsync'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
);
diff --git a/modules/email/classes/Email/Template.php b/modules/email/classes/Email/Template.php
index 32de7a0d..0c875dab 100644
--- a/modules/email/classes/Email/Template.php
+++ b/modules/email/classes/Email/Template.php
@@ -24,18 +24,18 @@ class Email_Template {
throw new Kohana_Exception('Email template :template not defined in DB',array(':template'=>$template));
if (is_null($language_id))
- $language_id = Config::language();
+ $language_id = Company::instance()->language();
$this->_etto = $eto->translate
->where_open()
->where('language_id','=',$language_id)
- ->or_where('language_id','=',Config::language())
+ ->or_where('language_id','=',Company::instance()->language())
->where_close()
->find();
if (! $this->_etto->loaded())
throw new Kohana_Exception('No template (:template) found for user language (:language_id) or default language (:default_lang)',
- array(':template'=>$eto->name,':language_id'=>$language_id,':default_lang'=>Config::language()));
+ array(':template'=>$eto->name,':language_id'=>$language_id,':default_lang'=>Company::instance()->language()));
}
public function __set($key,$value) {
diff --git a/modules/email/classes/Model/Email/Log.php b/modules/email/classes/Model/Email/Log.php
index dab53317..5992d26d 100644
--- a/modules/email/classes/Model/Email/Log.php
+++ b/modules/email/classes/Model/Email/Log.php
@@ -22,9 +22,13 @@ class Model_Email_Log extends ORM_OSB {
'id'=>'DESC',
);
+ protected $_compress_column = array(
+ 'data',
+ );
+
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::datetime',array(':value')),
+ array('Site::Datetime',array(':value')),
),
);
diff --git a/modules/export/classes/Controller/Reseller/Export.php b/modules/export/classes/Controller/Reseller/Export.php
index 66cde2ea..9937524a 100644
--- a/modules/export/classes/Controller/Reseller/Export.php
+++ b/modules/export/classes/Controller/Reseller/Export.php
@@ -88,7 +88,7 @@ class Controller_Reseller_Export extends Controller_Export {
->prepend(array(
'id'=>array('checkbox'=>'id[]'),
))->filters(array(
- 'exported'=>array(array('Config::date',array(':value'))),
+ 'exported'=>array(array('Site::Date',array(':value'))),
));
$output .= '
';
diff --git a/modules/export/classes/Model/Export/DataMap.php b/modules/export/classes/Model/Export/DataMap.php
index 05ee7a8a..fa845472 100644
--- a/modules/export/classes/Model/Export/DataMap.php
+++ b/modules/export/classes/Model/Export/DataMap.php
@@ -16,6 +16,10 @@ class Model_Export_DataMap extends ORM_OSB {
'module' => array(),
);
+ protected $_compress_column = array(
+ 'map_data',
+ );
+
public function list_itemsnoexport(Model $o,$emoid,$desc='title()') {
$result = array();
diff --git a/modules/export/classes/Model/Export/Module.php b/modules/export/classes/Model/Export/Module.php
index c0b0f598..74f394e5 100644
--- a/modules/export/classes/Model/Export/Module.php
+++ b/modules/export/classes/Model/Export/Module.php
@@ -22,6 +22,10 @@ class Model_Export_Module extends ORM_OSB {
'export_item' => array('far_key'=>'id'),
);
+ protected $_compress_column = array(
+ 'display',
+ );
+
protected $_nullifempty = array(
'display',
);
diff --git a/modules/host/classes/Model/Service/Plugin/Host.php b/modules/host/classes/Model/Service/Plugin/Host.php
index bdff7d32..a170c9ea 100644
--- a/modules/host/classes/Model/Service/Plugin/Host.php
+++ b/modules/host/classes/Model/Service/Plugin/Host.php
@@ -31,7 +31,7 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
array('strtoupper',array(':value')),
),
'host_expire'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
);
diff --git a/modules/invoice/classes/Model/Invoice.php b/modules/invoice/classes/Model/Invoice.php
index e3072e08..18b5e712 100644
--- a/modules/invoice/classes/Model/Invoice.php
+++ b/modules/invoice/classes/Model/Invoice.php
@@ -28,10 +28,10 @@ class Model_Invoice extends ORM_OSB implements Cartable {
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'due_date'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
@@ -46,6 +46,10 @@ class Model_Invoice extends ORM_OSB implements Cartable {
'invoice_item'=>'service_id,item_type,date_start,date_stop',
);
+ protected $_compress_column = array(
+ 'reminders',
+ );
+
private $_render = array();
// Our required Interface Methods
diff --git a/modules/invoice/classes/Model/Invoice/Item.php b/modules/invoice/classes/Model/Invoice/Item.php
index bbbf2c2c..ca06ae6d 100644
--- a/modules/invoice/classes/Model/Invoice/Item.php
+++ b/modules/invoice/classes/Model/Invoice/Item.php
@@ -21,13 +21,13 @@ class Model_Invoice_Item extends ORM_OSB {
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_start'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_stop'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
);
@@ -104,7 +104,7 @@ class Model_Invoice_Item extends ORM_OSB {
// Display the period that a transaction applies
public function period() {
- return ($this->date_start == $this->date_stop) ? Config::date($this->date_start) : sprintf('%s -> %s',Config::date($this->date_start),Config::date($this->date_stop));
+ return ($this->date_start == $this->date_stop) ? Site::Date($this->date_start) : sprintf('%s -> %s',Site::Date($this->date_start),Site::Date($this->date_stop));
}
public function save(Validation $validation = NULL) {
diff --git a/modules/invoice/classes/Model/Invoice/Memo.php b/modules/invoice/classes/Model/Invoice/Memo.php
index 333aac7f..aae7131a 100644
--- a/modules/invoice/classes/Model/Invoice/Memo.php
+++ b/modules/invoice/classes/Model/Invoice/Memo.php
@@ -23,8 +23,12 @@ class Model_Invoice_Memo extends ORM_OSB {
*/
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::datetime',array(':value')),
+ array('Site::Datetime',array(':value')),
),
);
+
+ protected $_compress_column = array(
+ 'memo',
+ );
}
?>
diff --git a/modules/oauth/classes/Model/Account/Oauth.php b/modules/oauth/classes/Model/Account/Oauth.php
index 20cc6110..2daff0a8 100644
--- a/modules/oauth/classes/Model/Account/Oauth.php
+++ b/modules/oauth/classes/Model/Account/Oauth.php
@@ -10,6 +10,10 @@
* @license http://dev.osbill.net/license.html
*/
class Model_Account_Oauth extends ORM_OSB {
+ protected $_compress_column = array(
+ 'oauth_data',
+ );
+
// Relationships
protected $_has_one = array(
'account' => array('foreign_key'=>'id'),
diff --git a/modules/payment/classes/Model/Payment.php b/modules/payment/classes/Model/Payment.php
index 8d1e01f9..c26b150a 100644
--- a/modules/payment/classes/Model/Payment.php
+++ b/modules/payment/classes/Model/Payment.php
@@ -26,10 +26,10 @@ class Model_Payment extends ORM_OSB {
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_payment'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'fees_amt'=>array(
array('Currency::display',array(':value')),
@@ -241,7 +241,7 @@ class Model_Payment extends ORM_OSB {
$sql .= ' GROUP BY A.id';
$sql .= ' HAVING round(A.total_amt-ALLOC,2) <> 0';
- foreach ($db->query(Database::SELECT,__($sql,array(':prefix_'=>$db->table_prefix(),':site_id'=>Config::siteid()))) as $values)
+ foreach ($db->query(Database::SELECT,__($sql,array(':prefix_'=>$db->table_prefix(),':site_id'=>Site::ID()))) as $values)
array_push($pid,$values['id']);
return $this->where('id','IN',$pid)->order_by('account_id')->find_all();
diff --git a/modules/product/classes/Model/Product.php b/modules/product/classes/Model/Product.php
index f9f7f7b8..ccc6cc8b 100644
--- a/modules/product/classes/Model/Product.php
+++ b/modules/product/classes/Model/Product.php
@@ -37,6 +37,13 @@ class Model_Product extends ORM_OSB implements Invoicable {
protected $_form = array('id'=>'id','value'=>'description()');
+ protected $_compress_column = array(
+ 'avail_category',
+ 'group_avail',
+ 'price_group',
+ 'prod_plugin_data',
+ );
+
protected $_nullifempty = array(
'price_group',
);
@@ -207,7 +214,7 @@ class Model_Product extends ORM_OSB implements Invoicable {
}
private function translate() {
- return $this->translate->where('language_id','=',Config::language())->find();
+ return $this->translate->where('language_id','=',Company::instance()->language())->find();
}
/**
diff --git a/modules/product/classes/Model/Product/Category.php b/modules/product/classes/Model/Product/Category.php
index 10c64069..f6d16b33 100644
--- a/modules/product/classes/Model/Product/Category.php
+++ b/modules/product/classes/Model/Product/Category.php
@@ -106,7 +106,7 @@ class Model_Product_Category extends ORM_OSB {
private function translate() {
- return $this->translate->where('language_id','=',Config::language())->find();
+ return $this->translate->where('language_id','=',Company::instance()->language())->find();
}
}
?>
diff --git a/modules/product/classes/Model/Product/Category/Translate.php b/modules/product/classes/Model/Product/Category/Translate.php
index 02da4541..8545808e 100644
--- a/modules/product/classes/Model/Product/Category/Translate.php
+++ b/modules/product/classes/Model/Product/Category/Translate.php
@@ -18,6 +18,10 @@ class Model_Product_Category_Translate extends ORM_OSB {
'language'=>array('foreign_key'=>'id'),
);
+ protected $_compress_column = array(
+ 'description',
+ );
+
protected $_save_message = TRUE;
}
?>
diff --git a/modules/product/classes/Model/Product/Translate.php b/modules/product/classes/Model/Product/Translate.php
index bd5636d1..b9465b69 100644
--- a/modules/product/classes/Model/Product/Translate.php
+++ b/modules/product/classes/Model/Product/Translate.php
@@ -21,6 +21,10 @@ class Model_Product_Translate extends ORM_OSB {
'language'=>array('foreign_key'=>'id'),
);
+ protected $_compress_column = array(
+ 'description_full',
+ );
+
protected $_save_message = TRUE;
}
?>
diff --git a/modules/service/classes/Controller/Admin/Service.php b/modules/service/classes/Controller/Admin/Service.php
index 0a656784..6cd1cc44 100644
--- a/modules/service/classes/Controller/Admin/Service.php
+++ b/modules/service/classes/Controller/Admin/Service.php
@@ -267,18 +267,18 @@ $(document).ready(function() {
case 4:
case 5:
if ($iio->date_start != $pdata['start_time']) {
- $doutput .= sprintf('%s: Set start_time: %s [%s]
',$iio->id,Config::date($pdata['start_time']),$pdata['start_time']);
+ $doutput .= sprintf('%s: Set start_time: %s [%s]
',$iio->id,Site::Date($pdata['start_time']),$pdata['start_time']);
$iio->date_start=$pdata['start_time'];
}
if (! $pr AND $iio->date_stop != $pdata['end_time']) {
- $doutput .= sprintf('%s: Set end_time: %s [%s]
',$iio->id,Config::date($pdata['end_time']),$pdata['end_time']);
+ $doutput .= sprintf('%s: Set end_time: %s [%s]
',$iio->id,Site::Date($pdata['end_time']),$pdata['end_time']);
$iio->date_stop = $pdata['end_time'];
}
$bt = ($pr ? $iio->date_stop : $pdata['end_time'])+86400;
- // $doutput .= sprintf('%s: BT now: %s (%s) [%s]
',$iio->id,Config::date($bt),Config::date($pdata['end_time']),$bt);
+ // $doutput .= sprintf('%s: BT now: %s (%s) [%s]
',$iio->id,Site::Date($bt),Site::Date($pdata['end_time']),$bt);
break;
default:
diff --git a/modules/service/classes/Model/Service.php b/modules/service/classes/Model/Service.php
index 04889844..0d056715 100644
--- a/modules/service/classes/Model/Service.php
+++ b/modules/service/classes/Model/Service.php
@@ -47,16 +47,16 @@ class Model_Service extends ORM_OSB {
*/
protected $_display_filters = array(
'date_start'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_end'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_last_invoice'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_next_invoice'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'external_billing'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
@@ -136,7 +136,7 @@ class Model_Service extends ORM_OSB {
// If $expire is NULL, we'll use the next invoice date
$expire = is_null($expire) ? $this->paid_to() : $expire;
- return $format ? Config::date($expire) : $expire;
+ return $format ? Site::Date($expire) : $expire;
}
/**
@@ -183,7 +183,7 @@ class Model_Service extends ORM_OSB {
$x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : ($iio->total() < 0 ? $iio->date_start-86400 : $iio->date_stop);
- return $format ? Config::date($x) : $x;
+ return $format ? Site::Date($x) : $x;
}
private function last_invoice_item() {
@@ -217,7 +217,7 @@ class Model_Service extends ORM_OSB {
break;
}
- return $format ? ($x ? Config::date($metric) : ' ') : ($x ? $metric : NULL);
+ return $format ? ($x ? Site::Date($metric) : ' ') : ($x ? $metric : NULL);
}
/**
diff --git a/modules/service/classes/Model/Service/Change.php b/modules/service/classes/Model/Service/Change.php
index 5ee54c76..9cb7102e 100644
--- a/modules/service/classes/Model/Service/Change.php
+++ b/modules/service/classes/Model/Service/Change.php
@@ -23,10 +23,10 @@ class Model_Service_Change extends ORM_OSB {
*/
protected $_display_filters = array(
'date_ordered'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
'date_effective'=>array(
- array('Config::date',array(':value')),
+ array('Site::Date',array(':value')),
),
);
diff --git a/modules/service/classes/Model/Service/Memo.php b/modules/service/classes/Model/Service/Memo.php
index 4fef31f7..29f4b667 100644
--- a/modules/service/classes/Model/Service/Memo.php
+++ b/modules/service/classes/Model/Service/Memo.php
@@ -18,12 +18,16 @@ class Model_Service_Memo extends ORM_OSB {
'account'=>array('foreign_key'=>'id'),
);
+ protected $_compress_column = array(
+ 'memo',
+ );
+
/**
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::datetime',array(':value')),
+ array('Site::Datetime',array(':value')),
),
);
}
diff --git a/modules/service/views/service/admin/add.php b/modules/service/views/service/admin/add.php
index 91de3203..9daf6d7f 100644
--- a/modules/service/views/service/admin/add.php
+++ b/modules/service/views/service/admin/add.php
@@ -17,7 +17,7 @@
- 'span2','label'=>'Date Next Invoice','add-on'=>'','disabled')); ?>
+ 'span2','label'=>'Date Next Invoice','add-on'=>'','disabled')); ?>
diff --git a/modules/ssl/classes/SSL.php b/modules/ssl/classes/SSL.php
index 147512cb..5c0c56cf 100644
--- a/modules/ssl/classes/SSL.php
+++ b/modules/ssl/classes/SSL.php
@@ -188,13 +188,13 @@ class SSL {
public function get_valid_to($format=FALSE) {
$k = $this->_details('validTo_time_t');
- return $format ? Config::date($k) : $k;
+ return $format ? Site::Date($k) : $k;
}
public function get_valid_from($format=FALSE) {
$k = $this->_details('validFrom_time_t');
- return $format ? Config::date($k) : $k;
+ return $format ? Site::Date($k) : $k;
}
public function get_version() {
diff --git a/modules/task/classes/Model/Task.php b/modules/task/classes/Model/Task.php
index b53feaf5..77d7dc98 100644
--- a/modules/task/classes/Model/Task.php
+++ b/modules/task/classes/Model/Task.php
@@ -12,7 +12,7 @@
class Model_Task extends ORM_OSB {
protected $_display_filters = array(
'date_run'=>array(
- array('Config::datetime',array(':value')),
+ array('Site::Datetime',array(':value')),
),
);
@@ -26,7 +26,7 @@ class Model_Task extends ORM_OSB {
public function next_run($format=FALSE) {
$x = $this->_cron()->next($this->date_run);
- return $format ? Config::datetime($x) : $x;
+ return $format ? Site::Datetime($x) : $x;
}
}
?>
diff --git a/modules/task/classes/Model/Task/Log.php b/modules/task/classes/Model/Task/Log.php
index 9da09ef4..15c0fc84 100644
--- a/modules/task/classes/Model/Task/Log.php
+++ b/modules/task/classes/Model/Task/Log.php
@@ -18,9 +18,13 @@ class Model_Task_Log extends ORM_OSB {
'task'=>array(),
);
+ protected $_compress_column = array(
+ 'message',
+ );
+
protected $_display_filters = array(
'date_orig'=>array(
- array('Config::datetime',array(':value')),
+ array('Site::Datetime',array(':value')),
),
);
}