',_('Domains are available with the following suffixes'));
diff --git a/modules/domain/classes/model/service/plugin/domain.php b/modules/domain/classes/Model/Service/Plugin/DOMAIN.php
similarity index 90%
rename from modules/domain/classes/model/service/plugin/domain.php
rename to modules/domain/classes/Model/Service/Plugin/DOMAIN.php
index 2ca5e67d..5d4e9b1f 100644
--- a/modules/domain/classes/model/service/plugin/domain.php
+++ b/modules/domain/classes/Model/Service/Plugin/DOMAIN.php
@@ -10,15 +10,15 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
-class Model_Service_Plugin_Domain extends Model_Service_Plugin {
+class Model_Service_Plugin_DOMAIN extends Model_Service_Plugin {
protected $_table_name = 'service__domain';
protected $_updated_column = FALSE;
// Relationships
protected $_has_one = array(
- 'domain_tld'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
+ 'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
'domain_registrar'=>array('foreign_key'=>'id','far_key'=>'domain_registrar_id'),
- 'service_plugin_host'=>array('through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'),
+ 'service_plugin_HOST'=>array('through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'),
);
protected $_belongs_to = array(
'service'=>array(),
@@ -49,7 +49,7 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
}
public function name() {
- return sprintf('%s.%s',$this->display('domain_name'),$this->domain_tld->display('name'));
+ return sprintf('%s.%s',$this->display('domain_name'),$this->domain_TLD->display('name'));
}
public function service_name() {
diff --git a/modules/domain/classes/service/domain.php b/modules/domain/classes/Service/Domain.php
similarity index 96%
rename from modules/domain/classes/service/domain.php
rename to modules/domain/classes/Service/Domain.php
index e9248145..49007fed 100644
--- a/modules/domain/classes/service/domain.php
+++ b/modules/domain/classes/Service/Domain.php
@@ -31,7 +31,7 @@ abstract class Service_Domain {
* Setup this class. We need to get our supplier details out of the database.
*/
public function __construct($sid) {
- $this->so = ORM::factory('domain_registrar',$sid);
+ $this->so = ORM::factory('Domain_Registrar',$sid);
}
/**
diff --git a/modules/domain/classes/service/domain/manual.php b/modules/domain/classes/Service/Domain/Manual.php
similarity index 88%
rename from modules/domain/classes/service/domain/manual.php
rename to modules/domain/classes/Service/Domain/Manual.php
index cbacefc0..f74b37ee 100644
--- a/modules/domain/classes/service/domain/manual.php
+++ b/modules/domain/classes/Service/Domain/Manual.php
@@ -16,7 +16,7 @@ class Service_Domain_Manual extends Service_Domain {
private $login_pass_field = '';
// Our required abstract classes
- public function manage_button($u,$p,$d) {
+ public function manage_button(Model_Service_Plugin_Domain $spdo,$t) {
return _('Please contact us');
}
}
diff --git a/modules/domain/classes/service/domain/planetdomain.php b/modules/domain/classes/Service/Domain/PlanetDomain.php
similarity index 62%
rename from modules/domain/classes/service/domain/planetdomain.php
rename to modules/domain/classes/Service/Domain/PlanetDomain.php
index 8542f6a3..55ffb97e 100644
--- a/modules/domain/classes/service/domain/planetdomain.php
+++ b/modules/domain/classes/Service/Domain/PlanetDomain.php
@@ -16,18 +16,18 @@ class Service_Domain_PlanetDomain extends Service_Domain {
private $login_pass_field = 'login.password';
// Our required abstract classes
- public function manage_button($u,$p,$d) {
+ public function manage_button(Model_Service_Plugin_Domain $spdo,$t) {
$output = '';
$output .= Form::open(
sprintf('%s/%s',$this->so->whitelabel_url,'newdnr/action/user/login.jsp'),
- array('target'=>'pd','method'=>'post')
+ array('target'=>'pd','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
);
- $output .= Form::input($this->login_user_field,$u,array('type'=>'hidden'));
- $output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden'));
+ $output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
+ $output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::input('page.next',sprintf('/newdnr/action/dns/getDNSDetails.jsp?domain.name=%s',$d),array('type'=>'hidden'));
- $output .= Form::button('submit',_('Manage'),array('class'=>'form_button'));
$output .= Form::close();
+ $output .= Form::button('submit',_('Manage'),array('class'=>'form_button','value'=>sprintf('%s:%s',$spdo->service_id,$t)));
return $output;
}
diff --git a/modules/domain/classes/service/domain/tpp.php b/modules/domain/classes/Service/Domain/TPP.php
similarity index 100%
rename from modules/domain/classes/service/domain/tpp.php
rename to modules/domain/classes/Service/Domain/TPP.php
diff --git a/modules/email/classes/controller/admin/email.php b/modules/email/classes/Controller/Admin/Email.php
similarity index 92%
rename from modules/email/classes/controller/admin/email.php
rename to modules/email/classes/Controller/Admin/Email.php
index 42e8c9ad..637b39f2 100644
--- a/modules/email/classes/controller/admin/email.php
+++ b/modules/email/classes/Controller/Admin/Email.php
@@ -25,7 +25,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('System Emails Sent'),
'body'=>Table::display(
- ORM::factory('email_log')->find_all(),
+ ORM::factory('Email_Log')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/email/view/'),
@@ -47,7 +47,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
* List our defined email templates
*/
public function action_templatelist() {
- $eto = ORM::factory('email_template');
+ $eto = ORM::factory('Email_Template');
$output = '';
// @todo Change this to use Table::
@@ -68,7 +68,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
* Add a template
*/
public function action_templateadd() {
- $eto = ORM::factory('email_template');
+ $eto = ORM::factory('Email_Template');
$output = '';
if ($_POST AND $eto->values($_POST)->check()) {
@@ -102,11 +102,13 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
* Edit Template Definition
* @todo Change this into an add_view function like payment()
*/
- public function action_templateedit($id) {
- $eto = ORM::factory('email_template',$id);
+ public function action_templateedit() {
+ $id = $this->request->param('id');
+
+ $eto = ORM::factory('Email_Template',$id);
if (! $eto->loaded())
- Request::current()->redirect('email/admin/template/list');
+ HTTP::redirect('email/admin/template/list');
$output = '';
diff --git a/modules/email/classes/controller/email.php b/modules/email/classes/Controller/Email.php
similarity index 100%
rename from modules/email/classes/controller/email.php
rename to modules/email/classes/Controller/Email.php
diff --git a/modules/email/classes/controller/email/template.php b/modules/email/classes/Controller/Email/Template.php
similarity index 100%
rename from modules/email/classes/controller/email/template.php
rename to modules/email/classes/Controller/Email/Template.php
diff --git a/modules/email/classes/controller/user/email.php b/modules/email/classes/Controller/User/Email.php
similarity index 97%
rename from modules/email/classes/controller/user/email.php
rename to modules/email/classes/Controller/User/Email.php
index 6a646e24..b5544628 100644
--- a/modules/email/classes/controller/user/email.php
+++ b/modules/email/classes/Controller/User/Email.php
@@ -41,7 +41,7 @@ class Controller_User_Email extends Controller_TemplateDefault_User {
public function action_view() {
list($id,$output) = Table::page(__METHOD__);
- $elo = ORM::factory('email_log',$id);
+ $elo = ORM::factory('Email_Log',$id);
if (! $elo->loaded() OR ! Auth::instance()->authorised($elo->account_id)) {
$this->template->content = 'Unauthorised or doesnt exist?';
diff --git a/modules/email/classes/email/template.php b/modules/email/classes/Email/Template.php
similarity index 96%
rename from modules/email/classes/email/template.php
rename to modules/email/classes/Email/Template.php
index 760c76a6..aa5d8a69 100644
--- a/modules/email/classes/email/template.php
+++ b/modules/email/classes/Email/Template.php
@@ -20,7 +20,7 @@ class Email_Template {
private $components = array('subject','message_text','message_html');
public function __construct($template,$language_id=NULL) {
- $this->template = ORM::factory('email_template',array('name'=>$template));
+ $this->template = ORM::factory('Email_Template',array('name'=>$template));
if (! $this->template->loaded())
throw new Kohana_Exception('Email template :template not defined in DB',array(':template'=>$template));
@@ -75,7 +75,7 @@ class Email_Template {
$list = array();
foreach ($this->email_data[$key]['account'] as $id) {
- $ao = ORM::factory('account',$id);
+ $ao = ORM::factory('Account',$id);
if ($ao->loaded())
$list[$ao->email] = $ao->name();
}
@@ -111,7 +111,7 @@ class Email_Template {
public function send(array $admin=array()) {
$e = Email::connect();
$sm = Swift_Message::newInstance()
- ->setFrom(Kohana::config('config.email_from'));
+ ->setFrom(Kohana::$config->load('config')->email_from);
foreach ($this->components as $component) {
if ($this->etto->loaded()) {
@@ -154,7 +154,7 @@ class Email_Template {
if ($result) {
// Store our email log.
- $elo = ORM::factory('email_log');
+ $elo = ORM::factory('Email_Log');
foreach ($sa as $id) {
$elo->clear();
diff --git a/modules/email/classes/model/email/log.php b/modules/email/classes/Model/Email/Log.php
similarity index 100%
rename from modules/email/classes/model/email/log.php
rename to modules/email/classes/Model/Email/Log.php
diff --git a/modules/email/classes/model/email/template.php b/modules/email/classes/Model/Email/Template.php
similarity index 100%
rename from modules/email/classes/model/email/template.php
rename to modules/email/classes/Model/Email/Template.php
diff --git a/modules/email/classes/model/email/template/translate.php b/modules/email/classes/Model/Email/Template/Translate.php
similarity index 100%
rename from modules/email/classes/model/email/template/translate.php
rename to modules/email/classes/Model/Email/Template/Translate.php
diff --git a/modules/export/classes/controller/admin/export.php b/modules/export/classes/Controller/Admin/Export.php
similarity index 93%
rename from modules/export/classes/controller/admin/export.php
rename to modules/export/classes/Controller/Admin/Export.php
index 2d0e50e8..51a6cea6 100644
--- a/modules/export/classes/controller/admin/export.php
+++ b/modules/export/classes/Controller/Admin/Export.php
@@ -21,11 +21,11 @@ class Controller_Admin_Export extends Controller_TemplateDefault_Admin {
* Add Export Maping items
*/
public function action_add() {
- $eo = ORM::factory('export');
+ $eo = ORM::factory('Export');
$output = '';
if ($_POST AND $eo->values($_POST)->check()) {
- $eo->module_id = ORM::factory('module',array('name'=>'product'))->id; // @todo This probably should be in the form.
+ $eo->module_id = ORM::factory('Module',array('name'=>'product'))->id; // @todo This probably should be in the form.
$eo->plugin_name = 'quicken'; // @todo This should be in the form.
// Entry updated
if (! $eo->save())
diff --git a/modules/export/classes/controller/affiliate/export.php b/modules/export/classes/Controller/Affiliate/Export.php
similarity index 94%
rename from modules/export/classes/controller/affiliate/export.php
rename to modules/export/classes/Controller/Affiliate/Export.php
index 50ba4a4b..af12c848 100644
--- a/modules/export/classes/controller/affiliate/export.php
+++ b/modules/export/classes/Controller/Affiliate/Export.php
@@ -24,7 +24,7 @@ class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
if (empty($_POST['plugin']))
$this->request->redirect('affiliate/export/index');
- $sc = sprintf('Export_%s',$_POST['plugin']);
+ $sc = sprintf('Export_%s',ucfirst($_POST['plugin']));
if (! class_exists($sc))
throw new Kohana_Exception('Export Class doesnt exist for :plugin',array(':plugin'=>$_POST['plugin']));
else
@@ -43,7 +43,7 @@ class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
$TBRexportplugins = array('quicken'=>'Export to Quicken');
// @todo: Need to limit this to affiliate acounts
- $p = ORM::factory('payment');
+ $p = ORM::factory('Payment');
if ($p->find_all()->count()) {
Block::add(array(
@@ -80,7 +80,7 @@ class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
'title'=>_('No payments to export'),
'type'=>'info',
'body'=>sprintf(_('There are no payments within the last %s days (since %s) to show.'),
- $daysago,date(Kohana::config('osb')->get('date_format'),$daysago*86400+time())),
+ $daysago,date(Kohana::$config->load('osb')->date_format,$daysago*86400+time())),
));
}
}
diff --git a/modules/export/classes/controller/export.php b/modules/export/classes/Controller/Export.php
similarity index 100%
rename from modules/export/classes/controller/export.php
rename to modules/export/classes/Controller/Export.php
diff --git a/modules/export/classes/export.php b/modules/export/classes/Export.php
similarity index 100%
rename from modules/export/classes/export.php
rename to modules/export/classes/Export.php
diff --git a/modules/export/classes/export/quicken.php b/modules/export/classes/Export/Quicken.php
similarity index 97%
rename from modules/export/classes/export/quicken.php
rename to modules/export/classes/Export/Quicken.php
index fc0b7813..f648f7e0 100644
--- a/modules/export/classes/export/quicken.php
+++ b/modules/export/classes/Export/Quicken.php
@@ -16,7 +16,7 @@ class Export_Quicken extends Export {
$qo = new Quicken;
foreach ($_POST['id'] as $pid) {
- $po = ORM::factory('payment',$pid);
+ $po = ORM::factory('Payment',$pid);
if ($po->loaded()) {
$invoice_ids = array();
@@ -85,9 +85,9 @@ class Export_Quicken extends Export {
$daterange = '';
if ($iio->product_id) {
- $mo = ORM::factory('module',array('name'=>'product'));
- $eo = ORM::factory('export')
- ->where('plugin_name','=',$this->plugin)
+ $mo = ORM::factory('Module',array('name'=>'product'));
+ $eo = ORM::factory('Export')
+ ->where('plugin_name','=',strtolower($this->plugin))
->and_where('module_id','=',$mo->id)
->and_where('item_id','=',$iio->product_id)
->find();
diff --git a/modules/export/classes/model/export.php b/modules/export/classes/Model/Export.php
similarity index 80%
rename from modules/export/classes/model/export.php
rename to modules/export/classes/Model/Export.php
index b9d8055a..b8f5aec4 100644
--- a/modules/export/classes/model/export.php
+++ b/modules/export/classes/Model/Export.php
@@ -18,12 +18,12 @@ class Model_Export extends ORM_OSB {
public function list_itemsnoexport() {
$result = array();
- $mo = ORM::factory('module',array('name'=>'product'));
- $p = ORM::factory('product')
+ $mo = ORM::factory('Module',array('name'=>'product'));
+ $p = ORM::factory('Product')
->order_by('id');
foreach ($p->find_all() as $po)
- if (! ORM::factory('export')->where('module_id','=',$mo->id)->where('item_id','=',$po->id)->find()->loaded())
+ if (! ORM::factory('Export')->where('module_id','=',$mo->id)->where('item_id','=',$po->id)->find()->loaded())
$result[$po->id] = $po;
return $result;
diff --git a/modules/export/classes/osbexport.php b/modules/export/classes/OSBExport.php
similarity index 100%
rename from modules/export/classes/osbexport.php
rename to modules/export/classes/OSBExport.php
diff --git a/modules/export/classes/quicken.php b/modules/export/classes/Quicken.php
similarity index 100%
rename from modules/export/classes/quicken.php
rename to modules/export/classes/Quicken.php
diff --git a/modules/export/classes/quicken/invoice.php b/modules/export/classes/Quicken/Invoice.php
similarity index 100%
rename from modules/export/classes/quicken/invoice.php
rename to modules/export/classes/Quicken/Invoice.php
diff --git a/modules/export/classes/quicken/invoiceitem.php b/modules/export/classes/Quicken/InvoiceItem.php
similarity index 100%
rename from modules/export/classes/quicken/invoiceitem.php
rename to modules/export/classes/Quicken/InvoiceItem.php
diff --git a/modules/export/classes/quicken/payment.php b/modules/export/classes/Quicken/Payment.php
similarity index 100%
rename from modules/export/classes/quicken/payment.php
rename to modules/export/classes/Quicken/Payment.php
diff --git a/modules/host/classes/controller/admin/host.php b/modules/host/classes/Controller/Admin/Host.php
similarity index 89%
rename from modules/host/classes/controller/admin/host.php
rename to modules/host/classes/Controller/Admin/Host.php
index 7a9e9f39..054e44ee 100644
--- a/modules/host/classes/controller/admin/host.php
+++ b/modules/host/classes/Controller/Admin/Host.php
@@ -19,7 +19,7 @@ class Controller_Admin_Host extends Controller_TemplateDefault_Admin {
public function action_ajaxmanage() {
$this->auto_render = FALSE;
- $hso = ORM::factory('host_server',$this->request->param('id'));
+ $hso = ORM::factory('Host_Server',$this->request->param('id'));
$k = Session::instance()->get_once('manage_button');
$o = array(
@@ -38,7 +38,7 @@ class Controller_Admin_Host extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('Customer Services'),
'body'=>Table::display(
- ORM::factory('host_server')->find_all(),
+ ORM::factory('Host_Server')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/host/update/'),
@@ -53,11 +53,11 @@ class Controller_Admin_Host extends Controller_TemplateDefault_Admin {
}
public function action_update() {
- $hso = ORM::factory('host_server',$this->request->param('id'));
+ $hso = ORM::factory('Host_Server',$this->request->param('id'));
$output = '';
if (! $hso->loaded())
- Request::current()->redirect('welcome/index');
+ HTTP::redirect('welcome/index');
if ($_POST) {
$hso->values($_POST);
diff --git a/modules/host/classes/controller/task/host.php b/modules/host/classes/Controller/Task/Host.php
similarity index 97%
rename from modules/host/classes/controller/task/host.php
rename to modules/host/classes/Controller/Task/Host.php
index 891eab1d..16ff68de 100644
--- a/modules/host/classes/controller/task/host.php
+++ b/modules/host/classes/Controller/Task/Host.php
@@ -29,7 +29,7 @@ class Controller_Task_Host extends Controller_Task {
case 'setdisablemail':
case 'setexpire':
case 'setpasswd':
- $this->so = ORM::factory('service',$this->request->param('id'));
+ $this->so = ORM::factory('Service',$this->request->param('id'));
if (! $this->so->loaded())
throw new Kohana_Exception('Unknown service :sid',array(':sid'=>$this->request->param('id')));
@@ -138,7 +138,7 @@ class Controller_Task_Host extends Controller_Task {
list($sid,$svrs) = preg_split('/:/',$ids,2);
list($fsid,$tsid) = preg_split('/-/',$svrs,2);
- $so = ORM::factory('service',$sid);
+ $so = ORM::factory('Service',$sid);
if (! $so->loaded())
throw new Kohana_Exception('Service :sid doesnt exist?',array(':sid'=>$sid));
@@ -154,7 +154,7 @@ class Controller_Task_Host extends Controller_Task {
throw new Kohana_Exception('Service :sid is not on server :tsid?',array(':sid'=>$sid,':tsid'=>$tsid));
// Temporarily set our host_server_id to $fsid
- $hpo = ORM::factory('host_server',$fsid);
+ $hpo = ORM::factory('Host_Server',$fsid);
if (! $hpo->loaded())
throw new Kohana_Exception('Host server :fsid not defined?',array(':fsid'=>$fsid));
@@ -230,7 +230,7 @@ class Controller_Task_Host extends Controller_Task {
$cats = array();
if ($mode)
- $cats = ORM::factory('product_category')->list_bylistgroup($mode);
+ $cats = ORM::factory('Product_Category')->list_bylistgroup($mode);
foreach (ORM::Factory('service')->list_provision()->find_all() as $so) {
$pc = array();
diff --git a/modules/host/classes/host/plugin.php b/modules/host/classes/Host/Plugin.php
similarity index 100%
rename from modules/host/classes/host/plugin.php
rename to modules/host/classes/Host/Plugin.php
diff --git a/modules/host/classes/host/plugin/plesk.php b/modules/host/classes/Host/Plugin/Plesk.php
similarity index 98%
rename from modules/host/classes/host/plugin/plesk.php
rename to modules/host/classes/Host/Plugin/Plesk.php
index 58d97e81..7b06d4b1 100644
--- a/modules/host/classes/host/plugin/plesk.php
+++ b/modules/host/classes/Host/Plugin/Plesk.php
@@ -88,7 +88,7 @@ abstract class Host_Plugin_Plesk extends Host_Plugin {
$request = Request::factory(sprintf('%s/%s',$this->hso->manage_url,$this->path))
->method('POST');
- $request->get_client()->options(Arr::merge($this->curlopts,array(
+ $request->client()->options(Arr::merge($this->curlopts,array(
CURLOPT_HTTPHEADER => array(
'HTTP_AUTH_LOGIN: '.$this->hso->manage_username,
'HTTP_AUTH_PASSWD: '.$this->hso->manage_password,
diff --git a/modules/host/classes/host/plugin/plesk/10.php b/modules/host/classes/Host/Plugin/Plesk/10.php
similarity index 99%
rename from modules/host/classes/host/plugin/plesk/10.php
rename to modules/host/classes/Host/Plugin/Plesk/10.php
index 40e4772a..61454f48 100644
--- a/modules/host/classes/host/plugin/plesk/10.php
+++ b/modules/host/classes/Host/Plugin/Plesk/10.php
@@ -110,7 +110,7 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
$this->init();
$items = array_keys($this->_template['reseller']);
- $hsao = ORM::factory('host_server_affiliate',array('affiliate_id'=>$so->affiliate_id,'host_server_id'=>$so->plugin()->host_server_id))->find();
+ $hsao = ORM::factory('Host_Server_Affiliate',array('affiliate_id'=>$so->affiliate_id,'host_server_id'=>$so->plugin()->host_server_id))->find();
if (! $hsao->loaded())
return NULL;
diff --git a/modules/host/classes/host/plugin/plesk/9.php b/modules/host/classes/Host/Plugin/Plesk/9.php
similarity index 100%
rename from modules/host/classes/host/plugin/plesk/9.php
rename to modules/host/classes/Host/Plugin/Plesk/9.php
diff --git a/modules/host/classes/model/host/server.php b/modules/host/classes/Model/Host/Server.php
similarity index 100%
rename from modules/host/classes/model/host/server.php
rename to modules/host/classes/Model/Host/Server.php
diff --git a/modules/host/classes/model/host/server/affiliate.php b/modules/host/classes/Model/Host/Server/Affiliate.php
similarity index 100%
rename from modules/host/classes/model/host/server/affiliate.php
rename to modules/host/classes/Model/Host/Server/Affiliate.php
diff --git a/modules/host/classes/model/product/plugin/host.php b/modules/host/classes/Model/Product/Plugin/HOST.php
similarity index 90%
rename from modules/host/classes/model/product/plugin/host.php
rename to modules/host/classes/Model/Product/Plugin/HOST.php
index 4ccfbf5b..827dfa6d 100644
--- a/modules/host/classes/model/product/plugin/host.php
+++ b/modules/host/classes/Model/Product/Plugin/HOST.php
@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
-class Model_Product_Plugin_Host extends Model_Product_Plugin {
+class Model_Product_Plugin_HOST extends Model_Product_Plugin {
// @todo This model doesnt have a database table
public function __construct() {
}
diff --git a/modules/host/classes/model/service/plugin/host.php b/modules/host/classes/Model/Service/Plugin/HOST.php
similarity index 95%
rename from modules/host/classes/model/service/plugin/host.php
rename to modules/host/classes/Model/Service/Plugin/HOST.php
index 88792c30..03de0afa 100644
--- a/modules/host/classes/model/service/plugin/host.php
+++ b/modules/host/classes/Model/Service/Plugin/HOST.php
@@ -20,7 +20,7 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
// Relationships
protected $_has_one = array(
- 'domain_tld'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
+ 'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
'host_server'=>array('far_key'=>'host_server_id','foreign_key'=>'id'),
);
protected $_belongs_to = array(
@@ -46,7 +46,7 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
}
public function name() {
- return sprintf('%s.%s',$this->display('domain_name'),$this->domain_tld->display('name'));
+ return sprintf('%s.%s',$this->display('domain_name'),$this->domain_TLD->display('name'));
}
public function service_view() {
diff --git a/modules/invoice/classes/controller/admin/invoice.php b/modules/invoice/classes/Controller/Admin/Invoice.php
similarity index 98%
rename from modules/invoice/classes/controller/admin/invoice.php
rename to modules/invoice/classes/Controller/Admin/Invoice.php
index 8f5d73b1..45a77e02 100644
--- a/modules/invoice/classes/controller/admin/invoice.php
+++ b/modules/invoice/classes/Controller/Admin/Invoice.php
@@ -43,7 +43,7 @@ class Controller_Admin_Invoice extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('System Customer Invoices'),
'body'=>Table::display(
- ORM::factory('invoice')->find_all(),
+ ORM::factory('Invoice')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
diff --git a/modules/invoice/classes/controller/invoice.php b/modules/invoice/classes/Controller/Invoice.php
similarity index 100%
rename from modules/invoice/classes/controller/invoice.php
rename to modules/invoice/classes/Controller/Invoice.php
diff --git a/modules/invoice/classes/controller/task/invoice.php b/modules/invoice/classes/Controller/Task/Invoice.php
similarity index 92%
rename from modules/invoice/classes/controller/task/invoice.php
rename to modules/invoice/classes/Controller/Task/Invoice.php
index 25447866..75aa587c 100644
--- a/modules/invoice/classes/controller/task/invoice.php
+++ b/modules/invoice/classes/Controller/Task/Invoice.php
@@ -20,7 +20,7 @@ class Controller_Task_Invoice extends Controller_Task {
public function action_list() {
$mode = $this->request->param('id');
- $i = ORM::factory('invoice');
+ $i = ORM::factory('Invoice');
$tm = 'list_'.$mode;
if (! method_exists($i,$tm))
@@ -59,9 +59,9 @@ class Controller_Task_Invoice extends Controller_Task {
public function action_remind_due() {
$action = array();
$key = 'remind_due';
- $days = ORM::factory('invoice')->config('REMIND_DUE');
+ $days = ORM::factory('Invoice')->config('REMIND_DUE');
- foreach (ORM::factory('invoice')->list_due(time()+86400*$days) as $io) {
+ foreach (ORM::factory('Invoice')->list_due(time()+86400*$days) as $io) {
// @todo Use another option to supress reminders
// If we have already sent a reminder, we'll skip to the next one.
if (($io->remind($key) AND (is_null($x=$this->request->param('id')) OR $x != 'again')) OR ($io->account->invoice_delivery != 1))
@@ -105,7 +105,7 @@ class Controller_Task_Invoice extends Controller_Task {
case 1:
case 2:
case 3:
- $days = ORM::factory('invoice')->config('REMIND_OVERDUE_'.$notice);
+ $days = ORM::factory('Invoice')->config('REMIND_OVERDUE_'.$notice);
break;
default:
@@ -115,7 +115,7 @@ class Controller_Task_Invoice extends Controller_Task {
$key = 'remind_overdue_'.$notice;
- foreach (ORM::factory('invoice')->list_overdue_billing(time()-86400*$days,FALSE) as $io) {
+ foreach (ORM::factory('Invoice')->list_overdue_billing(time()-86400*$days,FALSE) as $io) {
// @todo Use another option to supress reminders
// If we have already sent a reminder, we'll skip to the next one.
if (($io->remind($key) AND (is_null($x=$this->request->param('id')) OR $x != 'again')) OR ($io->account->invoice_delivery != 1))
@@ -154,7 +154,7 @@ class Controller_Task_Invoice extends Controller_Task {
*/
public function action_services() {
// Used to only process X invoices in a row.
- $max = ORM::factory('invoice')->config('GEN_INV_MAX');
+ $max = ($x=Kohana::$config->load('debug')->invoice) ? $x : ORM::factory('Invoice')->config('GEN_INV_MAX');
// Our service next billing dates that need to be updated if this is successful.
$snd = array();
// Our charges that need to be updated if this is successful.
@@ -162,7 +162,7 @@ class Controller_Task_Invoice extends Controller_Task {
// If we are invoicing a specific service
$sid = is_null($this->request->param('id')) ? NULL : explode(':',$this->request->param('id'));
// Sort our service by account_id, then we can generate 1 invoice.
- $svs = ORM::factory('service')->list_invoicesoon()->as_array();
+ $svs = ORM::factory('Service')->list_invoicesoon()->as_array();
Sort::MAsort($svs,'account_id,date_next_invoice');
$aid = $due = $io = NULL;
@@ -186,7 +186,7 @@ class Controller_Task_Invoice extends Controller_Task {
break;
// Start a new invoice.
- $io = ORM::factory('invoice');
+ $io = ORM::factory('Invoice');
$io->due_date = $due = $io->min_due($so->date_next_invoice);
$io->account_id = $aid = $so->account_id;
$io->status = TRUE;
@@ -210,7 +210,7 @@ class Controller_Task_Invoice extends Controller_Task {
$snd[$so->id] = $pdata['end_time']+86400;
// Check if there are any charges
- $c = ORM::factory('charge')
+ $c = ORM::factory('Charge')
->where('service_id','=',$so->id)
->where('status','=',0)
->where('sweep_type','=',6); // @todo This needs to be dynamic, not "6"
@@ -244,7 +244,7 @@ class Controller_Task_Invoice extends Controller_Task {
// Update our service next billing dates.
// @todo Catch any update errors
foreach ($snd as $sid=>$date) {
- $so = ORM::factory('service',$sid);
+ $so = ORM::factory('Service',$sid);
$so->date_next_invoice = $date;
$so->save();
}
@@ -252,7 +252,7 @@ class Controller_Task_Invoice extends Controller_Task {
// Update any processed charges as such
// @todo Catch any update errors
foreach ($chgs as $cid) {
- $co = ORM::factory('charge',$cid);
+ $co = ORM::factory('Charge',$cid);
$co->status=1;
$co->save();
}
@@ -262,7 +262,7 @@ class Controller_Task_Invoice extends Controller_Task {
public function action_send() {
// Used to only process X invoices in a row.
- $max = ORM::factory('invoice')->config('EMAIL_INV_MAX');
+ $max = ORM::factory('Invoice')->config('EMAIL_INV_MAX');
$action = array();
$iid = $this->request->param('id');
@@ -272,7 +272,7 @@ class Controller_Task_Invoice extends Controller_Task {
list($iid,$x) = explode(':',$iid);
// Get our list of invoices to send
- $i = $iid ? ORM::factory('invoice')->where('id','=',$iid) : ORM::factory('invoice')->list_tosend();
+ $i = $iid ? ORM::factory('Invoice')->where('id','=',$iid) : ORM::factory('Invoice')->list_tosend();
$key = 'send';
@@ -288,7 +288,7 @@ class Controller_Task_Invoice extends Controller_Task {
// Send our email
$et = Email_Template::instance('task_invoice_'.$key);
- $token = ORM::factory('module_method_token')
+ $token = ORM::factory('Module_Method_Token')
->method(array('invoice','user_download'))
->account($io->account)
->expire(time()+86400*21)
@@ -324,7 +324,7 @@ class Controller_Task_Invoice extends Controller_Task {
public function action_audit_invoice_items() {
$output = '';
- foreach (ORM::factory('invoice_item')->find_all() as $iio) {
+ foreach (ORM::factory('Invoice_Item')->find_all() as $iio) {
if ($iio->product_name AND $iio->product_id) {
if (md5(strtoupper($iio->product_name)) == md5(strtoupper($iio->product->name()))) {
$iio->product_name = NULL;
diff --git a/modules/invoice/classes/controller/user/invoice.php b/modules/invoice/classes/Controller/User/Invoice.php
similarity index 97%
rename from modules/invoice/classes/controller/user/invoice.php
rename to modules/invoice/classes/Controller/User/Invoice.php
index d7c71ef8..ff32c318 100644
--- a/modules/invoice/classes/controller/user/invoice.php
+++ b/modules/invoice/classes/Controller/User/Invoice.php
@@ -49,7 +49,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
public function action_view() {
list($id,$output) = Table::page(__METHOD__);
- $io = ORM::factory('invoice',$id);
+ $io = ORM::factory('Invoice',$id);
if (! $io->loaded() OR (! Auth::instance()->authorised($io->account_id,$io->affiliate_id) AND ! in_array($this->ao->affiliate->id,$io->service_affiliates()))) {
$this->template->content = 'Unauthorised or doesnt exist?';
@@ -123,7 +123,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
* Download an invoice
*/
public function action_download() {
- $io = ORM::factory('invoice',$this->request->param('id'));
+ $io = ORM::factory('Invoice',$this->request->param('id'));
$this->response->body(Invoice::instance($io)->pdf()->Output(sprintf('%s.pdf',$io->refnum()),'D'));
$this->response->headers(array('Content-Type' => 'application/pdf'));
diff --git a/modules/invoice/classes/invoice.php b/modules/invoice/classes/Invoice.php
similarity index 95%
rename from modules/invoice/classes/invoice.php
rename to modules/invoice/classes/Invoice.php
index a0448806..69356b04 100644
--- a/modules/invoice/classes/invoice.php
+++ b/modules/invoice/classes/Invoice.php
@@ -87,14 +87,14 @@ SELECT i.id AS iid,i.due_date AS due FROM ab_invoice i,ab_invoice_item ii WHERE
// @todo Function Not Used
public static function balance($id) {
- return ORM::factory('invoice',$id)->due();
+ return ORM::factory('Invoice',$id)->due();
}
/**
* Generate a PDF invoice
*/
public function pdf() {
- $invoice_class = sprintf('invoice_tcpdf_%s',Kohana::config('invoice.driver'));
+ $invoice_class = sprintf('Invoice_TCPDF_%s',ucfirst(Kohana::$config->load('invoice')->driver));
$pdf = new $invoice_class($this->io);
diff --git a/modules/invoice/classes/invoice/tcpdf.php b/modules/invoice/classes/Invoice/TCPDF.php
similarity index 100%
rename from modules/invoice/classes/invoice/tcpdf.php
rename to modules/invoice/classes/Invoice/TCPDF.php
diff --git a/modules/invoice/classes/invoice/tcpdf/default.php b/modules/invoice/classes/Invoice/TCPDF/Default.php
similarity index 98%
rename from modules/invoice/classes/invoice/tcpdf/default.php
rename to modules/invoice/classes/Invoice/TCPDF/Default.php
index bcb95655..ea50d57d 100644
--- a/modules/invoice/classes/invoice/tcpdf/default.php
+++ b/modules/invoice/classes/Invoice/TCPDF/Default.php
@@ -357,9 +357,9 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
// Calculate our rounding error
// @todo This shouldnt be required.
- $subtotal = round($subtotal-$this->io->discount_amt,Kohana::config('config.currency_format'));
+ $subtotal = Currency::round($subtotal-$this->io->discount_amt);
- if (round($this->io->subtotal(),Kohana::config('config.currency_format')) != $subtotal) {
+ if (Currency::round($this->io->subtotal()) != $subtotal) {
$this->SetFont('helvetica','',9);
$this->SetX($x);
$this->Cell(0,0,'Other');
diff --git a/modules/invoice/classes/model/invoice.php b/modules/invoice/classes/Model/Invoice.php
similarity index 98%
rename from modules/invoice/classes/model/invoice.php
rename to modules/invoice/classes/Model/Invoice.php
index 984c441e..21280d39 100644
--- a/modules/invoice/classes/model/invoice.php
+++ b/modules/invoice/classes/Model/Invoice.php
@@ -377,13 +377,13 @@ class Model_Invoice extends ORM_OSB {
$c = count($this->invoice_items);
- $this->invoice_items[$c] = ORM::factory('invoice_item');
+ $this->invoice_items[$c] = ORM::factory('Invoice_Item');
return $this->invoice_items[$c];
}
public function min_due($date) {
- return strtotime(date('Y-M-d',($date < time()) ? time()+ORM::factory('invoice')->config('DUE_DAYS_MIN')*86400 : $date));
+ return strtotime(date('Y-M-d',($date < time()) ? time()+ORM::factory('Invoice')->config('DUE_DAYS_MIN')*86400 : $date));
}
public function save(Validation $validation = NULL) {
@@ -577,7 +577,7 @@ class Model_Invoice extends ORM_OSB {
* @todo This should be optimised a little to return only invoices to send, instead of looking for them.
*/
public function list_tosend() {
- return ORM::factory('invoice')->where_active()->where_open()->where('print_status','is',NULL)->or_where('print_status','!=',1)->where_close();
+ return ORM::factory('Invoice')->where_active()->where_open()->where('print_status','is',NULL)->or_where('print_status','!=',1)->where_close();
}
public function html() {
diff --git a/modules/invoice/classes/model/invoice/item.php b/modules/invoice/classes/Model/Invoice/Item.php
similarity index 99%
rename from modules/invoice/classes/model/invoice/item.php
rename to modules/invoice/classes/Model/Invoice/Item.php
index cfbfbc81..049c3870 100644
--- a/modules/invoice/classes/model/invoice/item.php
+++ b/modules/invoice/classes/Model/Invoice/Item.php
@@ -169,7 +169,7 @@ class Model_Invoice_Item extends ORM_OSB {
// Need to save the discounts associated with the invoice_item
if ($this->saved()) {
- $iito = ORM::factory('invoice_item_tax');
+ $iito = ORM::factory('Invoice_Item_Tax');
if ($this->subitems_loaded) {
foreach (array('tax') as $i)
diff --git a/modules/invoice/views/invoice/user/email.php b/modules/invoice/views/invoice/user/email.php
index 6f2166ea..81ef9062 100644
--- a/modules/invoice/views/invoice/user/email.php
+++ b/modules/invoice/views/invoice/user/email.php
@@ -64,7 +64,7 @@
items_services($items) as $sid => $ito) { ?>
-
+
id(); ?> |
@@ -122,7 +122,7 @@
tax_summary() as $tid => $amount) {
- $m = ORM::factory('tax',$tid);
+ $m = ORM::factory('Tax',$tid);
?>
|
diff --git a/modules/invoice/views/invoice/user/view.php b/modules/invoice/views/invoice/user/view.php
index 7acccf64..d2b309a9 100644
--- a/modules/invoice/views/invoice/user/view.php
+++ b/modules/invoice/views/invoice/user/view.php
@@ -189,7 +189,7 @@
Taxes Included: |
tax_summary() as $tid => $amount) {
- $m = ORM::factory('tax',$tid); ?>
+ $m = ORM::factory('Tax',$tid); ?>
|
description; ?> |
diff --git a/modules/payment/classes/controller/admin/payment.php b/modules/payment/classes/Controller/Admin/Payment.php
similarity index 93%
rename from modules/payment/classes/controller/admin/payment.php
rename to modules/payment/classes/Controller/Admin/Payment.php
index dc31041f..878556cc 100644
--- a/modules/payment/classes/controller/admin/payment.php
+++ b/modules/payment/classes/Controller/Admin/Payment.php
@@ -24,8 +24,8 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
$return = array();
if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) {
- $return += ORM::factory('account')->list_autocomplete($_REQUEST['term']);
- $return += ORM::factory('invoice')->list_autocomplete($_REQUEST['term'],'account_id');
+ $return += ORM::factory('Account')->list_autocomplete($_REQUEST['term']);
+ $return += ORM::factory('Invoice')->list_autocomplete($_REQUEST['term'],'account_id');
}
$this->auto_render = FALSE;
@@ -44,7 +44,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
$i = 0;
$list = array();
if (isset($_REQUEST['pid']))
- foreach (ORM::factory('payment',$_REQUEST['pid'])->items() as $pio) {
+ foreach (ORM::factory('Payment',$_REQUEST['pid'])->items() as $pio) {
$output .= View::factory($this->viewpath().'/body')
->set('trc',$i++%2 ? 'odd' : 'even')
->set('pio',$pio)
@@ -54,12 +54,12 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
array_push($list,$pio->invoice_id);
}
- foreach (ORM::factory('account',$_REQUEST['key'])->invoices_due() as $io)
+ foreach (ORM::factory('Account',$_REQUEST['key'])->invoices_due() as $io)
// Only list invoices not yet listed
if (! in_array($io->id,$list))
$output .= View::factory($this->viewpath().'/body')
->set('trc',$i++%2 ? 'odd' : 'even')
- ->set('pio',ORM::factory('payment_item'))
+ ->set('pio',ORM::factory('Payment_Item'))
->set('io',$io);
// @todo Need the JS to add up the payment allocation before submission
@@ -76,7 +76,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('Customer Payments'),
'body'=>Table::display(
- ORM::factory('payment')->find_all(),
+ ORM::factory('Payment')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/payment/view/'),
@@ -97,7 +97,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
}
private function add_view($id=NULL,$output='') {
- $po = ORM::factory('payment',$id);
+ $po = ORM::factory('Payment',$id);
if ($_POST) {
// Update our invoice payment items
@@ -210,7 +210,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
$output = '';
if ($_POST AND isset($_POST['payer'])) {
- $c = sprintf('payment_bulk_%s',$_POST['payer']);
+ $c = sprintf('Payment_Bulk_%s',ucfirst($_POST['payer']));
$o = new $c();
if (! $_FILES) {
diff --git a/modules/payment/classes/controller/payment.php b/modules/payment/classes/Controller/Payment.php
similarity index 100%
rename from modules/payment/classes/controller/payment.php
rename to modules/payment/classes/Controller/Payment.php
diff --git a/modules/payment/classes/controller/user/payment.php b/modules/payment/classes/Controller/User/Payment.php
similarity index 100%
rename from modules/payment/classes/controller/user/payment.php
rename to modules/payment/classes/Controller/User/Payment.php
diff --git a/modules/payment/classes/model/payment.php b/modules/payment/classes/Model/Payment.php
similarity index 96%
rename from modules/payment/classes/model/payment.php
rename to modules/payment/classes/Model/Payment.php
index 0f79e54b..944c1da6 100644
--- a/modules/payment/classes/model/payment.php
+++ b/modules/payment/classes/Model/Payment.php
@@ -64,7 +64,7 @@ class Model_Payment extends ORM_OSB {
// New Item
$c = count($this->payment_items);
- $this->payment_items[$c] = ORM::factory('payment_item');
+ $this->payment_items[$c] = ORM::factory('Payment_Item');
$this->payment_items[$c]->invoice_id = $iid;
return $this->payment_items[$c];
@@ -76,7 +76,7 @@ class Model_Payment extends ORM_OSB {
* @param int $start List payments that were modified this many days ago
*/
public function export($start) {
- return ORM::factory('payment')
+ return ORM::factory('Payment')
->where('date_payment','>=',time()-$start*86400)
->find_all();
}
@@ -165,9 +165,9 @@ class Model_Payment extends ORM_OSB {
foreach ($items as $pio) {
// Only need to check items that ave actually changed.
if ($pio->changed()) {
- $old_pio = ORM::factory('payment_item',$pio->id);
+ $old_pio = ORM::factory('Payment_Item',$pio->id);
- if (($it = $pio->invoice->due()+ORM::factory('payment_item',$pio->id)->alloc_amt-$pio->alloc_amt) < 0)
+ if (($it = $pio->invoice->due()+ORM::factory('Payment_Item',$pio->id)->alloc_amt-$pio->alloc_amt) < 0)
$msg .= ($msg ? ' ' : '').sprintf('Invoice %s over allocated by %3.2f.',$pio->invoice_id,$it);
}
diff --git a/modules/payment/classes/model/payment/item.php b/modules/payment/classes/Model/Payment/Item.php
similarity index 100%
rename from modules/payment/classes/model/payment/item.php
rename to modules/payment/classes/Model/Payment/Item.php
diff --git a/modules/payment/classes/payment/bulk/ezypay.php b/modules/payment/classes/Payment/Bulk/Ezypay.php
similarity index 92%
rename from modules/payment/classes/payment/bulk/ezypay.php
rename to modules/payment/classes/Payment/Bulk/Ezypay.php
index 442611bd..ee04d990 100644
--- a/modules/payment/classes/payment/bulk/ezypay.php
+++ b/modules/payment/classes/Payment/Bulk/Ezypay.php
@@ -44,7 +44,7 @@ class Payment_Bulk_Ezypay {
if (preg_match('/^'.Config::siteid(TRUE).'-/',$array[4]) AND $array[10] == 'Cleared') {
$aid = preg_replace('/^'.Config::siteid(TRUE).'-/','',$array[4]);
- $po = ORM::factory('payment');
+ $po = ORM::factory('Payment');
$po->account_id = $aid;
$po->total_amt = $array[7];
$po->notes = $array[2].':'.$array[3];
@@ -85,7 +85,7 @@ class Payment_Bulk_Ezypay {
}
$return = '';
- $return .= View::Factory('payment/admin/addbulk/ezypay/head');
+ $return .= View::Factory('Payment/Admin/Addbulk/Ezypay/head');
$total = $fees = 0;
foreach ($payments as $po) {
@@ -94,11 +94,11 @@ class Payment_Bulk_Ezypay {
$total += $po->total_amt;
$fees += $po->fees_amt;
- $return .= View::Factory('payment/admin/addbulk/ezypay/body')
+ $return .= View::Factory('Payment/Admin/Addbulk/Ezypay/body')
->set('o',$po);
}
- $return .= View::Factory('payment/admin/addbulk/ezypay/foot')
+ $return .= View::Factory('Payment/Admin/Addbulk/Ezypay/foot')
->set('total',$total)
->set('fees',$fees);;
diff --git a/modules/product/classes/controller/admin/product.php b/modules/product/classes/Controller/Admin/Product.php
similarity index 88%
rename from modules/product/classes/controller/admin/product.php
rename to modules/product/classes/Controller/Admin/Product.php
index 6c940ec1..fc64aa76 100644
--- a/modules/product/classes/controller/admin/product.php
+++ b/modules/product/classes/Controller/Admin/Product.php
@@ -21,7 +21,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
public function action_ajaxtranslateform() {
$this->auto_render = FALSE;
- $po = ORM::factory('product',$this->request->param('id'));
+ $po = ORM::factory('Product',$this->request->param('id'));
if (! $this->request->is_ajax() OR ! $po->loaded() OR ! isset($_REQUEST['key']))
$this->response->body(_('Unable to find translate data'));
@@ -39,9 +39,9 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
*/
public function action_list() {
if ($this->request->param('id'))
- $prods = ORM::factory('product')->list_category($this->request->param('id'),FALSE);
+ $prods = ORM::factory('Product')->list_category($this->request->param('id'),FALSE);
else
- $prods = ORM::factory('product')->order_by('status DESC,prod_plugin_file')->find_all();
+ $prods = ORM::factory('Product')->order_by('status DESC,prod_plugin_file')->find_all();
Block::add(array(
'title'=>_('Customer Products'),
@@ -72,13 +72,13 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
* Edit a product configuration
*/
public function action_update() {
- $po = ORM::factory('product',$this->request->param('id'));
+ $po = ORM::factory('Product',$this->request->param('id'));
if (! $po->loaded())
- Request::current()->redirect('welcome/index');
+ HTTP::redirect('welcome/index');
if ($_POST) {
- if (isset($_POST['product_translate']['id']) AND ($pto=ORM::factory('product_translate',$_POST['product_translate']['id'])) AND $pto->loaded())
+ if (isset($_POST['product_translate']['id']) AND ($pto=ORM::factory('Product_Translate',$_POST['product_translate']['id'])) AND $pto->loaded())
if (! $pto->values($_POST['product_translate'])->save())
throw new Kohana_Exception('Failed to save updates to product_translate data for record :record',array(':record'=>$po->id()));
@@ -118,12 +118,12 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
}
public function action_view() {
- $po = ORM::factory('product',$this->request->param('id'));
+ $po = ORM::factory('Product',$this->request->param('id'));
Block::add(array(
'title'=>sprintf('%s: %s',_('Current Services Using this Product'),$po->name()),
'body'=>Table::display(
- ORM::factory('service')->where('product_id','=',$po->id)->find_all(),
+ ORM::factory('Service')->where('product_id','=',$po->id)->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
diff --git a/modules/product/classes/controller/product.php b/modules/product/classes/Controller/Product.php
similarity index 65%
rename from modules/product/classes/controller/product.php
rename to modules/product/classes/Controller/Product.php
index 91f3c18c..1bbd7519 100644
--- a/modules/product/classes/controller/product.php
+++ b/modules/product/classes/Controller/Product.php
@@ -15,7 +15,7 @@ class Controller_Product extends Controller_TemplateDefault {
$output = '';
$output .= ' ';
- foreach (ORM::factory('product_category')->list_active() as $pco) {
+ foreach (ORM::factory('Product_Category')->list_active() as $pco) {
$a = ''.$pco->display('name').'';
$a .= ''.$pco->description().' ';
@@ -35,15 +35,17 @@ class Controller_Product extends Controller_TemplateDefault {
* @todo Only show categories according to their validity dates
* @todo Obey sort order
*/
- public function action_category($id) {
- $cat = ORM::factory('product_category',$id);
+ public function action_category() {
+ $id = $this->request->param('id');
+
+ $cat = ORM::factory('Product_Category',$id);
if (! $cat->loaded())
- Request::current()->redirect('welcome/index');
+ HTTP::redirect('welcome/index');
- Breadcrumb::name($this->request->uri(),$cat->name);
- Breadcrumb::url('product','product/categorys');
- Breadcrumb::url('product/category','product/categorys');
+ BreadCrumb::name($this->request->uri(),$cat->name);
+ BreadCrumb::url('product','product/categorys');
+ BreadCrumb::url('product/category','product/categorys');
Block::add(array(
'title'=>sprintf('%s: %s',_('Category'),$cat->name),
@@ -57,31 +59,33 @@ class Controller_Product extends Controller_TemplateDefault {
* Obtain a list of pages in a category
*/
private function _get_category($id) {
- return ORM::factory('product')->list_category($id);
+ return ORM::factory('Product')->list_category($id);
}
/**
* Show a product
*/
- public function action_view($id) {
- $po = ORM::factory('product',$id);
+ public function action_view() {
+ $id = $this->request->param('id');
+
+ $po = ORM::factory('Product',$id);
if (! $po->loaded())
- Request::current()->redirect('product_category/index');
+ HTTP::redirect('Product_Category/index');
- Breadcrumb::name($this->request->uri(),$po->product_translate->find()->name);
- Breadcrumb::url('product','product/categorys');
+ BreadCrumb::name($this->request->uri(),$po->product_translate->find()->name);
+ BreadCrumb::url('product','product/categorys');
// Work out our category id for the control line
if (! empty($_GET['cid'])) {
- $co = ORM::factory('product_category',$_GET['cid']);
+ $co = ORM::factory('Product_Category',$_GET['cid']);
// If the product category doesnt exist, or doesnt match the product
if (! $co->loaded() OR ! in_array($co->id,unserialize($po->avail_category)))
- Request::current()->redirect('product_category/index');
+ HTTP::redirect('Product_Category/index');
- Breadcrumb::name('product/view',$co->name);
- Breadcrumb::url('product/view','product/category/'.$co->id);
+ BreadCrumb::name('product/view',$co->name);
+ BreadCrumb::url('product/view','product/category/'.$co->id);
}
Block::add(array(
diff --git a/modules/product/classes/controller/product/category.php b/modules/product/classes/Controller/Product/Category.php
similarity index 90%
rename from modules/product/classes/controller/product/category.php
rename to modules/product/classes/Controller/Product/Category.php
index 95aa3f5f..f73ff308 100644
--- a/modules/product/classes/controller/product/category.php
+++ b/modules/product/classes/Controller/Product/Category.php
@@ -15,7 +15,7 @@ class Controller_Product_Category extends Controller_TemplateDefault {
* By default show a menu of available categories
*/
public function action_index() {
- Request::current()->redirect('product_category/list');
+ HTTP::redirect('product_category/list');
}
public function action_list() {
@@ -33,7 +33,7 @@ class Controller_Product_Category extends Controller_TemplateDefault {
* @todo Move this to the model
*/
private function _get_categories() {
- return ORM::factory('product_category')
+ return ORM::factory('Product_Category')
->list_active();
}
}
diff --git a/modules/product/classes/model/product.php b/modules/product/classes/Model/Product.php
similarity index 98%
rename from modules/product/classes/model/product.php
rename to modules/product/classes/Model/Product.php
index b11f654e..c7e4ba4c 100644
--- a/modules/product/classes/model/product.php
+++ b/modules/product/classes/Model/Product.php
@@ -56,7 +56,7 @@ class Model_Product extends ORM_OSB {
if (! is_numeric($this->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->id,':type'=>$this->prod_plugin_file));
- return ORM::factory(sprintf('product_plugin_%s',$this->prod_plugin_file),$this->prod_plugin_data);
+ return ORM::factory(sprintf('Product_Plugin_%s',$this->prod_plugin_file),$this->prod_plugin_data);
}
/**
diff --git a/modules/product/classes/model/product/category.php b/modules/product/classes/Model/Product/Category.php
similarity index 100%
rename from modules/product/classes/model/product/category.php
rename to modules/product/classes/Model/Product/Category.php
diff --git a/modules/product/classes/model/product/category/translate.php b/modules/product/classes/Model/Product/Category/Translate.php
similarity index 100%
rename from modules/product/classes/model/product/category/translate.php
rename to modules/product/classes/Model/Product/Category/Translate.php
diff --git a/modules/product/classes/model/product/plugin.php b/modules/product/classes/Model/Product/Plugin.php
similarity index 100%
rename from modules/product/classes/model/product/plugin.php
rename to modules/product/classes/Model/Product/Plugin.php
diff --git a/modules/product/classes/model/product/translate.php b/modules/product/classes/Model/Product/Translate.php
similarity index 100%
rename from modules/product/classes/model/product/translate.php
rename to modules/product/classes/Model/Product/Translate.php
diff --git a/modules/product/views/product/admin/update.php b/modules/product/views/product/admin/update.php
index c134c0aa..654daaea 100644
--- a/modules/product/views/product/admin/update.php
+++ b/modules/product/views/product/admin/update.php
@@ -27,7 +27,7 @@
availPriceGroups() as $g) { ?>
availPriceOptions() as $o) { ?>
- name; ?> |
+ name; ?> |
|
price($g,$k,$o),array('size'=>5)); ?> |
@@ -48,7 +48,7 @@
Product Descriptions |
- |
+ |
|
diff --git a/modules/service/classes/controller/admin/service.php b/modules/service/classes/Controller/Admin/Service.php
similarity index 94%
rename from modules/service/classes/controller/admin/service.php
rename to modules/service/classes/Controller/Admin/Service.php
index 3361a783..9b92c1ed 100644
--- a/modules/service/classes/controller/admin/service.php
+++ b/modules/service/classes/Controller/Admin/Service.php
@@ -36,7 +36,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_ajaxlist() {
$return = array();
- $return += ORM::factory('service')->list_autocomplete(
+ $return += ORM::factory('Service')->list_autocomplete(
isset($_REQUEST['term']) ? $_REQUEST['term'] : '',
'id',
isset($_REQUEST['aid']) ? array(array('account_id','=',$_REQUEST['aid'])) : array());
@@ -48,7 +48,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_ajaxjson_traffic() {
$return = array();
- $svs = ORM::factory('service')->list_bylistgroup('ADSL');
+ $svs = ORM::factory('Service')->list_bylistgroup('ADSL');
$data = $this->consoltraffic($svs,time());
$google = GoogleChart::factory('ComboChart');
@@ -70,7 +70,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('Customer Services'),
'body'=>Table::display(
- ORM::factory('service')->find_all(),
+ ORM::factory('Service')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
@@ -95,9 +95,9 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_listbycheckout() {
$svs = array();
// @todo This needs to be configurable
- $go = ORM::factory('group',array('name'=>'Personal'));
+ $go = ORM::factory('Group',array('name'=>'Personal'));
- foreach (ORM::factory('account')->list_active() as $ao)
+ foreach (ORM::factory('Account')->list_active() as $ao)
if ($ao->has_any('group',array($go)))
foreach ($ao->service->list_active() as $so)
if (! $so->service_billing->checkout_plugin_id)
@@ -127,7 +127,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
)),
));
- foreach (ORM::factory('checkout')->list_active() as $co) {
+ foreach (ORM::factory('Checkout')->list_active() as $co) {
$svs = array();
foreach ($co->account->find_all() as $ao)
@@ -194,7 +194,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listadslservices() {
- $svs = ORM::factory('service')->list_bylistgroup('ADSL');
+ $svs = ORM::factory('Service')->list_bylistgroup('ADSL');
$data = $this->consoltraffic($svs,time());
$google = GoogleChart::factory('ComboChart')
@@ -238,7 +238,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
* Show a list of services that are expiring or have expired
*/
public function action_listexpiring() {
- $svs = ORM::factory('service')->list_expiring();
+ $svs = ORM::factory('Service')->list_expiring();
Sort::MAsort($svs,'expire()');
@@ -261,7 +261,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listhspaservices() {
- $svs = ORM::factory('service')->list_bylistgroup('HSPA');
+ $svs = ORM::factory('Service')->list_bylistgroup('HSPA');
$data = $this->consoltraffic($svs,time());
$google = GoogleChart::factory('Legacy')
@@ -302,7 +302,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listdomainservices() {
- $svs = ORM::factory('service')->list_bylistgroup('DOMAIN');
+ $svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
Sort::MAsort($svs,'name()');
Block::add(array(
@@ -329,7 +329,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listdomainservicesbysupplier() {
- $svs = ORM::factory('service')->list_bylistgroup('DOMAIN');
+ $svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
Sort::MAsort($svs,'plugin()->domain_registrar_id,name()');
$list = array();
@@ -362,13 +362,13 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listdomainservicesbydnshost() {
- $svs = ORM::factory('service')->list_bylistgroup('DOMAIN');
- Sort::MAsort($svs,'plugin()->service_plugin_host,name()');
+ $svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
+ Sort::MAsort($svs,'plugin()->service_plugin_HOST,name()');
$list = array();
foreach ($svs as $so)
- $list[$so->plugin()->service_plugin_host->host_server_id][] = $so;
+ $list[$so->plugin()->service_plugin_HOST->host_server_id][] = $so;
foreach (array_keys($list) as $sid)
Block::add(array(
@@ -392,7 +392,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listhostservices() {
- $svs = ORM::factory('service')->list_bylistgroup('HOST');
+ $svs = ORM::factory('Service')->list_bylistgroup('HOST');
Sort::MAsort($svs,'name()');
Block::add(array(
@@ -419,7 +419,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listhostservicesbysupplier() {
- $svs = ORM::factory('service')->list_bylistgroup('HOST');
+ $svs = ORM::factory('Service')->list_bylistgroup('HOST');
Sort::MAsort($svs,'plugin()->host_server,name()');
$list = array();
@@ -452,7 +452,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
public function action_listwebservices() {
- $svs = ORM::factory('service')->list_bylistgroup('WEB');
+ $svs = ORM::factory('Service')->list_bylistgroup('WEB');
Sort::MAsort($svs,'name()');
Block::add(array(
@@ -482,8 +482,10 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
*
* @todo this should really be in a different class, since adsl wont be part of the main app
*/
- public function action_listadslbilling($id) {
- $aso = ORM::factory('adsl_supplier',$id);
+ public function action_listadslbilling() {
+ $id = $this->request->param('id');
+
+ $aso = ORM::factory('ADSL_Supplier',$id);
// Process upload
// @todo This should be separated out by supplier in case each supplier has a different format
@@ -646,7 +648,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('Services to Invoice'),
'body'=>Table::display(
- ORM::factory('service')->list_invoicesoon(ORM::factory('invoice')->config('GEN_SOON_DAYS')),
+ ORM::factory('Service')->list_invoicesoon(ORM::factory('Invoice')->config('GEN_SOON_DAYS')),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
@@ -669,10 +671,10 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_update() {
$id = $this->request->param('id');
- $so = ORM::factory('service',$id);
+ $so = ORM::factory('Service',$id);
if (! $so->loaded())
- Request::current()->redirect('welcome/index');
+ HTTP::redirect('welcome/index');
if ($_POST) {
if (isset($_POST['plugin']) AND $_POST['plugin'])
@@ -717,7 +719,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_view() {
list($id,$output) = Table::page(__METHOD__);
- $so = ORM::factory('service',$id);
+ $so = ORM::factory('Service',$id);
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {
$this->template->content = 'Unauthorised or doesnt exist?';
@@ -781,7 +783,8 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
if (isset($_REQUEST['go']))
- $this->request->redirect('admin/service/view/'.$so->id);
+ HTTP::redirect('admin/service/view/'.$so->id);
+
Block::add(array(
'title'=>sprintf('Transaction History for %s: %s',$so->id(),$so->name()),
'body'=>$loutput,
@@ -803,7 +806,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_adslstat() {
$output = '';
- $svs = ORM::factory('service')->list_bylistgroup('ADSL');
+ $svs = ORM::factory('Service')->list_bylistgroup('ADSL');
$stats = array();
// @todo This needs to be configurable.
$traffic = array(1000,2000,5000,10000,25000,50000,75000,100000);
diff --git a/modules/service/classes/controller/affiliate/service.php b/modules/service/classes/Controller/Affiliate/Service.php
similarity index 94%
rename from modules/service/classes/controller/affiliate/service.php
rename to modules/service/classes/Controller/Affiliate/Service.php
index c3232ce6..1fd5f24d 100644
--- a/modules/service/classes/controller/affiliate/service.php
+++ b/modules/service/classes/Controller/Affiliate/Service.php
@@ -27,7 +27,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
Block::add(array(
'title'=>_('Customer Services'),
'body'=>Table::display(
- $this->filter(ORM::factory('service')->list_active(),$this->ao->affiliate->id),
+ $this->filter(ORM::factory('Service')->list_active(),$this->ao->affiliate->id),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
@@ -52,9 +52,9 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
public function action_listbycheckout() {
$svs = array();
// @todo This needs to be configurable
- $go = ORM::factory('group',array('name'=>'Personal'));
+ $go = ORM::factory('Group',array('name'=>'Personal'));
- foreach (ORM::factory('account')->list_active() as $ao)
+ foreach (ORM::factory('Account')->list_active() as $ao)
if ($ao->has_any('group',array($go)))
foreach ($this->filter($ao->service->list_active(),$this->ao->affiliate->id,'name()') as $so)
if (! $so->service_billing->checkout_plugin_id)
@@ -89,7 +89,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
'body'=>_('None found'),
));
- foreach (ORM::factory('checkout')->list_active() as $co) {
+ foreach (ORM::factory('Checkout')->list_active() as $co) {
$svs = array();
foreach ($co->account->find_all() as $ao)
@@ -156,7 +156,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
}
public function action_listadslservices() {
- $svs = $this->filter(ORM::factory('service')->list_bylistgroup('ADSL'),$this->ao->affiliate->id,'name()');
+ $svs = $this->filter(ORM::factory('Service')->list_bylistgroup('ADSL'),$this->ao->affiliate->id,'name()');
$data = $this->consoltraffic($svs,time());
$google = GoogleChart::factory('Legacy')
@@ -197,7 +197,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
}
public function action_listhspaservices() {
- $svs = $this->filter(ORM::factory('service')->list_bylistgroup('HSPA'),$this->ao->affiliate->id,'name()');
+ $svs = $this->filter(ORM::factory('Service')->list_bylistgroup('HSPA'),$this->ao->affiliate->id,'name()');
$data = $this->consoltraffic($svs,time());
$google = GoogleChart::factory('Legacy')
@@ -241,7 +241,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
Block::add(array(
'title'=>_('Domain Names'),
'body'=>Table::display(
- $this->filter(ORM::factory('service')->list_bylistgroup('DOMAIN'),$this->ao->affiliate->id,'name()'),
+ $this->filter(ORM::factory('Service')->list_bylistgroup('DOMAIN'),$this->ao->affiliate->id,'name()'),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
@@ -265,7 +265,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
Block::add(array(
'title'=>_('Hosting Services'),
'body'=>Table::display(
- $this->filter(ORM::factory('service')->list_bylistgroup('HOST'),$this->ao->affiliate->id,'name()'),
+ $this->filter(ORM::factory('Service')->list_bylistgroup('HOST'),$this->ao->affiliate->id,'name()'),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
diff --git a/modules/service/classes/controller/service.php b/modules/service/classes/Controller/Service.php
similarity index 100%
rename from modules/service/classes/controller/service.php
rename to modules/service/classes/Controller/Service.php
diff --git a/modules/service/classes/controller/task/service.php b/modules/service/classes/Controller/Task/Service.php
similarity index 93%
rename from modules/service/classes/controller/task/service.php
rename to modules/service/classes/Controller/Task/Service.php
index aad3bdf1..7fac9123 100644
--- a/modules/service/classes/controller/task/service.php
+++ b/modules/service/classes/Controller/Task/Service.php
@@ -12,7 +12,7 @@
*/
class Controller_Task_Service extends Controller_Task {
private function _traffic_suppliers($active=FALSE) {
- $suppliers = ORM::factory('adsl_supplier');
+ $suppliers = ORM::factory('Adsl_Supplier');
return $active ? $suppliers->list_active() : $suppliers->find_all();
}
@@ -22,7 +22,7 @@ class Controller_Task_Service extends Controller_Task {
*/
public function action_gettraffic() {
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
- if (CLI::options('verbose'))
+ if (Minion_CLI::options('verbose'))
echo $aso->name."\n";
$traffic = Service_Traffic_ADSL::instance($aso->name)->update_traffic();
diff --git a/modules/service/classes/controller/user/service.php b/modules/service/classes/Controller/User/Service.php
similarity index 95%
rename from modules/service/classes/controller/user/service.php
rename to modules/service/classes/Controller/User/Service.php
index a01b2a08..7cba88e4 100644
--- a/modules/service/classes/controller/user/service.php
+++ b/modules/service/classes/Controller/User/Service.php
@@ -20,7 +20,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
public function action_ajaxmanage() {
$this->auto_render = FALSE;
- $so = ORM::factory('service',$this->request->param('id'));
+ $so = ORM::factory('Service',$this->request->param('id'));
$k = Session::instance()->get_once('manage_button');
$amo = $so->plugin(isset($_REQUEST['t']) ? $_REQUEST['t'] : '');
@@ -60,7 +60,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
public function action_view() {
list($id,$output) = Table::page(__METHOD__);
- $so = ORM::factory('service',$id);
+ $so = ORM::factory('Service',$id);
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {
$this->template->content = 'Unauthorised or doesnt exist?';
diff --git a/modules/service/classes/model/service.php b/modules/service/classes/Model/Service.php
similarity index 97%
rename from modules/service/classes/model/service.php
rename to modules/service/classes/Model/Service.php
index 0579d8fd..a97155e9 100644
--- a/modules/service/classes/model/service.php
+++ b/modules/service/classes/Model/Service.php
@@ -56,7 +56,7 @@ class Model_Service extends ORM_OSB {
if (! is_numeric($this->product->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
- $o = ORM::factory(sprintf('service_plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
+ $o = ORM::factory(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
return $type ? $o->$type : $o;
}
@@ -208,7 +208,7 @@ class Model_Service extends ORM_OSB {
public function list_bylistgroup($cat) {
$result = array();
- $cats = ORM::factory('product_category')->list_bylistgroup($cat);
+ $cats = ORM::factory('Product_Category')->list_bylistgroup($cat);
foreach ($this->list_active() as $so) {
if (! $so->product->avail_category OR ! preg_match('/^a:/',$so->product->avail_category))
@@ -256,7 +256,7 @@ class Model_Service extends ORM_OSB {
public function list_invoicesoon($days=0) {
return $this->_where_active()
->where_open()->where('suspend_billing','IS',NULL)->or_where('suspend_billing','=','0')->where_close()
- ->where('date_next_invoice','<',time()+(ORM::factory('invoice')->config('GEN_DAYS')+$days)*86400)
+ ->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
->find_all();
}
diff --git a/modules/service/classes/model/service/billing.php b/modules/service/classes/Model/Service/Billing.php
similarity index 100%
rename from modules/service/classes/model/service/billing.php
rename to modules/service/classes/Model/Service/Billing.php
diff --git a/modules/service/classes/model/service/plugin.php b/modules/service/classes/Model/Service/Plugin.php
similarity index 100%
rename from modules/service/classes/model/service/plugin.php
rename to modules/service/classes/Model/Service/Plugin.php
diff --git a/modules/ssl/classes/controller/admin/ssl.php b/modules/ssl/classes/Controller/Admin/Ssl.php
similarity index 93%
rename from modules/ssl/classes/controller/admin/ssl.php
rename to modules/ssl/classes/Controller/Admin/Ssl.php
index ab997d86..b49dfa27 100644
--- a/modules/ssl/classes/controller/admin/ssl.php
+++ b/modules/ssl/classes/Controller/Admin/Ssl.php
@@ -21,7 +21,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('SSL CA Certificates'),
'body'=>Table::display(
- ORM::factory('ssl_ca')->find_all(),
+ ORM::factory('SSL_CA')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/ssl/view/'),
@@ -38,7 +38,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
}
private function add_view($id=NULL,$output='') {
- $so = ORM::factory('ssl_ca',$id);
+ $so = ORM::factory('SSL_CA',$id);
if ($_POST) {
if ($so->values($_POST)->changed()) {
@@ -84,14 +84,14 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
list($id,$output) = Table::page(__METHOD__);
Block::add(array(
- 'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('ssl_ca',$id)->display('sign_cert')),
+ 'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('SSL_CA',$id)->display('sign_cert')),
'body'=>$this->add_view($id,$output),
));
Block::add(array(
'title'=>_('Services using this Certificate'),
'body'=>Table::display(
- ORM::factory('ssl_ca',$id)->list_issued(),
+ ORM::factory('SSL_CA',$id)->list_issued(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/service/view/'),
diff --git a/modules/ssl/classes/controller/user/ssl.php b/modules/ssl/classes/Controller/User/Ssl.php
similarity index 82%
rename from modules/ssl/classes/controller/user/ssl.php
rename to modules/ssl/classes/Controller/User/Ssl.php
index 4748af9d..48960663 100644
--- a/modules/ssl/classes/controller/user/ssl.php
+++ b/modules/ssl/classes/Controller/User/Ssl.php
@@ -17,20 +17,20 @@ class Controller_User_SSL extends Controller_TemplateDefault_User {
public function action_download() {
$id = $_POST['sid'];
- $so = ORM::factory('service',$id);
+ $so = ORM::factory('Service',$id);
if (! $so->loaded())
- Request::current()->redirect('welcome/index');
+ HTTP::redirect('welcome/index');
$passwd = $_POST['passwd'];
- if (strlen($passwd) < Kohana::config('ssl.minpass_length')) {
+ if (strlen($passwd) < Kohana::$config->load('ssl')->minpass_length) {
SystemMessage::add(array(
'title'=>_('Validation failed'),
'type'=>'error',
'body'=>_('Your requested password is too short.'),
));
- Request::current()->redirect('user/service/view/'.$so->id);
+ HTTP::redirect('user/service/view/'.$so->id);
}
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {
@@ -38,7 +38,7 @@ class Controller_User_SSL extends Controller_TemplateDefault_User {
return FALSE;
}
- $file = Kohana::config('config.tmpdir').'/'.$so->name().'.pkcs12';
+ $file = sprintf('%s/%s.pkcs12',Kohana::$config->load('config')->tmpdir,$so->name());
openssl_pkcs12_export_to_file($so->plugin()->cert,$file,$so->plugin()->pk,$passwd,array('extracerts'=>$so->plugin()->cacerts()));
$x = file_get_contents($file);
unlink($file);
diff --git a/modules/ssl/classes/model/product/plugin/ssl.php b/modules/ssl/classes/Model/Product/Plugin/SSL.php
similarity index 100%
rename from modules/ssl/classes/model/product/plugin/ssl.php
rename to modules/ssl/classes/Model/Product/Plugin/SSL.php
diff --git a/modules/ssl/classes/model/ssl.php b/modules/ssl/classes/Model/SSL.php
similarity index 100%
rename from modules/ssl/classes/model/ssl.php
rename to modules/ssl/classes/Model/SSL.php
diff --git a/modules/ssl/classes/model/ssl/ca.php b/modules/ssl/classes/Model/SSL/CA.php
similarity index 100%
rename from modules/ssl/classes/model/ssl/ca.php
rename to modules/ssl/classes/Model/SSL/CA.php
diff --git a/modules/ssl/classes/model/service/plugin/ssl.php b/modules/ssl/classes/Model/Service/Plugin/SSL.php
similarity index 89%
rename from modules/ssl/classes/model/service/plugin/ssl.php
rename to modules/ssl/classes/Model/Service/Plugin/SSL.php
index 2fd63778..7b2d9e03 100644
--- a/modules/ssl/classes/model/service/plugin/ssl.php
+++ b/modules/ssl/classes/Model/Service/Plugin/SSL.php
@@ -19,7 +19,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
'service'=>array(),
);
protected $_has_one = array(
- 'ssl_ca'=>array('far_key'=>'ssl_ca_id','foreign_key'=>'id'),
+ 'SSL_CA'=>array('far_key'=>'ssl_ca_id','foreign_key'=>'id'),
);
protected $_display_filters = array(
@@ -74,7 +74,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
}
public function name() {
- return ($this->cert) ? sprintf('%s:%s',$this->ssl_ca->subject(),$this->display('cert')) : $this->display('csr');
+ return ($this->cert AND $this->SSL_CA->loaded()) ? sprintf('%s:%s',$this->SSL_CA->subject(),$this->display('cert')) : $this->display('csr');
}
public function service_view() {
@@ -124,7 +124,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
$x = $this->ssl_ca_id;
while ($x) {
- $sco = ORM::factory('ssl_ca',$x);
+ $sco = ORM::factory('SSL_CA',$x);
array_push($return,$sco->sign_cert);
$x = $sco->parent_ssl_ca_id;
}
@@ -134,7 +134,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
public function renew() {
$d = SSL::details($this->cert);
- $ssl_conf = Kohana::config('ssl');
+ $ssl_conf = Kohana::$config->load('ssl');
// @todo change this so an admin can force this.
$force = TRUE;
@@ -142,7 +142,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
if ($d['validTo_time_t'] > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
return FALSE;
- $res = openssl_csr_sign($this->csr,$this->ssl_ca->sign_cert,$this->ssl_ca->sign_pk,$this->service->product->plugin()->days,array(
+ $res = openssl_csr_sign($this->csr,$this->SSL_CA->sign_cert,$this->SSL_CA->sign_pk,$this->service->product->plugin()->days,array(
'config'=>$ssl_conf['config'],
'x509_extensions'=>$this->service->product->plugin()->extensions,
'digest_alg'=>'sha1',
@@ -156,8 +156,8 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
} else {
print_r(array(
'csr'=>$this->csr,
- 'ca'=>$this->ssl_ca->sign_cert,
- 'capk'=>$this->ssl_ca->sign_pk,
+ 'ca'=>$this->SSL_CA->sign_cert,
+ 'capk'=>$this->SSL_CA->sign_pk,
'days'=>$this->service->product->plugin()->days,
'ssl'=>$ssl_conf,
'x509e'=>$this->service->product->plugin()->extensions
diff --git a/modules/ssl/classes/ssl.php b/modules/ssl/classes/SSL.php
similarity index 98%
rename from modules/ssl/classes/ssl.php
rename to modules/ssl/classes/SSL.php
index 9bbbd3be..6c580b0b 100644
--- a/modules/ssl/classes/ssl.php
+++ b/modules/ssl/classes/SSL.php
@@ -202,10 +202,6 @@ class SSL {
return $this->_details('version');
}
- public static function xdn($cert) {
- return static::instance($cert)->get_dn();
- }
-
public static function xexpire($cert,$format=FALSE) {
return static::instance($cert)->get_expire($format);
}
diff --git a/modules/ssl/classes/controller/task/ssl.php b/modules/ssl/classes/Task/SSL/Renew.php
similarity index 56%
rename from modules/ssl/classes/controller/task/ssl.php
rename to modules/ssl/classes/Task/SSL/Renew.php
index 493e5015..fadd45e5 100644
--- a/modules/ssl/classes/controller/task/ssl.php
+++ b/modules/ssl/classes/Task/SSL/Renew.php
@@ -1,25 +1,22 @@
request->param('id');
- $so = ORM::factory('service',$id);
-
- $so->plugin()->renew();
+ ORM::factory('Service',$params['id'])->plugin()->renew();
}
}
?>
diff --git a/modules/ssl/views/service/user/plugin/ssl/view.php b/modules/ssl/views/service/user/plugin/ssl/view.php
index 856880b6..13e26b7c 100644
--- a/modules/ssl/views/service/user/plugin/ssl/view.php
+++ b/modules/ssl/views/service/user/plugin/ssl/view.php
@@ -19,7 +19,7 @@
CA |
- ssl_ca->subject(); ?> |
+ SSL_CA->loaded() ? $so->SSL_CA->subject() : $so->issuer(); ?> |
Valid From |
diff --git a/modules/statement/classes/controller/statement.php b/modules/statement/classes/Controller/Statement.php
similarity index 100%
rename from modules/statement/classes/controller/statement.php
rename to modules/statement/classes/Controller/Statement.php
diff --git a/modules/statement/classes/controller/user/statement.php b/modules/statement/classes/Controller/User/Statement.php
similarity index 100%
rename from modules/statement/classes/controller/user/statement.php
rename to modules/statement/classes/Controller/User/Statement.php
diff --git a/modules/static_page/classes/controller/staticpage.php b/modules/static_page/classes/controller/staticpage.php
index b8a69696..017a6fe5 100644
--- a/modules/static_page/classes/controller/staticpage.php
+++ b/modules/static_page/classes/controller/staticpage.php
@@ -15,7 +15,9 @@ class Controller_StaticPage extends Controller_TemplateDefault {
* By default show a menu of available categories
* @todo Only show categories according to their validity dates
*/
- public function action_view($id) {
+ public function action_view() {
+ $id = $this->request->param('id');
+
$sp = ORM::factory('staticpage',$id);
if (! $sp->loaded())
diff --git a/modules/static_page/classes/controller/staticpage/category.php b/modules/static_page/classes/controller/staticpage/category.php
index a14c313b..bca01f95 100644
--- a/modules/static_page/classes/controller/staticpage/category.php
+++ b/modules/static_page/classes/controller/staticpage/category.php
@@ -15,7 +15,7 @@ class Controller_StaticPage_Category extends Controller_TemplateDefault {
* By default show a menu of available categories
*/
public function action_index() {
- Request::current()->redirect('staticpage_category/list');
+ HTTP::redirect('staticpage_category/list');
}
public function action_list() {
@@ -31,11 +31,13 @@ class Controller_StaticPage_Category extends Controller_TemplateDefault {
* @todo Only show categories according to their validity dates
* @todo Obey sort order
*/
- public function action_view($id) {
+ public function action_view() {
+ $id = $this->request->param('id');
+
$spc = ORM::factory('staticpage_category',$id);
if (! $spc->loaded())
- Request::current()->redirect('welcome/index');
+ HTTP::redirect('welcome/index');
Breadcrumb::name($this->request->uri(),$spc->name);
diff --git a/modules/task/classes/controller/admin/task.php b/modules/task/classes/Controller/Admin/Task.php
similarity index 93%
rename from modules/task/classes/controller/admin/task.php
rename to modules/task/classes/Controller/Admin/Task.php
index 68a2f623..68944d11 100644
--- a/modules/task/classes/controller/admin/task.php
+++ b/modules/task/classes/Controller/Admin/Task.php
@@ -22,7 +22,7 @@ class Controller_Admin_Task extends Controller_TemplateDefault_Admin {
Block::add(array(
'title'=>_('Task Log'),
'body'=>Table::display(
- ORM::factory('task_log')->order_by('id','DESC')->find_all(),
+ ORM::factory('Task_Log')->order_by('id','DESC')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/task/view/'),
diff --git a/modules/task/classes/model/task.php b/modules/task/classes/Model/Task.php
similarity index 98%
rename from modules/task/classes/model/task.php
rename to modules/task/classes/Model/Task.php
index 62453833..818cd10f 100644
--- a/modules/task/classes/model/task.php
+++ b/modules/task/classes/Model/Task.php
@@ -19,7 +19,7 @@ class Model_Task extends ORM_OSB {
public function run() {
$r = rand(0,9999);
- $tlo = ORM::factory('task_log');
+ $tlo = ORM::factory('Task_Log');
$tlo->task_id = $this->id;
if (! $this->loaded())
diff --git a/modules/task/classes/model/task/log.php b/modules/task/classes/Model/Task/Log.php
similarity index 100%
rename from modules/task/classes/model/task/log.php
rename to modules/task/classes/Model/Task/Log.php
diff --git a/modules/task/classes/Task/Task/ListActive.php b/modules/task/classes/Task/Task/ListActive.php
new file mode 100644
index 00000000..fb3a5912
--- /dev/null
+++ b/modules/task/classes/Task/Task/ListActive.php
@@ -0,0 +1,36 @@
+list_active() as $t) {
+ $output .= sprintf('%2s %30s %21s %21s %40s',
+ $t['task']->id,
+ $t['task']->command,
+ $t['task']->display('date_run'),
+ Config::datetime($t['next']),
+ $t['task']->display('description')
+ );
+
+ $output .= "\n";
+ };
+
+ echo $output;
+ }
+}
+?>
diff --git a/modules/task/classes/Task/Task/Run.php b/modules/task/classes/Task/Task/Run.php
new file mode 100644
index 00000000..4a691372
--- /dev/null
+++ b/modules/task/classes/Task/Task/Run.php
@@ -0,0 +1,47 @@
+loaded()) {
+ if (! $to->status)
+ throw new Minion_Exception_InvalidTask('Task :task (:name) NOT active',array(':task'=>$params['id'],':name'=>$to->name));
+
+ if (! Kohana::$config->load('debug')->task_sim)
+ $to->run();
+ else
+ printf('Would Run task: (%s) %s',$params['id'],$to->name);
+
+ echo "\n";
+
+ } else
+ throw new Minion_Exception_InvalidTask('Unknown task :task',array(':task'=>$params['id']));
+
+ } else {
+ $tlo = ORM::factory('Task');
+ $t = time();
+
+ foreach ($tlo->list_active() as $to)
+ if ($to['next'] < $t) {
+ if (! Kohana::$config->load('debug')->task_sim)
+ $to['task']->run();
+ else
+ printf('Would Run task: (%s) %s',$to['task']->id,$to['task']->name);
+ echo "\n";
+ }
+ }
+ }
+}
+?>
diff --git a/modules/task/classes/controller/task/task.php b/modules/task/classes/controller/task/task.php
deleted file mode 100644
index bcda0ba7..00000000
--- a/modules/task/classes/controller/task/task.php
+++ /dev/null
@@ -1,59 +0,0 @@
-request->param('id');
-
- if (! method_exists($to,$tm))
- throw new Kohana_Exception('Unknown Task List command :command',array(':command'=>$tm));
-
- $output .= sprintf('%2s %30s %21s %21s %40s',
- 'ID','Command','Last Run','Next Run','Description');
- $output .= "\n";
-
- foreach ($to->$tm() as $t) {
- $output .= sprintf('%2s %30s %21s %21s %40s',
- $t['task']->id,
- $t['task']->command,
- $t['task']->display('date_run'),
- Config::datetime($t['next']),
- $t['task']->display('description')
- );
-
- $output .= "\n";
- };
-
- $this->response->body($output);
- }
-
- public function action_run() {
- if ($id = $this->request->param('id')) {
- $to = ORM::factory('task',$id);
- $to->run();
-
- } else {
- $tlo = ORM::factory('task');
- $t = time();
-
- foreach ($tlo->list_active() as $to)
- if ($to['next'] < $t)
- $to['task']->run();
- }
- }
-}
-?>
diff --git a/modules/tax/classes/model/invoice/item/tax.php b/modules/tax/classes/Model/Invoice/Item/Tax.php
similarity index 100%
rename from modules/tax/classes/model/invoice/item/tax.php
rename to modules/tax/classes/Model/Invoice/Item/Tax.php
diff --git a/modules/tax/classes/model/tax.php b/modules/tax/classes/Model/Tax.php
similarity index 100%
rename from modules/tax/classes/model/tax.php
rename to modules/tax/classes/Model/Tax.php
diff --git a/modules/tax/classes/tax.php b/modules/tax/classes/Tax.php
similarity index 97%
rename from modules/tax/classes/tax.php
rename to modules/tax/classes/Tax.php
index 62699faa..e82c183f 100644
--- a/modules/tax/classes/tax.php
+++ b/modules/tax/classes/Tax.php
@@ -20,7 +20,7 @@ class Tax {
* @return array Tax Information
*/
public static function detail($cid,$zone,$value=0) {
- $tax = ORM::factory('tax')
+ $tax = ORM::factory('Tax')
->where('country_id','=',$cid)
->and_where('zone','=',$zone)
->find_all();
|